Go Back   Internet Business Forums > Design & Development

Reply
 
Thread Tools Display Modes
Old 13-01-2007, 06:41 PM   #11 (permalink)
Senior Member
 
charlesbw's Avatar
 
Join Date: Dec 2006
Posts: 214
Default Re: [PHP] Login script with MySQL

i added it, but is there a way to actaully check the permission. such as if someone is not logged in, if they click links they will be asked to login.

and also can a script be made that will keep the login box from displaying on the page if someone is logged in.

currently am using the

PHP Code:
<?php include 'main_login.php'?>
to show the login on my web page
charlesbw is offline   Reply With Quote
Old 13-01-2007, 08:15 PM   #12 (permalink)
co-admin
 
army's Avatar
 
Join Date: Oct 2006
Location: Belgium
Posts: 666
Default Re: [PHP] Login script with MySQL

If you want a safe password, you can use MD5.

Just change this:
PHP Code:
$mypassword=$_POST['mypassword'
into this:
PHP Code:
$mypassword md5($_POST['mypassword']) 

More information about MD5-protection: http://www.betlik.com/understanding-...and-t1537.html
army is offline   Reply With Quote
Old 14-01-2007, 07:57 PM   #13 (permalink)
Member
 
Join Date: Nov 2006
Posts: 47
Default Re: [PHP] Login script with MySQL

charlesbw, here's a modified code with which you can use. The user will be asked to login if they aren't, otherwise it will display the page. Just put this on the top of your protected pages, like the previous code. Replace the previous code, so don't have both together.

PHP Code:
<?php
session_start
();
?>
<!-- HTML code here -->
<html>
<head>
<title>Website Title</title>
</head>
<!-- etc etc, you get the idea -->

<!-- Start of content -->
<?php
if(!session_is_registered(myusername)){
echo 
"Sorry, you need to login first!";
}
else
{
?>
<!-- Content here -->

<!-- End of content -->
<?php
}
?>
</body>
</html>

Just replace the HTML comments with the corresponding HTML code, remember, this part must be done properly otherwise your page will not look right! Don't change any of the PHP code unless you know what you're doing.
Zeggy is offline   Reply With Quote
Old 15-01-2007, 10:41 AM   #14 (permalink)
Senior Member
 
Join Date: Oct 2006
Location: PK
Posts: 106
Default Re: [PHP] Login script with MySQL

waoo its a cool tutorial..i love it..Thanks for sharing.
Mujahid is offline   Reply With Quote
Old 29-01-2007, 02:59 PM   #15 (permalink)
Junior Member
 
Join Date: Jan 2007
Posts: 19
Default Re: [PHP] Login script with MySQL

Quote:
Originally Posted by army View Post
If you want a safe password, you can use MD5.

Just change this:
PHP Code:
$mypassword=$_POST['mypassword'
into this:
PHP Code:
$mypassword md5($_POST['mypassword']) 

More information about MD5-protection: http://www.betlik.com/understanding-...and-t1537.html
Are you sure? I'm using PASSWORD encryption.... and see no difference:

PHP Code:
$mypassword PASSWORD '$_POST['mypassword']' ); 
Executor89 is offline   Reply With Quote
Old 29-01-2007, 03:35 PM   #16 (permalink)
Member
 
warchief's Avatar
 
Join Date: Jan 2007
Posts: 50
Default Re: [PHP] Login script with MySQL

guys, I'm pretty much Noob in PHP issues but I was thinking of the making a website with "special Members Subscription" area

so basicly I think from this tutorial I can, Make 1 Single Password for members only pages.

I can put a certain code on the pages I want only membes to see.

but this keeps some questions opened,

1- how can someone register in this website (is there a way to get new user and password to the MySQL database)

2- is there's a way to make that subscription end in a certain time period?

sorry if I'm posting this in the tutorials not in normal MySQL and PHP page, as I'm just requesting a minor change to the script mentioned in this tutorial.

warchief
warchief is offline   Reply With Quote
Old 29-01-2007, 08:44 PM   #17 (permalink)
Member
 
Join Date: Nov 2006
Posts: 47
Default Re: [PHP] Login script with MySQL

Quote:
Originally Posted by Executor89 View Post
Are you sure? I'm using PASSWORD encryption.... and see no difference:

PHP Code:
$mypassword PASSWORD '$_POST['mypassword']' ); 
I've never seen or heard of a PASSWORD() function before in PHP, and it doesn't show up in the documentation either. Are you sure it's not a custom function somewhere else in the file?
Zeggy is offline   Reply With Quote
Old 29-01-2007, 09:40 PM   #18 (permalink)
co-admin
 
army's Avatar
 
Join Date: Oct 2006
Location: Belgium
Posts: 666
Default Re: [PHP] Login script with MySQL

Quote:
Originally Posted by Executor89 View Post
Are you sure? I'm using PASSWORD encryption.... and see no difference:

PHP Code:
$mypassword PASSWORD '$_POST['mypassword']' ); 
I never heard f the PASSWORD-function ?
Use the MD5-encryption . It is safe.
army is offline   Reply With Quote
Old 28-05-2007, 05:04 PM   #19 (permalink)
http://www.gofiresale.com
 
Join Date: Feb 2007
Location: http://www.gofiresale.com
Posts: 109
Send a message via Yahoo to smilemaker
Default Re: [PHP] Login script with MySQL

Where to put this code, i mean to say edit this code in which file

Quote:
Originally Posted by army View Post
If you want a safe password, you can use MD5.

Just change this:
PHP Code:
$mypassword=$_POST['mypassword'
into this:
PHP Code:
$mypassword md5($_POST['mypassword']) 

More information about MD5-protection: http://www.betlik.com/understanding-...and-t1537.html
smilemaker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are Off


All times are GMT +1. The time now is 10:37 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.