Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Details in asterisk to hide.
- '<?php
- define('DB_SERVER', '******');
- define('DB_USERNAME', '*******');
- define('DB_PASSWORD', '*******');
- define('DB_DATABASE', '*******');
- $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
- $query = "SELECT user_id, username, user_password FROM User_Login WHERE username='$username' AND user_password='$password'",
- $username = mysqli_real_escape_string($db,$_GET['username']),
- $password = mysqli_real_escape_string($db,$_GET['password']);
- // Perform Query
- $result = mysqli_query($db,$query);
- // Check result
- // This shows the actual query sent to MySQL, and the error. Useful for debugging.
- if (!$result) {
- $message = 'Invalid query: ' . mysqli_error($db) . "n";
- $message .= 'Whole query: ' . $query;
- die($message);
- }
- // Use result
- // Attempting to print $result won't allow access to information in the resource
- // One of the mysql result functions must be used
- while ($row = mysqli_fetch_assoc($result)) {
- echo $row['$username'];
- echo $row['username'];
- echo $row['user_password'];
- }
- // Free the resources associated with the result set
- // This is done automatically at the end of the script
- mysqli_free_result($result);
- ?>`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement