There are a number of project wide files, which include the following: functions.php- This script contains some of the functions that the application uses on a system wide basis. Below are some of them. The names are indicative of the work that the function is supposed to do: function checkformat($aUsername){ if(eregi('^[a-z]+[.]+[a-z]+$',$aUsername)) return TRUE; else return FALSE; } The "checkformat()" function above uses regular expression to check the format of the given username. In this application, all user names must follow the format "name.surname" and all must be in lowercase. It is just to put another obstacle in the way of any potential intruder or hacker of the authentication system. As you might have guessed, the function is used by the login script as part of the verification process. function checkmailformat($aEmail){ if(eregi('^[a-zA-Z0-9_-.]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+ $',$aEmail)) return TRUE; else return FALSE; }//end function The "checkmailformat()" function checks the format of an email address when a new user is created and also during the password recovery process. It also uses a regular expression to verify the format of the email address. dbcon.php - The dbcon.php script basically contains the database login credentials. This is what my login details are: <? session_start(); $title = "Project Management"; //database connection $db = mysql_connect("localhost") or die("Failed to open connection to MySQL server."); mysql_select_db("project_management") or die("Unable to select database"); //set useful variables $month_names = array("","January","February","March","April","May","June","July","August", //set useful variables $td = date("Y-m-d"); $date_time =date("Y-m-d h:i:s"); ?> I can show you my connection details because I don't have any sensitive information that you should not see and also, I'm not connected to the Internet or part of any network, and so cannot be hacked. Otherwise, I would not do so. But please make use of the MySQL security system and secure your data; don't ever show your connection details to anyone, in fact, if you are going to use this application, make sure to put this file outside of your root directory. Now, this script contains some information that will be used most of the time and is therefore included in almost all the scripts of the project.
blog comments powered by Disqus |
|
|
|
|
|
|
|