Advertisement
Guest User

index.php

a guest
Dec 18th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. <?php echo"
  2. <!DOCTYPE html>
  3.  
  4. <html>
  5. <head>
  6. <link href='styles.css' type='text/css' rel='stylesheet'>
  7. <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Tangerine'>
  8. <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Cantarell:italic|Droid+Serif:bold'>
  9. <link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
  10. <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
  11. <link href='http://fonts.googleapis.com/css?family=Raleway:400,600' rel='stylesheet' type='text/css'>
  12.  
  13. </head>
  14.  
  15. <body>
  16.  
  17. <div style='background-image:url(http://imageshack.com/a/img910/8746/cYM9Uz.png);background-position:center' id='docboxbackground'>
  18. <h1>DocBox</h1>
  19.  
  20. </div>
  21. ";
  22.  
  23.  
  24.  
  25.  
  26. echo '<p>It has never been easier to store your documents..</p>';
  27.  
  28. session_start();
  29. $user=null;
  30. $userpass=0;
  31.  
  32. if (isset($_POST['regSubmit'])){
  33. $GLOBALS['user'] = $_POST['RegisterName'];
  34. $GLOBALS['userpass'] = $_POST['pass1'];
  35. }
  36.  
  37. //ftp.docbox.altervista.org
  38.  
  39. $servername = "localhost";
  40. $username = "root";
  41. $password = "";
  42. $dbname = "docbox";
  43. // Create connection
  44. $conn = new mysqli($servername, $username, $password, $dbname);
  45. // Check connection
  46. if ($conn->connect_error) {
  47. die("Connection failed: " . $conn->connect_error);
  48. }
  49. $userpass=$GLOBALS['userpass'];
  50. if($GLOBALS['user']!==null){
  51. $sql = "INSERT INTO accounts (UserName, Password)
  52. VALUES ('$user','$userpass')";
  53.  
  54. if ($conn->query($sql) === TRUE) {
  55. echo "User $user CREATED";
  56. } else {
  57. echo "Error: " . $sql . "<br>" . $conn->error;
  58. }}
  59.  
  60.  
  61. $sql1 = "SELECT UserName, Password, id FROM accounts";
  62. $result = $conn->query($sql1);
  63.  
  64. if ($result->num_rows > 0) {
  65. // output data of each row
  66. while($row = $result->fetch_assoc()) {
  67. if(isset($_POST['login'])){
  68. if( $row["UserName"] == $_POST['username'] && $row['Password']==$_POST['password']){
  69.  
  70. echo "USER FOUND! and pass okay";
  71. $userid=$row["id"];
  72. $_SESSION["userid"]=$userid;
  73. $_SESSION["usernamesession"]=$_POST['username'];
  74. header('Location: tablodeneme.php');
  75.  
  76. }
  77. else
  78. {
  79. echo "USER not FOUND pass wrong!";
  80.  
  81.  
  82. }
  83. }
  84. }
  85. } else {
  86. echo "0 results";
  87.  
  88. }
  89.  
  90.  
  91.  
  92.  
  93. echo "
  94. <div id='circle' class='center'>
  95.  
  96. <br>
  97. <form class='form-wrapper' action='index.php' method='post'>
  98. <input required type='text' name='username' id='username' placeholder='UserName' required>
  99. <input required type='password' name='password'id='password' placeholder='Password' required><br>
  100. <button type='submit' id='login' name='login'>Login</button>
  101. </form>
  102. <a href = 'javascript:void(0)' id='register' onclick=\"document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'\" >Register</a></a>
  103. <div id='light' class='white_content'>
  104.  
  105. <form name='entry' action='index.php' method='post' onsubmit='return validateForm();'>
  106. <div id='entries'>
  107. <input type='text' id='Registerusername' name='RegisterName' placeholder='UserName' required><br>
  108.  
  109. <input type='password' name='pass1' id='pass1' placeholder='Password' onkeyup='checkPass(); return false;''><br>
  110. <input type='password' name='pass2' id='pass2' placeholder='Re-Type Password' onkeyup='checkPass(); return false;'><br>
  111.  
  112.  
  113. <input type='text' name='email' id='e_mail' placeholder='E-mail'><br>
  114. <input type='submit' id='submit' value='Submit' name='regSubmit' <a href = 'javascript:void(0)'' onclick = 'document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block''</a></input>
  115.  
  116. </div>
  117.  
  118. <a href = 'javascript:void(0)'' id='RegisterClose' onclick = \"document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'\">X</a></div>
  119. <div id='fade' class='black_overlay'></div>
  120.  
  121. </form>
  122. </div>
  123.  
  124.  
  125.  
  126. </div>
  127.  
  128. <img src='http://imageshack.com/a/img903/4531/ACXP4G.png' id='folder'>
  129. <p id='about'>Upload your files, reach them whenever and wherever you want.</p>
  130.  
  131.  
  132. <script type='text/javascript'>
  133.  
  134.  
  135. ";
  136.  
  137. echo ";
  138. function checkPass()
  139. {
  140.  
  141. var pass1 = document.getElementById('pass1');
  142. var pass2 = document.getElementById('pass2');
  143. var green = '#66cc66';
  144. var red = '#FFC8E3';
  145. if(pass1.value == pass2.value){
  146. pass2.style.backgroundColor = green;
  147. message.style.color = green;
  148. }else{
  149. pass2.style.backgroundColor = red;
  150. message.style.color = red;
  151. }
  152. }
  153.  
  154. function validateForm() {
  155. var x = document.forms['myForm']['email'].value;
  156. var atpos = x.indexOf('@');
  157. var dotpos = x.lastIndexOf('.');
  158. if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
  159. alert('Not a valid e-mail address');
  160. return false;
  161. }
  162. }
  163.  
  164.  
  165.  
  166.  
  167. </script>
  168. </body>
  169.  
  170.  
  171. </html>
  172. "
  173. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement