Jump to content

[SOLVED] User System?


adamlacombe

Recommended Posts

I have searched google for days for a user system tutorial but all i get are advanced scripts with lost password, sign up, members page, and profile page features. All im looking for is something that will let me login with mysql, I can make all the other features.

If anyone knows of a tutorial that will help me or can write one up that would be great!

Thanks!

Link to comment
Share on other sites

If anyone knows of a tutorial that will help me or can write one up that would be great!

 

Hate to burst your bubble princess, but I don't think anyone is going to write a tutorial just for you.  I'm sure you can find basic tutorials on how to create a login script.  This is a very common request.  I would recommend doing a search on phpfreaks for some similar threads as well.

 

I have searched google for days for a user system tutorial but all i get are advanced scripts with lost password, sign up, members page, and profile page features.

 

Just ignore the extra features you don't want.

Link to comment
Share on other sites

well i have found a basic one i want to use but i dont know how to pull the info of the logged in user.

i have tried:

$_SESSION['username']

but that does not wanna work.

I run into this problem a lot with the other script i have found too.

the link to the tut is: http://dev.thatspoppycock.com/index.php/Creating_a_Simple_PHP_and_MySQL-Based_Login_System

Link to comment
Share on other sites

ok, got it working!

I hate to be such a pain but any idea why this:

<?php 
session_start();
include "db_connect.php"; //mysql db connection here

print "<link rel='stylesheet' href='style.css' type='text/css'>";

print "<table class='maintable'>";

print "<tr class='headline'><td>From</td><td>Author</td><td>Message</td></tr>";

$getmail="SELECT * from PM where to='$_SESSION['username']'";

$getmail2=mysql_query($getmail) or die("Could not get mail");

while($getmail3=mysql_fetch_array($getmail2))

{

  print "<tr class='mainrow'><td>$getmail3[from]</a></td><td>$getmail3[msg]</a></td></tr>";

}

print "</table>";



?>

 

does not work?

 

it has something to do with the:

$getmail="SELECT * from PM where to='$_SESSION['username']'";

Link to comment
Share on other sites

Change that to:

 

$getmail="SELECT * from PM where to='{$_SESSION['username']}'";

 

It thought that the single quote in the query was ending the comparative value, when adding curly brackets it escapes the quotes and allows for variables such as arrays.

Link to comment
Share on other sites

OK, 'to' is a reserved word - Reserved Words.  The way around this is to use back ticks which will escape the reserved word and give the meaning literally.

 

This should work:

 

$getmail="SELECT * from PM where `to`='{$_SESSION['username']}'";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.