⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modify.php

📁 alumini based system
💻 PHP
字号:
<?php
	header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
    header( "Cache-Control: no-cache, must-revalidate" );
    header( "Pragma: no-cache" );
	session_start();
	$action=0;
		$strHTML="";
		if (!isset($_SESSION['LoggedIn'])){
		 $action=0;
         //not logged in
         $strHTML="<p><center><Form action=login.php method=post>";
         $strHTML=$strHTML."<br><B>User ID:</b>&nbsp;&nbsp;&nbsp;&nbsp;<input type=text name=uname>"; 
         $strHTML=$strHTML."<br><B>Password:</b>&nbsp;<input type=password name=pass>";
         $strHTML=$strHTML."<br><input type=Submit name=submit></form></center>";
        }
		else{
		  if (!isset($_POST['B1'])){
		   $strHTML="";
		   $action=1; 
		   //display alumni details to be modified
		             if (isset($_GET['id'])){
					 //retrieve  info for this id and show it in table
					        $id=$_GET['id'];
                            $link = mysql_connect("localhost", "root", "")  or die("Could not connect to the Database Server!");
                            $db = mysql_select_db("alumni", $link) or die("Could not select Database!");			
                            $numresults=mysql_query("SELECT * FROM alumni WHERE user_index=$id");
                            $numrows=mysql_num_rows($numresults);
                            if ($numrows == 0)  {
     						$action=2; 
							$strHTML="<h1 align=center><font  color=\"Red\">Sorry, No such alumni exists!</font></h1>";					 											
							}
							else{
                                        $row= mysql_fetch_array($numresults);
      					 	                $name=$row["name"]; 
			                            $email=$row["email"]; 
			                            $country=$row["country"];
			                            $year=$row["year"];		
			                            $address=$row["address"]; 
			                           $department=$row["department"];
							}
					 }
					 else {
					  header("Location :controlpanel.php");
					 }
		   }
		   else{
		     $action=2; //Check form  data, if correct update
		     $strHTML="<h1 align=center><font  color=\"Red\">Alumni Update :: Success!</font></h1>";
		        if (empty($_POST['name']) || empty($_POST['year']) || empty($_POST['email'])){
		        	//incomlete information
			        $action=1;
			        $strHTML="<h1 align=center><font  color=\"Red\">Error :: Incomplete Information!</font></h1>";
			    }
				else{
				//insert
                $link = mysql_connect("localhost", "root", "")  or die("Could not connect to the Database Server!");
                $db = mysql_select_db("alumni", $link) or die("Could not select Database!");
		        $id=$_POST['index'];
				$name=$_POST['name']; 
			    $email=$_POST['email'];
			    $country=$_POST['country'];
			    $year=$_POST['year'];
			    $address=$_POST['address'];
			    $department=$_POST['department'];
                $result = mysql_query("UPDATE ALUMNI SET name='$name',email='$email',country='$country',address='$address',department='$department',year=$year WHERE user_index=$id");
                $db_close=mysql_close();
			      if ($result ) {
                    $strHTML="<h1 align=center><font  color=\"Red\">&quot;$name&quot;&nbsp;Alumni Update :: Success!</font></h1>";					
				  }
			      else{
			        $action=1;
			        $strHTML="<h1 align=center><font  color=\"Red\">Error :: 1Unable to update &quot;$name&quot;&nbsp;alumni, please try again!</font></h1>";
			      } 			   				
				}
		   }
        }
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="author" content="Sudershan Thaiba, sudershanthaiba@gmail.com">
<title>Alumni Administration</title>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" width="703" height="387">
  <tr>
    <td width="701" height="86" colspan="2" align="center">
      <blockquote>
        <blockquote>
      <p align="center"><img border="0" src="../banner.jpg" width="464" height="86">
        </blockquote>
      </blockquote>
    </td>
  </tr>
  <tr>
    <td width="152" height="33" align="center" valign="middle">
      <h1 align="center"><b><font color="#006600" face="Haettenschweiler" size="6">Control
      Panel</font></b></h1>
    </td>
    <td width="547" height="241" align="top" rowspan="2">
      <div align=center; style="position: relative; "> <centeR>
        <? 		  
		  echo $strHTML; 
		  if ($action==1) {
 		  include("ModifyAlumniForm.inc");
          }
		  ?></center>
      </div>
    </td>
  </tr>
  <tr>
    <td width="152" height="208" align="left" valign="top">
      <menu>
        <li><a href="controlpanel.php?action=logout"><b><font color="#000080">Log out</font></b></a></li>
        <li><b><a href=addnew.php><font color="#000080">Add New
          Alumni</font></a></b></li>		
        <li><b><a href="search.php"<font color="#000080">Search
          Alumni</font></a></b></li>
      </menu>
    </td>
  </tr>
  <tr>
</table>
<br>
<br>
<bR>
<div style="position:relative;">
<HR color="blue">
      <blockquote>
        <blockquote>
          <p align="center"><font color="#666699">Copyright
      2006, Bluegene Consulting Services<br></font>
      
          <a href="mailto:sudershanthaiba@gmail.com"><font color="#888577">Contact
          Webmaster</font></a>
        </blockquote>
      </blockquote>
</div>	  
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -