Newbie to PHP: Trying to change url and encode it

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

Newbie to PHP: Trying to change url and encode it

Post 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
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

post your php code that is using the header, we can probably solve it for you.
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

Post 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 
}}}
?>
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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....
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

Post 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.
Post Reply