Using
funtion head{
$mime = ((stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) ? "application/xhtml+xml" : "text/xhtml");
$charset = "utf-8";
header("content-type:$mime;charset=$charset");
$ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >";
$ret .= "<head>";
$ret .= "<title>title</title>";
return $ret; }
funtion footer{ $ret ="</body>"; $ret .="</html>"; return $ret; }
Php pages
Collapse
X
-
Nothing really but the way i did mine if page will load if it had nomal page..
Leave a comment:
-
Thats it bro, with }else{ function is something I need. Maybe better than standard error page.
Thanks!
And whats the difference with
$action = strip_tags(trim($_GET['action'])); and $_GET[action] ?
Leave a comment:
-
DEMO http://chat4u.ath.cx/page/test.php
PHP Code:
<?php
$action = strip_tags(trim($_GET['action']));
/////////////////////////////////////////////////////
function head()
{
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\">
<html>";
}
function footer()
{
echo "</body></html>";
}
////////////////////////////////////////////////////
// INDEX PAGE
if($action == "")
{
head();
echo '<p><a href="?action=friends">TRY ME</a></p>';
footer();
exit();
}
if($action == "friends")
{
head();
echo '
Site Friends<hr/>
<div><a href="http://">link</a></div>
<div>> <a href="http://">link</a></div>';
footer();
exit();
}else{
head();
echo '404 ERROR PAGE';
footer();
exit();
}
?>
Do you know you can change $action = strip_tags(trim($_GET['action'])); to $_GET[action]
like this
if($_GET[action] == "")
{
head();
echo '<p><a href="?action=friends">TRY ME</a></p>';
footer();
exit();
}
if($_GET[action] == "friends")
{
head();
echo '
Site Friends<hr/>
<div><a href="http://">link</a></div>
<div>> <a href="http://">link</a></div>';
footer();
exit();
}
Leave a comment:
-
Yes, just to send browser to classic Not Found page if the requested variable does not exists or is undefined, not to make it my self (thats not itnerestingOriginally posted by subzero View Postdo you want to make a error page ??
like i type link.com?action=admin
it will show
ERROR PAGE NOT FOUND!!
or you want to block hiden browsers ?
).
Does if(isset) function doing something good for this? :D
Right now I get just blank page.Last edited by arnage; 15.11.09, 20:08.
Leave a comment:
-
do you want to make a error page ??
like i type link.com?action=admin
it will show
ERROR PAGE NOT FOUND!!
or you want to block hiden browsers ?
Leave a comment:
-
Thanks Something else, thats which is what I feared because the index page is there. Is this a security whole?
Subzero, thanks bro, I use somethong like body.php for other pages because it is with prohibition of anonymous browser, do not whant to forbidd it on index.
Is something like this solution for all variables and if someone can code it ? :
if ("non existent or unvalid variable")
{
header('HTTP/1.1 404 Not Found');
exit();
}
Or something like......?
Leave a comment:
-
You don't need to add header() function this will show up all pagesCode:<?php $action = strip_tags(trim($_GET['action'])); ///////////////////////////////////////////////////// echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\"> <html>"; function footer() { echo "</body></html>"; } //////////////////////////////////////////////////// // INDEX PAGE if($action == "") { echo '<p><a href="?action=friends">TRY ME</a></p>'; echo footer(); exit(); } if($action == "friends") { echo ' Site Friends<hr/> <div><a href="http://">link</a></div> <div>> <a href="http://">link</a></div>'; echo footer(); exit(); } ?>
You can use footer() function thou as it will read it thou there...
if you want to be smart try using include("body.php");
then use headers and footer function !!
But you may find a error using the name header to change it to head
like this
Code:<?php $action = strip_tags(trim($_GET['action'])); ///////////////////////////////////////////////////// function head() { echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\"> <html>"; } function footer() { echo "</body></html>"; } //////////////////////////////////////////////////// // INDEX PAGE if($action == "") { head(); echo '<p><a href="?action=friends">TRY ME</a></p>'; footer(); exit(); } if($action == "friends") { head(); echo ' Site Friends<hr/> <div><a href="http://">link</a></div> <div>> <a href="http://">link</a></div>'; footer(); exit(); } ?>
Leave a comment:
-
blabla is not a varibile so u would end up with a blank page....
however your not your ending up with a status code 404 error page
which means that index.php doesnt exsist
Leave a comment:
-
Php pages
Please can someone code this right
When in url write ie http://site.tld/index.php?action=blabla , it does not get Error 404 page, gets something blank...PHP Code:<?php
$action = strip_tags(trim($_GET['action']));
function header()
{
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">
<html>';
}
function footer()
{
echo '
</body></html>';
}
// INDEX PAGE
if($action == "")
{
echo header();
echo '<p>...</p>';
echo footer();
exit();
}
if($action == "friends")
{
echo header();
echo '
Site Friends<hr/>
<div><a href="http://">link</a></div>
<div>> <a href="http://">link</a></div>';
echo footer();
exit();
}
?>
Tags: None
Leave a comment: