intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Secure PHP Development- P27

Chia sẻ: Cong Thanh | Ngày: | Loại File: PDF | Số trang:5

53
lượt xem
4
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Secure PHP Development- P27: Welcome to Secure PHP Development: Building 50 Practical Applications. PHP has come a long way since its first incarnation as a Perl script. Now PHP is a powerful Web scripting language with object-oriented programming support. Slowly but steadily it has entered the non-Web scripting arena often reserved for Perl and other shell scripting languages. Arguably, PHP is one of the most popular Web platforms.

Chủ đề:
Lưu

Nội dung Text: Secure PHP Development- P27

  1. 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; Continued
  2. 102 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
  3. 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; } Continued
  4. 104 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)) {
  5. 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 -- Asif function 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
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2