What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Php Help

Php Help
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Php Help
you just use file_exists

http://au.php.net/manual/en/function.file-exists.php

so you could use
code:
$file = "path to file here";
if (!file_exists($file)) {
die("page can not be found");
}

just put it before anything echo's in your code and when the file can not be found it will echo "page can not be found" then kill the script

so in your script it would be something like

code:

<?php
$page = htmlentities($_GET['page']) ;
$language = htmlentities($_GET['lan']) ;
if (!isset($_GET['page'])) {
if(!isset($_GET['lan'])) {
include ("pages/code/home.txt");
}
else {
$file = "pages/code/$language.txt";
if (!file_exists($file)) { die("page can not be found");}

include ("$file");

}
}
else {
$file = "pages/code/$language/$page.txt";
if (!file_exists($file)) { die("page can not be found");}

include ("$file");
}
?>

[/code]

This post was edited on 01-22-2005 at 10:32 AM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
01-22-2005 10:25 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Php Help - by Stigmata on 01-22-2005 at 10:18 AM
RE: Php Help - by -dt- on 01-22-2005 at 10:25 AM
RE: Php Help - by Stigmata on 01-22-2005 at 10:31 AM
RE: Php Help - by -dt- on 01-22-2005 at 10:33 AM
RE: Php Help - by Stigmata on 01-22-2005 at 10:37 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On