Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- if (empty($_POST['username'])) {
- $error = "Username is empty";
- }
- else
- {
- // Define $username and $password
- $username=$_POST['username'];
- // Establishing Connection with Server by passing server_name, user_id and password as a parameter
- $connection = mysql_connect("server°name", "user", "pass");
- $username = $username;
- // Selecting Database
- $db = mysql_select_db("u843753740_test", $connection);
- // SQL query to fetch information of registerd users and finds user match.
- $query = mysql_query("SELECT * FROM login WHERE username='$username'", $connection);
- if ($rows == true)
- $rows = mysql_num_rows($query);
- if(! $query ) {
- die('Could not request data: ' . mysql_error());
- }
- if ($rows > 1)
- echo "SQL Injection succesfully completed! <br/> " .$rows;
- else
- echo "SQL Injection failed! <br/> " .$rows;
- $usersArray = array(); // make a new array to hold all your data
- $index = 0;
- while($row = mysql_fetch_assoc($query)){ // loop to store the data in an associative array.
- $usersArray[$index] = $row;
- echo "<br/> array: " .$usersArray[$index]['username'];
- $index++;
- }
- mysql_close($connection); // Closing Connection
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement