Jump to content

[SOLVED] Bit of troubles with a login script.


labine50

Recommended Posts

I'm pretty new to PHP and SQL in general. I've basically been doing web development solely in HTML for the last 16 months, (Basically the entire time I've been doing web development) and figured it was time to learn some new stuff. Learning can't hurt, no?

 

Anyway, I play this mildly popular MMO and my group has a website which needs password protection. So far the security system has been based on trying to keep it off of Google. I followed the Tutorial here and made a very simple login system. Unfortunately, it doesn't allow the option to register and seems to only protect one page.

 

The registration thing I should be able to figure out on my own, but for the mutli-page protection... I basically have an entire directory that needs to be protected. Can anybody make recommendations on this?

Link to comment
Share on other sites

Well, I honestly don't feel like reading the tutorial because it's probably bad code in the first place and I'd rather not comment on it (most tutorials these days are old and outdated).  Do you login with sessions or cookies?

 

It includes this-

<?
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>

 

So I think it's sessions.

Link to comment
Share on other sites

Oh boy I knew that there would be bad code.  They're using deprecated session functions. >_<  You don't need any session_* functions other than like session_start() and session_destroy() because the $_SESSION superglobal is now usable for writing to sessions.  And to protect any page, just put that code on the top of the page.  Like the very top before any output.  But you should really learn a bit of PHP and clean it up.

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.