Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 127.0.0.1
- $user = localhost
- $password = ascent
- $connection = mysql_connect($host, $user, $password)
- or die("Connection to the database could not be established");
- mysql_select_db("test") or die ("Database could not be selected");
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = sprinft("SELECT username, password FROM userdb WHERE username='%s' AND password='%s'"",
- mysql_real_escape_string($username),
- mysql_real_escape_string($password));
- $result = mysql_query($query);
- if (!$result) {
- $message = 'Invalid query: ' . mysql_error() . "\n";
- $message .= 'Whole query: ' . $query;
- die($message);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement