Old 07-02-2007   #1 (permalink)
Registered User
 
Join Date: Jun 2007
Posts: 4

Little script is missing?

At the tutorial of a complete php memb system (BioRUST.com :: Tutorials >> A Complete Membership System) Is a little thing missed i think. Whats the code to put on each page that is member only?And that will redirect you to login.php when you are not logged in?

Jelleke60
jelleke60 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-02-2007   #2 (permalink)
Steven
 
Join Date: Jun 2005
Location: McAlester, OKlahaoma - United States
Posts: 21

On the member.php the code to check if a member is logged in is
PHP Code:
<?php
session_start
();
if(
$_SESSION['s_logged_n'] == 'true'){
include 
'process.php';
?>
In the login file the code to check if they are logged and to send them back to the main page is

PHP Code:
<?php
session_start
();
include 
'config.php';

if(isset(
$_POST['login']))
{

$username trim(addslashes($_POST['username']));
$password md5(trim($_POST['password']));

$query mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());

$row mysql_fetch_array($query);

// now we check if they are activated

if(mysql_num_rows($query) > 0)
{

if(
$row['Activated'] > 0)
{

$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];

header("Location: member.php");
__________________
--
Steven
basicwe is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-06-2007   #3 (permalink)
Registered User
 
Join Date: Jul 2007
Posts: 5

for logging must use a little security trick... for username the trimming and the stripslashed is nice thing but not enought. use the strip_tags() function too

Code:
 example: $username = strip_tags($_POST["loginedname"]);
huncyrus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-23-2007   #4 (permalink)
PHP Lover
 
Join Date: May 2007
Location: Zug, Switzerland
Posts: 84

Also make sure that if you are sending any information to a database, then use the

PHP Code:
mysql_real_escape_string() 
function, it's the best way to ensure that your database will not be harmed by a malicious user.
Gjbphp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - looking for jpg submission script ot tut volicio HTML / PHP / ASP / JS 0 03-17-2006 08:57 PM
Member script question not in FAQ. London HTML / PHP / ASP / JS 6 01-04-2006 06:06 PM
Plz help w/ PHP-MySQL membership script Tutorial Oasis HTML / PHP / ASP / JS 9 12-01-2005 11:40 PM
php members script jumbosheep HTML / PHP / ASP / JS 2 09-01-2005 06:46 PM
How to wrap the alt text area when an image is missing? ranjithkr1 HTML / PHP / ASP / JS 4 06-15-2005 05:50 AM


All times are GMT +1. The time now is 07:58 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT