Jump to content

Links to the same page...


dean7

Recommended Posts

Hey all, I'm currently coding a Few Blacklists for my Website, in which I want to code it so I'll have all blacklists on one page so the URL would be like:

 

localhost/blacklist.php?user

localhost/blacklist.php?staff

 

I've got a Blacklist coded which all works well, just I've attempted using the $_GET function to change the code to the blacklist that they clicked on...

 

<?php
session_start();

include ("includes/config.php");
include ("includes/functions.php");

logincheck();

$Username = $_SESSION['username'];

?>
<table width='50%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'>
<tr>
    	<td class='header' align='center' colspan='4'>Other Blacklists:</td>
    </tr>
    <tr>
    	<td align='center'><a href='?user' target='mainFrame'>User Blacklist</a></td><td align='center'><a href='?money' target='mainFrame'>Most Money</a></td><td align='center'><a href='?racewins.php' target='mainFrame'>Race Wins</a></td><td align='center'><a href='?racelose' target='mainFrame'>Race Loses</a></td>
   	</tr>
    <tr>
    	<td align='center'><a href='?miles' target='mainFrame'>Most Miles</a></td><td align='center'><a href='?fosbl' target='mainFrame'>Faster Or Slower</a></td><td align='center'><a href='?police' target='mainFrame'>Police Chase</a></td>
    </tr>
</table>        
<br />
<table width='20%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'>
    	<tr>
        	<td colspan='2' align='center' class='header'>User Blacklist:</td>
        </tr>
        <tr>
        	<td align='center' class='omg' width='5%'>Num:</td><td align='center' class='omg' width='10%'>Username:</td>
        </tr>       

<?php
if ($_GET['user']){
$Query = mysql_query("SELECT * FROM users WHERE userlevel = '1' OR userlevel = '5' ORDER BY rep DESC LIMIT 25");
for ($Place < 25; $This = mysql_fetch_object($Query){
$Place = $Place+1;
if ($This->username != $Username){
$Colour = "bgcolor=#424242";	
}else{
	$Colour = "bgcolor=#111111";
}
print ("<tr><td width='5%' align='center' $Colour>$Place</td><td width='20%' align='center' $Colour><a href='profile.php?viewuser=".$This->username."'>$This->username</a></td></tr>");
}
}


?>
    </table> 
    <br />

Soon as I added the $_GET['user]{ it stopped showing the Blacklist completely.

 

Sorry if it wasn't explained well, but hopefully you can catch what I'm trying to-do

 

Thanks.   

Link to comment
https://forums.phpfreaks.com/topic/245274-links-to-the-same-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.