Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-24-2008, 08:08 AM Urgent Help Needed!
Skilled Talker

Posts: 73
Name: Farrhad
Trades: 0
Hi,

i want to create a log in box for my website
only users who login can view certain pages
i also need a method in which users can register

please give me the simplest way
can dreamweaver help?


Thank you

http://www.aviationearth.com
__________________

Please login or register to view this content. Registration is FREE
farrhad16 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-24-2008, 09:05 AM Re: Urgent Help Needed!
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Use sessions
if you want me to post a script just ask.
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Old 02-24-2008, 09:13 AM Re: Urgent Help Needed!
Skilled Talker

Posts: 73
Name: Farrhad
Trades: 0
please do so thank you very much
__________________

Please login or register to view this content. Registration is FREE
farrhad16 is offline
Reply With Quote
View Public Profile
 
Old 02-25-2008, 01:50 PM Re: Urgent Help Needed!
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
PHP Code:
<?php  
 
 $mysql 
= @mysql_connect"localhost""yourserverusername""yourserverpassword" );
 
 @
mysql_select_db"my_db" ); 
 
 
$user $_POST['username'];
 
$pass sha1$_POST['password'] );
 
$ref $_SERVER['HTTP_REFERER'];
   
 
//check db for these values
 
$sql "SELECT * FROM my_table WHERE username = '$user'";
   
 
$query mysql_query$sql );
   
 
$result mysql_fetch_array$query );
   
 if( 
$result['password'] == $pass // if it returned with a result
 
{
  
session_start();
    
  
//assign session data to mysql data
  
$_SESSION['username'] = $user;
  
$_SESSION['password'] = $pass;
  
$_SESSION['author'] = $result['forename']." ".$result['surname'];
    
  
header"location:".$ref );
 }
 else
 {
  
header"incorrect.php" ); //if not correct send user here.
 
}
?>
what this does is check if theyre is a user on the database and if theyre is a matching username & password combination it starts a session. NOTE:: this script is vulnerable and you should be escaping the variables and adding salt to your passwords but for the purpose i just did this script and you should know a little PHP if your posting here so thats why i left out security just do a search on the forum and youll find out how toincrease security.
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Urgent Help Needed!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15028 seconds with 12 queries