|
| ||||||||||
| Tags: how to, php, script, scripting language, webpage |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to Redirect to New WebPage in PHP
Code: <?php
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
if($action=="subscribe"){
$id=time();
$rand=rand(10000,1000000000);
if($group!="" && $name!="" && $email!=""){
$vef=explode("@",$email);
if(strlen($vef[0])>="2"&&strlen($vef[1])>="2"){
$lday =date("D d");
$lmonth =date("M");
$lyear =date("Y");
$sdate="$lday-$lmonth-$lyear";
$g=fopen("subscribers/$group/$id$rand&~@&.php","w");
fwrite($g,"<?php \n");
fwrite ($g, '$content="');
fwrite ($g, $name);
fwrite ($g, "|Ä0_è|");
fwrite ($g, $email);
fwrite ($g, "|Ä0_è|");
fwrite ($g, $sdate);
fwrite ($g, "|Ä0_è|");
fwrite ($g, "\"; ?>");
fclose ($g);
echo"<FONT COLOR=blue face=arial>Thank you for subscribing with us</FONT><BR>";
}
}else{
echo"<FONT COLOR=red face=arial>Please fill in the form properly.</FONT><BR>";
}
}
echo "<form method=post action=?action=subscribe>";
echo "<Table width=80%><TR><TD width=15%></TD>
<TD width=80%>Name
<input type='text' name='name' title='Enter Your Name' style='font-size:12px'></TD></TR><TR><TD width=15%> </TD><TD width=80%>Email:
<input type='text' name='email' title='Enter Email Address' style='font-size:12px'></TD></TR><TR><TD width=15%><input type=hidden name=group
value='$group'><BR><BR></TD><TD width=80%><input type='submit' value='Submit Your Information' style='font-size:18px'></TD></TR></Table>
</form>";
?> |
|
#2
| |||
| |||
| re: How to Redirect to New WebPage in PHP
Hello I have seen your code and I think you have not entered the redirect code and so therefore you should try to add proper redirect code on your subscriber’s script and after that let me: Code: $url = 'thepageyouwanttogoto.html';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; |
|
#3
| |||
| |||
| re: How to Redirect to New WebPage in PHP
Hello thanks for the reply and I have tried your code and this helped me with only one browser. After trying your code I have tested with Google chrome and working perfectly without any issue but when I have tried with the Firefox and Internet explorer nothing happens. I have tried the lots of solution but nothing helped me to solve mien issue, I have removed all my cookies and history but doesn’t helped me to solve mine issue. Please suggest me what should I do here is my PHP code: Code: <?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','subject','message');
$required = array('name','email','subject','message');
$your_email = "me@mine.co.uk";
$email_subject = "Enquiry: ".$_POST['subject'];
$email_content = "Enquiry message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'company') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(@mail($your_email,$email_subject,$email_content))
{
$url = 'http://www.mine.co.uk/thankyou.html"';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
} else {
echo 'ERROR!';
}
}
?> |
|
#4
| |||
| |||
| Re: How to Redirect to New WebPage in PHP
Ok I have created the PHP Redirect Script from below method and you can implement this: First of all You can easily redirect using following code: Code: <?php
/* Redirect browser */
header("Location: http://theos.in/");
/* Make sure that code below does not get executed when we redirect. */
exit;
?> Code: <?php
$var="something";
echo "Hello world";
echo $var;
/****************************************************
* Remember that header() must be called before any actual output is sent,
* either by normal HTML tags, blank lines in a file, or from PHP.
*****************************************************/
header("Location: http://theos.in/");
exit;
?> Code: function movePage($num,$url){
static $http = array (
100 => "HTTP/1.1 100 Continue",
101 => "HTTP/1.1 101 Switching Protocols",
200 => "HTTP/1.1 200 OK",
201 => "HTTP/1.1 201 Created",
202 => "HTTP/1.1 202 Accepted",
203 => "HTTP/1.1 203 Non-Authoritative Information",
204 => "HTTP/1.1 204 No Content",
205 => "HTTP/1.1 205 Reset Content",
206 => "HTTP/1.1 206 Partial Content",
300 => "HTTP/1.1 300 Multiple Choices",
301 => "HTTP/1.1 301 Moved Permanently",
302 => "HTTP/1.1 302 Found",
303 => "HTTP/1.1 303 See Other",
304 => "HTTP/1.1 304 Not Modified",
305 => "HTTP/1.1 305 Use Proxy",
307 => "HTTP/1.1 307 Temporary Redirect",
400 => "HTTP/1.1 400 Bad Request",
401 => "HTTP/1.1 401 Unauthorized",
402 => "HTTP/1.1 402 Payment Required",
403 => "HTTP/1.1 403 Forbidden",
404 => "HTTP/1.1 404 Not Found",
405 => "HTTP/1.1 405 Method Not Allowed",
406 => "HTTP/1.1 406 Not Acceptable",
407 => "HTTP/1.1 407 Proxy Authentication Required",
408 => "HTTP/1.1 408 Request Time-out",
409 => "HTTP/1.1 409 Conflict",
410 => "HTTP/1.1 410 Gone",
411 => "HTTP/1.1 411 Length Required",
412 => "HTTP/1.1 412 Precondition Failed",
413 => "HTTP/1.1 413 Request Entity Too Large",
414 => "HTTP/1.1 414 Request-URI Too Large",
415 => "HTTP/1.1 415 Unsupported Media Type",
416 => "HTTP/1.1 416 Requested range not satisfiable",
417 => "HTTP/1.1 417 Expectation Failed",
500 => "HTTP/1.1 500 Internal Server Error",
501 => "HTTP/1.1 501 Not Implemented",
502 => "HTTP/1.1 502 Bad Gateway",
503 => "HTTP/1.1 503 Service Unavailable",
504 => "HTTP/1.1 504 Gateway Time-out"
);
header($http[$num]);
header ("Location: $url");
} Code: <?php
@include("/path/to/sitefunctions.php");
movePage(403,"http://www.cyberciti.biz/");
?> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to Redirect to New WebPage in PHP" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to use a url to redirect to different url | Harold Elwin | Technology & Internet | 5 | 23-01-2011 11:08 PM |
| How can i redirect the video to a URL? | M. Rafi | Software Development | 4 | 12-06-2009 11:57 AM |
| To display webpage inside another webpage | Faakhir | Technology & Internet | 3 | 24-03-2009 10:59 AM |
| DNS / redirect email | grudge | Networking & Security | 2 | 24-09-2008 07:00 PM |
| Redirect dns or iis? | The_cobra666 | Windows Server Help | 4 | 05-12-2007 05:47 PM |