Jump to content

Undefined function.


unsider

Recommended Posts

<?php
if (!isLoggedIn())
{

    if (isset($_POST['cmdlogin']))
    {
      
        if (checkLogin($_POST['username'], $_POST['password']))
        {
            show_userbox();
        } else
        {
            echo "Incorrect Login information !";
            show_loginform();
        }
    } else
    {

        show_loginform();
    }

} else
{

    show_userbox();
}
?>

 

Fatal error: Call to undefined function isLoggedIn() in ..website name.. on line 2

Link to comment
Share on other sites

Read the message:

Fatal error: Call to undefined function isLoggedIn() in ..website name.. on line 2

 

Notice the important parts:

Fatal error: Call to undefined function isLoggedIn() in ..website name.. on line 2

 

Look at your line 2:

if (!isLoggedIn())

 

Now show me where in your code you defined that function.  i.e. where in your code do you have this:

function isLoggedIn(){
  // does something
}

Link to comment
Share on other sites

<?php

include ("db_connect.inc.php");



if ( $_GET["op"] == "reg" )      ---------------------------11
{
$bInputFlag = false;
foreach ( $_POST as $field )
	{
	if ($field == "")
   {
   $bInputFlag = false;
   }
	else
   {
   $bInputFlag = true;
   }
	}

if ($bInputFlag == false)
	{
	die( "Problem with your registration info. "
   ."Please go back and try again.");
	}


$q = "INSERT INTO `members` (`username`,`password`,`email`) "
	."VALUES ('".$_POST["username"]."', "
	."PASSWORD('".$_POST["password"]."'), "
	."'".$_POST["email"]."')";

$r = mysql_query($q);


if ( !mysql_insert_id() )
	{
	die("Error: User not added to database.");
	}
else
	{

	Header("Location: register.php?op=thanks");
	}
} 



elseif ( $_GET["op"] == "thanks" )                ------------------------------- 55
{
echo "<h2>Thanks for registering!</h2>";
}


else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n";
echo "<input type=\"submit\">\n";
echo "</form>\n";
}
// EOF
?>

 

Notice: Undefined index: op in ..website.. on line 11

 

Notice: Undefined index: op in ..website.. on line 55

 

Marked #s

Link to comment
Share on other sites

Add this at the top:

$op = isset($_GET['op']) ? $_GET['op'] : '';

 

Then everywhere in your code where you have $_GET['op'], use $op instead.

 

The error is saying the index is not defined, or that $_GET has no index named 'op' associated with it.  The line you put at the top of the script will set $op equal to $_GET['op'] if the index is set and the empty string if it is NOT set.

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.