Danh mục

Secure PHP Development- P27

Số trang: 5      Loại file: pdf      Dung lượng: 74.84 KB      Lượt xem: 6      Lượt tải: 0    
Jamona

Hỗ trợ phí lưu trữ khi tải xuống: 5,000 VND Tải xuống file đầy đủ (5 trang) 0

Báo xấu

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Secure PHP Development- P27: Welcome to Secure PHP Development: Building 50 Practical Applications. PHPhas come a long way since its first incarnation as a Perl script. Now PHP is a powerfulWeb scripting language with object-oriented programming support. Slowlybut steadily it has entered the non-Web scripting arena often reserved for Perl andother shell scripting languages. Arguably, PHP is one of the most popular Web platforms.
Nội dung trích xuất từ tài liệu:
Secure PHP Development- P27 Chapter 4: Architecture of an Intranet Application 101 { echo ‘’; print_r($this); echo ‘’; } else { print_r($this); } } function checkRequiredFields($fieldType = null, $fieldData = null,$errorCode = null) { $err = array(); while(list($field, $func) = each ($fieldType)) { $ok = $this->$func($fieldData[$field]); if (! $ok ) { $this->alert($errorCode{$field}); } } return $err; } function number($num = null) { if (is_array($num)) { foreach ($num as $i) { if (! is_numeric($i)) { return 0; } } return 1; Continued102 Part II: Developing Intranet Solutions Listing 4-4 (Continued) } else if (is_numeric($num)) { return 1; } else { return 0; } } function name($name = null) { if (!strlen($name) || is_numeric($name)) { return 0; } else { return 1; } } function email($email = null) { if (strlen($email) < 5 || ! strpos($email,’’)) { return 0; } else { return 1; } } function currency($amount = null) { return 1; } function month($mm = null) { if ($mm >=1 && $mm Chapter 4: Architecture of an Intranet Application 103// ASIF what is thie method doing in this class???function comboOption($optVal = null){ if ($optVal != 0) { return 1; }else { return 0; }}function day($day = null){ if ($day >=1 && $day number($year));}function one_zero_flag($flag = null){ if ($flag == 1 || $flag == 0) { return 1; } else { return 1; }}function plain_text($text = null){ return 1;} Continued104 Part II: Developing Intranet Solutions Listing 4-4 (Continued) function debug_array($hash = null) { $this->debugger->debug_array($hash); } function writeln($msg) { // print global $WWW_NEWLINE; global $NEWLINE; echo $msg ,(strstr($this->app_type, ‘WEB’)) ? $WWW_NEWLINE : $NEWLINE; } function show_status($msg = null,$returnURL = null) { global $STATUS_TEMPLATE; $template = new Template($this->template_dir); $template->set_file(‘fh’, $STATUS_TEMPLATE); $template->set_block(‘fh’, ‘mainBlock’, ‘mblock’); $template->set_var(‘STATUS_MESSAGE’, $msg); if (!preg_match(‘/^http:/’, $returnURL) && (!preg_match(‘/^\//’, $returnURL))) { $appPath = sprintf(“%s/%s”, $this->app_path, $returnURL); } else { $appPath = $returnURL; } $template->set_var(‘RETURN_URL’, $appPath); $template->set_var(‘BASE_URL’, $this->base_url); $template->parse(‘mblock’, ‘mainBlock’); $template->pparse(‘output’, ‘fh’); } function set_escapedVar($hash) { while(list($key, $value) = each ($hash)) { Chapter 4: Architecture of an Intranet Application 105 $this->escapedVarHash{$key} = preg_replace(“/\s/”,”+”,$value); }}function get_escapedVar($key){ return $this->escapedVarHash{$key};}function setUID($uid = null){ $this->user_id = $uid;}function getUID(){ return $this->user_id;}//To Kabir: I added this -- Asiffunction getUserName(){ return $this->user_name;}function emptyError($field, $errCode){ if (empty($field)) { $this->alert($errCode); }}function getRequestField($field, $default = null){ return (! empty($_REQUEST[$field] )) ? $_REQUEST[$field] : $default;}function getSessionField($field, $default = null){ return (! empty($_SESSION[$field] )) ? $_SESSION[$field] : $default;} Continued

Tài liệu được xem nhiều: