Re: [PHP] Authentication
To be more accurate, its IIS on Windows that causes problems.. one of our test boxes runs windows + apache and doesn't experience this problem Tnx, I've been trying out some stuff last night and found out some interesting facts! the ISAPI dll is full of access violations. Being a Delphi programmer, I know that ain't good. Stable is indeed the word. Sometimes IIS could find a page, most of the time not. And I got the header to show :) However the authentication part (in my script) was never triggered, due to the fact that IIS couldn't find the page anymore, if the ISAPI dll was used. Though luck! So, people, when using PHP authentication, please use a Linux box!!! The windows version doesn't really work (at all). Brave Cobra - Original Message - From: Phil Driscoll [EMAIL PROTECTED] To: Brave Cobra [EMAIL PROTECTED]; Php-General [EMAIL PROTECTED] Sent: Tuesday, June 26, 2001 9:52 AM Subject: Re: [PHP] Authentication If you run PHP as a CGI, or as an ISAPI module *without* installing the ISAPI filter, then IIS will have already dealt with everything to do with headers before PHP gets a look in. Installing PHP in the ISAPI filters list allows it to get at the headers and do authentication, however you may have serious problems with the stability of the ISAPI module version of PHP. Cheers -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Authentication
On Tuesday 26 June 2001 11:24, Brave Cobra wrote: So, people, when using PHP authentication, please use a Linux box!!! The windows version doesn't really work (at all). ...or the Apache module on NT. Cheers -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Authentication
Kath, Thank you, I completely forgot to strip the UserID and Password to MySQL. The book is called PHP, Fast Easy Web Development by Julie C. Meloni. The errata is located at the somewhat famous www.thickbook.com (more specifically http://www.thickbook.com/books/index.phtml, the book is the first book listed on that page). The errata was helpful in some situations where mistakes were noticable, but it doesn't go any further and it didn't help solve the current problem I'm having. Perhaps I could have made a mistake in the coding, who knows. All I know is that I tried checking and rechecking my code and it looks fine to me. It is also the exact script from the book, yet with the errata's corrections applied as well. Any help from you or any of our other collegues on this newsgroup would be helpful. Thank you for your response and attempt to help. Navid Yar -Original Message- From: Kath [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 4:06 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Authentication In the future, do not post your mysql password on the list Just a little piece of advice ;) Also, try checking the online errata for the book (You didn't mention which book so I can't point you in the right direction). - Kath - Original Message - From: "Navid Yar" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 19, 2001 4:59 PM Subject: [PHP] Authentication Hello, I'm somewhat new to PHP. I'm having problems with a script and I don't know why. It is from a book, yet it does not work for some reason. Both Apache and MySQL are on and are working fine on my system. The code deals with creating tables within a database (the database already exists. The error is that it could connect to the database, but couldn't create the table within the specified DB. Below are two PHP files that work together for this specific project. Any help with this is much appreciated. Here are the scripts: Script #1 ?php // Check that the user entered the info. If not then direct them back to the form if ((!$table_name) || (!$num_fields)) { header ("Location: http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h tml"); exit; } $form_block = "form method=\"post\" action=\"do_createtable.php\" input type=\"hidden\" name=\"table_name\" value=\"$table_name\" table cellspacing=\"5\" cellpadding=\"5\" tr thFIELD NAME/ththFIELD TYPE/ththFIELD LENGTH/th/tr "; for ($i = 0; $i $num_fields; $i++) { $form_block .= "tr td align=\"center\"input type=\"text\" name=\"field_name[]\" size=\"30\"/td td align=\"center\" select name=\"field_type[]\" option value=\"char\"char/option option value=\"date\"date/option option value=\"float\"float/option option value=\"int\"int/option option value=\"text\"text/option option value=\"varchar\"varchar/option /select /td td align=\"center\"input type=\"text\" name=\"field_length[]\" size=\"5\"/td "; } $form_block .= "tr td align=\"center\" colspan=\"3\"input type=\"submit\" value=\"Create Table\"/td /tr /table /form "; ? html head titleCreate a Database Table: Step 2/title /head body h1Define fields for ?php echo "$table_name"; ?/h1 ?php echo "$form_block"; ? /body /html Script #2 ?php $db_name="testDB"; $connection = @mysql_connect("localhost", "afghan", "office939") or die ("Couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "CREATE TABLE $table_name ("; for ($i = 0; $i count($field_name); $i++) { $sql .= "$field_name[$i] $field_type[$i]"; if ($field_length[$i] != "") { $sql .= "(field_length[$i]),"; } else { $sql .= ","; } } $sql = substr($sql, 0, -1); $sql .= ")"; $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); if ($result) { $msg = "p$table_name has been created!/p"; } ? html head titleCreate a Database Table: Step 3/title /head body h1Adding tabl
RE: [PHP] Authentication
check and see if you have create_privilege on the database, and also make sure your code is clean...echo the sql statement before you use it and type it into mysql from the mysql command line and see if it works then... -jack -Original Message- From: Navid Yar [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 5:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Authentication Hello, I'm somewhat new to PHP. I'm having problems with a script and I don't know why. It is from a book, yet it does not work for some reason. Both Apache and MySQL are on and are working fine on my system. The code deals with creating tables within a database (the database already exists. The error is that it could connect to the database, but couldn't create the table within the specified DB. Below are two PHP files that work together for this specific project. Any help with this is much appreciated. Here are the scripts: Script #1 ?php // Check that the user entered the info. If not then direct them back to the form if ((!$table_name) || (!$num_fields)) { header ("Location: http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h tml"); exit; } $form_block = "form method=\"post\" action=\"do_createtable.php\" input type=\"hidden\" name=\"table_name\" value=\"$table_name\" table cellspacing=\"5\" cellpadding=\"5\" tr thFIELD NAME/ththFIELD TYPE/ththFIELD LENGTH/th/tr "; for ($i = 0; $i $num_fields; $i++) { $form_block .= "tr td align=\"center\"input type=\"text\" name=\"field_name[]\" size=\"30\"/td td align=\"center\" select name=\"field_type[]\" option value=\"char\"char/option option value=\"date\"date/option option value=\"float\"float/option option value=\"int\"int/option option value=\"text\"text/option option value=\"varchar\"varchar/option /select /td td align=\"center\"input type=\"text\" name=\"field_length[]\" size=\"5\"/td "; } $form_block .= "tr td align=\"center\" colspan=\"3\"input type=\"submit\" value=\"Create Table\"/td /tr /table /form "; ? html head titleCreate a Database Table: Step 2/title /head body h1Define fields for ?php echo "$table_name"; ?/h1 ?php echo "$form_block"; ? /body /html Script #2 ?php $db_name="testDB"; $connection = @mysql_connect("localhost", "afghan", "office939") or die ("Couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "CREATE TABLE $table_name ("; for ($i = 0; $i count($field_name); $i++) { $sql .= "$field_name[$i] $field_type[$i]"; if ($field_length[$i] != "") { $sql .= "(field_length[$i]),"; } else { $sql .= ","; } } $sql = substr($sql, 0, -1); $sql .= ")"; $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); if ($result) { $msg = "p$table_name has been created!/p"; } ? html head titleCreate a Database Table: Step 3/title /head body h1Adding table to ?php echo "$db_name"; ?.../h1 ?php echo "$msg"; ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Authentication
In the future, do not post your mysql password on the list Just a little piece of advice ;) Also, try checking the online errata for the book (You didn't mention which book so I can't point you in the right direction). - Kath - Original Message - From: "Navid Yar" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 19, 2001 4:59 PM Subject: [PHP] Authentication Hello, I'm somewhat new to PHP. I'm having problems with a script and I don't know why. It is from a book, yet it does not work for some reason. Both Apache and MySQL are on and are working fine on my system. The code deals with creating tables within a database (the database already exists. The error is that it could connect to the database, but couldn't create the table within the specified DB. Below are two PHP files that work together for this specific project. Any help with this is much appreciated. Here are the scripts: Script #1 ?php // Check that the user entered the info. If not then direct them back to the form if ((!$table_name) || (!$num_fields)) { header ("Location: http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h tml"); exit; } $form_block = "form method=\"post\" action=\"do_createtable.php\" input type=\"hidden\" name=\"table_name\" value=\"$table_name\" table cellspacing=\"5\" cellpadding=\"5\" tr thFIELD NAME/ththFIELD TYPE/ththFIELD LENGTH/th/tr "; for ($i = 0; $i $num_fields; $i++) { $form_block .= "tr td align=\"center\"input type=\"text\" name=\"field_name[]\" size=\"30\"/td td align=\"center\" select name=\"field_type[]\" option value=\"char\"char/option option value=\"date\"date/option option value=\"float\"float/option option value=\"int\"int/option option value=\"text\"text/option option value=\"varchar\"varchar/option /select /td td align=\"center\"input type=\"text\" name=\"field_length[]\" size=\"5\"/td "; } $form_block .= "tr td align=\"center\" colspan=\"3\"input type=\"submit\" value=\"Create Table\"/td /tr /table /form "; ? html head titleCreate a Database Table: Step 2/title /head body h1Define fields for ?php echo "$table_name"; ?/h1 ?php echo "$form_block"; ? /body /html Script #2 ?php $db_name="testDB"; $connection = @mysql_connect("localhost", "afghan", "office939") or die ("Couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "CREATE TABLE $table_name ("; for ($i = 0; $i count($field_name); $i++) { $sql .= "$field_name[$i] $field_type[$i]"; if ($field_length[$i] != "") { $sql .= "(field_length[$i]),"; } else { $sql .= ","; } } $sql = substr($sql, 0, -1); $sql .= ")"; $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); if ($result) { $msg = "p$table_name has been created!/p"; } ? html head titleCreate a Database Table: Step 3/title /head body h1Adding table to ?php echo "$db_name"; ?.../h1 ?php echo "$msg"; ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Authentication through a login form
By definition, if you want to use HTTP Authentication with the browser taking care of username/password automagically, you get that popup box. If you don't want the popup box, you need to "roll your own" with cookies etc. Fortunately, "roll your own" now mainly consists of doing this: ?php session_start(); session_register('foo'); session_register('bar'); #etc for each variable that is about to appear #in the script that you want to be "saved" #for other pages. #Other pages need session_start() at the top #and can register any "new" variables to add to the "save" list ? Then, you just need a form with username/password and a submit button, and some way to look up who is or isn't valid so you can accept or reject their entry into the system. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: "Patrick Dunford" [EMAIL PROTECTED] Newsgroups: php.general Sent: Friday, January 26, 2001 10:23 AM Subject: [PHP] Authentication through a login form I want to replace the popup dialog box that occurs when a user accesses a password protected area, with a login screen. How do I do that? Someone told me I had to use a cookie to say the person is logged on and read it whenever I needed to verify their access. Is it possible to trap the request made to the browser for a username/password and then pass these back to the server whenever the server requires authentication? === Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/ Blessed is the man who does not walk in the counsel of the wicked or stand in the way of sinners or sit in the seat of mockers. -- Psalm 1:1 http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010125 === Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]