Soldato
Doesn't matter now anyway I've built a password reset script so that users can get their passwords reset to a random combination of letters and numbers then emailed to them
kiwi said:could they not write their own encyption? for example a simple ROT-13 would leave the password unreadable if database access was gained. obviously, they would use a cyper that's a little harder to break
<? if($page) { include("pages/$page.php"); } else { include("pages/pagenumber.php"); } ?>
<? if($file) { include("directory/$file.php"); } else { include("pages/pagenumber.php"); } ?>
<?php
// Name your content files with this extension,
// and pass the page without the extension
// Example: content in page1.inc.php, url will be
// thisfile.php?page=page1
$extension = '.inc.php';
// Strip HTML
$page = strip_tags($_GET['page']);
// Strip double full stops to stop people navigating outside the current directory
$page = str_replace('..', '', $page);
// Strip any characters that aren't word characters, -, _ or . for a number of reasons
$page = preg_replace('|[^\w-_\.]|', '', $page);
if(file_exists(dirname(__FILE__).'/'.$page.$extension)) {
include $page.$extension;
} else {
include 'default'.$extension;
}
?>
robmiller said:If people insist on using the oh-so inferior ?page=* method, then here's a script that isn't like a colander.
Code:snip
What's that ment to do ?Ben said:Craig,
try ?page=../index
should keep the server busy for a while
also using register_globals... tut tut!
Craig321 said:What's that ment to do ?
Does nothing
Warning: feof(): supplied argument is not a valid stream resource in /home/nykampm/public_html/cnupload/pages/1.php on line 44
Warning: fgets(): supplied argument is not a valid stream resource in /home/nykampm/public_html/cnupload/pages/1.php on line 45
Craig321 said:robmiller:
That doesn't do a includes thing to show a page on the index file itself does it?
Anyways, that script I gave doesn't allow people to navigate outside the directory
<?php
/************************* INCLUDE PAGE ***********************/
$pages = array (
"home" => "home.php",
"news" => "news.php",
"news_archive" => "news_archive.php",
"gallery" => "gallery.php",
"movie" => "movie.php",
"downloads" => "downloads.php",
"team" => "team.php",
"stats" => "stats.php",
"contact" => "contact.php",
"movie" => "movie.php",
"admin" => "admin_login.php",
"mail_confirm" => "mail_confirm.php",
"mail_result" => "mail_result.php",
);
$path = strip_tags ($_GET['path']);
$page = strip_tags ($_GET['page']);
$include = "pages/";
if (!$page) {
$include .= "news.php";
$self = $_SERVER['PHP_SELF']."?page=news";
}
elseif (array_key_exists ($page, $pages) AND !file_exists ($include.$pages[$page])) {
$include .= "construction.php";
$self = $_SERVER['PHP_SELF']."?page=".$page;
}
elseif (!array_key_exists ($page, $pages)) {
$include .= "not_found.php";
$self = $_SERVER['PHP_SELF']."?page=".$page;
}
else {
$include .= $pages[$page];
$self = $_SERVER['PHP_SELF']."?page=".$page;
}
if (file_exists ($include)) {
include ($include);
}
?>
So is it unsafe????robmiller said:Looks ok, but you don't need to define $self, seen as what you're defining it to will just be the same as $_SERVER['REQUEST_URI'] anyway
clogiccraigm said:Is phpInfo(); dangerous?
Craig321 said:Rob, please can you email me an example of how they could get out of the directory
Not here cause someone might wanna use it
Thanks.
(Email in trust)