Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Champ 'admin' inconnu dans where clause.
- <body>
- <div class="container">
- <form id="signup" method="post" action="">
- <div class="header">
- <img src="admin/adminpanel.png">
- </div>
- <div class="sep"></div>
- <div class="inputs">
- <input type="text" placeholder="Username" name="admin-username" />
- <input type="password" placeholder="Password" name="admin-password" />
- <input type="Submit" Value="Sign Up"/>
- </div>
- </form>
- </div>
- <?php
- @mysql_connect('localhost', 'root', '');
- $select_db = mysql_select_db('register');
- session_start();
- if (isset($_POST['admin-username'])){
- $username = $_POST['admin-username'];
- $password = $_POST['admin-password'];
- $query = "SELECT * FROM `admin` WHERE admin-username='$username' and admin-password='$password' ";
- $result = mysql_query($query) or die(mysql_error());
- $rows = mysql_num_rows($result);
- if($rows==1){
- $_SESSION['admin-username'] = $username;
- header("Location: admin.php");
- }else{
- echo "<div class='form'><h3>Username/password is incorrect.</h3></div>";
- }
- }else
- ?>
- </body>
- <?php
- session_start();
- $connection = new mysqli ("localhost", "root", "", "register");
- if ($connection -> connect_errno) {
- echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
- }
- $select_db = mysqli_select_db($connection, 'register');
- if (!$select_db){
- die("Database Selection Failed" . mysql_error());
- }
- if (isset($_POST['admin-username'])){
- $username = $_POST['admin_username'];
- $password = $_POST['admin_password'];
- $query = "SELECT * FROM `admin` WHERE admin_username='$username' and admin_password='$password'";
- $result = mysqli_query($connection, $query)
- or die(mysql_error());
- $rows = mysqli_num_rows($result);
- if ($rows == 1){
- header("Location:admin.php");
- $_SESSION['name'] = $username;
- }else{
- echo "Invalid Login Credentials.";
- }
- }
- ?>
- <html>
- <body>
- <form action="<?php $_PHP_SELF ?>" method="post">
- <input type="text" name="admin_username">
- <input type="password" name="admin_password">
- <button type="submit" name="submit" value="submit" >
- </form>
- </body>
- </html>
- ___________________________________
- | admin_username | admin_password |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement