עבור לתוכן

איך אפשר לעשות חזרה אוטומטית מקובץ PHP כלשהו לINDEX.PHP ?

Featured Replies

פורסם

יש לי קובץ HTML שהוא טופס "ספר לחבר על האתר"





<html>
<head>
<title>Tell a friend</title>
</head>
<body bgcolor="#ffffff" text="#000000^a€³ link="#0000ff" vlink="#800080^a€³ alink="#ff0000^a€³>
<?
$status = "OK";
$msg="";
$y_email=$_POST['y_email'];
$y_name=$_POST['y_name'];
$f_email=$_POST['f_email'];
$f_name=$_POST['f_name'];
$y_msg=$_POST['y_msg'];
if(substr_count($y_email,"@") > 1 or substr_count($f_email,"@") > 1){
$msg .="Use only one email address<BR>";
$status= "NOTOK";
}
if (!stristr($y_email,"@") OR !stristr($y_email,".")) { // checking your email
$msg .="Your email address is not correct<BR>";
$status= "NOTOK";}
if (strlen($y_name) <2 ) { // checking your name
$msg .="Please enter your name<BR>";
$status= "NOTOK";}
if (!stristr($f_email,"@") OR !stristr($f_email,".")) { // checking friends email
$msg .="Your Friends address is not correct<BR>";
$status= "NOTOK";}
if (strlen($f_name) <2 ) { // checking freinds name
$msg .="Please enter your friend's name<BR>";
$status= "NOTOK";}
if (strlen($y_msg) <2 ) { // checking Message details
$msg .="Please enter your message details<BR>";
$status= "NOTOK";}
if($status=="OK"){ // all validation passed
/////////// Sending the message starts here //////////////
$ref=@$HTTP_REFERER;
/////Message at the top of the page showing the url////
$header_message = "Hi $f_name Your friend $y_name requested you to visit this page [url]http://www.i-olymp.net/olymp/[/url] ";
/// Body message prepared with the message entered by the user ////
$body_message =$header_message."n".$y_msg."n";
$body_message .="";
//// Mail posting part starts here /////////
$headers="";
//$headers = "Content-Type: text/html; charset=iso-8859-1n".$headers;
// Un comment the above line to send mail in html format
$headers4=$y_email; // Change this to change from address
$headers.="Reply-to: $headers4n";
$headers .= "From: $headers4n";
$headers .= "Errors-to: $headers4n";
$subject="Request to visit URL";
mail($f_email,$subject,$body_message,$headers);
////// Mail posting ends here ///////////
echo "<center><font face='Verdana' size='2' color=green>Thank You, Your message was send to $f_name</font></center>";
//////////// Sending the message ends here /////////////
}else{// display the error message
echo "<center><font face='Verdana' size='2' color=red>$msg</font></center>";
}
?>
</body>
</html>


ניתן איכשהו לעשות בסוף הטופס כאשר מקבלים המשתמש מקבל הודעה על קח שההודעה נשלחה , שיהיה טיימר שנגיד יספר 5 שניות אחורה ואז נחזור לINDEX.PHP ?

פורסם

הצורה הפשוטה ביותר זה JS עם טיימר.

<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
window.location = "../index.php"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">

</body>
</html>

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים