Jump to content

Organisation


Plxply

Recommended Posts

Hello,

 

This is a slightly strange question so bare with me. I've been dabbling in PHP for a while and to help further my PHP skills I created a basic URL shortening service with a login and registration system, this works fine however I'm not sure I organised it in the best manner.

 

What I basically did was have an if statement at the top of the page which would check for example if the username field has been posted if not it would run:

include_once("interface/login.php");
die();

 

interface/login.php will contain the HTML for the login interface along with parts of the code that was ready to accept errors e.g.

<body><?php if(isset($pass_error)) { echo $pass_error; }?> 

 

Then within the login.php code I would compare the hashed password with the one in the database if it did not match I would then run code similar to this:

 

$pass_error = "<div class='error'>You have entered an incorrect username/password</div>";
include_once("interface/login.php");
die();

 

However I'm not sure if this is the most "clean" way of handling it and I would appreciate if someone would tell me better ways in which I can structure my code and the interface for it.

 

Thank you,

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.