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
Need help making a login!
Old 06-29-2010, 10:45 AM Need help making a login!
maximusminds's Avatar
Experienced Talker

Posts: 44
Name: ernie
Location: USA
Trades: 0
Hello people, could someone please explain how I can make a login for your website so people have to login and become users for them to see selected pages. I'm using dreamweaver and and I'm not quite sure how to start as it seems very complicated. I asked this question in the wen design forum and they said to go to the php forum. So do you guys know how to make one?
maximusminds is offline
Reply With Quote
View Public Profile Visit maximusminds's homepage!
 
 
Register now for full access!
Old 06-29-2010, 10:53 AM Re: Need help making a login!
vectorialpx's Avatar
Extreme Talker

Posts: 249
Name: octavian
Location: Bucharest
Trades: 0
you have to use sessions [it's recommended]
check this: http://www.google.ro/search?q=php+login+tutorial
and take a look on some tutorials, cause it's a lot to talk

If you have problems, come and ask here
__________________
you can
Please login or register to view this content. Registration is FREE
vectorialpx is offline
Reply With Quote
View Public Profile Visit vectorialpx's homepage!
 
Old 06-29-2010, 01:30 PM Re: Need help making a login!
Average Talker

Posts: 25
Location: Somehwere in the U.S.A
Trades: 0
Well, I'm not sure you can use it in dreamweaver, but there are tons of "tweakable" PHP Login scripts that you can use online, and just customize it to the look and feel of your website. Here's the one I'm planning on using on my website:

http://www.php-login-script.com

Try it out! I hope this helps.
__________________
Have a beautiful day =)
Please visit my site:
Please login or register to view this content. Registration is FREE
shanterenee is offline
Reply With Quote
View Public Profile Visit shanterenee's homepage!
 
Old 06-30-2010, 07:01 AM Re: Need help making a login!
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
If you are inexpierienced with PHP, as it seems you are, then I would strongly reccomend you use a CMS rather than try this yourself.

There are so many potencial security risks with coding your own that you would be better to learn PHP as a whole before trying to jump right in with a login script.

CMS:

http://wordpress.org/
<yes it can be used as a cms
http://silverstripe.org/ <free open source cms
__________________

Please login or register to view this content. Registration is FREE

Learn professional skills from professional people, from $6.50 a month.
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 07-02-2010, 08:11 AM Re: Need help making a login!
Experienced Talker

Posts: 41
Trades: 0
hi I'll give complete code just try it,

<?php
if(isset($_POST['posted']))
{
$name=$_POST['dir_username'];
$pass=$_POST['dir_password'];
$connect=mysql_connect('localhost','root','');
$db=mysql_select_db('dir_db',$connect);
$query=mysql_query('SELECT * FROM dir_login',$connect);
while($row=mysql_fetch_array($query))
{
$column1=$row['username'];
$column2=$row['password'];
if($column1 == $name && $column2 == $pass)
{
header('location:registration_dir.php');
}
else
{
echo('Sorry Username and password is mismatch');
exit();
}
}
}

?>

<form name="index_dir" method="post" action="index_dir.php">
<table align="center" border="">
<tr>
<td>
<b style="background-color:#063">USERNAME</b>
<input type="text" name="dir_username" value="USERNAME" style="background-color:#966">
</td>
</tr>
<tr>
<td><b style="background-color:#063">PASSWORD</b>
<input type="password" name="dir_password" value="*****" style="background-color:#966">
</td>
</tr>
<tr>
<td><input type="hidden" name="posted" value="true>"></td>
<td>
<input type="submit" name="dir_submir" value="GO" style="background-color:#063">
</td>
</tr>
</table>
</form>

just create adatabase and table using Mysql, and run it on localhost
sandeep Kumar is offline
Reply With Quote
View Public Profile Visit sandeep Kumar's homepage!
 
Old 07-02-2010, 10:19 AM Re: Need help making a login!
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by sandeep Kumar View Post
hi I'll give complete code just try it
Did you try it?

Just looking at it I see a couple things wrong. The query as it is will pull every row from the table, which is a waste.

Next it looks like you're attempting to cycle through every record, searching for the correct username / password combination, but since you call exit in the case that the username and password don't match it will only work if the correct record is the first one returned.

You could fix this by adding "WHERE username = '$name'" to the query, but then you'd have to account for sql injections.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 07-02-2010 at 10:21 AM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Need help making a login!
 

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.23435 seconds with 12 queries