runnerjp Posted March 16, 2007 Share Posted March 16, 2007 Fatal error: Call to undefined function: validateemail() <?php session_start(); include 'http://www.runnerselite.com/config.php'; $ses_id2 = session_id(); if(!$ses_id2 == $_SESSION['ses_id']) { $ErrorMsg = 'Error, session ID mismatch.'; $_SESSION['errormsg'] = $ErrorMsg; header('Location: '.$ErrorDomain.''); exit(); } $Name = $_POST['name']; $Email = $_POST['email']; $Comment = $_POST['comment']; $_SESSION['name'] = $Name; $_SESSION['email'] = $Email; $_SESSION['comment'] = $Comment; if (($Name == NULL) || ($Email == NULL) || ($Comment == NULL)) { $ErrorMsg = 'Error, please make sure all fields are filled in.'; $_SESSION['errormsg'] = $ErrorMsg; header('Location: '.$ErrorDomain.''); exit(); } if (!ValidateEmail($Email)) { $ErrorMsg = 'Error, invalid email address supplied.'; $_SESSION['errormsg'] = $ErrorMsg; header('Location: '.$ErrorDomain.''); exit(); } $time = time(); $datetime = date("D, M jS Y / g:ia", $time); $ip = $_SERVER["REMOTE_ADDR"]; $message = ' <html> <head> <title>'.$subject.'</title> </head> <body> <p><strong>Name:</strong> '.$Name.'</p> <p><strong>E-mail:</strong> '.$Email.'</p> <p><strong>Comment / Question:</strong></p> <p>'.SafeHTML($Comment).'</p> <p><strong>Sent on:</strong> '.$datetime.'</p> <p><strong>Logged IP Address:</strong> '.$ip.'</p> </body></html>'; $headers = "MIME-Version: 1.0rn"; $headers .= "Content-type: text/html; charset=iso-8859-1rn"; $headers .= "From: $emailrn"; mail($to, $subject, $message, $headers); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <title>Contact Form - Thank You</title> <style type="text/css"> body { margin: 0px; padding: 100px; background: #fafafa; font-family: verdana, Arial, sans-serif; font-size: 11px; line-height: 18px; } #Wrapper { margin: 0 auto; padding: 10px; width: 500px; background: #fff; border: 1px solid #999999; } </style> </head> <body> <div id="Wrapper"> <h1>Thank You</h1> <p>Thank you <?=$Name?>, your comment/question has been received. The following information has been sent;</p> <p><strong>Name:</strong> <?=$Name?></p> <p><strong>E-mail:</strong> <?=$Email?></p> <p><strong>Comment / Question:</strong></p> <p><?=SafeHTML($Comment)?></p> </div> </body> </html> then it send it to the which is config.php <?php function SafeHTML($string) { $string = stripslashes($string); $string = htmlspecialchars($string); return nl2br($string); } /* The function 'SafeHTML' helps to protect you from being sent HTML emails via your contact form. http://us2.php.net/manual/en/function.htmlspecialchars.php * & (ampersand) becomes & * " (double quote) becomes " * ' (single quote) becomes ' *< (less than) becomes < *> (greater than) becomes > */ function ValidateEmail($Email){ $result = ereg("^[^@ ]+@[^@ ]+.[^@ .]+$", $Email); if ($result){ return true; } else { return false; } } /* The 'ValidateEmail' function checks to see if the email provided is that of the structure of a real email address ([email protected]). It doesn't check if the email address is a REAL address ... it just checks the format. */ $ErrorDomain = "http://www.runnerselite.com/contact.php?error=1"; /* The '$ErrorDomain' variable stores the URL the browser should re-direct to should any errors be encountered. Whatever you change the URL to, make sure you keep '?error=1' at the end. */ $to = "Admin<[email protected]>"; $subject = "password"; /* '$to' is your email address, where the form shall be sent to. '$subject' is the subject of the email. */ ?> Link to comment https://forums.phpfreaks.com/topic/43011-solved-call-to-underfined-function/ Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 the problem is how you are including it, you are including it via the virtual location which does not produce the original code. You must include it by the absolute path include 'http://www.runnerselite.com/config.php'; should be include '/actual/location/to/path/on/server/config.php Link to comment https://forums.phpfreaks.com/topic/43011-solved-call-to-underfined-function/#findComment-208897 Share on other sites More sharing options...
runnerjp Posted March 16, 2007 Author Share Posted March 16, 2007 ok but i chnaged it and now im getting Warning: main(include/config.php): failed to open stream: No such file or directory in /home/runnerse/public_html/include/contactlost2.inc.php on line 3 Warning: main(include/config.php): failed to open stream: No such file or directory in /home/runnerse/public_html/include/contactlost2.inc.php on line 3 Warning: main(): Failed opening 'include/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/runnerse/public_html/include/contactlost2.inc.php on line 3 Fatal error: Call to undefined function: validateemail() in /home/runnerse/public_html/include/contactlost2.inc.php on line 28 Link to comment https://forums.phpfreaks.com/topic/43011-solved-call-to-underfined-function/#findComment-208910 Share on other sites More sharing options...
runnerjp Posted March 16, 2007 Author Share Posted March 16, 2007 i also tried putting /include/config.php Link to comment https://forums.phpfreaks.com/topic/43011-solved-call-to-underfined-function/#findComment-208929 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 Warning: main(include/config.php): failed to open stream: No such file or directory in /home/runnerse/public_html/include/contactlost2.inc.php on line 3 Are you sure that the file exists in that path? Link to comment https://forums.phpfreaks.com/topic/43011-solved-call-to-underfined-function/#findComment-208951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.