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
Member system won't protect access to pages..
Old 08-21-2004, 04:02 PM Member system won't protect access to pages..
Junior Talker

Posts: 2
Trades: 0
I thought that I had my member system all up and running, when I learned that it wasn't protecting access from non-members! Now I'm

Here is my code:

PHP Code:
<? ob_start(); ?>
<?php

// For register_global on PHP settings
$member $_COOKIE['member'];

session_start(); // you must put this to read session variables

if (empty($member) || !isset($member)) // fail to read the browser cookie
{
// Try to read session
if (empty($_SESSION['member']) || !isset($_SESSION['member']))
{
header("Location: /login.php"); // redirect user to login
exit;

else
{
$member $_SESSION['member'];
}
}


// MySQL Connection Variables 
$hostname'EDIT';
$user'EDIT';
$pass='EDIT'
$dbase'colourdreamscom';

$connection mysql_connect("$hostname"$user"$pass") or die ("Can't connect to MySQL");
$db mysql_select_db($dbase $connection) or die ("Can't select database.");

// User has login but you should check his account validity again
$qChk "select id from membership where username='$member' and status='Y' ";
$rsChk mysql_query($qChk);

if (
mysql_num_rows($rsChk) != '1')
{
header("Location: /login.php");
exit; 
}

// Rest of your welcome page content here
echo ("
<HEAD>
 <TITLE>COLOUR-DREAMS :: </TITLE>
<link rel='stylesheet' type='text/css' href='/style.css'>
</HEAD>
<BODY style='background-color: transparent;' topmargin='0' leftmargin='0'>
<? include ('/home/lauren/colour-dreams.net/includes/everypageinc.html'); ?>
<a href='#' onClick='history.go(-1)'><img src='/images/back.gif' border='0'> Go Back</a>
<p><img src='/images/bullet.gif'> <b>Members</b><p>

<Table align='center' border='0' cellpadding='5' cellspacing='0'>
<Tr>

<? include ('/home/lauren/colour-dreams.net/members/menu.html'); ?>

<TD valign='top'>


If you use anything post a credit link back to http://colour-dreams.net!

<p>First of all, if you use anything, tag my board and let me know.</p>

<p>&nbsp;Pixels:
<br>In many cases, please link the actual image back to us. For calendars, post a credit link directly under the calendars. For website pixels, post a credit link on your site, main page or credit page is fine. For smilies, I've made a little animated image you can post on your credit page or somewhere. Or, if you use smilies in a blog, you can put a link right in the name/time posted, etc. section. Be creative.
</p>

<p>&nbsp;Tutorials/Scripts:
<br>Yep, these, too. Post a link back if you use anything for your site!</p>
</TD></Tr></Table>

<p><a href='#' onClick='history.go(-1)'><img src='/images/back.gif' border='0'> Go Back</a>
</body>
</html>
"
);
?>
I got this script from daydreamgraphics.com and only edited it slightly.

Please help me.
ColourDreamer is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-21-2004, 07:32 PM
ermau's Avatar
Experienced Talker

Latest Blog Post:
Chopper pwnage
Posts: 47
Name: Eric
Location: Florida
Trades: 0
It would be a very good idea to remove your MySQL connection variables, because right now, if I wanted, I could delete your entire database because you've now given me the login information.
ermau is offline
Reply With Quote
View Public Profile
 
Old 08-21-2004, 07:41 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
I edited for you, ColourDreamer Thanks ermau
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
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

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Member system won't protect access to pages..
 

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