Jump to content

Archived

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

desithugg

Need help modifying a PHP Freaks script

Recommended Posts

Nevermind made new script and works if anybody needs it

[b]$user_currently_loged[/b] is the username that is currently logged in this depends on your login script

[code]<?php
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('tpf');
if (!$db_selected) {
   die('Could not select database: ' . mysql_error());
}
$result = mysql_query("SELECT username from banned where username = '$user_currently_loged' ");
if (!$result) {
   echo 'Could not run query: ' . mysql_error();
   exit;
}
$userban = $row["username"];
$userban = str_replace ('\"', "&quot;", $userban);
?>[/code]

[code]<?php
$banned_username = array();
$banned_username[] = $userban;

foreach($banned_username as $banned_user) {
    $user = $user_currently_loged;
    if($user == $banned_user){
        echo "You Have been Banned";
        exit();
    }
}
?>[/code]

lol itll be fun if this gets on the PHP Freaks script lists

Share this post


Link to post
Share on other sites
[!--quoteo(post=364706:date=Apr 14 2006, 01:50 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 14 2006, 01:50 AM) [snapback]364706[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Huh?
[/quote]

I want to modify the script so it recieves a set of Ip's from a DB table but the script above that i modified did'not work the page just went blank if i put in the script.SO i need help modifing it

Share this post


Link to post
Share on other sites
[!--quoteo(post=364773:date=Apr 14 2006, 08:34 AM:name=desithugg)--][div class=\'quotetop\']QUOTE(desithugg @ Apr 14 2006, 08:34 AM) [snapback]364773[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I want to modify the script so it recieves a set of Ip's from a DB table but the script above that i modified did'not work the page just went blank if i put in the script.SO i need help modifing it
[/quote]
That much I understood -- but what about it isn't working? Is the query successful, do you get back the expected results, etc.?

Share this post


Link to post
Share on other sites
[!--quoteo(post=365368:date=Apr 16 2006, 03:16 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 16 2006, 03:16 PM) [snapback]365368[/snapback][/div][div class=\'quotemain\'][!--quotec--]
That much I understood -- but what about it isn't working? Is the query successful, do you get back the expected results, etc.?
[/quote]
yup before i had 1 query and it didnt work but above i have 2 and it works perfectly if anyone needs it their welcome to use it

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.