Advertisement
Guest User

Untitled

a guest
Jun 13th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. <?php
  2.  
  3. ob_start();
  4.  
  5. if(file_exists("install.php") == "1"){
  6. header('Location: install.php');
  7. exit();
  8. }
  9.  
  10. include 'inc/database.php';
  11.  
  12. $result = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));
  13. while($row = mysqli_fetch_assoc($result)){
  14. $website = $row['website'];
  15. $favicon = $row['favicon'];
  16. }
  17.  
  18. if (!isset($_SESSION)) {
  19. session_start();
  20. }
  21.  
  22. if (isset($_SESSION['username'])) {
  23. header('Location: index.php');
  24. exit();
  25. }
  26.  
  27. if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirmpassword']) && isset($_POST['email'])){
  28.  
  29. $username = mysqli_real_escape_string($con, $_POST['username']);
  30. $password = mysqli_real_escape_string($con, md5($_POST['password']));
  31. $confirmpassword = mysqli_real_escape_string($con, md5($_POST['confirmpassword']));
  32. $email = mysqli_real_escape_string($con, $_POST['email']);
  33.  
  34. if($password != $confirmpassword){
  35. die("The confirmation password was not equal to the password.");
  36. }
  37.  
  38. if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  39. die("The email entered was not correct.");
  40. }
  41.  
  42. $result = mysqli_query($con, "SELECT * FROM `users` WHERE `username` = '$username'") or die(mysqli_error($con));
  43. if(mysqli_num_rows($result) > 0){
  44. die("This username already exists.");
  45. }
  46.  
  47. $result = mysqli_query($con, "SELECT * FROM `users` WHERE `email` = '$email'") or die(mysqli_error($con));
  48. if(mysqli_num_rows($result) > 0){
  49. die("This email already exists.");
  50. }
  51.  
  52. $ip = mysqli_real_escape_string($con, $_SERVER['REMOTE_ADDR']);
  53. $date = date('Y-m-d');
  54.  
  55. mysqli_query($con, "INSERT INTO `users` (`username`, `password`, `email`, `date`, `ip`) VALUES ('$username', '$password', '$email', '$date', '$ip')") or die(mysqli_error($con));
  56.  
  57. header("Location: login.php?action=registered");
  58.  
  59. }
  60.  
  61. mysqli_query($con, "SELECT * FROM settings WHERE paypal = '".$_POST['paypal']."'") or die(mysqli_error($con));
  62. ?>
  63.  
  64. <!DOCTYPE html>
  65. <html lang="en">
  66. <head>
  67. <meta charset="utf-8">
  68. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  69. <meta name="description" content="">
  70. <meta name="author" content="24/7">
  71. <meta name="keyword" content="">
  72. <link rel="shortcut icon" href="<?php echo $favicon;?>">
  73.  
  74. <title><?php echo $website;?> - Registration</title>
  75.  
  76. <!-- Bootstrap core CSS -->
  77. <link href="css/bootstrap.min.css" rel="stylesheet">
  78. <link href="css/bootstrap-reset.css" rel="stylesheet">
  79. <!-- Custom styles for this template -->
  80. <link href="css/style.css" rel="stylesheet">
  81. <link href="css/style-responsive.css" rel="stylesheet" />
  82.  
  83. <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
  84. <!--[if lt IE 9]>
  85. <script src="js/html5shiv.js"></script>
  86. <script src="js/respond.min.js"></script>
  87. <![endif]-->
  88.  
  89. </head>
  90.  
  91. <body class="login-body">
  92.  
  93. <div class="container">
  94.  
  95. <form class="form-signin" action="register.php" method="POST">
  96. <h2 class="form-signin-heading"><?php echo $website;?></h2>
  97. <div class="login-wrap">
  98. <input type="text" id="username" name="username" class="form-control" placeholder="Username" autofocus>
  99. <input type="password" id="password" name="password" class="form-control" placeholder="Password">
  100. <input type="password" id="confirmpassword" name="confirmpassword" class="form-control" placeholder="Confirm Password">
  101. <input type="text" id="email" name="email" class="form-control" placeholder="Email">
  102. <button class="btn btn-lg btn-login btn-block" type="submit">Register</button>
  103. </form>
  104.  
  105. <div class="registration">
  106. Already have an account?&nbsp
  107. <a class="" href="login.php">
  108. Sign In
  109. </a>
  110. </div>
  111.  
  112. </div>
  113.  
  114. </div>
  115.  
  116.  
  117.  
  118. <!-- js placed at the end of the document so the pages load faster -->
  119. <script src="js/jquery.js"></script>
  120. <script src="js/bootstrap.min.js"></script>
  121. </body>
  122. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement