欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP編寫學(xué)校網(wǎng)站上新生注冊(cè)登陸程序的實(shí)例分享

 更新時(shí)間:2016年03月21日 15:25:45   作者:可笑癡狂  
這篇文章主要介紹了使用PHP編寫學(xué)校網(wǎng)站上新生注冊(cè)登陸程序的實(shí)例分享,只包括簡(jiǎn)單的數(shù)據(jù)庫(kù)信息錄入和查詢等步驟的一些關(guān)鍵點(diǎn),需要的朋友可以參考下

就弄了三個(gè)頁(yè)面:

(1)、新生信息注冊(cè)模塊(register.php):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <title>班級(jí)注冊(cè)表</title>
  </head>
  <body background="image/bg3.jpg">
    <center><img src="image/school_1.jpg" height="50%" width="60%">
    <marquee behavior="alternate" bgcolor="#FF0000"><b>河南理工大學(xué)真誠(chéng)歡迎2012級(jí)新同學(xué)到校學(xué)習(xí)</b></marquee>
    </center>
    <p><center><font color="red" size="6"><b><blink>新生注冊(cè)系統(tǒng)</blink></b></font></center></p>
    <form action="mysql_stu.php" method="post" name="reg_stu">
    <table align="center" cellspacing="0" bordercolor="#FFFFFF" width="60%" bordercolorlight="#FFFFFF" border="1" cellpadding="3">
      <tr bgcolor="#CCCCCC">
        <td width="100%" align="center" valign="bottom" height="19" colspan="2">
        <font face="隸書" size="4" color="#000000">請(qǐng)仔細(xì)填寫以下內(nèi)容</font></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19" >姓名:</td>
        <td width="70%"><input type="text" name="reg_name" size="10" maxlength="18" ></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">性別:</td>
        <td width="70%"><input type="radio" name="reg_sex" value="男" checked >男<input type="radio" name="sex" value="女">女</td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">年齡:</td>
        <td width="70%"><input type="text" name="reg_age" size="5" maxlength="15"></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">班級(jí):</td>
        <td width="70%"><input type="text" name="reg_class" size="20"></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">身份證號(hào):</td>
        <td width="70%"><input type="text" name="reg_id" size="20"></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">聯(lián)系電話:</td>
        <td width="70%"><input type="text" name="reg_tele" size="20"></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">電子郵件:</td>
        <td width="70%"><input type="text" name="reg_email" size="20"></td>
      </tr>
      <tr>
        <td width="100%" align="center" colspan="2"><input type="submit" value="馬上注冊(cè)">
        <input type="reset" value="全部重寫"></td>
      </tr>
    </table>
    </form>
    <marquee behavior="scroll">
    <center><img src="image/school2.jpg" height="15%" width="15%">
    <img src="image/lake.jpg" height="15%" width="15%">
    <img src="image/flower.jpg" height="15%" width="15%">
    <img src="image/autumn.jpg"height="16%" width="16%">
    <img src="image/bridge.jpg" height="15%" width="15%">
    <img src="image/beauty.jpeg" height="15%" width="15%">  
    <img src="image/party1.jpeg" height="18%" width="17%">
    <img src="image/party2.jpeg" height="18%" width="18%">
    <img src="image/party3.jpeg" height="18%" width="17%">
    <img src="image/party4.jpeg" height="18%" width="17%">
    </center></marquee>
  </body>
</html>

2016321152141216.jpg (1281×703)

(2)、信息查詢登錄模塊(mysql_stu.php):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新生登陸系統(tǒng)</title>
</head>
 
<body background="image/bg1.jpg">
  <?php
    //連接數(shù)據(jù)庫(kù);
    $link = mysql_connect('localhost','root','Dongsheng');
    if(!$link)
    {
      echo "與數(shù)據(jù)庫(kù)連接失??!";
      die('Could not connect: ' .mysql_error());
    }
    $createdb="create database if not exists mis_stu";
    $result=mysql_query($createdb)
      or die("<br>數(shù)據(jù)庫(kù)創(chuàng)建失?。?.mysql_error());
    $result=mysql_select_db(mis_stu)
      or die('選擇mis_stu數(shù)據(jù)庫(kù)失敗:'.mysql_error());
    $createtable="create table if not exists stu_reg (stu_name varchar(30) not null,stu_sex char(2),stu_age int,stu_class varchar(30),stu_id varchar(18),stu_tele varchar(20),stu_email varchar(30))";
    $result=mysql_query($createtable)
      or die('<br>數(shù)據(jù)表創(chuàng)建失?。?.mysql_error());
    //選擇數(shù)據(jù)庫(kù)
    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'];
      //定義插入數(shù)據(jù)到stu_reg表中的SQL字符串
      mysql_query("set names gb2312");
      $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 "<center><font color='blue' size='10'><b>恭喜您,注冊(cè)成功!<br>輸入以下內(nèi)容登陸系統(tǒng)查詢注冊(cè)信息</b></font></center>";
    }
    mysql_close($link);
  ?>
  <font size='6' color="#FFFF00">登錄前請(qǐng)先<a href="register.php">注冊(cè)</a></font>
  <p><center><font color="red" size="6"><b>信息查詢登錄</b></font></center></p>
    <form action="stu_info.php" method="post" name="log_stu">
    <table align="center" cellspacing="0" bordercolor="#FFFFFF" width="60%" bordercolorlight="#FFFFFF" border="1" cellpadding="3">
      <tr bgcolor="#CCCCCF">
        <td width="100%" align="center" valign="bottom" height="19" colspan="2">
        <font face="隸書" size="4" color="#000000">請(qǐng)輸入姓名和身份證號(hào)</font></td>
      </tr>
      <tr>
        <td width="50%" align="right" height="19" >請(qǐng)輸入姓名:</td>
        <td width="70%"><input type="text" name="log_name" size="20"></td>
      </tr>
      <tr>
        <td width="30%" align="right" height="19">請(qǐng)輸入身份證號(hào):</td>
        <td width="70%"><input type="text" name="log_id" size="20"></td>
      <tr>
        <td width="100%" align="center" colspan="2"><input type="submit" value="登錄">
        <input type="reset" value="清空"></td>
      </tr>
    </table>
    </form>>
    <center>
    <p><font face="隸書" size="5" color=red>新生入學(xué)需知:<br></font></p>
    <p><font face="隸書" size="5" color="#0033FF"><marquee behavior="scroll" direction="up" height="200" bgcolor="#FFFFCC" width="60%">
    請(qǐng)各位同學(xué)先到各個(gè)學(xué)院完善注冊(cè)信息,<br>做好報(bào)道注冊(cè)工作,<br>同時(shí)按要求完善電子檔案信息。
    <br><br>希望廣大同學(xué)盡快適應(yīng)新環(huán)境,<br>認(rèn)識(shí)新朋友,盡快投入到學(xué)習(xí)工作當(dāng)中!<br><br>教務(wù)處電話:12345678<br>保衛(wèi)科電話:87654321</marquee></p></font>
    </center>
</body>
</html>

2016321152226105.jpg (1281×703)

(3)、查詢信息顯示模塊(stu_info.php)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>基本信息</title>
</head>
 
<body background="image/bg6.jpg">
  <?php
    if($_POST['log_name']=='')
    {
      echo "<center><font color='blue' size='8'><b>姓名不能為空!請(qǐng)重新輸入!<br></b></font></center>";
      echo "<center><font size='6'><a href='mysql_stu.php'>重新登錄</font></center>";
    }
    else
    { 
      $link = mysql_connect('localhost','root','Dongsheng');
      if(!$link)
      {
        echo "與數(shù)據(jù)庫(kù)連接失?。?;
        die('Could not connect: ' .mysql_error());
      }
      $result=mysql_select_db(mis_stu)
        or die('選擇mis_stu數(shù)據(jù)庫(kù)失敗:'.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 "<font color='red' size='8'><b>登錄成功,您的基本信息為:<br></b></font></center><br>";
            echo "<font size='6'>姓名:".$arr['stu_name']."<br>";
            echo "<font size='6'>性別:".$arr['stu_sex']."<br>";
            echo "<font size='6'>年齡:".$arr['stu_age']."<br>";
            echo "<font size='6'>班級(jí):".$arr['stu_class']."<br>";
            echo "<font size='6'>身份證號(hào):".$arr['stu_id']."<br>";
            echo "<font size='6'>聯(lián)系電話:".$arr['stu_tele']."<br>";
            echo "<font size='6'>電子郵件:".$arr['stu_email']."<br>";
            break;
          }
          else
          {
            echo "<center><font color='blue' size='8'><b>密碼錯(cuò)誤!請(qǐng)<a href='mysql_stu.php'>重新輸入。<br></b></font></center>";
            break;
          }
        }
        $arr=mysql_fetch_assoc($slt);
      }
      if($flag==0)
        echo "<center><font color='blue' size='8'><b>對(duì)不起!您查詢的用戶不存在,請(qǐng)先返回<a href='register.php'>注冊(cè)</a><br></b></font></center>";
      mysql_close($link);
      echo "<center><font color='blue' size='6'><a href='mysql_stu.php'>切換用戶</a><br></b></font></center>";
    }
     
  ?>
</body>
</html>

2016321152251020.jpg (1281×703)

相關(guān)文章

  • php遍歷目錄與文件夾的多種方法詳解

    php遍歷目錄與文件夾的多種方法詳解

    介紹幾個(gè)php遍歷目錄的方法,可以遍歷目錄及目錄中的文件,供大家參考
    2013-11-11
  • PHP二進(jìn)制與字符串之間的相互轉(zhuǎn)換教程

    PHP二進(jìn)制與字符串之間的相互轉(zhuǎn)換教程

    歡迎大家在這里學(xué)習(xí)PHP二進(jìn)制與字符串之間的相互轉(zhuǎn)換!問(wèn)題也肯定是很多朋友在關(guān)心的,想要了解的朋友可以看一下。
    2016-10-10
  • PHP編寫RESTful接口的方法

    PHP編寫RESTful接口的方法

    這篇文章主要為大家詳細(xì)介紹了PHP編寫RESTful接口的方法,如何使用PHP編寫RESTful接口,感興趣的小伙伴們可以參考一下
    2016-02-02
  • PHP rsa加密解密使用方法

    PHP rsa加密解密使用方法

    這篇文章主要介紹了PHP rsa加密解密使用方法,本文講解了生成公鑰、私鑰及PHP中使用生成的公鑰、私鑰進(jìn)行加密解密實(shí)例,需要的朋友可以參考下
    2015-04-04
  • laravel框架與其他框架的詳細(xì)對(duì)比

    laravel框架與其他框架的詳細(xì)對(duì)比

    今天小編就為大家分享一篇laravel框架與其他框架的詳細(xì)對(duì)比,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-10-10
  • 一個(gè)自定義位數(shù)的php多用戶計(jì)數(shù)器代碼

    一個(gè)自定義位數(shù)的php多用戶計(jì)數(shù)器代碼

    一個(gè)自定義位數(shù)的php多用戶計(jì)數(shù)器代碼...
    2007-03-03
  • php時(shí)間戳轉(zhuǎn)換的示例

    php時(shí)間戳轉(zhuǎn)換的示例

    PHP獲取“今天的時(shí)間戳”,再通過(guò)“今天”獲取昨天和明天0點(diǎn)和23:59:59的時(shí)間戳
    2014-03-03
  • Yii2下session跨域名共存的解決方案

    Yii2下session跨域名共存的解決方案

    這篇文章主要介紹了Yii2下session跨域名共存的解決方案,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-02-02
  • PHP函數(shù)引用返回的實(shí)例詳解

    PHP函數(shù)引用返回的實(shí)例詳解

    其實(shí)PHP函數(shù)引用與php中變量引用一樣,都使用的是&符號(hào)了,那么今天我們就一起來(lái)看看函數(shù)的引用返回的一些例子,有需要的朋友們可以參考借鑒,下面來(lái)一起看看吧。
    2016-09-09
  • Redis在Laravel項(xiàng)目中的應(yīng)用實(shí)例詳解

    Redis在Laravel項(xiàng)目中的應(yīng)用實(shí)例詳解

    這篇文章主要給大家介紹了關(guān)于Redis在Laravel項(xiàng)目中應(yīng)用的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用laravel具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-08-08

最新評(píng)論