Jump to content

Warning: mysql_fetch_array():


mikad0t

Recommended Posts

Hello if some one be nice to help me out it be most kind... i got this error

 

"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in/home/23url/public_html/new.php on line 66"

 

the code is -

 

 

$getbans =mysql_query("SELECT banned FROM $tab[banned];");

 

$bans = array();

 

LINE 66 > while($ban=mysql_fetch_array($getbans)) {

 

  array_push($bans, $ban[0]);

 

}

 

 

many thanks

Link to comment
Share on other sites

Your query is failing, probably due to the query string being malformed.

 

$getbans = "SELECT banned FROM {$tab['banned']}";
if( $result = mysql_query($getbans) ) {
$bans = array();
while( $ban = mysql_fetch_array($result) ) {
	array_push($bans, $ban[0]);
}
} else {
echo "<br>Query: $getbans<br>Error: " . mysql_error() . '<br>';
}

Link to comment
Share on other sites

many thanks .. but it comes up with

 

an error saying "Waning:invalid argument supllied for foreach() in ..... line 91

 

 

 

LINE 91 > foreach ($bans as $correct){

 

if(strstr($host,"$correct")){

 

$banreason = mysql_fetch_array(mysql_query("SELECT reason FROM $tab[banned] WHERE banned='$correct';"));

 

sorry im not that good at php but im trying to learn

Link to comment
Share on other sites

<?

 

include("html.php");

 

 

 

$html = mysql_fetch_array(mysql_query("SELECT rules,tos FROM $tab;"));

 

 

 

if($ref){ setcookie("refer",$refer, time()+7776000); }

 

if($ref){ setcookie("ref",$ref); }

 

if(!$step){$step=1;}

 

    if(($step1 == 1) && ($agree == yes)){ header("Location: ?step=3"); }

 

elseif(($step1 == 1) && ($agree != yes)){ header("Location: ?warn=yes"); }

 

elseif(($step2 == 1) && ($agree == yes)){ header("Location: ?step=3"); }

 

elseif(($step2 == 1) && ($agree != yes)){ header("Location: ?step=2&warn=yes"); }

 

 

 

      if($signup)

 

        {

 

        $host=gethostbyaddr("$REMOTE_ADDR");

 

        $code = md5($username.trucode.$password);

 

        $pin = md5($email.trucode);

 

         

 

          if ((!preg_match ('/^[a-z0-9][a-z0-9\.\-_]*$/i', $username)) || (strstr($username,".")))

 

              { $msg="&#149 Invalid username: a-Z 0-9 -_ charactors only."; $username=""; }

 

      elseif ((strlen($username) <= 2) || (strlen($username) >= 19))

 

              { $msg="&#149 Invalid username: must be at least 3-18 in length."; $username=""; }

 

      elseif (fetch("SELECT username FROM $tab[user] WHERE username='$username';"))

 

              { $msg="&#149 Invalid username: already taken."; $username="";}

 

      elseif ((!preg_match ('/^[a-z0-9][a-z0-9\.\-_]*$/i', $password)) || (strstr($password,".")))

 

              { $msg="&#149 Invalid password: a-Z 0-9 -_ charactors only."; $password=""; $cpassword=""; }

 

      elseif ((strlen($password) <= 2) || (strlen($password) >= 13))

 

              { $msg="&#149 Invalid password: must be at least 3-12 in length."; $password=""; $cpassword=""; }

 

      elseif ($password != $cpassword)

 

              { $msg="&#149 Invalid password: your passwords do not match."; $password=""; $cpassword=""; }

 

      elseif (!ereg("^.+@.+\\..+$", $email))

 

              { $msg="&#149 Invalid email: that is not a valid e-mail address."; $email=""; }

 

      elseif (fetch("SELECT email FROM $tab[user] WHERE email='$email';"))

 

              { $msg="&#149 That e-mail address has already been used."; $email="";}

 

      elseif ((!preg_match ('/^[a-z]*$/i', $first)) || (strstr($first,".")))

 

              { $msg="&#149 Invalid first name: a-Z charactors only."; $first=""; }

 

      elseif ((!preg_match ('/^[a-z]*$/i', $last)) || (strstr($last,".")))

 

              { $msg="&#149 Invalid last name: a-Z charactors only."; $last=""; }

 

      elseif (($age <= 13) || ($age >= 100))

 

              { $msg="&#149 Invalid age: you must be 18 years or older to play."; $age=""; }

 

      elseif (($messager == AIM) && (!preg_match ('/^[a-z0-9][a-z0-9]*$/i', $messager_id)))

 

              { $msg="&#149 Invalid screen name: sould only contain a-Z 0-9 charactors, no spaces."; $messager=""; $messager_id=""; }

 

      elseif (($messager == MSN) && (!ereg("^.+@.+\\..+$", $messager_id)))

 

              { $msg="&#149 Invalid msn email: that is not a valid e-mail address.."; $messager=""; $messager_id=""; }

 

      elseif (($messager == YaHoO) && (!preg_match ('/^[a-z0-9][a-z0-9]*$/i', $messager_id)))

 

              { $msg="&#149 Invalid screen name: sould only contain a-Z 0-9 charactors, no spaces."; $messager=""; $messager_id=""; }

 

  else {

 

  mysql_query("UPDATE $tab[user] SET credits=credits+1000 WHERE id=$refer");

 

  mysql_query("UPDATE $tab[user] SET referrals=referrals+1 WHERE id=$refer");

 

  mysql_query("UPDATE $tab[user] SET refcredits=refcredits+1000 WHERE id=$refer");

 

              mysql_query("INSERT INTO $tab[user] (username,password,email,fullname,age,messager,online,ip,host,code,membersince,referredby,refcredits) VALUES ('$username','$password','$email','$first $last','$age','$messager: $messager_id','$time','$REMOTE_ADDR','$host','$code','$time','$refer','$refcredits');");

 

              mail_1("Welcome to Mafia-Name!","\nWelcome to Mafia-Name.com!\n\nYour account information:\n  Username: $username\n  Password: $password\n  Pin: $pin\n\nBefore you can login, you must verify your email address.\n\nTo confirm this email address click on the bottom link, or copy and paste it to your browser.\n$site[location]confirm.php?verify=yes&email=$email&pin=$pin&referer=$refer\n\nIf that link doesnt work, go to $site[location], login and enter in this pin:\n\n $pin\n\n-Admin\n\n\n-----------------------------\n-----------------------------\nAlso upon signup you were added to our Mailing list automatically! If you would like to be removed from this list please wait until you recieve the first letter and use the link at the botttom of the page to unsubscribe yourself!\n","$email");

 

              mail_2("Welcome to Mafia-Name.com!","\nWelcome to the Mafia-Name.com!\n\nYour account information:\n  Username: $username\n  Password: $password\n  Pin: $pin\n\nBefore you can login, you must verify your email address.\n\nTo confirm this email address click on the bottom link, or copy and paste it to your browser.\n$site[location]confirm.php?verify=yes&email=$email&pin=$pin&referer=$refer\n\nIf that link doesnt work, go to $site[location], login and enter in this pin:\n\n $pin\n\n-Admin\n\n\n-----------------------------\n-----------------------------\nAlso upon signup you were added to our Mailing list automatically! If you would like to be removed from this list please wait until you recieve the first letter and use the link at the botttom of the page to unsubscribe yourself but doing this you wont be first to hear our new news!\n","$email");

 

 

 

              header("Location: newmem.php?step=4&email=$email&referer=$refer");

 

 

 

              }

 

        }

 

 

 

siteheader();

 

 

 

//LAMER CHECK//////////////

 

$getbans = "SELECT banned FROM {$tab['banned']}";

if( $result = mysql_query($getbans) ) {

 

 

 

$bans = array();

 

 

 

while( $ban = mysql_fetch_array($result) ) {

 

 

 

 

 

array_push($bans, $ban[0]);

 

 

 

}

} else {

 

 

 

echo "<br>Query: $getbans<br>Error: " . mysql_error() . '<br>';

}

 

 

 

foreach ($bans as $correct){

 

if(strstr($host,"$correct")){

 

$banreason = mysql_fetch_array(mysql_query("SELECT reason FROM $tab[banned] WHERE banned='$correct';"));

 

?>

 

 

 

<head>

 

<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" language="javascript" src="lytebox.js">         

<link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />

 

<script type="text/javascript">

<!--

 

function MM_swapImgRestore() { //v3.0

 

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

 

}

 

function MM_preloadImages() { //v3.0

 

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

 

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

 

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

 

}

 

 

 

function MM_findObj(n, d) { //v4.01

 

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

 

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

 

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

 

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

 

  if(!x && d.getElementById) x=d.getElementById(n); return x;

 

}

 

 

 

function MM_swapImage() { //v3.0

 

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

 

  if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

 

}

 

//-->

 

</script>

</head>

 

 

 

<table width="99%" height="100%">

 

<tr>

 

  <td valign="top">

 

  <br>

 

  <b>Your account has been permently banned from Mafia-Name!!

 

  <br>

 

  Here is our stated reason:</b><br><br><font color="#7777CC"><?=$banreason[0]?></font>

 

  </td>

 

</tr>

 

</table>

 

<?

 

 

 

$lamerstop=bitch;

 

}

 

}

 

 

 

////////////////////////////

 

if($lamerstop!=bitch){

 

?>

 

  <table width="100%" class="maintxt" height="100%">

 

    <tr>

 

    <td height="12"><b>Signing up: <font color="#FFCC00">Step <?=$step?></font></b></td>

 

    </tr>

 

    <tr>

 

    <td valign="top">

 

<?

 

        if($step==4){?>

 

        <br>

 

        THANKS FOR JOINING Mafia-Name.com! An E-mail has been sent to <font color="#ff0000"><?=$email?></font> containing instructions and a pin number you need to verify your account!

 

        <br>

 

        <br><a href="confirm.php?referer=<?=$referer?>"><font color="#FFFFFF">Click</font> here <font color="#FFFFFF">to enter your pin number!</font></a>

 

        <br>

 

        <br>Didnt receive your pin number? Our Bad!

 

        <br><a href="resend.php">Request it again</a>!

 

        <br>

 

        <br>Still having problems?

 

        <br><a href="support.php">GET HELP</a>!

 

        <br>

 

        <?}elseif($step==3){?>

 

        <form method="post" action="newmem.php?step=3">

 

        <?if($msg){?><center><b><font color="#FFCC00"><?=$msg?></font></b></center><?}?>

 

        <table align="center" cellspacing="2" cellpadding="2" class="maintxt">

 

          <tr bgcolor="#FFFFFF">

 

            <td colspan="2" bgcolor="#000000"> </td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td colspan="2" class="border"><b>Login Info:</b> <font color="#CCCCCC">Required</font></td>

 

          </tr>

 

          <tr>

 

            <td align="right" bgcolor="#000000"> </td>

 

            <td bgcolor="#000000"> </td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td align="right" bgcolor="#000000">Username:</td>

 

          <td><input type="text" name="username" maxlength="18" value="<?=$username?>"> <font color="#CCCCCC" size="1">3-18 length, a-Z 0-9 Charactors.</font> <a href="check.php"><font color="#FF0000">(Check Availability)</font></td><a>

 

          </tr>

 

          <tr>

 

          <td align="right" bgcolor="#000000">Password:</td>

 

          <td><input type="password" name="password" maxlength="18" value="<?=$password?>"> <font color="#CCCCCC" size="1">3-12 length, a-Z 0-9 Charactors.</font></td>

 

          </tr>

 

          <tr>

 

          <td align="right" bgcolor="#000000">Confirm Password:</td>

 

          <td><input type="password" name="cpassword" maxlength="18" value="<?=$cpassword?>"></td>

 

          </tr>

 

          <tr>

 

          <td align="right" bgcolor="#000000">E-mail Address:</td>

 

          <td><input type="text" name="email" maxlength="100" value="<?=$email?>">

 

            <strong>No yahoo or Aol emails Dont Work </strong></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

            <td align="right" bgcolor="#000000"> </td>

 

            <td> </td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td colspan="2" bgcolor="#000000" class="border"><b>Personal:</b> <font color="#CCCCCC">Required</font></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

            <td align="right" bgcolor="#000000"> </td>

 

            <td> </td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td align="right" bgcolor="#000000">First Name:</td>

 

          <td><input type="text" name="first" maxlength="25" value="<?=$first?>"></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td align="right" bgcolor="#000000">Last Name:</td>

 

          <td><input type="text" name="last" maxlength="25" value="<?=$last?>"></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td align="right" bgcolor="#000000">Age:</td>

 

          <td><input type="text" name="age" size="4" maxlength="2" value="<?=$age?>">

 

          <font color="#CCCCCC" size="1">18+ only.</font></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

            <td align="right" bgcolor="#000000"> </td>

 

            <td> </td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

          <td colspan="2" class="border"><b>Misc:</b> <font color="#CCCCCC">Optional</font></td>

 

          </tr>

 

          <tr bgcolor="#000000">

 

            <td align="right"> </td>

 

            <td> </td>

 

          </tr>

 

          <tr bgcolor="none">

 

          <td align="right">instant messager:</td>

 

          <td> <select  name="messager"><option class="maintxt" <?if($messager==""){echo"selected";}?>>N/A</option><option value="AIM" <?if($messager=="AIM"){echo"selected";}?>>AIM</option><option value="MSN" <?if($messager=="MSN"){echo"selected";}?>>MSN</option><option value="YaHoO" <?if($messager=="YaHoO"){echo"selected";}?>>YaHoO</option></select> <input type="text" name="messager_id" size="14" maxlength="50" value="<?=$messager_id?>"> <font color="#CCCCCC" size="1">so we may contact you if important.</font></td>

 

          </tr>

 

  <tr>

 

  <td align="right"><strong>Referred By: ( If Referred )</strong></td><td>  <? if($refer){ echo"<b>$refer</b><input type=hidden name=refer value=$refer>"; } ?></td>

 

  </tr>

 

          <tr bgcolor="none">

 

          <td colspan="2" align="center"><br>

 

            <b>You ip address is being logged as: <font color="#FFCC00"><?=$REMOTE_ADDR?></font></b><br>

 

            when signing up yahoo and aol emails dont work to well to get the verify email so id use something else <br></td>

 

          </tr>

 

  <?php

 

  $sagain = fetch("SELECT ip FROM $tab[user] WHERE ip='$REMOTE_ADDR'");

 

  ?>

 

  <?if($sagain){ ?>

 

  <tr bgcolor="none">

 

          <td colspan="2" align="center"><strong><font color="ff0000">This "<?=$REMOTE_ADDR?>" ip has already been used, the admins will be alerted as soon as you sign up!</strong></font><br>

 

            <br></td>

 

          </tr>

 

  <? } ?>

 

          <tr bgcolor="none">

 

          <td colspan="2" align="center"><input type="submit" name="signup" value="signup">       <input type="reset" value="cancel"></td>

 

          </tr>

 

        </table>

 

        <br>

 

<input type="hidden" name="hash" value="f7610358ffcc3db6558310ea4a166bcb">

 

        </form>

 

        <?}elseif($step==2){?>

 

        <form method="post" action="newmem.php">

 

        <?if($warn==yes){?><b><?}?>In order to proceed, you must agree with the following Game Rules:</b>

 

        <table width="100%">

 

          <tr>

 

          <td colspan="2">

 

          <div class="maintxt" style="border:thin inset;background: #000000; padding:6px; height:175px; overflow:auto"><?=$html[0]?></div>

 

          </td>

 

          </tr>

 

          <tr>

 

          <td><input type="checkbox" name="agree" value="yes" style="background: #111111;"> <input type="hidden" name="step2" value="1"> <strong class="maintxt">I have read, and agree to abide by the Game Rules.</strong></td>

 

          <td align="right"><input type="submit" value="next »»"></td>

 

          </tr>

 

        </table>

 

        </form>

 

        <?}else{?>

 

        <form method="post" action="newmem.php">

 

        <?if($warn==yes){?><b><?}?>In order to proceed, you must agree with the following Terms of Service:</b>

 

        <table width="100%">

 

          <tr>

 

          <td colspan="2">

 

          <div class="maintxt" "><?=$html[1]?>  The service of Mafia-Name.com is provided to you (the General) for free under the terms and conditions of this Disclaimer. By playing Mafia-Name.com you are indicating your agreement to be bound by the terms and conditions of this Disclaimer. <BR>

 

                      <BR>

 

                     

 

                      <BR></div>          </td>

 

          </tr>

 

          <tr>

 

          <td><input type="checkbox" name="agree" value="yes" style="background: #111111;"> <input type="hidden" name="step1" value="1">

 

            <span class="maintxt"><strong><nobr>I have read, and agree to abide by the Terms of Service.</nobr></strong></span></td>

 

          <td align="right"><input type="submit" value="next »»"></td>

 

          </tr>

 

        </table>

 

        </form>

 

        <?}?>

 

    </td>

 

    </tr>

 

  </table>

 

<?}

 

sitefooter();

 

?> 

Link to comment
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.