Page 1 of 1

Newbie to PHP: Trying to change url and encode it

Posted: Fri Jun 17, 2005 10:33 am
by bradsteele
Hi,

I am trying to redirect my current php page to a htm page that has content, but I can't seem to get the header function to work...is there another way to get a page to redirect in php? I can do it with a small java script (window.location), but after I get the page launched I need to encode it, so that the users can't cut and paste the weblink and share it with their friends?

Any help you can forward me would appreciated.

Brad

Posted: Fri Jun 17, 2005 10:37 am
by phpScott
post your php code that is using the header, we can probably solve it for you.

Posted: Fri Jun 17, 2005 10:47 am
by bradsteele

Code: Select all

<?PHP
if(mysql_affected_rows()==0)	{
 	print "Invalid Username and/or Password.";
   	exit();
									}
	else	{
   print "Successfully logged into system. Redirecting you to Math Trek 7, 8 Web Site";
  // sleep(5);
   ?> 
   //Header("Location: http://www.somewhere.com");
   	<script language="JavaScript">
   	window.location = "http://rwa.occdsb.on.ca/mt78/menu.htm"
	</script>
   <?PHP 
}}}
?>

Posted: Fri Jun 17, 2005 11:21 am
by Chris Corbyn

Code: Select all

<?php
header('Location: your_url.php');

//Other content BELOW the header
?>
Yadda yadda yadda
What do you mean by you need to encode it? You want it to show differently in the web browser? Can still cut & paste though... if it's the URL the browser will visit then nothing can stop people knowing the address....

Posted: Fri Jun 17, 2005 12:04 pm
by bradsteele
Thanks for the info on the encoding, that helps.....as for the code snippet.....does it matter that my destination page is not php? I try using the header exactly where you have placed it in code and it dosn't work.