Show DevBest [PHP] [REL] Very simple register & login script

Status
Not open for further replies.

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
Here's a download of the entire thing:
100% credit to monsta.
Thanks m0nsta. it's great!

NOTE:
I forgot to put the code into Register.php, my bad!
I also found out that replacing index.php with:
PHP:
<?php
include( "db.php" );
 
if ( isset( $_SESSION['loggedin'] ) == "1" )
{
include("main.php");
}
else
{
echo "You are not logged in. <a href=\"login.php\">Login</a> or <a href=\"register.php\">Register</a>";
}
?>
makes it so you have to be logged it to see that page, although people that are "savy" enough can just go to
your-awesome-site-with-marks-code-on-it.com/main.php
But still there's ways of making it so people can't get to the page. I think?
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Hey there, changed and optimized the code and such also edited the readme for contributions :)

 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Hey there, changed and optimized the code and such also edited the readme for contributions :)

Nice, but may I ask why you did this in db.php:

PHP:
$config = array(
    'DATABASE_HOST' => "localhost"// Database hostname (default: localhost)
    'DATABASE_USER' => "root"// Database username (default: root)
    'DATABASE_PASS' => ""// Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);
 
$config['DATABASE_HOST'] = "localhost"; // Database hostname (default: localhost)
$config['DATABASE_USER'] = "root"; // Database username (default: root)
$config['DATABASE_PASS'] = ""; // Database password (default: <empty>);
$config['DATABASE_NAME'] = "simplelogin"; // Database name (default: simplelogin)

You made two arrays containing the same keys and values, but created the differently lol
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Nice, but may I ask why you did this in db.php:

PHP:
$config = array(
    'DATABASE_HOST' => "localhost"// Database hostname (default: localhost)
    'DATABASE_USER' => "root"// Database username (default: root)
    'DATABASE_PASS' => ""// Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);
 
$config['DATABASE_HOST'] = "localhost"; // Database hostname (default: localhost)
$config['DATABASE_USER'] = "root"; // Database username (default: root)
$config['DATABASE_PASS'] = ""; // Database password (default: <empty>);
$config['DATABASE_NAME'] = "simplelogin"; // Database name (default: simplelogin)

You made two arrays containing the same keys and values, but created the differently lol

That was a failure on my side ( I was first making the $config[<key>] = <value> but then I thought the array variable was easier - you can just delete one of them (which one you think is easiest). Thanks for finding that, I knew I forgot something :p
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
That was a failure on my side ( I was first making the $config[<key>] = <value> but then I thought the array variable was easier - you can just delete one of them (which one you think is easiest). Thanks for finding that, I knew I forgot something :p
You also forgot the commas to separate each of the keys ;P

This
PHP:
$config = array(
    'DATABASE_HOST' => "localhost"// Database hostname (default: localhost)
    'DATABASE_USER' => "root"// Database username (default: root)
    'DATABASE_PASS' => ""// Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);

Should be:
PHP:
$config = array(
    'DATABASE_HOST' => "localhost", // Database hostname (default: localhost)
    'DATABASE_USER' => "root", // Database username (default: root)
    'DATABASE_PASS' => "", // Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);

:p
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
You also forgot the commas to separate each of the keys ;P

This
PHP:
$config = array(
    'DATABASE_HOST' => "localhost"// Database hostname (default: localhost)
    'DATABASE_USER' => "root"// Database username (default: root)
    'DATABASE_PASS' => ""// Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);

Should be:
PHP:
$config = array(
    'DATABASE_HOST' => "localhost", // Database hostname (default: localhost)
    'DATABASE_USER' => "root", // Database username (default: root)
    'DATABASE_PASS' => "", // Database password (default: <empty>);
    'DATABASE_NAME' => "simplelogin"// Database name (default: simplelogin)
);

:p

Oops, my mistake - was in a rush (made it in school) - but thanks :D
 
Status
Not open for further replies.

Users who are viewing this thread

Top