PHP login script

sycogrim08

Well-Known Member
Joined
Nov 6, 2008
Messages
321
Reaction score
133
Location
JHB - Randburg
Hey pp

ok I know this is a really stupid question, but I am a newbie when it comes to PHP scripting and all I want to do is create a PHP login script that connects me to the SQL DB but now I got a few scripts but I do not know what im looking at when i see the scripting its like seeing programming language for the first time lol... and I kinda need someone to pretty much baby talk me through it.... if anyone has a php script I may use and has details on where to insert what eg: where to insert where my username must be checked and password and where the details for the database must go etc...

i would be oh so greatful as my website is due very soon :P

Thanks in advance :confused:
 
We'll be glad to help, if you provided sufficient, easier-to-understand information.

And note: "help", not "complete" :p
 
We'll be glad to help, if you provided sufficient, easier-to-understand information.

And note: "help", not "complete" :p

haha... yeh no i totally understand I just need to know where do I input my SQL server information and I have setup the database, I also just need to know how I link my login page to the php as I have the page all setup but I do not know how to actually make it work if u know what I mean.

What I can do is email you the scripting I have and then if you just pin point exactly where I have to insert the necessary information.

Thanks ;)
 
its an SQL DB I just wanna create something simple but secure as I dont feel like being crapped on should this site be hacked :P

uhm

mySQL or MSSQL ?

or SQLite?

or MSDE?

or....

SQL is a language, not a vendor.
 
Here is a simple script. It also depends on what you want to do once you connect to the db.

Replace the words in quotes with your details.

//database connections
$hostname="your server";
$serveruser="username",
$serverpass="password",
$databasename="database";

if(!$connection = mysql_connect($hostname, $serveruser, $serverpass))
echo mysql_error();
if(!$db = mysql_select_db($databasename))
echo mysql_error();
 
Start with the index page. Have a form requesting a username and a password. Submit the form to a php page that connects to your db and check the validity of the username and password. If authenticated set a session variable that will tell you if a user is authenticated or not and use a header("location:yourpage.php") to redirect the page if correct or send you back to the login page with a custom message in a $_POST variable :D Also, on top of ALL your pages have an include("checklogin.php") that will check with your session wether the user is authenticated or not!

This should give you some sort of idee how to do this...
 
Also, on top of ALL your pages have an include("checklogin.php") that will check with your session wether the user is authenticated or not!

or use the auto_prepend directive in php.ini.
But this should only be done if all the sites have a need for this - or you will need a dummy checklogin.php in the other sites.
It does have the benefit of not forgetting to add the include in some pages.
 
well I must say thanks alot everyone I have just about finished the site just gotta see if I can link 2 spreadsheets together but based on 2 different pages and be able to lock down individual cells anyone got any ideas???

Thanks again for help with the login guys it works :D
 
well I must say thanks alot everyone I have just about finished the site just gotta see if I can link 2 spreadsheets together but based on 2 different pages and be able to lock down individual cells anyone got any ideas???

Thanks again for help with the login guys it works :D

"link 2 spreadsheets together" ??

as in combine them?
 
"link 2 spreadsheets together" ??

as in combine them?

yeh well what i mean is that if you go into the excel program you can link the 2 worksheets together but what I need to do is link not only the 2 worksheets but they will be in 2 seperate pages and I need to be able to lock down individual cells but I dont think u can do that in FP 2003... :P
 
FP 2003 - as in FrontPage 2003? Excel?

Dude, are you coding a website here, or just pulling our legs??

BTW, I found a PHP login script by Googling the keywords "PHP login". Took me 5 seconds, and the first 2 links were tutorials. Try searching first next time.
 
FP 2003 - as in FrontPage 2003? Excel?

Dude, are you coding a website here, or just pulling our legs??

BTW, I found a PHP login script by Googling the keywords "PHP login". Took me 5 seconds, and the first 2 links were tutorials. Try searching first next time.

I also thought it was a bit suspicious when the whole "linking 2 workbooks from different pages" (?) and "freezing cells" got mentioned. And then the FP2003 comment... :eek:
 
no im being dead serious guys ok think about it now.... when ur working in Excel you are able to combine 2 worksheets together eg: worksheet 1 has block A1 and B1 linked to worksheet 2 which has the codes imbeded =SUM(Sheet1!B1:A1) so this means worksheet 2 is linked to worksheet 1 I hope you understand what im saying so far... ok right now im sure there is a way to link worksheet 1 and 2 but in a page format and why i say seprated into 2 pages because I have my stores connecting to one and my directors connecting to the other page... I also need to lock the worksheets down but only individual cells and that I can only seem to do in Excel itself not in FP 2003... I promise this is no joke im being really serious about this...

Thanks ;)
 
Top
Sign up to the MyBroadband newsletter
X