Jump to content

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]
Link to comment
https://forums.phpfreaks.com/topic/13555-_get-problems/
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]
Link to comment
https://forums.phpfreaks.com/topic/13555-_get-problems/#findComment-52490
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.