Witam
moze mi ktos pomoze mam takie dwa skrypty kture działac działaja ale wywalają błedy i niewiem jak to naprawic.
oto index.php
<?php
require('tell_includes.php');
<html>
<head>
<title>Tell-A-Friend</title>
</head>
<body>
<hr>
<?php
if ($_GET['to_do']){
$to_do = $_GET['to_do'];
}
elseif ($_POST['to_do']){
$to_do = $_POST['to_do'];
}
else {
$to_do = "first";
}
switch ($to_do) {
case "first":
$url = getenv("HTTP_REFERER");
if (!$url){
$url = $default_url;
}
echo"<p align='center' style='font-size: 14pt; font-family: $font_face; font-weight: bold;'>Tell-A-Friend</p>";
echo"<p align='center' style='font-size: 14pt; font-family: $font_face; font-style: italic;'>$url</p>";
echo"<p align='left' style='font-size: 9pt; font-family: $font_face;'>If you would like to tell a friend about this website, please complete the form below, then click <i>'Tell-A-Friend!'</i>.</p>";
tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
break;
case "process":
$to_name = $_POST['to_name'];
$to_email = $_POST['to_email'];
$from_name = $_POST['from_name'];
$from_email = $_POST['from_email'];
$url = $_POST['url'];
$comment = $_POST['comment'];
if (!(email_validator($to_email))){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, the e-mail address you entered for your friend is invalid. Please try again, making certain you have entered it correctly."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
if (!(email_validator($from_email))){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, the e-mail address you entered for yourself is invalid. Please try again, making certain you have entered it correctly."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
if (!$to_name){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, forgot to enter your friends name. Please try again."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
if (!$from_name){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, forgot to enter your name. Please try again."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
if (!$url){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, no URL was specified to e-mail to your friend."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
if(!do_email($to_name,$to_email,$from_name,$from_email,$url,$comment,$ip)){
echo"<p align='left' style='font-size: 10pt; font-family: $font_face;'><font color='#FF0000'>Error:</font> Sorry, there was an error when trying to e-mail your friend. Please try again later."; tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment);
}
else {
echo"<p align='center' style='font-size: 14pt; font-family: $font_face; font-weight: bold;'>E-Mail Sent</p>";
echo"<p align='left' style='font-size: 9pt; font-family: $font_face;'>An e-mail has been sent to <b>$to_email</b> with the information you just entered.<br><br><a href='$url'>Click here</a> to go back to the website you recommended.</p>";
}
}
}
}
}
}
break;
case "version":
echo"<p align='left' style='font-size: 9pt; font-family: $font_face;'>You are currently using version <b>$version</b> of the Starsol Tell-A-Friend script. The latest version may be downloaded for free at <a href='http://www.starsol.co.uk/scripts/' target='_blank'>Starsol Scripts</a>.</p>";
break;
}
echo"<p align='center' style='font-size: 8pt; font-family: $font_face; color: #888888'>Powered by <a href='http://www.starsol.co.uk/scripts/' target='_blank'>Starsol</a> Tell-A-Friend version $version.</p>";
?>
<hr>
</body>
</html>
<?php // AND THIS LINE ?>
ten skrypt wywala mi cos takiego
Notice: Undefined index: to_do in /home/compart1/public_html/pruba/tell.php on line 38 Notice: Undefined index: to_do in /home/compart1/public_html/pruba/tell.php on line 41
Notice: Undefined variable: to_name in /home/compart1/public_html/pruba/tell.php on line 64 Notice: Undefined variable: to_email in /home/compart1/public_html/pruba/tell.php on line 64 Notice: Undefined variable: from_name in /home/compart1/public_html/pruba/tell.php on line 64 Notice: Undefined variable: from_email in /home/compart1/public_html/pruba/tell.php on line 64 Notice: Undefined variable: comment in /home/compart1/public_html/pruba/tell.php on line 64
teraz tell_includes.php
<?php
$font_face = "Verdana,Arial";
$default_url = "http://www.starsol.co.uk/scripts/";
$starsol_credit = "1";
$show_ip = "1";
function do_email($to_name,$to_email,$from_name,$from_email,$url,$comment,$ip){
global $starsol_credit, $show_ip;
$message = "$from_name ($from_email) visited the following website and thought it may be of interest to you:\n\n$url\n\n";
if ($comment != ""){
$message = $message . "$from_name also said:\n$comment\n\n";
}
if ($show_ip == "1" OR $show_ip == "2"){
if ($show_ip == "1"){
$ip = asterisk_ip($ip);
}
$message = $message . "The IP address for the person who sent this note was $ip.\n\n";
}
if ($starsol_credit == "1"){
$message = $message . "~~~~~\nTell-a-friend script powered by Starsol Scripts.\nhttp://www.starsol.co.uk/scripts/";
}
if(!mail("$to_email","$to_name, A recommendation from $from_name","$message","FROM:$from_email")){ return FALSE;
}
else {
return TRUE;
}
}
function email_validator($email_address){
if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email_address)) { return TRUE;
}
else {
return FALSE;
}
}
function asterisk_ip($ip){
$ip_fragments[3] = "***";
$ip = "$ip_fragments[0].$ip_fragments[1].$ip_fragments[2].$ip_fragments[3]";
return $ip;
}
function tell_form($to_name,$to_email,$from_name,$from_email,$url,$comment){
echo"<form action='tell.php' method='post'>"; echo"<input type='hidden' name='to_do' value='process'>"; echo"<input type='hidden' name='url' value='$url'>"; echo"<font style='font-size: 9pt; font-family: $font_face;'>"; echo"Friend's Name<br><input type='text' name='to_name' value='$to_name' size='30'><br><br>"; echo"Friend's E-Mail<br><input type='text' name='to_email' value='$to_email' size='30'><br><br>"; echo"Your Name<br><input type='text' name='from_name' value='$from_name' size='30'><br><br>"; echo"Your E-Mail<br><input type='text' name='from_email' value='$from_email' size='30'><br><br>"; echo"Any other comments you would like to send to your friend:<br><textarea name='comment' cols='35' rows='8'>$comment</textarea><br><br>"; echo"<input type='submit' value='Tell A Friend!'>"; }
$version = "1.01";
?>
i to mi wywala cos takiego
Notice: Undefined index: to_do in /home/compart1/public_html/pruba/tell.php on line 38
juz niewiem co z tym zrobic prosze o pomoc