spielmeister Posted September 18, 2009 Posted September 18, 2009 Hi Everybody, I'm working on my website. I just barely uploaded the files, did it today, actually. I'm using Windows Vista, Mozilla Firefox. Anyway, I'm writing a website called "MySite.php". it requires an activation code at a different site to be entered in. I type the code, and it leads me to my main site. I know that I've typed the correct code, and everything. only I have a little problem - after MySite.php executes the php code, it won't do the html I want it to. Here is the code for it: <html> <head> <title>Welcome to My Site</title> </head> <body> <?php <?php $code="random"; $code=$_POST["verifycode"]; if ($code!="*************") { echo "You are not a verified user. Go Away."; $blah=5; while ($blah=5) { echo "You are not a verified user. Go Away."; } } else { echo "You are a verified user."; } ?> ?> <frameset cols="120,*"> <frame src="navframe.htm" /> <frame src="default.php" name="showframe" /> </frameset> </body> </html> Do I just need to put the php after the frameset content I want? Or is it an OS problem?
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 Well, when unwanted users went to the page entering the wrong password, then it would say that over and over and over until they had to exit the page and they wouldn't be able to view the content. But I guess the exit function takes care of that. Is it possible to have html tags in the php tags?
Byron Posted September 19, 2009 Posted September 19, 2009 Is it possible to have html tags in the php tags? Yes. You can have html before the php, html after the php or you can echo the html inside the php. It doesn't matter. <html> <head></head> <body> </body> </html> <?php # php code ?> or <?php # php code ?> <html> <head></head> <body> </body> </html> or <?php echo "<html>\n"; echo "<head></head>\n"; echo "<body>\n"; # php code echo "</body>\n"; echo "</html>\n"; ?>
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 Do you have to have the <body> and <head> tags though?
Byron Posted September 19, 2009 Posted September 19, 2009 Do you have to have the <body> and <head> tags though? No. You can have your php inside the html like this: <html> <head></head> <body> <?php # php code ?> </body> </html>
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 That doesn't work though. I enter the verification code and on "MySite.php" it says this: Parse error: syntax error, unexpected '<' in /home/lbpages/public_html/MySite.php on line 17 Here's the code for MySite.php: <html> <head> <title>Welcome to Lincoln's Site</title> </head> <body> <?php $code="random"; $code=$_POST["verifycode"]; if ($code!="****************") { echo "You are not a verified user. Go Away."; exit; } else { <frameset cols="120,*"> <frame src="navframe.htm" /> <frame src="default.php" name="showframe" /> </frameset> } ?> </body> </html>
Byron Posted September 19, 2009 Posted September 19, 2009 You need to echo out the html if it's inside the php like this: <html> <head> <title>Welcome to Lincoln's Site</title> </head> <body> <?php # $code = "random"; # remove this or the code will always see the password $code = $_POST["verifycode"]; if ($code != "****************") { echo "You are not a verified user. Go Away."; exit; } else { # backslash your quotes echo "<frameset cols=\"120,*\">\n"; echo "<frame src=\"navframe.htm\" />\n"; echo "<frame src=\"default.php\" name=\"showframe\" />\n"; echo "</frameset>\n"; } ?> </body> </html>
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 Sorry to keep bothering you about his, but there is still no content! I press ctrl+U in firefox to view the source and it shows this: <html> <head> <title>Welcome to Lincoln's Site</title> </head> <body> <frameset cols="120,*"> <frame src="navframe.htm" /> <frame src="default.php" name="showframe" /> </frameset> </body> </html> should I just not use frameset?
Byron Posted September 19, 2009 Posted September 19, 2009 I just noticed I had my exclamation mark in the wrong place incase you copied my code. It's fixed now. if ($code != "****************") <html> <head> <title>Welcome to Lincoln's Site</title> </head> <body> <?php # $code = "random"; # remove this or the code will always see the password $code = $_POST["verifycode"]; if ($code != "****************") { echo "You are not a verified user. Go Away."; exit; } else { # backslash your quotes echo "<frameset cols=\"120,*\">\n"; echo "<frame src=\"navframe.htm\" />\n"; echo "<frame src=\"default.php\" name=\"showframe\" />\n"; echo "</frameset>\n"; } ?> </body> </html> See if this shows google in the frameset for you after you enter the password. http://byrondallas.heliohost.org/test/login.html
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 It doesn't. Does that mean its a browser problem or an os prob?
Byron Posted September 19, 2009 Posted September 19, 2009 It doesn't. Does that mean its a browser problem or an os prob? It would be a browser problem. Try this real quick and see if you see the google page in the frame. http://byrondallas.heliohost.org/test/login.html
spielmeister Posted September 19, 2009 Author Posted September 19, 2009 sorry about the wait - it did show google.
Byron Posted September 19, 2009 Posted September 19, 2009 Go to your frameset page and add a frameset doctype and remove the <body></body> tags. Frameset doesn't use a body tag. Frameset doctype <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> and remember <frameset cols="120,*"> = navigation on the left <frameset rows="120,*"> = navigation on the top This is a txt version of my frameset page http://byrondallas.heliohost.org/test/lwebsite.txt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now