Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: PHP  |  size: 1.42 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <?php include("langNO.php"); ?>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title><?php print("$registerTitle"); ?></title>
  7. </head>
  8. <body>
  9. <fieldset>
  10. <legend> <?php print("$RegisterFormLegend"); ?> </legend>
  11. <form name="register" id="register" >
  12. <p> <?php print("$userText"); ?> </p> <input type="text" name="userID" id="userID" /> <br/>
  13. <p> <?php print("$passText"); ?> </p><input type="password" name="PW" id="PW"/> <br/>
  14. <input type="submit" value="Register!" name="register" id="register"/>
  15. <input type="reset" value="Clear fields" name="clear" id="clear"/>
  16. </form>
  17. </fieldset>
  18.  
  19. <?php
  20.  
  21. $ok=$_POST["register"];
  22.  
  23. if ($ok)
  24. {
  25.  include("db.php");
  26.  
  27.  $username=$_POST["userID"];
  28.  $PW=$_POST["PW"];
  29.  
  30.  $state=1;
  31.  
  32.         if( !$username || !$PW)
  33.         {
  34.                 print("$userError1");
  35.                 $state=0;
  36.         }
  37.  
  38.         else
  39.         {
  40.                 $sqlCheck="SELECT * FROM userInfo WHERE username='$username';";
  41.        
  42.                 $Check=mysql_query($sqlCheck);
  43.        
  44.                 if(mysql_num_rows($Check)!=0)
  45.                 {
  46.                         print("$userError2");
  47.                         $state=0;
  48.                 }
  49.         }
  50.  
  51.         if($state=1)
  52.         {
  53.                 $encrypt=md5($PW);
  54.                 $sqlSave="INSERT INTO userInfo VALUES ('$username', '$encrypt');";
  55.                 mysql_query($sqlSave) or die (mysql_error());
  56.                 print("$RegisteredMsg");
  57.         }      
  58. }
  59.  
  60.  
  61.  
  62.  
  63. ?>
  64.  
  65.  
  66.  
  67. </body>
  68. </html>