PHP to write a school website on the registration of new students login procedures to share, PHP instance _php tutorial

Source: Internet
Author: User
Tags function examples

PHP to write a school website on the registration of new students to share the program, the example of PHP


We've got three pages:

(1), new Student Information Registration module (register.php):

    
 
    Class Registration Form        
 
      
  
   
   
    Henan University of Science and Technology sincerely welcome Class 2012 New students to school study
  
       
 
      

Freshman registration System


(2), Information query login module (mysql_stu.php):

 
  
 <title>New Landing System</title> <?php//connection database;    $link = mysql_connect (' localhost ', ' root ', ' Dongsheng '); if (! $link) {echo] failed to connect to the database!      ";    Die (' Could not connect: '. Mysql_error ());    } $createdb = "CREATE database if not exists mis_stu"; $result =mysql_query ($createdb) or Die ("
Database creation failed: ". Mysql_error ()); $result =mysql_select_db (Mis_stu) or Die (' Select Mis_stu database failed: '. mysql_error ()); $createtable = "CREATE table if not exists Stu_reg (stu_name varchar ($) Not null,stu_sex char (2), Stu_age Int,stu_class Varc Har (+), stu_id varchar (stu_tele), Stu_email varchar (30)) "; $result =mysql_query ($createtable) or Die ('
Data table creation failed: '. mysql_error ()); Select Database mysql_select_db (MIS_STU); if (!empty ($_post[' reg_name ')) {$name =$_post[' reg_name ']; $sex =$_post[' Reg_sex ']; $age =$_post[' reg_age ']; $class =$_post[' Reg_class ']; $id =$_post[' reg_id ']; $tele =$_post[' Reg_tele ']; $email =$_post[' Reg_email ']; Defines the SQL string mysql_query ("Set names gb2312") that inserts data into the Stu_reg table; $SQL = "INSERT into Stu_reg (stu_name,stu_sex,stu_age,stu_class,stu_id,stu_tele,stu_email) VALUES (' $name ', ' $sex ', ' $ Age ', ' $class ', ' $id ', ' $tele ', ' $email '); mysql_query ($SQL); mysql_query ("COMMIT"); echo " Congratulations, your registration is successful!
Enter the following to log in system query registration information
"; } mysql_close ($link); Please register before?> login

Information Query Login

>

New students need to know:

Please go to each college to improve the registration information,
Do a good job of reporting registration,
At the same time, as required to improve electronic file information.

Hope that the majority of students adapt to the new environment as soon as possible
Meet new people and get into the study work as soon as possible!

Academic Office Tel: 12345678
Security Branch Tel: 87654321

(3), Query information display module (stu_info.php)

 
  
 <title>Basic information</title> <?php if ($_post[' log_name ']== ') {echo "
 
  
 
   The name cannot be empty! Please re-enter!
"; echo " Re-Login "; } else {$link = mysql_connect (' localhost ', ' root ', ' Dongsheng '); if (! $link) {echo] failed to connect to the database! "; Die (' Could not connect: '. Mysql_error ()); } $result =mysql_select_db (Mis_stu) or Die (' Select Mis_stu database failed: '. mysql_error ()); mysql_query ("Set names gb2312"); $slt =mysql_query ("SELECT * from Stu_reg"); $arr =mysql_fetch_assoc ($SLT); $flag = 0; while ($arr) {if ($_post[' log_name ']== $arr [' stu_name ']) {$flag = 1; if ($_post[' log_id ']== $arr [' stu_id ']) {echo "login is successful, your basic information is:

"; echo "Name:". $arr [' Stu_name ']. "
"; echo "Gender:". $arr [' Stu_sex ']. "
"; echo "Age:". $arr [' Stu_age ']. "
"; echo "Class:" $arr [' Stu_class ']. "
"; echo "ID Number:" $arr [' stu_id ']. "
"; echo "Contact Phone:" $arr [' Stu_tele ']. "
"; echo "e-mail:". $arr [' Stu_email ']. "
"; Break } else {echo ' Wrong password! Please re-enter.
"; Break }} $arr =mysql_fetch_assoc ($SLT); } if ($flag ==0) echo " I am sorry! The user you are querying does not exist, please return to registration first
"; Mysql_close ($link); echo " Switch users
"; }?>

Articles you may be interested in:

    • PHP Registration Login System Simplified version
    • Ultra-detailed PHP user registration page Fill in the information complete example (attached source)
    • PHP user registration information validation Regular expression
    • PHP Production User Registration system
    • Summary of test function examples commonly used in PHP user registration
    • Php+jquery Registration Module Development detailed
    • Php+ajax detect if a user name or message registration is already present in the instance tutorial
    • thinkphp User Registration Login Message Complete Example
    • PHP code to verify the existence of the user name before registering the page
    • Php+ajax for no flush registration (real-time detection with username)

http://www.bkjia.com/PHPjc/1113730.html www.bkjia.com true http://www.bkjia.com/PHPjc/1113730.html techarticle PHP to write the school's website on the new registration of the login program to share, PHP instance has three pages: (1), the new Information Registration module (register.php):! DOCTYPE HTML Public "-//w3 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.