View Full Version : ?? login ??


nubs
01-02-2006, 11:27 PM
i was wanting to know is there a login script/member script ....that dont need to run on a database ?....if so where would i get it ...??

iGeek
01-03-2006, 04:25 AM
All member and login scripts require a database to store the different users and such. Its possible to have ONE username and everyone would get the same access. Like, perhaps you wanted to just require a password to access. You'd make a simple form, then give them the general password. But if you wanted a nice smooth login with different members then yes you'd need a database or some way to store and retrieve login info.

nubs
01-03-2006, 05:11 PM
ok i got a member script here and its not wanting to work for me :( heres the errors im geting


Warning: main(INC_DB) [function.main]: failed to open stream: No such file or directory in C:\Program Files\Abyss Web Server\htdocs\SimpleMember\main.php on line 95

Fatal error: main() [function.require]: Failed opening required 'INC_DB' (include_path='.;C:\php5\pear') in C:\Program Files\Abyss Web Server\htdocs\SimpleMember\main.php on line 95

can some one help me?

putnamehere
01-03-2006, 05:16 PM
Yeah database being were all the data is stored so for a membership system the passwords and names have to be stored somewere.
I created this "membership system" without a mysql database if thats what you mean? Just copy the code into the appropate files and make a text file called database.txt outside of your htdocs, makeing it secure, if not more secure than a mysql database.
First file, Register.php

<?php
$addmem = "../private/database.txt";
$username = $_POST['username'];
$password = $_POST['password'];
$pass = $_POST['pass'];
$i = 0;
$data = file( "../private/database.txt" );
$email = $_POST['email'];


if ($pass == $password)

{
$duplicate = false;
foreach ($data as $line) {
if(preg_match("#".$username."#",$line))
{
$duplicate = true;
break;
}
}

if($duplicate) {
echo '<font color=red>ERROR: The username is alredy in use please chose another username.</font><p>





<FORM ACTION="register.php" METHOD="POST" NAME=register">
Username:<BR>
<INPUT TYPE="text" SIZE="30" maxlenght=12 NAME="username" style=\"text-transform: lowercase;\"><br>
Password:<br>
<INPUT TYPE="password" SIZE="30" maxlenght=20 NAME="password"><BR>
Confirm password:<br>
<INPUT TYPE="password" SIZE="30" maxlenght=20 NAME="pass"><BR>
Email:<br>
<INPUT TYPE="TEXT" SIZE="30" maxlenght=20 NAME="email"><BR>

<INPUT TYPE="submit" NAME="submit" VALUE="Register">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="register.html">Register</a><BR>
</FORM>

';
exit;
} else {
echo 'Username available';
}

$file = fopen ( $addmem, "a+") ;
fwrite ( $file, "
$username $password" ) ;
fclose ( $file ) ;
echo ( " Thank you for registering $username. You may now log in

<FORM ACTION=login.php?ref=index.php METHOD=POST NAME=login>
Username:<BR>
<INPUT TYPE=text SIZE=30 maxlenght=12 NAME=username><BR>
Password:<br>
<INPUT TYPE=password SIZE=30 maxlenght=20 NAME=password><BR>

<INPUT TYPE=submit NAME=submit VALUE=Sign in>" );




$headers = "From: PHPCodes <Registrations@phpcodes.co.uk> \r\n";



mail("$email", "Account Infomation", "Welcome to *website name* $username
----- Account Infomation ----
Username: $username
Password: $password


", $headers);









}



else
{
echo ( "The passwords didn't match" );
}
?>

nubs
01-03-2006, 06:59 PM
i was just wanting to know how to fix that errors above........

Douglas
01-03-2006, 08:20 PM
You'll have to post the code please :)