Jump to content


Photo

Need help modifying a PHP Freaks script


  • Please log in to reply
4 replies to this topic

#1 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 14 April 2006 - 01:32 AM

Nevermind made new script and works if anybody needs it

$user_currently_loged is the username that is currently logged in this depends on your login script

<?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);
?>

<?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();
    }
}
?>

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

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 14 April 2006 - 05:50 AM

Huh?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 14 April 2006 - 01:34 PM

[!--quoteo(post=364706:date=Apr 14 2006, 01:50 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 14 2006, 01:50 AM) View Post[/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

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 16 April 2006 - 07:16 PM

[!--quoteo(post=364773:date=Apr 14 2006, 08:34 AM:name=desithugg)--][div class=\'quotetop\']QUOTE(desithugg @ Apr 14 2006, 08:34 AM) View Post[/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.?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 17 April 2006 - 03:27 PM

[!--quoteo(post=365368:date=Apr 16 2006, 03:16 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 16 2006, 03:16 PM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users