PHP Regristration Example

DON'T post new tutorials here! Please use the "Pending Submissions" board so the staff can review them first.
Post Reply
User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

PHP Regristration Example

Post by ayu »

In this example i use config.php register.php and index.php

First up is the page that is shown in index when a certain button is pressed

Index.php HERE (the ?> <?php are a little messed since it's taken from my original code)

then we have the config.php where i have all the mysql data and extra functions like string trim and different filters.

config.php HERE

The mysql info in the config.php is very simple, i added it just to make it easier for me to switch between hosts if needed (which i am in fact doing atm)



Code: Select all

session_start();

/*Page settings*/

$title="-==Document Cat==-";


/*Config for the MySQL connection*/

$host="localhost";
$user="root";
$pass="lol";
$db="mindb";
Then we have the register.php, it looks a lot, but it's just statements to check all the things that could be used to try an bypass the rules, like using illegal names on the site or to long words or weird chars.

I wont show you all the tables that i use here, they are included in the code though.

register.php HERE
As you can see in the code it's a function, which i call on the index page when the user submits the reg info, the register.php then checks so that everything is alright and then if it is, it will add the info to the database...

The register page just got done so i am adding alot of stuff like mail filter and image verification.
"The best place to hide a tree, is in a forest"

Post Reply