ahmedezzat44

registration in php

May 2nd, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(isset($_SESSION['user'])!="")
  4. {
  5.  header("Location: home.php");
  6. }
  7. include_once 'dbconnect.php';
  8.  
  9. if(isset($_POST['btn-signup']))
  10. {
  11.  $uname = mysql_real_escape_string($_POST['uname']);
  12.  $email = mysql_real_escape_string($_POST['email']);
  13.  $upass = md5(mysql_real_escape_string($_POST['pass']));
  14.  
  15.  if(mysql_query("INSERT INTO users(username,email,password) VALUES('$uname','$email','$upass')"))
  16.  {
  17.   ?>
  18.         <script>alert('successfully registered ');</script>
  19.         <?php
  20.  }
  21.  else
  22.  {
  23.   ?>
  24.         <script>alert('error while registering you...');</script>
  25.         <?php
  26.  }
  27. }
  28. ?>
  29. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  30. <html xmlns="http://www.w3.org/1999/xhtml">
  31. <head>
  32. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  33. <title>Login & Registration System</title>
  34. <link rel="stylesheet" href="style.css" type="text/css" />
  35.  
  36. </head>
  37. <body>
  38. <center>
  39. <div id="login-form">
  40. <form method="post">
  41. <table align="center" width="30%" border="0">
  42. <tr>
  43. <td><input type="text" name="uname" placeholder="User Name" required /></td>
  44. </tr>
  45. <tr>
  46. <td><input type="email" name="email" placeholder="Your Email" required /></td>
  47. </tr>
  48. <tr>
  49. <td><input type="password" name="pass" placeholder="Your Password" required /></td>
  50. </tr>
  51. <tr>
  52. <td><button type="submit" name="btn-signup">Sign Me Up</button></td>
  53. </tr>
  54. <tr>
  55. <td><a href="index.php">Sign In Here</a></td>
  56. </tr>
  57. </table>
  58. </form>
  59. </div>
  60. </center>
  61. </body>
  62. </html>
  63.  
  64. resource from  >>> http://adyou.me/qtCb
Advertisement
Add Comment
Please, Sign In to add comment