You are invited to Log in or Register a free Frihost Account!

Secure website with password?

Hello everyone,
I would need to know how to secure my website with a password. I would also like to create specific passwords for each user (100+)

Any ideas/tips would be appreciated!

Erik Very Happy
Google up a user management system, basically if you want to do it yourself you need a database with a user table in it, a username and a password which is encrypted using md encryption, your password field and username login section would be a form and upon successful execution will create sessions.
You can use one of those ready scripts, e.g. from the or
If you prefer to develop your own script from scratch, I would like to suggest the PEAR::Auth package.
Programming this would not be too hard. It would just take some time and a fair amount of php knowledge. Some kind of database would be required, even if its just a formatted text file like I used to use when MySql databases were available on some free hosts.

explode(); used to be my buddy back in the day when I just used text files as databases.

It all depends on your amount of knowledge. I'd reccomend going with some prewritten code if you are not comfortable coding.
have you though about using apaches .htaccess ?
I mean, Im not 100% sue how secure that would be but its worth a shot =]
Or with user authentications, you should have something like:

<form action="<? $PHP_SELF ?>" method="post">
    <input name="name" type="text"><br>
    <input name="password" type="password"><br>
    <input type="submit" name="submit">

include "";

  if(isset($_POST['submit'])) {
    $passwd = $_POST['password'];
    if(empty($passwd)) die("Need a password there ;-) ");
    $user = $_POST['username'];
    if(empty($user)) die("Need a username there ;-) ");
    $password = md5($passwd);
    $query = "insert into $db_table values(null, ";
    $query .= "$user, ";
    $query .= "password('$password') )";

    if(!db_connect($db)) die(sql_error());
    if(!db_query($query)) die(sql_error());
    if(!db_close($db)) die(sql_error()); }


Of coarse you can always add something like session handling and what not.
Mod a phpBB installation and make a members area... You'd kill two birds with one stone (a discussion forum, and a members area).
what filess would be moded?
phpBBs code confuses me or I just dont know the "=>" notation yet...
how would I go about doing that? Specifically, contribute the code to if you may =[
search hotscripts i think user authentication is the proper named used. A simple one can do it, but if you want one that can ban ips and tells you which ip looged on and other functions you might want to get something more complex.
how exactly would that improove security? Well I suppose Just having some random malicous user come on and register then is in a session in which when they register, thier IP is logged and when they leave it's reset or
Could you simply just take like:

  $userip = $_SERVER['REMOTE_ADDR'];
  $sessionip = $userip;
  if($userip == $sessionip ) die(ban_function ());

 /* making sure that when the user logs on, thier ip is logged and when they */
 /* log off, its still the same... if not, then do whatever */
First, install phpBB (There's a tutorial somewhere on these boards). Then, once you've installed phpBB (preferably NOT in the root folder, so name the folder like, 'boards', or 'forums' or something). Next, you just create a page like the one below in your root folder (index.php):
define('IN_PHPBB', true);
$phpbb_root_path = './changethis/';
include($phpbb_root_path . '');
include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
// End session management
// standard page header
include($phpbb_root_path . 'includes/page_header2.'.$phpEx);

        'body' => 'tpl/home.tpl')


// standard page footer
include($phpbb_root_path . 'includes/page_tail2.'.$phpEx);
I copied the page_tail.php and page_header.php and renamed them, then put in my own header and footer html. Et voila!

If you don't understand what I've posted above, just PM me and I'll help you out.
ahhh, that looks good ^_^
I think ill use that for session handling on my part... At least I think it
would beable to work like that..
Related topics
How To : Secure Your PHP Website
MySQL problrem?
looking for password gate script
File Upload from webpage failing
How can I create a User account and password for my website?
No website is secure from this man
hashing your passwords
installation: Drupal, Joomla, PHP-BB, SMF, e107, and more
Paypal Hacked!
Problems with Vista... again!
Relatively Secure Session Management System for PHP
FRIH$ 250 for answers - secure administr of dynamic website
Bad Passwords
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.