PHP GET not grabbing ID [RESOLVED]
Posted: Wed Oct 08, 2014 6:40 am
Why is it not grabbing the users ID on the attack.php?
Main page that displays the <a href> that leads to attack.php where it should GET the id passed on.
My attack.php... Not much there as I want to just try and get it to pass the ID over first
Thanks for any help/assistance
Main page that displays the <a href> that leads to attack.php where it should GET the id passed on.
Code: Select all
<?php
$sql2 = mysql_query("SELECT username, family, strength, id FROM users ORDER BY strength DESC $limit");
$outputList = '';
while($row = mysql_fetch_array($sql2)){
$get_user = "SELECT `username` FROM `users` WHERE `id`='".$row['id']."'";
$user_query1 = mysqli_query($db_conx, $get_user);
$numrows = mysqli_num_rows($user_query1);
$rank_name = mysqli_fetch_assoc($user_query1);
$id = $row['id'];
$firstname = $row["username"];
$family = $row["family"];
$strength = $row["strength"];
$outputList .= '<table border="0" bgcolor="590c02" width="99%"><td width="15%"><b><font color="white">' . $firstname . '</td><td align="left" width="15%"><b><font color="white">' . $family . '</td><td><b><font color="white"><img src="images/strength.png">' .number_format($strength) . '</td><td width="15%"><a href="attack.php?id=".$row[id]."\"><img src="images/Handgun.png" width="30" height="30"></a> <img src="images/notification.png" width="30" height="30"> <img src="images/mail.png" width="30" height="30"></td><td width="5%"><img src="images/robber.png" width="20" height="20"></td></b></table>';
?>
Code: Select all
<?php include_once("php_includes/check_login_status.php")?>
<?php include_once("leftbar.php")?>
<?php include_once("rightbar.php"); ?>
<?php include_once("includes/functions.php"); ?>
<?php
$username = $_SESSION["username"];
// Select the member from the users table
$sql = "SELECT * FROM users WHERE username='$username' AND activated='1' LIMIT 1";
$user_query = mysqli_query($db_conx, $sql);
// Now make sure that user exists in the table
$numrows = mysqli_num_rows($user_query);
if($numrows < 1){
header("location: filenotfound.php");
exit();
}
?>
<div id="pageMiddle">
<link href="style/style.css" rel="stylesheet" type="text/css" />
<?php
$id = protect($_GET['id']);
$user_check = "SELECT * FROM `users` WHERE `id`='".$id."'";
$user_query = mysqli_query($db_conx, $user_check);
if(mysqli_num_rows($user_query) == 0){
echo "There is no user with that ID!";
}else{
echo "works";
}
?>