Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(isset($_SESSION['user'])!="")
  4. {
  5. header("Location: index.php");
  6. }
  7. include_once 'dbconnect.php';
  8.  
  9. if(isset($_POST['btn-signup']))
  10. {
  11. $uname = mysql_real_escape_string($_POST['Username']);
  12. $uemail = mysql_real_escape_string($_POST['Email']);
  13. $upass = $_POST['Password'];
  14.  
  15.  
  16. $uname = trim($uname);
  17. $uemail = trim($uemail);
  18. $upass = trim($upass);
  19.  
  20.  
  21. // email exist or not
  22. $query = "SELECT email FROM users WHERE email='$uemail'";
  23. $result = mysql_query($query);
  24.  
  25. $count = mysql_num_rows($result); // if email not found then register
  26.  
  27. if($count == 0){
  28.  
  29.  
  30. if(mysql_query("INSERT INTO users(username,password,email) VALUES('$uname','$upass','$uemail')"))
  31. {
  32. ?>
  33. <script>alert('Successfully registered ');</script>
  34. <?php
  35.  
  36. header("Location: login.php");
  37. }
  38. else
  39. {
  40. $query = "SELECT username FROM users WHERE username='$uname'";
  41. $result = mysql_query($query);
  42.  
  43. $count = mysql_num_rows($result);
  44. if($count!=0) { ?>
  45. <script>alert('That username is already taken');</script> <?php
  46. }else{
  47. ?>
  48. <script>alert('Error while registering you...');</script>
  49. <?php }
  50. }
  51. }
  52. else{
  53. ?>
  54. <script>alert('Sorry that email is already taken ...');</script>
  55. <?php
  56. }
  57.  
  58. }
  59. ?>
  60.  
  61.  
  62. <!DOCTYPE html>
  63. <html lang="en">
  64. <head>
  65. <meta charset="utf-8">
  66. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  67. <meta name="description" content="Team 12, Code App, Level Up, Travel, Agency">
  68.  
  69. <title>Register</title>
  70.  
  71. <!-- Bootstrap core CSS -->
  72. <link href="css/bootstrap_nova.css" rel="stylesheet">
  73. <!--external css-->
  74. <link href="css/font-awesome/css/font-awesome.css" rel="stylesheet"/>
  75.  
  76. <!-- Custom styles for this template -->
  77. <link href="css/style.css" rel="stylesheet">
  78. <link href="css/style-responsive.css" rel="stylesheet">
  79.  
  80. <style>
  81. #grad1{
  82. height: 100px;
  83. background: red; /* For browsers that do not support gradients */
  84. background: -webkit-linear-gradient(left top, gold, goldenrod); /* For Safari 5.1 to 6.0 */
  85. background: -o-linear-gradient(bottom right, gold, goldenrod); /* For Opera 11.1 to 12.0 */
  86. background: -moz-linear-gradient(bottom right, gold, goldenrod); /* For Firefox 3.6 to 15 */
  87. background: linear-gradient(to bottom right, gold, goldenrod); /* Standard syntax (must be last) */
  88. }
  89. #test1{
  90. opacity: 0.9;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95.  
  96. <div id="login-page">
  97. <div class="container">
  98.  
  99. <form class="form-login" method="post" id="test1">
  100. <h2 class="form-login-heading" id="grad1">premium user</h2>
  101. <div class="login-wrap">
  102. <div class="input-group input-group-lg">
  103. <span style="border: none" class="input-group-addon"><i style="width: 15px;" class="fa fa-user"></i></span>
  104. <input style="border: none" type="text" class="form-control" placeholder="Username" name="Username" autofocus required>
  105. </div>
  106.  
  107. <!--<input type="text" class="form-control" placeholder="Username" name="Username" autofocus required>-->
  108. <br>
  109. <div class="input-group input-group-lg">
  110. <span style="border: none" class="input-group-addon"><i class="fa fa-envelope" style="width: 15px;"></i></span>
  111. <input style="border: none" type="email" class="form-control" placeholder="Email" name="Email" autofocus required>
  112. </div>
  113.  
  114. <br>
  115. <div class="input-group input-group-lg">
  116. <span style="border: none" class="input-group-addon"><i style="width: 15px;" class="fa fa-lock"></i></span>
  117. <input style="border: none" type="password" class="form-control" placeholder="Password" name="Password" required>
  118. </div>
  119. <br>
  120.  
  121. <button class="btn btn-theme btn-block" name="btn-signup" type="submit"> REGISTER</button>
  122. <hr>
  123. <div class="registration">
  124.  
  125. <strong> <a class="" href="index.php">
  126. Home
  127. </a></strong>
  128. |
  129. <strong><a class="" href="blog.php">
  130. Blog
  131. </a></strong>
  132. </div>
  133. </div>
  134. </form>
  135. </div>
  136. </div>
  137.  
  138.  
  139. <script src="js/jquery.js"></script>
  140. <script src="js/bootstrap.min.js"></script>
  141.  
  142. <!--BACKSTRETCH-->
  143. <!-- You can use an image of whatever size. This script will stretch to fit in any screen size.-->
  144. <script type="text/javascript" src="js/jquery.backstretch.min.js"></script>
  145. <script>
  146. $.backstretch("img/paris-large.jpeg", {speed: 500});
  147. </script>
  148.  
  149. </body>
  150. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement