rofl90 Posted March 22, 2007 Share Posted March 22, 2007 Ok with this i get a MySQL Error: saying is_numeric is not a defined function.. heres the code i think its like 63: <?php include ("includes/header.php"); session_start(); //check if the user is logged in in the 1st place if(isset($_SESSION['isadmin'])) { $ID = $_GET['ID']; $act = $_GET['act']; if(isset ($ID)) { if ($act == "delete") { $command2 = "Delete from ext_users where ID='$ID'"; mysql_query($command2) or die($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User deleted!</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } else if ($act == "ban") { $command = "update ext_users set banned='1' where ID='$ID'"; mysql_query($command) or die($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User has been banned!</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } else if ($act == "unban") { $command = "update ext_users set banned='0' where ID='$ID'"; mysql_query($command) or die($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User has been unbanned!</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } else if($act == "makemod") { $command = "update ext_users set ismod='1' where ID='$ID'"; mysql_query($command) or die($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User added as a game mod!</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } else if($act == "delmod") { $command = "update ext_users set ismod='0' where ID='$ID'"; mysql_query($command) or die($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">User removed as a game mod!</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } else { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">Please follow the links in the control panel</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } } else { print "<table width=\"100%\" cellpadding=\"5px\" align=\"center\" border=\"1\" style=\"border-style:dashed; border-width:thin; border-collapse:collapse;\" cellspacing=\"0px\">"; print "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Users</caption>"; print "<center>All users listed in ABC order</center>"; global $start; if(!isset($_GET["start"]) || !is_numerical($_GET["start"])) { $start = "0"; } else { $start = $_GET["start"]; } $command1 = "SELECT * from ext_users order by playername ASC limit $start, 10 "; $query1 = mysql_query($command1) or die($db_error); print "<tr><td>Username</td><td>E-mail</td><td>Level</td><td>Honor</td><td>Gold</td><td>Last Online</td><td>Last IP</td><td>Action</td></tr>"; while($playerinfo = mysql_fetch_array($query1)) { $time = getdate($playerinfo['ontime']); if ($playerinfo['ismod']) { $lastlink = "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=delmod\">Remove Mod</a>"; } else if ($playerinfo['admin']) { $lastlink = "<s>Make Mod</s>"; } else { $lastlink = "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=makemod\">Make Mod</a>"; } if ($playerinfo['banned']) { $link = "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=unban\">UnBan</a>"; } else if ($playerinfo['admin']) { $link = "<s>Ban</s>"; } else { $link = "<a href=\"usercp.php?ID=".$playerinfo['ID']."&act=ban\">Ban</a>"; } print "<tr><td>".$playerinfo['playername']."</td><td>".$playerinfo['email']."</td><td>".$playerinfo['lvl']."</td><td>".$playerinfo['honor']."</td><td>".$playerinfo['gold']."</td><td>".$time['mday']." ".$time['month']." ".$time['year']."</td><td>".$playerinfo['lastip']."</td><td><a href=\"usercp.php?ID=".$playerinfo['ID']."&act=delete\">Delete</a> | ".$link." | ".$lastlink."</td></tr>"; } print "</table>"; $command1 = "SELECT * from ext_users"; $query1 = mysql_query($command1); $d=0; $f=0; $g=1; print "Page: "; while($result1 = mysql_fetch_array($query1)) { if($f%10 == 0) { print "[<a href=\"usercp.php?start=$d\">$g</a>] "; $g++; } $d=$d+1; $f++; } $count = mysql_num_rows($query1); print "<br /><br />No. of users:".$count; } } //if user is not logged in else { print "<script language=\"Javascript\">alert(\"You are not logged in!\");</script>"; print "<meta http-equiv=\"refresh\" content=\"0; url=$path/index.php\" />"; print "<center><a href=\"index.php\">Continue to homepage if browser doesn't redirect you</a></center>"; } include ("includes/footer.php"); ?> Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/ Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 It's very wierd personally I thought is_numerical would make it work, and now it's given me a Fatal Error Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212887 Share on other sites More sharing options...
pocobueno1388 Posted March 22, 2007 Share Posted March 22, 2007 Try changing this line: if(!isset($_GET["start"]) || !is_numerical($_GET["start"])) To this: if ((!isset($_GET['start']) || (!is_numeric($_GET['start'])) Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212898 Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 Returning: ERROR: Parse error: parse error, unexpected '{' in /home/fhlinux174/h/habbouncovered.co.uk/user/htdocs/mmorpg/admin/usercp.php on line 64 Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212902 Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 ... ;/ Wheres the error guyz ;/ Im completely stumped.. My PHP is good, but not amazing. I would appreciate some help ;P Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212912 Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 Errm.. [move]HELP![/move] Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212918 Share on other sites More sharing options...
kenrbnsn Posted March 22, 2007 Share Posted March 22, 2007 Don't bump so often -- once every 3 or 4 hours is acceptable. As for your error, please repost the affected line and about 10 lines before and after it. Ken Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212928 Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">Please follow the links in the control panel</p>"; print "<p align=\"center\"><a href=\"usercp.php\">Continue</a></p>"; } } else { print "<table width=\"100%\" cellpadding=\"5px\" align=\"center\" border=\"1\" style=\"border-style:dashed; border-width:thin; border-collapse:collapse;\" cellspacing=\"0px\">"; print "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Users</caption>"; print "<center>All users listed in ABC order</center>"; global $start; if ((!isset($_GET['start']) || (!is_numeric($_GET['start'])) { $start = "0"; } else { $start = $_GET["start"]; } $command1 = "SELECT * from ext_users order by playername ASC limit $start, 10 "; $query1 = mysql_query($command1) or die($db_error); Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212930 Share on other sites More sharing options...
kenrbnsn Posted March 22, 2007 Share Posted March 22, 2007 You parenthesis are unbalanced in this line: <?php if ((!isset($_GET['start']) || (!is_numeric($_GET['start'])) ?> That is why you're getting the error. Re-write it as <?php if (!isset($_GET['start']) || !is_numeric($_GET['start'])) ?> You can also re-write the entire "if" block as: <?php $start = (!isset($_GET['start']) || !is_numeric($_GET['start']))?0:$_GET['start']; ?> Also, you don't need the line: <?php global $start; ?> Ken Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212935 Share on other sites More sharing options...
rofl90 Posted March 22, 2007 Author Share Posted March 22, 2007 THANKYOU SO MUCH! It works perfectly, its an MMORPG, if you'd like to check it out the URL is http://www.habbouncovered.co.uk/mmorpg/ Also anyone interested in domain: ProWebDesigns.co.uk nice domain for prgrammers etc.. As its a good domain I'm looking for another domain in return PM me for details. Link to comment https://forums.phpfreaks.com/topic/43850-solved-is_numeric-not-a-defined-function/#findComment-212942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.