Simple Script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gogobg
Forum Newbie
Posts: 3
Joined: Thu Mar 27, 2008 6:57 am

Simple Script

Post 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!
Strike
Forum Newbie
Posts: 3
Joined: Thu Mar 27, 2008 8:17 am
Location: Tabluha,Egypt.

Re: Simple Script

Post 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!');?>
User avatar
gogobg
Forum Newbie
Posts: 3
Joined: Thu Mar 27, 2008 6:57 am

Re: Simple Script

Post by gogobg »

What do you mean by "more secure"?
Post Reply