p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   call to undefined function (http://p2p.wrox.com/showthread.php?t=88845)

internetpirate11 November 21st, 2012 03:50 AM

call to undefined function
 
call to undefined function cmpfx().. what does that mean?

if (isset($_SESSION["admin"])) redirect("home.php");

if (!empty($_POST)) {
//$rs = getconfigvar("admin_username,admin_password");
$sql="select * from user_master where 'user_name'='admin'";
// $sql="select * from user_master where active=1 and user_type in (1,2) and user_name='".pdbfx("username")."'";
$cmd = mysql_query($sql);
$rs = mysql_fetch_array($cmd);
/*echo $rs["password"]."-".pdbfx("password");
echo cmpfx($rs["password"], pdbfx("password"));
echo $sql;
die;*/
if (cmpfx($rs["user_name"], $_POST["username"]) && cmpfx($rs["password"], md5($_POST["password"]))) {
$_SESSION["admin"] = $_POST["username"];
$_SESSION["user_type"] =$rs["user_type"];
$_SESSION["user_id"] =$rs["user_id"];

redirect("home.php");
}
else {
setErr("<div class='response-msg error ui-corner-all'> <span>Invalid Username or Password </span></div>");
redirect("index.php");
}
}

UseLess November 21st, 2012 12:46 PM

Greetings,

It means that on this line;
Code:

if (cmpfx($rs["user_name"], $_POST["username"]) && cmpfx($rs["password"], md5($_POST["password"]))) {
you're calling the function 'cmpfx' which has not been defined. So you would need to define the function like so;
Code:

function cmpfx($var, $var)
{
// function code in here
}

You'd replace the '// function code in here' with code to work on the 2 passed values and then return a result.


All times are GMT -4. The time now is 08:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.