php的php培训机构需要多久啊

支持键盘← →键翻阅图片
http://imgbbs.ph.126.net/Yfrjf9MbAzFb-07U0PSElg==/7071099.png
http://imgbbs.ph.126.net/2EOLnMgPVuZ46_5YwZin2g==/7071100.png
http://imgbbs.ph.126.net/FJdK0v5VI2mvWKvXbugZXw==/7071102.png
http://imgbbs.ph.126.net/aVBBvrsli8qjz_mmWfa4jg==/7071101.png
相关图集推荐
每30秒自动保存一次内容5000家学校 100万学员的选择 .cn
&欢迎光临培训通
学PHP要多久?
&来源: &&&责任编辑:信息中心&&&发布时间: 11:20:56 & 浏览-次
掌握PHP语言语法,掌握动态网站开发的流程和框架思维,掌握数据库的操作方法和技巧,掌握服务器的配置,掌握面向对象编程的思想,掌握项目开发框架THINKPHP,掌握各种类型网站的开发。涵盖了php培训课程,厦门mysql数据库培训,apache服务器配置全日制:1个半月 业余制:2个月开设有上午班,下午班,晚班,周末班上午9:00-12:00 下午:2:00―6:00 晚上:7:00―9:00备注:(周六、周日照常上课),以上班次学会为止!①江头吕岭路②厦门厦禾路③团体培训、业务合作、资格认证&《厦门中信电脑培训学校钢印证书》《国家劳动与社会保障部从业职业资格证书》《国家信息产业部设计师技术资格证书》 《Adobe 网页设计师认证 ACCD》网络设计公司,广告设计公司,网站开发建设,网站管理,网站后台开发,传媒,电子商务企业,培训教育学校等厦门php培训课程:让你独立完成企业网站,快速网站模板开发,网站后台的设计,电子商务网站的建设。重点培养学员项目实战,动手能力和常用技巧,理论与实践相结合,成为技能全面,实战能力超强的“能手”型人才&中信电脑学校咨询热线:咨询QQ:更多课程:&&相关新闻:?????
&文章标签:&厦门PHP开发培训,
PHP开发培训,
软件开发培训
&本地相关课程推荐:
&&综合广告
①本网注明“来源:培训通”的所有作品,版权均属于培训通,未经本网授权不得转载、摘编或利用其它方式使用上述作品。已经本网授权使用作品的,应在授权范围内使用,并注明“来源:培训通”。违反上述声明者,本网将追究其相关法律责任。
② 凡本网注明“来源:XXX(非培训通)”的作品,均转载自其它媒体,转载目的在于传递更多信息并不代表本网赞同其观点和对其真实性负责。
③ 如因作品内容、版权和其它问题需要同本网联系的,请在30日内进行。 培训通网站内容侵权处理:(请发QQ邮件) 培训通网站内容侵权处理:(请发QQ邮件) 培训通网站内容侵权处理:(请发QQ邮件)
&&热点新闻;&&相关内容推荐
&&关键词阅读
&&&网络营销
&&&教育培训
烟台牧哲IT教育教育培训新手园地& & & 硬件问题Linux系统管理Linux网络问题Linux环境编程Linux桌面系统国产LinuxBSD& & & BSD文档中心AIX& & & 新手入门& & & AIX文档中心& & & 资源下载& & & Power高级应用& & & IBM存储AS400Solaris& & & Solaris文档中心HP-UX& & & HP文档中心SCO UNIX& & & SCO文档中心互操作专区IRIXTru64 UNIXMac OS X门户网站运维集群和高可用服务器应用监控和防护虚拟化技术架构设计行业应用和管理服务器及硬件技术& & & 服务器资源下载云计算& & & 云计算文档中心& & & 云计算业界& & & 云计算资源下载存储备份& & & 存储文档中心& & & 存储业界& & & 存储资源下载& & & Symantec技术交流区安全技术网络技术& & & 网络技术文档中心C/C++& & & GUI编程& & & Functional编程内核源码& & & 内核问题移动开发& & & 移动开发技术资料ShellPerlJava& & & Java文档中心PHP& & & php文档中心Python& & & Python文档中心RubyCPU与编译器嵌入式开发驱动开发Web开发VoIP开发技术MySQL& & & MySQL文档中心SybaseOraclePostgreSQLDB2Informix数据仓库与数据挖掘NoSQL技术IT业界新闻与评论IT职业生涯& & & 猎头招聘IT图书与评论& & & CU技术图书大系& & & Linux书友会二手交易下载共享Linux文档专区IT培训与认证& & & 培训交流& & & 认证培训清茶斋投资理财运动地带快乐数码摄影& & & 摄影器材& & & 摄影比赛专区IT爱车族旅游天下站务交流版主会议室博客SNS站务交流区CU活动专区& & & Power活动专区& & & 拍卖交流区频道交流区
白手起家, 积分 195, 距离下一级还需 5 积分
论坛徽章:0
下面是顾客管理模块,由三个脚本组成:
example.customer.1.php (验证和更新顾客)
example.customer.2.php(顾客输入&form&;)
example.customer.3.php(顾客回执页面)
example.customer.1.php
&?php
&&// This script validates customer data entered into
&&// example.customer.2.php.
&&// If validation succeeds, it INSERTs or UPDATEs
&&// a customer and redire if it
&&// fails, it creates error messages and these are later
&&// displayed by example.customer.2.php.
&&include 'include.inc';
&&set_error_handler(&errorHandler"
&&// Initialize a session
&&session_start();
&&// Register an error array - just in case!
&&if (!session_is_registered(&errors&quot)
& &&&session_register(&errors"
&&// Clear any errors that might have been
&&// found previously
&&$errors = array();
&&// Set up a $formVars array with the POST variables
&&// and register with the session.
&&if (!session_is_registered(&formVars&quot)
& &&&session_register(&formVars"
&&foreach($HTTP_POST_VARS as $varname =&; $value)
& && &$formVars[$varname] = trim(clean($value, 50));
&&// Validate the firstName
&&if (empty($formVars[&firstName&]))
& && &// First name cannot be a null string
& && &$errors[&firstName&] =
& && && & &The first name field cannot be blank.&;
&&elseif (!eregi(&^[a-z'-]*$&, $formVars[&firstName&]))
& && &// First name cannot contain white space
& && &$errors[&firstName&] =
& && &&The first name can only contain alphabetic & .
& && && &&characters or \&-\& or \&'\&&;
&&elseif (strlen($formVars[&firstName&]) &; 50)
& && &$errors[&firstName&] =
& && &&The first name can be no longer than 50 & .
& && && &&characters&;
&&// Validate the Surname
&&if (empty($formVars[&surname&]))
& && &// the user's surname cannot be a null string
& && &$errors[&surname&] =
& && && & &The surname field cannot be blank.&;
&&elseif (strlen($formVars[&surname&]) &; 50)
& && &$errors[&surname&] =
& && && & &The surname can be no longer than 50 & .
& && && & &characters&;
&&// Validate the Address
&&if (empty($formVars[&address1&]) &&
& && &empty($formVars[&address2&]) &&
& && &empty($formVars[&address3&]))
& && &// all the fields of the address cannot be null
& && &$errors[&address&] =
& && && & &You must supply at least one address line.&;
& && &if (strlen($formVars[&address1&]) &; 50)
& && &$errors[&address1&] =
& && && & &The address line 1 can be no longer & .
& && && & &than 50 characters&;
& && &if (strlen($formVars[&address2&]) &; 50)
& && &$errors[&address2&] =
& && && & &The address line 2 can be no longer & .
& && && & &than 50 characters&;
& && &if (strlen($formVars[&address3&]) &; 50)
& && &$errors[&address3&] =
& && && & &The address line 3 can be no longer & .
& && && & &than 50 characters&;
&&// Validate the user's Initial
&&if (!empty($formVars[&initial&]) &&
& && &!eregi(&^[a-z]{1}$&, $formVars[&initial&]))
& && &// If there is a middle initial, it must be
& && &// one character in length
& && &$errors[&initial&] =
& && && &&The initial field must be empty or one & .
& && && &&character in length.&;
&&// Validate the City
&&if (empty($formVars[&city&]))
& && &// the user's city cannot be a null string
& && &$errors[&city&] = &You must supply a city.&;
&&elseif (strlen($formVars[&city&]) &; 20)
& && &$errors[&city&] =
& && &&&&The city can be no longer than 20 characters&;
&&// Validate State - any string less than 21 characters
&&if (strlen($formVars[&state&]) &; 20)
& && &$errors[&state&] =
& && && &&The state can be no longer than 20 characters&;
&&// Validate Zipcode
&&if (!ereg(&^([0-9]{4,5})$&, $formVars[&zipcode&]))
& && &$errors[&zipcode&] =
& && && &&The zipcode must be 4 or 5 digits in length&;
&&// Validate Country
&&if (strlen($formVars[&country&]) &; 20)
& && &$errors[&country&] =
& && && &&The country can be no longer than 20 characters&;
&&// Phone is optional, but if it is entered it must have
&&//&&correct format
&&$validPhoneExpr =
& &&&&^([0-9]{2,3}[ ]?)?[0-9]{4}[ ]?[0-9]{4}$&;
&&if (!empty($formVars[&phone&]) &&
& && &!ereg($validPhoneExpr, $formVars[&phone&]))
& && &$errors[&phone&] =
& && &&&&The phone number must be 8 digits in length, & .
& && &&&&with an optional 2 or 3 digit area code&;
&&// Fax is optional, but if it is entered it must
&&// have correct format
&&if (!empty($formVars[&fax&]) &&
& && &!ereg($validPhoneExpr, $formVars[&fax&]))
& && &$errors[&fax&] =
& && &&&&The fax number must be 8 digits in length, with & .
& && &&&&an optional 2 or 3 digit area code&;
&&// Validate Date of Birth
&&if (empty($formVars[&dob&]))
& && &// the user's date of birth cannot be a null string
& && &$errors[&dob&] = &You must supply a date of birth.&;
&&elseif (!ereg(&^([0-9]{2})/([0-9]{2})/([0-9]{4})$&,
& && && & $formVars[&dob&], $parts))
& && &// Check the format
& && &$errors[&dob&] =
& && &&&&The date of birth is not a valid date in the & .
& && &&&&format DD/MM/YYYY&;&&
&&elseif (!checkdate($parts[2],$parts[1],$parts[3]))
& && &$errors[&dob&] =
& && && &&The date of birth is invalid. Please check & .
& && && &&that the month is between 1 and 12, and the & .
& && && &&day is valid for that month.&;
&&elseif (intval($parts[3]) & 1890)
& && &// Make sure that the user has a reasonable birth year
& && &$errors[&dob&] =
& && && &&You must be alive to use this service.&;
& & // Check whether the user is 18 years old.
& & // If all the following are NOT true, then report
& & // an error.
& & // Were they born more than 19 years ago?
& & (!((intval($parts[3]) & (intval(date(&Y&quot - 19))) ||
& & // No, so were they born exactly 18 years ago, and
& & // has the month they were born in passed?
& & (intval($parts[3]) == (intval(date(&Y&quot) - 1 &&
& & (intval($parts[2]) & intval(date(&m&quot))) ||
& & // No, so were they born exactly 18 years ago in this
& & // month, and was the day today or earlier in the month?
& & (intval($parts[3]) == (intval(date(&Y&quot) - 1 &&
& & (intval($parts[2]) ==&&intval(date(&m&quot)) &&
& & (intval($parts[1]) &= intval(date(&d&))))))
& && &$errors[&dob&] =
& && && & &You must be 18+ years of age to use this &.
& && && & &service.&;
&&// Only validate email if this is an INSERT
&&if (!session_is_registered(&loginUsername&))
& &&&// Check syntax
& &&&$validEmailExpr =
& && && &&^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*& .
& && && &&@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*$&;
& &&&// Extract the domain of the email address
& &&&$maildomain = substr(strstr($formVars[&email&], '@'), 1);
& &&&if (empty($formVars[&email&]))
& && && &// the user's email cannot be a null string
& && && &$errors[&email&] =
& && && && &&You must supply an email address.&;
& &&&elseif (!eregi($validEmailExpr, $formVars[&email&]))
& && && &// The email must match the above regular
& && && &// expression& && && &
& && && &$errors[&email&] =
& && && && &&The email address must be in the & .
& && && && &&name@domain format.&;
& &&&elseif (strlen($formVars[&email&]) &; 50)
& && && &// The length cannot exceed 50 characters
& && && &$errors[&email&] =
& && && && &&The email address can be no longer than & .
& && && && &&50 characters.&;
& &&&elseif (!( getmxrr($maildomain, $temp) || gethostbyname($maildomain) != $maildomain ))
& && && &// Can email be sent to this domain?
& && && &$errors[&email&] =
& && && && &&The domain does not exist.&;
& && &&&// Check if the email address is already in use in
& && &&&//&&the winestore
& && &&&if (!($connection = @ mysql_pconnect($hostName,
& && && && && && && && && && && && && && && &$username,
& && && && && && && && && && && && && && && &$password)))
& && && &&&showerror();
& && &&&if (!mysql_select_db($databaseName, $connection))
& && && &&&showerror();
& && &&&$query = &SELECT * FROM users
& && && && && && &WHERE user_name = '& .
& && && && && && &$formVars[&email&] . &'&;
& && &&&if (!($result = @ mysql_query ($query,
& && && && && && && && && && && && && &$connection)))
& && && &&&showerror();
& && &&&// Is it taken?
& && &&&if (mysql_num_rows($result) == 1)
& && && &&&$errors[&email&] =
& && && && &&&&A customer already exists with this & .
& && && && &&&&login name.&;
&&// Only validate password if this is an INSERT
&&// Validate password - between 6 and 8 characters
&&if (!session_is_registered(&loginUsername&) &&
& &&&(strlen($formVars[&loginPassword&]) & 6 ||
& && &strlen($formVars[&loginPassword&] &; ))
& && &$errors[&loginPassword&] =
& && && &&The password must be between 6 and 8 & .
& && && &&characters in length&;
&&// Now the script has finished the validation,
&&// check if there were any errors
&&if (count($errors) &; 0)
& && &// There are errors.&&Relocate back to the client form
& && &header(&Location: example.customer.2.php&);
&&// If we made it here, then the data is valid
&&if (!isset($connection))
& &&&if (!($connection = @ mysql_pconnect($hostName,
& && && && && && && && && && && && && && &$username,
& && && && && && && && && && && && && && &$password)))
& && &&&showerror();
& &&&if (!mysql_select_db($databaseName, $connection))
& && &&&showerror();
&&// Reassemble the date of birth into database format
&&$dob = & \&$parts[3]-$parts[2]-$parts[1]\&&;
&&// Is this an update?
&&if (session_is_registered(&loginUsername&))
& &&&$custID = getCustomerID($loginUsername, $connection);
& &&&$query = &UPDATE customer SET &.
& &&&&title = \&& . $formVars[&title&] . &\&, & .
& &&&&surname = \&& . $formVars[&surname&] . &\&, & .
& &&&&firstname = \&& . $formVars[&firstName&] . &\&, & .
& &&&&initial = \&& . $formVars[&initial&] . &\&, & .
& &&&&addressline1 = \&& . $formVars[&address1&] . &\&, & .
& &&&&addressline2 = \&& . $formVars[&address2&] . &\&, & .
& &&&&addressline3 = \&& . $formVars[&address3&] . &\&, & .
& &&&&city = \&& . $formVars[&city&] . &\&, & .
& &&&&state = \&& . $formVars[&state&] . &\&, & .
& &&&&zipcode = \&& . $formVars[&zipcode&] . &\&, & .
& &&&&country = \&& . $formVars[&country&]. &\&, & .
& &&&&phone = \&& . $formVars[&phone&] . &\&, & .
& &&&&fax = \&& . $formVars[&fax&] . &\&, & .
& &&&&birth_date = & . $dob .
& &&&& WHERE cust_id = $custID&;
& &&&$query = &INSERT INTO customer VALUES (NULL, & .
& && && && &&&&\&& . $formVars[&surname&] . &\&, & .
& && && && &&&&\&& . $formVars[&firstName&] . &\&, & .& && && && && && &&&
& && && && &&&&\&& . $formVars[&initial&] . &\&, & .
& && && && &&&&\&& . $formVars[&title&] . &\&, & .
& && && && &&&&\&& . $formVars[&address1&] . &\&, & .
& && && && &&&&\&& . $formVars[&address2&] . &\&, & .
& && && && &&&&\&& . $formVars[&address3&] . &\&, & .
& && && && &&&&\&& . $formVars[&city&] . &\&, & .
& && && && &&&&\&& . $formVars[&state&] . &\&, & .
& && && && &&&&\&& . $formVars[&zipcode&] . &\&, & .
& && && && &&&&\&& . $formVars[&country&] . &\&, & .
& && && && &&&&\&& . $formVars[&phone&] . &\&, & .
& && && && &&&&\&& . $formVars[&fax&] . &\&, & .
& && && && &&&&\&& . $formVars[&email&] . &\&, & .
& && && && &&&$dob . &, & .
& && && && &&&0 . &)&;
&&// Run the query on the customer table
&&if (!(@ mysql_query ($query, $connection)))
& &&&showerror();& &
&&// If this was an INSERT, we need to INSERT
&&// also into the users table
&&if (!session_is_registered(&loginUsername&))
& &&&// Get the customer id that was created
& &&&$custID = @ mysql_insert_id($connection);
& &&&// Use the first two characters of the
& &&&// email as a salt for the password
& &&&$salt = substr($formVars[&email&], 0, 2);
& &&&// Create the encrypted password
& &&&$stored_password =
& && && &crypt($formVars[&loginPassword&], $salt);
& &&&// Insert a new user into the user table
& &&&$query = &INSERT INTO users
& && && && && &SET cust_id = $custID,
& && && && && && &password = '$stored_password',
& && && && && && &user_name = '& . $formVars[&email&] . &'&;
& &&&if (!($result = @ mysql_query ($query, $connection)))
& && &&&showerror();& && && && && && && && && && && &
& &&&// Log the user into their new account
& &&&session_register(&loginUsername&);
& &&&$loginUsername = $formVars[&email&];
&&// Clear the formVars so a future &form&; is blank
&&session_unregister(&formVars&);
&&session_unregister(&errors&);
&&// Now show the customer receipt
&&header(&Location: example.customer.3.php?custID=$custID&);
example.customer.2.php
&?php
&&// This script shows the user a customer &form&;.
&&// It can be used both for INSERTing a new customer and
&&// for UPDATE-ing an existing customer. If the customer
&&// is logged in, then it is an UPDATE; otherwise, an
&&// INSERT.
&&// The script also shows error messages above widgets
&&// that co errors are generated
&&// by example.customer.1.php
&&include 'include.inc';
&&set_error_handler(&errorHandler&);
&&// Show an error in a red font
&&function fieldError($fieldName, $errors)
& & if (isset($errors[$fieldName]))
& && & echo &&font color=\&red\&&;& .
& && && &&&$errors[$fieldName] .
& && && &&&&&/font&;&br&;&;
&&// Connect to a session
&&session_start();
&&// Is the user logged in and were there no errors from a previous
&&// validation?&&If so, look up the customer for editing
&&if (session_is_registered(&loginUsername&) && empty($errors))
& &&&if (!($connection = @ mysql_pconnect($hostName,
& && && && && && && && && && && && && &&&$username,
& && && && && && && && && && && && && &&&$password)))
& && &&&showerror();
& &&&if (!mysql_select_db($databaseName, $connection))
& && &&&showerror();
& &&&$custID = getCustomerID($loginUsername, $connection);
& &&&$query = &SELECT * FROM customer
& && && && && &WHERE cust_id = & . $custID;
& &&&if (!($result = @ mysql_query($query, $connection)))
& && &&&showerror();
& &&&$row = mysql_fetch_array($result);
& &&&// Reset $formVars, since we're loading from
& &&&// the customer table
& &&&$formVars = array();
& &&&// Reset the errors
& &&&$errors = array();
& &&&// Load all the form variables with customer data
& &&&$formVars[&title&] = $row[&title&];
& &&&$formVars[&surname&] = $row[&surname&];
& &&&$formVars[&firstName&] = $row[&firstname&];
& &&&$formVars[&initial&] = $row[&initial&];
& &&&$formVars[&address1&] = $row[&addressline1&];
& &&&$formVars[&address2&] = $row[&addressline2&];
& &&&$formVars[&address3&] = $row[&addressline3&];
& &&&$formVars[&city&] = $row[&city&];
& &&&$formVars[&state&] = $row[&state&];
& &&&$formVars[&zipcode&] = $row[&zipcode&];
& &&&$formVars[&country&] = $row[&country&];
& &&&$formVars[&phone&] = $row[&phone&];
& &&&$formVars[&fax&] = $row[&fax&];
& &&&$formVars[&email&] = $row[&email&];
& &&&$formVars[&dob&] = $row[&birth_date&];
& &&&$formVars[&dob&] = substr($formVars[&dob&], 8, 2) . &/& .
& && && && && && && && &substr($formVars[&dob&], 5, 2) . &/& .& &
& && && && && && && && &substr($formVars[&dob&], 0, 4);
&!DOCTYPE HTML PUBLIC
& &&-//W3C//DTD HTML 4.0 Transitional//EN&
& &&http://www.w3.org/TR/html4/loose.dtd& &;
&head&;&title&;Customer Details&/title&;&/head&;
&body bgcolor=&white&&;&&
&&// Show the user login status
&&showLogin();
&form method=&post& action=&example.customer.1.php&&;
&h1&;Customer Details&/h1&;
&&// Display any messages to the user
&&showMessage();
&&// Show meaningful instructions for UPDATE or INSERT
&&if (session_is_registered(&loginUsername&))
& &&&echo &&h3&lease amend your details below as required. Fields shown in &font color=\&red\&&;red&/font&; are mandatory.&/h3&;&;
& &&&echo &&h3&lease fill in the details below to join. Fields shown in &font color=\&red\&&;red&/font&; are mandatory.&/h3&;&;
&col span=&1& align=&right&&;
& & &tr&;&td&;&font color=&red&&;Title:&/font&;&/td&;
& &&td&;&select name=&title&&;
& && & &option &?if ($formVars[&title&]==&Mr&) echo &selected&;?&;&;Mr
& && & &option &?if ($formVars[&title&]==&Mrs&) echo &selected&;?&;&;Mrs
& && & &option &?if ($formVars[&title&]==&Ms&) echo &selected&;?&;&;Ms
& && & &option &?if ($formVars[&title&]==&Dr&) echo &selected&;?&;&;Dr
& && & &/select&;&br&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;First name:&/font&;&/td&;
& &&td&;&? echo fieldError(&firstName&, $errors); ?&;
& && & &input type=&text& name=&firstName&
& && &value=&&? echo $formVars[&firstName&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;Surname:&/font&;&/td&;
& &&td&;&? echo fieldError(&surname&, $errors); ?&;
& && & &input type=&text& name=&surname&
& && &value=&&? echo $formVars[&surname&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;Initial: &/td&;
& &&td&;&? echo fieldError(&initial&, $errors); ?&;
& && & &input type=&text& name=&initial&
& && &value=&&? echo $formVars[&initial&]; ?&;& size=1&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;Address:&/font&;&/td&;
& &&td&;&? echo fieldError(&address&, $errors); ?&;
& && & &? echo fieldError(&address1&, $errors); ?&;
& && & &input type=&text& name=&address1&
& && &value=&&? echo $formVars[&address1&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;&/td&;
& &&td&;&? echo fieldError(&address2&, $errors); ?&;
& && & &input type=&text& name=&address2&
& && &value=&&? echo $formVars[&address2&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;&/td&;
& &&td&;&? echo fieldError(&address3&, $errors); ?&;
& && & &input type=&text& name=&address3&
& && &value=&&? echo $formVars[&address3&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;City:&/font&;&/td&;
& &&td&;&? echo fieldError(&city&, $errors); ?&;
& && & &input type=&text& name=&city&
& && &value=&&? echo $formVars[&city&]; ?&;& size=20&;&/td&;
& & &/tr&;
& & &tr&;&td&;State: &/td&;
& & &td&;&? echo fieldError(&state&, $errors); ?&;
& &&input type=&text& name=&state&
& && & value=&&? echo $formVars[&state&]; ?&;& size=20&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;Zipcode:&/font&;&/td&;
& & &td&;&? echo fieldError(&zipcode&, $errors); ?&;
& &&input type=&text& name=&zipcode&
& && && &value=&&? echo $formVars[&zipcode&]; ?&;& size=5&;&/td&;
& & &/tr&;
& & &tr&;&td&;Country: &/td&;
& &&td&;&? echo fieldError(&country&, $errors); ?&;
& && & &select name=&country&&;
& && &&option &?if ($formVars[&country&]==&Australia&) echo &selected&;?&;&;
& && && & Australia
& && &&option &?if ($formVars[&country&]==&United States&) echo &selected&;?&;&;
& && && & United States
& && &&option &?if ($formVars[&country&]==&Zimbabwe&) echo &selected&;?&;&;
& && && & Zimbabwe
& && & &/select&;&/td&;
& & &/tr&;
& & &tr&;&td&;Telephone: &/td&;
& &&td&;&? echo fieldError(&phone&, $errors); ?&;
& &&input type=&text& name=&phone&
& && & value=&&? echo $formVars[&phone&]; ?&;& size=15&;&/td&;
& & &/tr&;
& & &tr&;&td&;Fax: &/td&;
& &&td&;&? echo fieldError(&fax&, $errors); ?&;
& && & &input type=&text& name=&fax&
& && &value=&&? echo $formVars[&fax&]; ?&;& size=15&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&;Date of birth (dd/mm/yyyy):&/font&; &/td&;
& &&td&;&? echo fieldError(&dob&, $errors); ?&;
& && & &input type=&text& name=&dob&
& && &value=&&? echo $formVars[&dob&]; ?&;& size=10&;&/td&;
& & &/tr&;
&&// Only show the username/email and password widgets to new users
&&if (!session_is_registered(&loginUsername&))
& & &tr&;&td&;&font color=&red&&;Email/username:&/font&;&/td&;
& &&td&;&? echo fieldError(&email&, $errors); ?&;
& && & &input type=&text& name=&email&
& && &value=&&? echo $formVars[&email&]; ?&;& size=50&;&/td&;
& & &/tr&;
& & &tr&;&td&;&font color=&red&&assword:&/font&;&/td&;
& &&td&;&? echo fieldError(&loginPassword&, $errors); ?&;
& && & &input type=&password& name=&loginPassword&
& && &value=&&? echo $formVars[&loginPassword&]; ?&;& size=8&;&/td&;
& & &/tr&;
& &&td&;&input type=&submit& value=&Submit&&;&/td&;
&br&;&a href=&http://validator.w3.org/check/referer&&;&img
& &&&src=&http://www.w3.org/Icons/valid-html401& height=&31& width=&88&
& && && & align=&right& border=&0& alt=&Valid HTML 4.01!&&;&/a&;
example.customer.3.php
&?php
&&// This script shows the user a receipt for their customer
&&// UPDATE or INSERT. It carries out no database actions and
&&// can be bookmarked.
&&// The user must be logged in to view it.
&&include 'include.inc';
&&set_error_handler(&errorHandler&);
&&// Show the user a customer INSERT or UPDATE receipt
&&function show_HTML_receipt($custID, $connection)
& & $query = &SELECT * FROM customer
& && && && & WHERE cust_id = $custID&;
& & if (!($result = @ mysql_query ($query, $connection)))
& && & showerror();
& & // There is only one matching row
& & $row = @ mysql_fetch_array($result);
& & echo &\n&h1&;Account details for &font color=\&red\&&;& . $row[&email&] . &&/font&;&/h1&;\n&;
& & echo &&p&;&i&lease record your password somewhere safe for future use&/i&;\n&;
& & echo &&p&;Your shipping and billing details are as follows:\n&br&;&b&; & .
& && && &$row[&title&] . & & .
& && && &$row[&firstname&] . & & .
& && && &$row[&initial&] . & & .
& && && &$row[&surname&] . &\n&br&;& .
& && && &$row[&addressline1&] . &\n&;
& & if ($row[&addressline2&] != &&)
& && & echo &\n&br&;& .
& && && && &$row[&addressline2&];
& & if ($row[&addressline3&] != &&)
& && & echo &\n&br&;& .
& && && && &$row[&addressline3&];
& & echo &\n&br&;& .
& && && &$row[&city&] . & & .
& && && &$row[&state&] . & & .
& && && &$row[&zipcode&] . &\n&br&;& .
& && && &$row[&country&] . &&/b&;&br&;\n&;
& & if ($row[&phone&] != &&)
& && & echo &\n&br&;&b&;Telephone: & .
& && && && &$row[&phone&] . &&/b&;&;
& & if ($row[&fax&] != &&)
& && & echo &\n&br&;&b&;Fax: & .
& && && && &$row[&fax&] . &&/b&;&;
& & $row[&dob&] = substr($row[&birth_date&], 8, 2) . &/& .
& && && && && && &substr($row[&birth_date&], 5, 2) . &/& .& &
& && && && && && &substr($row[&birth_date&], 0, 4);
& & echo &\n&br&;&b&;Date of Birth: & .
& && && &$row[&dob&] . &&/b&;\n&br&;&;
&&// Main ----------
& &// Re-establish the existing session
& &session_start();& &
& &// Check if the user is logged in
& &if (!session_is_registered(&loginUsername&))
& && &session_register(&message&);
& && &$message = &You must login to view your customer receipt.&;
& && &header(&Location: example.cart.1.php&);
& &}& && &
& &// Check the correct parameters have been passed
& &if (!isset($custID))
& && &session_register(&message&);
& && &$message = &Incorrect parameters to example.customer.3.php&;
& && &// Redirect the browser back to the calling page
& && &header(&Location: $HTTP_REFERER&);
& &}& && &
& &// Check this customer matches the custID
& &if ($custID != getCustomerID($loginUsername, NULL))
& && &session_register(&message&);
& && &$message = &You can only view your own customer receipt!&;
& && &$custID = getCustomerID($loginUsername, NULL);
& &// Open a connection to the DBMS
& &if (!($connection = @ mysql_pconnect($hostName,
& && && && && && && && && && && && &&&$username,
& && && && && && && && && && && && &&&$password)))
& && &showerror();
& &if (!mysql_select_db($databaseName, $connection))
& && &showerror();
&!DOCTYPE HTML PUBLIC
& &&-//W3C//DTD HTML 4.01 Transitional//EN&
& &&http://www.w3.org/TR/html401/loose.dtd&&;
&&&title&;Hugh and Dave's Online Wines&/title&;
&body bgcolor=&white&&;
& &// Show the user login status
& &showLogin();
& &// Show the user any messages
& &showMessage();
& &// Show the customer confirmation
& &show_HTML_receipt($custID, $connection);
& &// Show buttons
& &echo &&form action=\&example.cart.5.php\& method=\&GET\&&;&;
& &echo &&table&;&;
& &echo &&td&;&input type=\&submit\& name=\&home\& value=\&Home\&&;&/td&;&;
&br&;&a href=&http://validator.w3.org/check/referer&&;&img
& &&&src=&http://www.w3.org/Icons/valid-html401& height=&31& width=&88&
& &&&align=&right& border=&0& alt=&Valid HTML 4.01!&&;&/a&;
请问一个PHPer 要学多久就能够写出这样的代码?(对大众PHPer而言)
&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp
家境小康, 积分 1765, 距离下一级还需 235 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
原帖由 &myfavourite& 发表:
请问一个PHPer 要学多久就能够写出这样的代码?(对大众PHPer而言)
家境小康, 积分 1042, 距离下一级还需 958 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
代码太杂,看不清,很初级的程序,顶多只是面向过程....
没有清析的结构
白手起家, 积分 195, 距离下一级还需 5 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
原帖由 &hitty& 发表:
代码太杂,看不清,很初级的程序,顶多只是面向过程....
没有清析的结构
初级?不会吧?我现在只要求能够写出像上面的那样代码已经算不错了
我觉得上面的代码挺清析的,至少我是这样认为的,,
下面是登录脚本:
example.order.1.php
& &// 该脚本管理登录过程
& &//应该在用户示登录才调用该脚本。
& &//如果用户登录,它将重定向回到调用页面。
& &//如果用户示登录,它将显示一个登录&form&;
& &include 'include.inc';
set_error_handler(&errorHandler"
function check_login($loginUsername, $loginPassword)
&&global $
&&global $
&&global $
&&global $hostN
&&global $databaseN
&&global $
&&// Get the two character salt from the
&&// user-name collected from the challenge
&&$salt = substr($loginUsername, 0, 2);
&&// Encrypt the loginPassword collected from
&&// the challenge
&&$crypted_password = crypt($loginPassword, $salt);
&&// Formulate the SQL find the user
&&$query = &SELECT password FROM users
& && && && && &WHERE user_name = '$loginUsername'
& && && && && &AND password = '$crypted_password'&;
&&// Open a connection to the DBMS
&&if (!($connection = @ mysql_pconnect($hostName,
& && && && && && && && && && && && &&&$username,
& && && && && && && && && && && && &&&$password)))
& &&&showerror();
&&if (!mysql_select_db($databaseName, $connection))
& &&&showerror();
&&// Execute the query
&&if (!($result = @ mysql_query($query, $connection)))
& &&&showerror();
&&// exactly one row? then we have found the user
&&if (mysql_num_rows($result) == 1)
& &&&// Register the loginUsername to show the user is logged in
& &&&session_register(&loginUsername"
& &&&// Clear any other session variables
& &&&if (session_is_registered(&errors&quot)
& && &&&// Delete the form errors session variable
& && &&&session_unregister(&errors"
& &&&if (session_is_registered(&formVars&quot)
& && &&&// Delete the formVars session variable
& && &&&session_unregister(&formVars"
& &&&// Do we need to redirect to a calling page?
& &&&if (session_is_registered(&referer&quot)
& &&&{& &&&
& && &&&// Delete the referer session variable
& && &&&session_unregister(&referer"
& && &&&// Then, use it to redirect
& && &&&header(&Location: $referer"
& && &&&header(&Location: example.cart.1.php"
& &&&// Ensure loginUsername is not registered, so the user
& &&&// is not logged in
& &&&if (session_is_registered(&loginUsername&))
& && &&&session_unregister(&loginUsername&);
& &&&// Register an error message
& &&&session_register(&message&);
& &&&$message = &Username or password incorrect. Login failed.&;
& &&&// Show the login page
& &&&// so the user can have another go!
& &&&login_page();
&&}& && &&&
// Function that shows the HTML &form&; that is
// used to collect the user-name and password
function login_page()
&&global $
&!DOCTYPE HTML PUBLIC
& & &-//W3C//DTD HTML 4.0 Transitional//EN&
& & &http://www.w3.org/TR/html4/loose.dtd& &;
& &&&&title&;Winestore Login Page&/title&;
&&&/head&;
&&&body bgcolor=&white&&;
&&// Show login status (should be logged out!)
&&showLogin();
& & &h2&;Winestore Login Page&/h2&;
& & &form method=&quotOST& action=&example.order.1.php&&;
&&// Show messages
&&showMessage();
&&// Generate the login &form&; layout
& & &td&;Enter your username:&/td&;
& & &td&;&input type=&text& size=15
& && && &maxlength=30
& && && &name=&loginUsername&&;&/td&;
&/tr&;& &&&
&tr&;&td&;Enter your password:&/td&;
& & &td&;&input type=&password& size=15
& && && &maxlength=8
& && && &name=&loginPassword&&;&/td&;
& & &td&;&input type=&submit& value=&Log in&&;&/td&;
&br&;&a href=&http://validator.w3.org/check/referer&&;&img
& &&&src=&http://www.w3.org/Icons/valid-html401& height=&31& width=&88&
& &&&align=&right& border=&0& alt=&Valid HTML 4.01!&&;&/a&;
// ------------------
// Initialise the session
session_start();
if (isset($HTTP_POST_VARS[&loginUsername&]))
& &$loginUsername = clean($HTTP_POST_VARS[&loginUsername&], 30);
if (isset($HTTP_POST_VARS[&loginPassword&]))
& &$loginPassword = clean($HTTP_POST_VARS[&loginPassword&], 8 );
// Check if the user is already logged in
if (session_is_registered(&loginUsername&))
&&// If they are, then just bounce them back where
&&// they came from
&&if (session_is_registered(&referer&))
& &&&session_unregister(&referer&);
& &&&header(&Location: $referer&);
& &&&header(&Location: example.cart.1.php&);
// Have they provided only one of a username and password?
if ((empty($HTTP_POST_VARS[&loginUsername&]) &&
& & !empty($HTTP_POST_VARS[&loginPassword&])) ||
& & (!empty($HTTP_POST_VARS[&loginUsername&]) &&
& & empty($HTTP_POST_VARS[&loginPassword&])))
& &&&// Register an error message
& &&&session_register(&message&);
& &&&$message = &Both a username and password must be supplied.&;
// Have they not provided a username/password, or was there an error?
if (!isset($loginUsername) ||
& & !isset($loginPassword) ||
& &&&session_is_registered(&message&))
&&login_page();
&&// They have provided a login. Is it valid?
&&check_login($loginUsername, $loginPassword);
丰衣足食, 积分 741, 距离下一级还需 259 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
里面除了正则对偶来说有点难度
其他都已经不是问题鸟
第一次接触PHP到现在不到两年
近一年前才写了个简单的留言本
白手起家, 积分 195, 距离下一级还需 5 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
原帖由 &姜运涛& 发表:
里面除了正则对偶来说有点难度
其他都已经不是问题鸟
第一次接触PHP到现在不到两年
近一年前才写了个简单的留言本
里面的代码并不是说难,难就难在考虑得比较周到,几乎没有Bug可言,我是这样认为的。我学PHP也有一段时间了,不过都是看代码,还没有动手写过代码 ,菜啊
白手起家, 积分 12, 距离下一级还需 188 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
其實這個代碼很糟糕的,沒有清晰的設計,沒有很好的數據封裝,混亂的業務邏輯,學PHP如果只要學到這種程度,那還是一開始就不要學的好
不過正則表達式用的還可以
论坛徽章:0
提示: 作者被禁止或删除 内容自动屏蔽
稍有积蓄, 积分 204, 距离下一级还需 296 积分
论坛徽章:0
[学习] 学PHP要学多久才学出这样的代码
感觉有点乱 不过考虑挺全面的
论坛徽章:1
[学习] 学PHP要学多久才学出这样的代码
不要总是想着我可以做什么
而要总是想着我学了什么

我要回帖

更多关于 php培训机构 的文章

 

随机推荐