Page 1 of 1
Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 9:56 am
by bad959fl
My programmer bailed on me and I'm trying to fix some errors in the error_log:
Notice: Undefined variable: sender in /var/www/vhosts/mydomain.com/httpdocs/v3messenger/include_/func.php
The only code I could find in the referring page to the chat program (v3messenger) is "show_header_chat":
Code: Select all
<?
include "template/header.php";
}//end header
function show_header_chat($Page='home'){
global $conn;
?>
Since I don't use the chat feature any longer, I would like to remove it and fix these errors. What piece of code can I remove from the referring page to fix it without breaking anything?
Thanks!
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 10:10 am
by Celauran
We don't really have enough information to say. What's in func.php? Where/how is it being called?
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 10:34 am
by bad959fl
The func.php file is being called by the homepage (referring page). This is what is located in the func.php file:
Code: Select all
<?php
$reme = mysql_real_escape_string($reme);
$member = mysql_real_escape_string($member);
$membername = mysql_real_escape_string($membername);
$postbyname = mysql_real_escape_string($postbyname);
$postbyid = mysql_real_escape_string($postbyid);
$memberid = mysql_real_escape_string($memberid);
$u = mysql_real_escape_string($u);
$v3chat_n = mysql_real_escape_string($v3chat_n);
$v3chat_p = mysql_real_escape_string($v3chat_p);
$fs_expired = mysql_real_escape_string($fs_expired);
$delete_name = mysql_real_escape_string($delete_name);
$delete_id = mysql_real_escape_string($delete_id);
$term = mysql_real_escape_string($term);
$mid = mysql_real_escape_string($mid);
$del = mysql_real_escape_string($del);
$usr = mysql_real_escape_string($usr);
$id = mysql_real_escape_string($id);
$m = mysql_real_escape_string($m);
$lastID = mysql_real_escape_string($lastID);
$new_clogin = mysql_real_escape_string($new_clogin);
$message = mysql_real_escape_string($message);
$blocked = mysql_real_escape_string($blocked);
$sender = mysql_real_escape_string($sender);
$m_n = mysql_real_escape_string($m_n);
$l_n = mysql_real_escape_string($l_n);
$system_c = mysql_real_escape_string($system_c);
$new_request = mysql_real_escape_string($new_request);
$e_mail = mysql_real_escape_string($e_mail);
$today = mysql_real_escape_string($today);
$usr_remember = mysql_real_escape_string($usr_remember);
$exists = mysql_real_escape_string($exists);
$addmemberid = mysql_real_escape_string($addmemberid);
$addmember = mysql_real_escape_string($addmember);
$email = mysql_real_escape_string($email);
$mname = mysql_real_escape_string($mname);
$contact_name = mysql_real_escape_string($contact_name);
$contact_id = mysql_real_escape_string($contact_id);
$_cid = mysql_real_escape_string($_cid);
$_mid = mysql_real_escape_string($_mid);
$fs_expired = mysql_real_escape_string($fs_expired);
$user_change = mysql_real_escape_string($user_change);
$login_id = mysql_real_escape_string($login_id);
$usr_name = mysql_real_escape_string($usr_name);
$usr_pass = mysql_real_escape_string($usr_pass);
$hobbies = mysql_real_escape_string($hobbies);
$aboutme = mysql_real_escape_string($aboutme);
$_username = mysql_real_escape_string($_username);
$_membername = mysql_real_escape_string($_membername);
$min_age = mysql_real_escape_string($min_age);
$max_age = mysql_real_escape_string($max_age);
$a_member = mysql_real_escape_string($a_member);
$fname = mysql_real_escape_string($fname);
$username = mysql_real_escape_string($username);
$viewedby = mysql_real_escape_string($viewedby);
$action = mysql_real_escape_string($action);
$view = mysql_real_escape_string($view);
$recipientname = mysql_real_escape_string($recipientname);
?>
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 12:36 pm
by Celauran
Oh my.
You could get rid of the undefined variable notices by checking if each one is set before calling mysql_real_escape_string, though that's really addressing the symptom and not the disease.
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 1:41 pm
by bad959fl
Can I remove this code from the functions.php file? I just want to stop all the error issues from it being called/referenced from the homepage:
Code: Select all
function show_header_chat($Page='home'){
global $conn;
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 1:52 pm
by Celauran
Just those two lines? No. That's the start of a function. You'd need to, at the very least, remove all references to the function, ensure that nothing breaks, and then remove the function itself in its entirety.
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 2:15 pm
by bad959fl
How would I find all references to the function?
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 3:05 pm
by Celauran
grep or your editor's "Find in folder" functionality would be best.
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 3:32 pm
by bad959fl
What should I grep for on the server?
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 3:33 pm
by Celauran
I'd look for the function name in across all the files in the webroot to start.
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 4:59 pm
by bad959fl
I used that grep command and it only found 4 files on the server. What part of the code should I remove to fix these issues? Here is the snippet in those files:
Code: Select all
<?
include "template/header.php";
}//end header
function show_header_chat($Page='home'){
global $conn;
?>
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 6:19 pm
by Celauran
That's the same snippet you posted earlier. It's the beginning of the function definition, but not the whole thing. You'll need to go to the ending brace. More important, you need to check the other files where this function is being called, rather than being defined, and remove the calls to the function.
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 8:57 pm
by bad959fl
I've never worked with PHP so I have no idea how to diagnose/fix this. Can I email you the files to review?
Re: Beginner Needs Help with PHP Errors
Posted: Tue Feb 18, 2014 9:29 pm
by Celauran
Put them up on PasteBin or GitHub or something and we can take a look.