Page 1 of 1
Login with txt to store variables...
Posted: Thu Feb 20, 2003 11:33 am
by molandim
Hi, I'am a stupid in PHP.
I only know actionscript and html .... I know that I can do a script for login that read the variables "name" and "password" in a txt file..
Now...How do that ??
How pull this informations from the txt file ???
Help me !!!

Posted: Thu Feb 20, 2003 12:23 pm
by uberpolak
Do you mean check the values entered in the form against those in a text file? If that's what you're trying to do you could do this (not very secure but it works):
Contents of text file:
Code: Select all
<?php
$name = "whatever you want the acceptable name to be";
$password = "whatever you want the password to be";
?>
Then the script that processes the form could look like this:
Code: Select all
<?php
include("nameofyourtextfile.txt");
if ($_POST['name'] == $name && $_POST['password'] == $password)
{
header("Location: wherever you want to send them if they get it right");
}
else
{
header("Location: wherever they just came from");
}
?>
Like I said, this is not very secure, there are much better ways of doing this. If you want to use user authentication you should probably look into a database, but this will do it from a text file.
Posted: Thu Feb 20, 2003 1:48 pm
by hob_goblin
You shouldn't use the .txt extension, you should use the .php extension, so the password can't be seen by anybody.