Jump to content

Archived

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

xyn

$_GET Problems.

Recommended Posts

Hi.
I'm trying to make an Unban IP script by using this way, I used it before but I don't know how to make this "multiple script" work...

ie:
[code=php:0]delete.php?id=X[/code] then it'll delete the X id from database, but now I wanted to do this:

ban.php?act=unban&ip=172.141.192.232&id=1
[code=php:0]//AT the top of script i have:
$act = $_GET['act'];
$id = $_GET['id'];

} elseif( $act == unban ) {
$pip = $_GET['ip'];
if( $id == '.$pid.' ){

include("db.php");
mysql_query("DELETE FROM ban WHERE id='$pid'"); //$pip is set as a var above the code! also. works

echo '<SCRIPT>alert ("You have unbanned the IP #'.$pip.'.")</SCRIPT>';
}[/code]

Share this post


Link to post
Share on other sites
Is that you code? If it is you have a few problems [b]unban[/b] should be [b]'unban'[/b] (including the quotes). Also [b]'.$pid.'[/b] wont work as it wont parse the $pid variable as it is in single quotes. You might want ot use double quotes instead.
Also if $id is supposed to be an number you should check that it by doing this:
[code=php:0]if(isset($_GET['id']) && is_int($_GET['id']))
{
    // unban ip code here
}
else
{
    die("Please provide a valid id for the ipaddress");
}[/code]

Share this post


Link to post
Share on other sites
all that aside, am i reading this wrong or are you basing your unban script on an id passed in the url?

Share this post


Link to post
Share on other sites

×

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.