Jump to content

[SOLVED] is_numeric not a defined function ;/


rofl90

Recommended Posts

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

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

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

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.

Archived

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

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