Page 1 of 1

Simple Script

Posted: Thu Mar 27, 2008 7:13 am
by gogobg
Hello. I'm trying to build this script and i've some problems whit it.
Now, becouse my knowledges of PHP are too low, some parts of the script are still going to be edited by hand.

What i'm trying to do:

I've this:

Code: Select all

 
<?php
$pass0='';
$pass1='pass1';
$pass2='pass2';
$pass3='pass3';
 
if($_POST['password']==$pass0)
require('file0.php');
elseif($_POST['password']==$pass1)
require('file1.php');
elseif($_POST['password']==$pass2)
require('file2.php');
elseif($_POST['password']==$pass3)
require('file3.php');
 
else {
echo "wrong password"
}
?>
 
Now my question is, can I do this with one file instead of 3-4 files (file0.php, file2.php etc.)?
I mean, if this script is my index, then it search in file called f.ex. passwords.php where is the content of file0, file1... and when I type right pass to show me another part of this file.

If I can't make myself clear I can give you a link to see.
Thank you!

Re: Simple Script

Posted: Thu Mar 27, 2008 8:27 am
by Strike
gogobg wrote: Now my question is, can I do this with one file instead of 3-4 files (file0.php, file2.php etc.)?
Yes, you can.
here is short Exaple for Password.php

Code: Select all

<?
switch($_GET['inc'])
{
case "file0":
//piece of Code
break;
case "file1":
//piece of Code
break;
case "file2":
//piece of Code
break;
}
?>
 
I think u should make ur script more securer but for now it should be enough.

<?=die('My Signature!');?>

Re: Simple Script

Posted: Thu Mar 27, 2008 11:19 am
by gogobg
What do you mean by "more secure"?