Advertisement
Guest User

index.html

a guest
Sep 21st, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.66 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. session_start();
  4. if (isset($_SESSION['Username'])) {
  5. ?><meta http-equiv="refresh" content="0; url=<? $site; ?>/start.php">
  6. <?
  7. }
  8.  
  9. $aa = 0;
  10. include ('config.php');
  11. if (isset($_POST['formsubmitted'])) {
  12. // Initialize a session:
  13. session_start();
  14. $error = array(); //this aaray will store all error messages
  15.  
  16.  
  17. if (empty($_POST['Username'])) {//if the email supplied is empty
  18. $error[] = 'You forgot to enter your Email ';
  19. } else {
  20. $Username = $_POST['Username'];
  21. }
  22.  
  23.  
  24. if (empty($_POST['Password'])) {
  25. $error[] = 'Please Enter Your Password ';
  26. } else {
  27. $Password = $_POST['Password'];
  28. }
  29.  
  30.  
  31. if (empty($error)) {//if the array is empty , it means no error found
  32. $query_check_credentials = "SELECT * FROM members WHERE (Username='$Username' AND password='$Password') AND Activation IS NULL";
  33.  
  34.  
  35.  
  36. $result_check_credentials = mysqli_query($dbc, $query_check_credentials);
  37. if (!$result_check_credentials) {//If the QUery Failed
  38. echo 'Query Failed ';
  39. }
  40.  
  41. if (@mysqli_num_rows($result_check_credentials) == 1) {//if Query is successfull // A match was made.
  42. $_SESSION = mysqli_fetch_array($result_check_credentials, MYSQLI_ASSOC); //Assign the result of this query to SESSION Global Variable
  43. ?><meta http-equiv="refresh" content="0; url=<? echo $site; ?>/start.php"><?
  44. } else {
  45.  
  46. $msg_error = 'Either Your Account is inactive or Username /Password is Incorrect';
  47. }
  48. } else {
  49.  
  50.  
  51.  
  52. echo '<div class="errormsgbox"> <ol>';
  53. foreach ($error as $key => $values) {
  54.  
  55. echo ' <li>' . $values . '</li>';
  56. }
  57. echo '</ol></div>';
  58. }
  59.  
  60.  
  61. if (isset($msg_error)) {
  62.  
  63. $aa = 1;
  64. }
  65. var_dump($error);
  66. mysqli_close($dbc);
  67. } // End of the main Submit conditional.
  68. ?>
  69.  
  70.  
  71. <!DOCTYPE html>
  72. <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
  73. <!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
  74. <!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
  75. <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
  76. <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
  77. <head>
  78. <meta charset="UTF-8" />
  79. <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
  80. <title><? echo $sitetitle; ?></title>
  81. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  82.  
  83.  
  84. <link rel="stylesheet" type="text/css" href="css/demo.css" />
  85. <link rel="stylesheet" type="text/css" href="css/style3.css" />
  86. <link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
  87. </head>
  88. <body>
  89. <div class="container">
  90. <!-- Codrops top bar -->
  91. <div class="codrops-top">
  92. <a href="<? echo $site; ?>/leader.php">
  93. <strong>See the Leader Board</strong>
  94. </a>
  95. <span class="right">
  96. <a href="<? echo $site; ?>/rules.php">
  97. <strong>Read the Rules</strong>
  98. </a>
  99. </span>
  100. <div class="clr"></div>
  101. </div><!--/ Codrops top bar -->
  102. <header>
  103. <h1><? echo $sitetitle; ?></h1>
  104.  
  105. </header>
  106. <section>
  107. <div id="container_demo" >
  108.  
  109. <a class="hiddenanchor" id="toregister"></a>
  110. <a class="hiddenanchor" id="tologin"></a>
  111. <div id="wrapper">
  112. <div id="login" class="animate form">
  113. <form method="post" action="index.php" autocomplete="on">
  114. <h1>Log in</h1>
  115.  
  116.  
  117.  
  118. <? if (!isset($_SESSION['Username'])) {
  119. ?><?
  120. } else {
  121. ?><li><a href="/logout.php">Logout</a></li><? }
  122. ?>
  123. </ul>
  124. </nav>
  125.  
  126. <? if (!isset($_SESSION['Username'])) {
  127. ?>
  128. <form method="post" action="index.php" class="login">
  129.  
  130. <p>
  131. <label for="username" class="uname" data-icon="u" > </br> </label>
  132. <input name="Username" required="required" type="text" id="Username" placeholder="Username">
  133. </p>
  134.  
  135. <p><label for="password" class="youpasswd" data-icon="p"> </br> </label>
  136. <input name="Password" required="required" type="password" id="Password" placeholder="Password">
  137. </p>
  138.  
  139. <input type="hidden" name="formsubmitted" value="TRUE" />
  140. <p class="login button">
  141. <input type="submit" value="Login" />
  142.  
  143. </p>
  144.  
  145. <p class="forgot-password"><a href="forgot.php">Forgot password?</a></p>
  146. </form>
  147. <? } ?>
  148.  
  149.  
  150. <p class="change_link">
  151. Not a member yet
  152. <a href="#toregister" class="to_register">Join us</a>
  153. </p>
  154. </form>
  155. </div>
  156.  
  157.  
  158. <div id="register" class="animate form">
  159. <form method="post" action="register.php" autocomplete="on">
  160. <h1> Sign up </h1>
  161. <p> <label for="username" class="uname" data-icon="u" > </br></label>
  162. <input placeholder="Your Name" id="n" name="n" required="required" type="text" />
  163. </p>
  164. <p> <label for="emailsignup" class="youmail" data-icon="e" > </br> </label>
  165. <input id="e-mail" name="e-mail" required="required" type="email" placeholder="Your Email"/>
  166. </p>
  167.  
  168. <p> <label for="username" class="uname" data-icon="u" > </br> </label>
  169. <input name="schoolname" required="required" type="text" placeholder="School Name" id="schoolname"/>
  170. </p>
  171. <p> <label for="username" class="uname" data-icon="u" > </br> </label>
  172. <input id="name" name="name" required="required" type="text" placeholder="Your Username" />
  173. </p>
  174. <p> <label for="password" class="youpasswd" data-icon="p"> </br> </label>
  175. <input id="Password" name="Password" required="required" type="password" placeholder="Password"/>
  176. </p>
  177. <p class="signin button">
  178. <input type="hidden" name="formsubmitted" value="TRUE" />
  179. <input type="submit" name="send" value="Register" id="submit" />
  180. </p>
  181. <p class="change_link">
  182. Already a member
  183. <a href="#tologin" class="to_register"> Go and log in </a>
  184. </p>
  185. </form>
  186. </div>
  187.  
  188. </div>
  189. </div>
  190. </section>
  191. </div>
  192. </body>
  193. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement