HostKube

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to PHP need a little help with member scripts.
11-10-2008, 10:41 PM
Post: #1
^^ New to PHP need a little help with member scripts.
Hey guys a found a tutorial on this site for membership scripts.

I felt brave so I re wrote them and added a little more validation to them the problem I have is after you have logged in and it redirects you the the index.php how do I display information held by the database for the logged in user?

Sorry for the noobie question but I now very little PHP.

Any help would be greatly appreciated.

Thanks as always.
Josh Connerty.

If anyone ever needs any help with PHP, HTML, CSS, JavaScript, AJAX or MySql just ask.

Also If anyone would like me to create a tutorial about anything to do with these subjects just ask.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-10-2008, 10:57 PM
Post: #2
RE: New to PHP need a little help with member scripts.
Is this the tutorial you are referring to?

http://byteforums.com/thread-390.html

depending on how much you have re-wrote it is going to change my answer.

If you post your new code i'd be happy to read through it and answer your question the best i can

PS Welcome to the forums!

[Image: poweredby.jpg]
Web Hosting | Shoutcast Servers | Custom Solutions
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2008, 12:29 AM (This post was last modified: 11-11-2008 12:42 AM by Josh Connerty.)
Post: #3
RE: New to PHP need a little help with member scripts.
I'd prefer not to post the code as it is really long but, I haven't changed it as such just added validation to it and changed the errors to refer to an error document as apose to just echoing out text.

So the main code is exactly the same but when I get back to my index.php I put an if statement followed by an else statement and this says it was logged in.

This code is as follows
Code:
<?php
            if (isset($_SESSION['username'])) {
                @include("login.php");
            } else {
                echo "You are logged in as";
                echo "&nbsp;";
                echo $Username;
            }
            
            ?>

I also tried:
Code:
<?php
            if (isset($_SESSION['username'])) {
                @include("login.php");
            } else {
                echo "You are logged in as";
                echo "&nbsp;";
                echo $_SESSION['username'];
            }
            
            ?>
But neither worked if you want to see the code working then go to here.

I've it is vital that I post the documents than I shall.

Thanks as always,
Josh Connerty.

P.S. Thanks buddy.

If anyone ever needs any help with PHP, HTML, CSS, JavaScript, AJAX or MySql just ask.

Also If anyone would like me to create a tutorial about anything to do with these subjects just ask.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2008, 01:34 AM (This post was last modified: 11-11-2008 01:35 AM by goughy000.)
Post: #4
RE: New to PHP need a little help with member scripts.
think of your logic

your doing "if the user is logged in then ask them to login"

"else (ie there not logged in) tell them there logged in"


see what i mean?

what you should be doing is the opposite, you can make this simple change with 1 character

instead of if(isset(.....

add the ! character which means "not" in a sense,

so it becomes

if(!isset(...

so then your logic is

"if username NOT set then they are not logged in thus show the login form" etc

[Image: poweredby.jpg]
Web Hosting | Shoutcast Servers | Custom Solutions
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2008, 09:08 AM
Post: #5
RE: New to PHP need a little help with member scripts.
Ah, another satisfied customer member.

[Image: GHST_Sig.png]

Epic quote: "Posts should be as short as short skirts, short enough to cover enough, not too long that it covers too much."
Visit this user's website Find all posts by this user
Quote this message in a reply
12-29-2008, 04:48 AM
Post: #6
Thumbsup RE: New to PHP need a little help with member scripts.
Sorry I didn't get back to you guys,

My PC broke and then I din't have time so I did fix it like goughy said.

And also I have moved on alot more now (beleive it or not).

Thanks for the help Wink

If anyone ever needs any help with PHP, HTML, CSS, JavaScript, AJAX or MySql just ask.

Also If anyone would like me to create a tutorial about anything to do with these subjects just ask.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  PHP Scripts [Read First] progogre 1 378 06-22-2008 04:46 AM
Last Post: progogre

Forum Jump:

Contact UsByte ForumsReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication