Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="http://www.mySite.co/login.php" method="post">
- <fieldset>
- <p><input type="text" name="uname" placeholder="Name" required></p>
- <p><input type="password" name="pass" placeholder="identity number" required></p>
- <p><a href="#">Forgot Password?</a></p>
- <p><input type="submit" name="submit" value="Login"></p>
- </fieldset>
- </form>
- <?php
- $mydb = new wpdb('DB UserName','DB Password','DB','localhost');
- if (isset($_POST['submit'])){
- $username=mysql_escape_string($_POST['uname']);
- $password=mysql_escape_string($_POST['pass']);
- if (!$_POST['uname'] | !$_POST['pass'])
- {
- echo ("<SCRIPT LANGUAGE='JavaScript'>
- window.alert('You did not complete all of the required fields')
- window.location.href='htmlogin.html'
- </SCRIPT>");
- exit();
- }
- $sql=$mydb->get_results("SELECT * FROM `TableName` WHERE `NAME` = '$username' AND `ID` = '$password'");
- if($mydb->num_rows($sql) > 0)
- {
- echo ("<SCRIPT LANGUAGE='JavaScript'>
- window.alert('Login Succesfully!.')
- window.location.href='htmllogin.html'
- </SCRIPT>");
- exit();
- }
- else{
- echo ("<SCRIPT LANGUAGE='JavaScript'>
- window.alert('Wrong username password combination.Please re-enter.')
- window.location.href='htmllogin.html'
- </SCRIPT>");
- exit();
- }
- }
- else{
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement