Jump to content

i can't seem to get this page to redirect..


cascer1

Recommended Posts

hello,

 

so i have this contact page on my website, but i want people to actually know if the mail got sent or not, so i first have contact.php, which sends all the information to sendmail.php, which in turn tells redirect.php wether or not the mail was sent, and redirect.php then shows this information for the user to see, and has a 10 second timer before users get sent back..

 

here is the website: http://hcg.drokz.eu.clanservers.com/

 

all files are in the same folder

 

 

so here is my code: 

 

<?php $url1 = 'redirect.php?sent=sent'; $url2 = 'redirect.php?sent=fail'; $timeout = 0; ?>

<?php $to = "[email protected]"; 
$name = $_REQUEST['name'] ;
$subjectm = $_REQUEST['subject'] ;
$subject = "contact form entry on the hcg website by $name with the subject $subjectm"; 
$email = $_REQUEST['email'] ; 
$message = $_REQUEST['message'] ; 
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ; ?>


<?php if($sent) {header('Refresh: ' . $timeout . ';url=' . $url1); ?>

<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url1); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url1); ?>";}, <?php echo($timeout * 1000); ?>);
</script>
<?php } ; ?>

<?php else {header('Refresh: ' . $timeout . ';url=' . $url2); ?>

<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url2); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url2); ?>";}, <?php echo($timeout * 1000); ?>);
</script> 
<?php } ; ?>
  

<a href='contact.php'> this page should redirect you, if nothing happens, click here! </a>

 

<?php 
$sent = $_GET['sent'] ;
?>

<?php $url = 'contact.php'; $timeout = 10; ?>

<?php header('Refresh: ' . $timeout . ';url=' . $url); ?>
<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url); ?>";}, <?php echo($timeout * 1000); ?>);
</script>

    <h1>
<?php
if($sent == sent) {echo "Success!" } ;
elseif($sent == fail) {echo "Failure!" } ;
?></h1>
    <?php
if($sent == sent) {echo "your email has been sent successfully and we will reply as soon as we can."} ;
elseif($sent == fail) {echo "we have encountered a problem while sending your email, please try again!"} ;
?>
<p>
<a href='contact.php'> this page will redirect you in 10 seconds, if nothing happens or you can't wait, click here! </a>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.