Re: storing / processing login info (newbie stuff not intutorials)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



good_times wrote:
> 1. instead of typing: $conn=ocilogon("usrname","passwrd","db");
> can i save this info in a file and have my php script either include or call
> it when it needs to make a db connection? what would that look like? i may
> want to point my app to a test db at some point & it would be nice to only
> change it in one place.
> 
> 2. i see an example where a form in a login.html submits to "authcheck.php"
> but authcheck.php just prints ('User not found in LDAP' or 'error occured'
> or 'success'). how can authcheck.php redirect the user to... say.. BACK to
> the login.html and tell it "yes or no" and then have login.html either
> direct the user to a different data entry page (if the login was good), or
> display "sorry, try again" - all from the 1 form's "submit"
> 
> thanx in advance, 
> mike.

1. Normally you would have a file that is included in every file or most
files that does certain things like setup the db connection, etc...
This file can also include other files based upon some other logic that
you define, but a simple example would be to include('db_config.php');
in your pages:

db_config.php

$db_username = 'myusername';
$db_password = 'somepassword';
$db_name = 'mydb';

Then you can use those vars in your code.

2. Just have the login.html form submit to itself.  At the top of the
file check to see if it is a POST request and if so check the user
credentials, set a session var that shows that they are loggedin and use
header() to redirect to the correct page.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux