Jump to content

Help needed - Fatal error – function not defined


lesterdan

Recommended Posts

Hi everyone,

 

I employed a php guy to code all my site he has done quite alot but has got stuck on something called a Fatal error - function not defined! this is shown every time he loads the page up. I need the help quick as i am on holiday in a few days. If you know you can help or have any suggestions please do write back. Sorry about my knowledge i am a new one to all this. lol cheers

Link to comment
Share on other sites

this is the code?

 

<?php

if(isset($_SESSION['user_id'])) {

//header("Location: ./");

}

 

$firmname = NULL;

$strapline = NULL;

$bullet1 = NULL;

$bullet2 = NULL;

$bullet3 = NULL;

$bullet4 = NULL;

$manager = NULL;

$address = NULL;

$mail = NULL;

$www = NULL;

$phone = NULL;

$mobile = NULL;

$login = NULL;

$pass = NULL;

$pass2 = NULL;

 

if(isset($_POST['submitform'])) {

$error = array(

"no_firmname" => "<h3 class=\"msg_red\">Please enter your Stage/Company name</h3>",

"no_strapline" => "<h3 class=\"msg_red\">Please enter a strapline</h3>",

"no_bullet" => "<h3 class=\"msg_red\">You must enter 4 bullets</h3>",

"no_manager" => "<h3 class=\"msg_red\">Please type a description of your services</h3>",

"no_address" => "<h3 class=\"msg_red\">Please enter your address</h3>",

"no_email" => "<h3 class=\"msg_red\">Please enter your email</h3>",

"no_www" => "<h3 class=\"msg_red\">Please enter your website</h3>",

"no_phone" => "<h3 class=\"msg_red\">Please enter your phone</h3>",

"no_mobile" => "<h3 class=\"msg_red\">Please enter your mobile number</h3>",

"no_login" => "<h3 class=\"msg_red\">Please enter a login name</h3>",

"no_pass" => "<h3 class=\"msg_red\">Please enter s password</h3>",

"no_pass2" => "<h3 class=\"msg_red\">Please re-enter your password</h3>",

"no_match_pass" => "<h3 class=\"msg_red\">The passwords you entered do not match</h3>",

"no_agree" => "<h3 class=\"msg_red\">You cannot signup if you do not agree to our terms</h3>"

);

 

 

$user_taken =  user_taken($_POST['login']); // CHECK IF LOGIN IS TAKEN

$email_taken = email_taken($_POST['mail']); // CHECK IF EMAIL IS TAKEN

$checkEmail =  check_email($_POST['mail']); // CHECK EMAIL FORMAT

 

// Make friendly password vars

$pass = $_POST['pass'];

$pass2 = $_POST['pass2'];

 

if(trim($_POST['firmname']) == "") { // NO FIRST NAME

$errorMsg = $error['no_firmname'];

//die("test");

}

else if(trim($_POST['strapline']) == "") { // NO STRAPLINE

$errorMsg = $error['no_strapline'];

}

else if(trim($_POST['bullet1']) == "") { // NO BULLET

$errorMsg = $error['no_bullet'];

}

else if(trim($_POST['bullet2']) == "") { // NO BULLET

$errorMsg = $error['no_bullet'];

}

else if(trim($_POST['bullet3']) == "") { // NO BULLET

$errorMsg = $error['no_bullet'];

}

else if(trim($_POST['bullet4']) == "") { // NO BULLET

$errorMsg = $error['no_bullet'];

}

else if(mysql_prep($_POST['mail']) == "") { // NO EMAIL

$errorMsg = $error['no_email'];

}

else if($checkEmail == 0) { // INVALID EMAIL

$errorMsg = $error['invalid_email'];

}

else if($email_taken == 1) { // EMAIL TAKEN

$errorMsg = $error['email_taken'];

$_POST['mail'] = NULL;

}

else if($user_taken == 1) { // USER TAKEN

$errorMsg = $error['user_taken'];

$_POST['login'] = NULL;

}

else if(mysql_prep($_POST['email2']) == "") { // NO EMAIL2

$errorMsg = $error['no_email2'];

}

else if($_POST['mail'] != $_POST['email2']) { // NO MATCH - EMAILS

$errorMsg = $error['no_match_email'];

}

else if(mysql_prep($_POST['pass']) == "") { // NO PASSWORD

$errorMsg = $error['no_pass'];

}

else if(mysql_prep($_POST['pass2']) == "") { // NO PASSWORD 2

$errorMsg = $error['no_pass2'];

}

else if($_POST['pass'] != $_POST['pass2']) { // NO MATCH - PASSWORDS

$errorMsg = $error['no_match_pass'];

$pass2 = "";

}

else if(mysql_prep($_POST['agree']) != "on") { // NO AGREE CONFIRM

$errorMsg = $error['no_agree'];

}

else {

$errorMsg = NULL; // Set Error Msg var to NULL

 

// Make friendly vars for db insertion

$signupIP = get_remote_address();

$confirmKey = sha1(date("ijmyhs").$signupIP);

$username = mysql_prep($_POST['username']);

$email = mysql_prep($_POST['email']);

$password = sha1($_POST['pass']);

 

// Process Query

$sql = "INSERT INTO unreg_user(

confirmKey, username, email, password,

signup_date, signup_time, signupIP

) VALUES (

'{$confirmKey}', '{$username}', '{$email}', '{$password}',

current_date, current_time, '{$signupIP}'

)";

$result = mysql_query($sql);

if($result) {

// ---------------- SEND MAIL FORM ----------------

$to = $email;

$subject = "backupurl.com Registration Confirmation";

$header = "from: www.backupurl.com <admin@backupurl.com>";

 

// Your message

$message= "Thank you for signing up for the BackupURL.com Membership.\n";

$message.="You must click the confirmation link to complete the registration process. \r\n\n";

$message.="Once you confirm your registration, you will be able to save a list of websites you have cached.\n\n";

$message.="Click on this link to activate your account: \r\n";

$message.="confirm.php?a=process&ck={$confirmKey} \n\n";

$message.="You're login details are:\n";

$message.="Username: {$email}\n";

$message.="Password: {$_POST['pass']}\n\n";

$message.="If you want to cancel your registration, please click the link below:\n";

$message.="confirm.php?a=cancel&ck={$confirmKey} \n\n";

$message.="Thanks \n\n\n";

$message.="BackupURL";

 

// send email

$sentmail = mail($to,$subject,$message,$header);

if($sentmail) {

$msg = "Thank you, your confirmation link has been sent to your email address.";//.mysql_error();

$hideForm = 1;

} else {

$msg = "Sorry, your details could not be processed. Please try again.";//.mysql_error();

}

} else if(!$result) {

$msg = "Sorry, your details could not be processed. Please try again.";//.mysql_error();

}

}

}

//echo "confirm.php?a=process&ck={$confirmKey} \n\n";

?>

<?php if(!empty($msg)) { echo $msg; } ?>

<?php if(!empty($error_msg)) { echo $error_msg; } ?>

<div id="resultsHeader">

<a href="http://www.findanentertainer.com">

<img align="left" src="images/entertainer_sml.png" border="0"></a>

<a href="#">Sign in</a>

</div>

<div id="resultsPanel">

<div class="rbroundbox" style="width: 660px;">

<div class="rbtop"><div></div></div>

<div class="rbcontent">

<font size="4" face="Calibri">

<center><B><u>Apply</u></B></center></font>

<?php if(!empty($msg)) { echo $msg; } ?>

<?php if(!empty($error_msg)) { echo $error_msg; } ?>

<form action="" method="post" enctype="multipart/form-data">

<table id="regtable" border="0">

<tr>

<td colspan="4">

<h3><u>Step 1</u></h3>

</td>

</tr>

<tr>

<td class="titles">Stage / Company name:</td>

<td style="width:320px;"><input type="text" class="regtxtfld" name="firmname" value="" /></td>

<td class="required"></td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Strap line:</td>

<td><input type="text" class="regtxtfld" name="strapline" value="" /></td>

<td class="required"></td>

<td class="whatsthis"> <a href="" color="blue" title="Strapline is like your company slogan. e.g Award Winning Magician."><font color="blue">(?)</a> </td>

</tr>

<tr>

<td class="titles">Bullet Points:</td>

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"><a href="" color="blue" title="Bullet points about your entertainment e.g Cabaret, Weddings and Parties."><font color="blue">(?)</a> </td>

</tr>

<tr>

<td class="titles"> </td>

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles"> </td>

 

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles"> </td>

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

 

</tr>

<tr>

<td colspan="4"> </td>

</tr>

<tr>

<td class="titles">Contact name:</td>

<td><input type="text" class="regtxtfld"  value=""name="manager" /></td>

<td class="required"></td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Address</td>

<td><textarea class="regtxtbox" name="address value="""></textarea></td>

<td class="required"></td>

<td class="whatsthis"> </td>

 

</tr>

<tr>

<td class="titles"></td>

<td>

Would you like your address to be seen on site?<br />

<center> Yes: <input type="radio" class="" name="" /> 

No: <input type="radio" class="" name="" /></center>

 

</td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Email:</td>

<td><input type="text" class="regtxtfld" value="" name="mail" onBlur="checkemail(this.value)/></td>

<td class="required"></td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Website:</td>

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

 

<td class="titles">Telephone:</td>

<td><input type="text" class="regtxtfld" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Mobile</td>

<td><input type="text" class="regtxtfld" name="" /></td>

 

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td colspan="4" class="step">

<br><br><br> <center><hr width="500"></center><h3><u>Step 2</u></h3>

</td>

</tr>

<tr>

 

<td class="titles">Sell yourself here</td>

<td>

<textarea class="regtxtbox"  name="business"></textarea><br />

<span class="smalltxt">250 to 300 words</span>

</td>

<td class="required"> </td>

<td class="whatsthis"><a href=""  title="Sell yourself here and describe key selling points about your entertainment."><font color="blue">(?)</a> </td>

 

</tr>

<tr>

<td class="titles">Photograph (8 x 10)</td>

<td><input type="file" name="" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

 

<td class="titles">Category:</td>

<td>

  <SELECT style="width:200px" style="height:25px"NAME="category[]" multiple style="font-size:10px; width:200; height:50;">

 

<OPTION VALUE="7#0#0"> Bands </OPTION><OPTION VALUE="18#0#0"> Discos </OPTION><OPTION VALUE="25#0#0"> Stage Magicians</OPTION><OPTION VALUE="6#0#0">Balloon Artists</OPTION><OPTION VALUE="8#0#0">Bouncy Castles</OPTION><OPTION VALUE="9#0#0">Cheer Leaders</OPTION><OPTION VALUE="10#0#0">Chefs</OPTION><OPTION VALUE="11#0#0">Children&#039;s Discos</OPTION><OPTION VALUE="12#0#0">Children&#039;s Magicians</OPTION><OPTION VALUE="13#0#0">Chocolate Fountains</OPTION><OPTION VALUE="14#0#0">Choirs</OPTION><OPTION VALUE="15#0#0">Close Up Magicians</OPTION><OPTION VALUE="16#0#0">Clowns</OPTION><OPTION VALUE="17#0#0">Comedians </OPTION><OPTION VALUE="19#0#0">Face Painters</OPTION><OPTION VALUE="20#0#0">Impressionists</OPTION><OPTION VALUE="21#0#0">Karaoke </OPTION><OPTION VALUE="22#0#0">Party Bus</OPTION><OPTION VALUE="23#0#0">Singers</OPTION><OPTION VALUE="24#0#0">Speakers</OPTION><OPTION VALUE="26#0#0">Strippers </OPTION></SELECT><br>* Hold CTRL key to select more than one category<br>* Hold CTRL key to select more than one category.

</td>

 

<td class="required"></td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td class="titles">Region:</td>

<td>

      Country:

   

      <SELECT NAME="city" style="width:300;">

                             

 

<OPTION VALUE="1">East Anglia & Eastern England<OPTION VALUE="2">East Midlands<OPTION VALUE="3">London<OPTION VALUE="4">North East<OPTION VALUE="5">North West <OPTION VALUE="6">Northern Ireland<OPTION VALUE="7">Scotland <OPTION VALUE="8">South East<OPTION VALUE="9">South West<OPTION VALUE="10">Wales<OPTION VALUE="11">West Midlands<OPTION VALUE="12">Yorkshire & Humberside</SELECT></td></tr>

</td>

 

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td colspan="4" class="step">

<br><br><br> <center><hr width="500"></center> <h3><u>Step 3</u></h3>

</td>

</tr>

<tr>

  <td bgColor="" align="left">

 

<font color="red"></font>

<tr>

<td class="titles">Login:</td>

<td><input type="text" value=""  class="regtxtfld" name="login" /></td>

<td class="required"> </td>

<td class="whatsthis"><a href=""  title="Username must contain 5 or more characters/numbers."><font color="blue">(?)</a> </td>

</tr>

<tr>

<td class="titles">Password:</td>

<td><input type="password" value="" class="regtxtfld" name="pass" /></td>

<td class="required"> </td>

<td class="whatsthis"><a href=""  title="Password must contain 5 or more characters/numbers."><font color="blue">(?)</a></td>

</tr>

<tr>

<td class="titles">Repeat Password:</td>

<td><input type="password" value="" class="regtxtfld" name="pass2" /></td>

<td class="required"> </td>

<td class="whatsthis"> </td>

</tr>

<tr>

<td bgColor="" align="left">

<font color="red"></font>

</td>

</tr>

<td colspan="4">

 

 

 

<center><a href="javascript:animatedcollapse.toggle('rabbit')"></a> <a href="javascript:animatedcollapse.show('rabbit')"><b>View Terms And Conditions</b></a>  <a href="javascript:animatedcollapse.hide('rabbit')"></a>

 

<div id="rabbit" style="width:490px; padding:5px; background: #333333">

  <font color="white" ><p align="justify">I understand that a full payment of the relevant amount needs to be paid via PayPal or cheque before the advert is online. Once paid, the advert will be placed on the site within 24 hours of the payment clearing. The payment is per annum and needs to be renewed within 5 working days of the renewal date to keep the ad on the site. Findanentertainer.com reserves the right, without liability, to reject or terminate any entertainer’s advertising on the site for any reason or at any time. If Findanentertainer.com decides that the advert is not acceptable, but has been published on the site a full pro-rata refund will be made in these circumstances.</font>

</p></div> </center><p align="justify">

<br> <input type="checkbox" class="" name="" />

I agree to the terms and conditions

</td>

</tr>

</table>

 

<center>

<input type="hidden" name="submitform" />

<input type="submit" name="regbut" value="Submit Listing">

</center> </form>

 

</div><!-- /rbcontent -->

<div class="rbbot"><div></div></div>

</div><!-- /rbroundbox -->

</div>

 

Link to comment
Share on other sites

<?php

if(isset($_SESSION['user_id'])) {

header("Location: ./");

}

 

if(isset($_POST['submitform'])) {

require("process_login.php");

}

if(isset($_GET['action']) && $_GET['action'] == "loggedout") {

echo "<p style=\"padding-bottom:8px; text-align:left;\">Thank you, you are now logged out!</p>";

}

?>

<div id="resultsHeader">

<a href="http://www.findanentertainer.com">

<img align="left" src="images/entertainer_sml.png" border="0"></a>

<a href="#">Sign in</a>

</div>

<form method="post" action="">

<table id="loginTable" style="margin:auto;">

<tr>

<td>Username:</td>

<td><input type="text" name="login" class="formTxtField" /></td>

</tr>

<tr>

<td>Password:</td>

<td><input type="text" name="password" class="formTxtField" /></td>

</tr>

<tr>

<td colspan="2" style="text-align:center;">

<input type="hidden" name="submitform" />

<input type="submit" name="submit" value="Login" />

</td>

</tr>

<tr>

<td colspan="2" style="text-align:right; font-size:12px;">

<a href="lostpass">Forgot Password?</a><br />

<a href="apply">Signup Now!</a>

</td>

</tr>

</table>

</form>

<?php

if(!empty($message)) {

echo "<p>{$message}</p>";

}

?>

 

SORRY I THINK THIS IS THE ONE WITH THE ERROR - AND THE error is this ----

 

Fatal error: Call to undefined function get_user_by_id() in /home/findan/public_html/old/cont/user.php on line 1

 

Link to comment
Share on other sites

Mate thanks for your reply erm he said this ---- All the functions are being called from.

includes/pagefunctions.php

 

erm?  I don't understand.  Your error says you're not calling that function but I did ctr+f for "get_user_by_id()" and it doesn't exist anywhere on this thread except the error message.

Link to comment
Share on other sites

 

// Form Validation

$required_fields = array('login', 'password');

foreach($required_fields as $fieldname) {

if (!isset($_POST[$fieldname]) || (empty($_POST[$fieldname]) && $_POST[$fieldname] != 0)) {

$errors[] = $fieldname;

}

}

 

$fields_with_lengths = array('login' => 100, 'password' => 50);

foreach($fields_with_lengths as $fieldname => $maxlength ) {

if (strlen(trim(mysql_prep($_POST[$fieldname]))) > $maxlength) { $errors[] = $fieldname; }

}

 

$username = trim(mysql_prep($_POST['login']));

$password = trim(mysql_prep($_POST['password']));

$hashed_password = sha1($password);

 

if (empty($errors)) {

//Check database to see if username and the hashed password exist there.

$query = "SELECT selector, login ";

$query .= "FROM pmd_users ";

$query .= "WHERE login = '{$username}' ";

$query .= "AND pass = '{$hashed_password}' ";

$query .= "LIMIT 1";

//die($query);

$query_result = mysql_query($query);

//if(!$query_result) { echo mysql_error(); }

 

if (mysql_num_rows($query_result) == 1) {// username/password authenticated and only 1 match.

// Set Session Vars

$found_user = mysql_fetch_array($query_result);

$_SESSION['user_id'] = $found_user['selector'];

$_SESSION['username'] = $found_user['firmname'];

$_SESSION['log_code'] = sha1(uniqid(rand()));

 

// Get IP of the PC the user is using

$login_ip = get_remote_address();

 

// update last login

$login_sql = "UPDATE pmd_users SET

  lastlogin = NOW(),

  lastlogin_date = current_date,

  lastlogin_time = current_time,

  lastloginIP = '{$login_ip}'

  WHERE user_id = '{$found_user['selector']}'

  LIMIT 1";

$result = mysql_query($login_sql);

 

// update login log

$log_sql = "INSERT INTO login_logs(

log_code, user_id, username,

email, login_date, login_time, loginIP

) VALUES (

'{$_SESSION['log_code']}', '{$found_user['selector']}', '{$found_user['firmname']}',

'{$found_user['mail']}', current_date, current_time, '{$login_ip}'

)";

$logresult = mysql_query($log_sql);

header("Location: user");

} else {

// username/password combo was not found in the database

$message = "<h3 class=\"msg_red\">username/password combo is incorrect.<br>Please make sure your caps lock key is turned off and try again.</h3>";

$message .= "<br/ >". mysql_error();

}

} else {

// Errors Occurred

//$message = "The number of errors counted was: " . count($errors) .".";

}

 

THE GUY SAID CHECK THIS LOL I THINK THIS IS CALLED THE PROCESS LOGIN AND HE SAID CAN U HAVE A LOOK AT LINE 12? CHEERS

Link to comment
Share on other sites

THE GUY SAID CHECK THIS LOL I THINK THIS IS CALLED THE PROCESS LOGIN AND HE SAID CAN U HAVE A LOOK AT LINE 12? CHEERS

 

Why not have him debug this. You are just posting random bits of code, not even posting the code in the


tags like you have been asked several times before.

 

My bet is, you do not have the functions file being included on user.php given that the error is thrown on line 1, you could not. You have to include the functions file that holds the definitions of the functions before you can use those functions.

Link to comment
Share on other sites

lesterdan, the only way someone can help you is if you provide accurate and relevant information. So far you have failed to do that.

 

The error message states in which file the error is occurring. Start by posting the actual error message (I have my doubts that the error posted above in this thread is accurate.) Then post the file that the error message states the error is occurring in.

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.