What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP login system help needed

PHP login system help needed
Author: Message:
andrewdodd13
Senior Member
****

Avatar
Oh so retro

Posts: 870
Reputation: 16
34 / Male / Flag
Joined: Jan 2005
RE: RE: RE: A bit of help please :p
quote:
Originally posted by J-Thread
quote:
Originally posted by andrewdodd13
I think this is what you're looking for:

code:
<?php
session_start();

if (empty($_SESSION['Nathan']) || $_SESSION['Nathan'] != "Nathan")
die ("Not logged in");


ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if ($dbc = mysql_connect ('hostname', 'username', 'password')) {
    if (!@mysql_select_db ('nathan1')) {
        die ('<p>coud not select ' . mysql_error() . '</p>');
    }
} else {
    die ('<p>could not connect</p>');
}

$query = 'SELECT * FROM blog_entries ORDER
BY date_entered DESC';
if ($r = mysql_query ($query)) {
    while ($row = mysql_fetch_array ($r)) {
        echo "<h3 align='center'>{$row['title']}</h3><p>Date Entered: {$row['date_entered']}</p><div align='center' style='border: 1px solid white; width: 40%; margin-left: 25%;'>{$row['entry']}</div><br />
<div align='right' style='float: right;'><a href=\"edit_entry.php?id={$row['blog_id']}\">Edit</a></div>
<div align='left' style='float: left;'><a href=\"delete_entry.php?id={$row['blog_id']}\">Delete</a></div>
<hr color='black' />\n";
    }
} else {
    echo 'MOOOO';
}
mysql_close();

?>

This is what you mean ;-)


Sort of. I actually just forgot to close the bracket... the way I done it is because I always thought if the first part of an and statement was false the second part wasn't evaluated.

if (empty($_SESSION['Nathan']) || $_SESSION['Nathan'] != "Nathan")

This line is redundant. If the var is empty, it can't equal Nathan.

However, if $_SESSION['Nathan'] isn't set then you'll get a warning.
[Image: AndrewsStyle.png]
10-14-2006 12:58 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP login system help needed - by Nathan on 10-13-2006 at 09:37 PM
RE: A bit of help please :p - by andrewdodd13 on 10-14-2006 at 09:43 AM
RE: RE: A bit of help please :p - by J-Thread on 10-14-2006 at 11:12 AM
RE: RE: RE: A bit of help please :p - by andrewdodd13 on 10-14-2006 at 12:58 PM
RE: PHP login system help needed - by -dt- on 10-14-2006 at 11:31 AM
RE: PHP login system help needed - by J-Thread on 10-14-2006 at 05:00 PM
RE: PHP login system help needed - by Lou on 10-14-2006 at 05:27 PM
RE: PHP login system help needed - by -dt- on 10-14-2006 at 05:36 PM
RE: PHP login system help needed - by J-Thread on 10-14-2006 at 06:21 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On