Jump to content

PHP Code Correction... Any Help???


Pavlos1316

Recommended Posts

Hello

 

My code below is written so when somebody tries to skip login page and copy/paste the members page url. to show the msg and redirect to login page.

 

Everything is working exept that it prints not only the msg but the 3 last lines of the code as well. (EOF; } ?>)

 

I tried many things but nothing. Any suggestions? ???

 

<?php
//members page
session_start();
if(empty($Username)){
print<<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head> <meta http-equiv="refresh" content="0;url=/">
</head>
<body>
<center><h1>Unauthorized Access!</h1></center>
<center><h1>Please Register... It is Totally Free!!!</h1></center>
  </body>
</html>
EOF;
}
?>
[/quote]

Link to comment
https://forums.phpfreaks.com/topic/107626-php-code-correction-any-help/
Share on other sites

It's much easier to stop/start PHP:

<?php
//members page
session_start();
if(empty($Username)){
  //Unauthorized page
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head> <meta http-equiv="refresh" content="0;url=/">
</head>
<body>
<center><h1>Unauthorized Access!</h1></center>
<center><h1>Please Register... It is Totally Free!!!</h1></center>
  </body>
</html>
<?php
  exit;
}
?>

??? Ok. My mistake I didn't mention I am new at coding.

 

Last month I did a lot of job in my page. But this is maybe my biggest promblem cause everybody saying that I have just to copy paste the same code to my restricted pages.

 

Can you give me an example of what you are saying???

 

Thanks

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.