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
https://forums.phpfreaks.com/topic/217474-organisation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.