php-windows Digest 18 Jan 2001 12:27:29 -0000 Issue 403 Topics (messages 5081 through 5095): Re: [PHP] best user authentication method? 5081 by: Miles Thompson 5082 by: Miles Thompson Re: Basic Clarification on Sessions(PHP4) 5083 by: Mujahid Passing values 5084 by: Jan Walter 5085 by: Michael Cartmel 5086 by: Jan Walter 5088 by: Michael Cartmel Header variable not working?? 5087 by: OoCobra97.aol.com Re: best user authentication method? 5089 by: Michael Rudel Two questions 5090 by: andy.mekong.southcom.com.au PHP4 foreach command work around for php3 5091 by: Charles Williams \( CEO ACNS \) R: [PHP-WIN] Two questions 5092 by: Ermanno Iannacci 5095 by: andy.mekong.southcom.com.au Problem uploading files... 5093 by: Per Nielsen Windows File Tree 5094 by: Tom Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
IIS I'm not familiar with, and Apache has a native scheme involving .htaccess. If you want a portable authentication method, I'd recommend authenticating against a list of users/passwords contained in a database. Using MySQL, PostgreSQL or Interbase would keep your database platform neutral, and low cost. Here's code picked up from a Rasmus Lerdorf article which authenticates against a MySQL database, there are variations on this everywhere. I put this in a file called auth.inc, and then the top of every page which requires authentication simply includes "auth.inc". ------------cut------------ <? require( "dbname.inc" ); function authenticate() { Header("WWW-authenticate: basic realm=\"Auction Maintenance\""); Header("HTTP/1.0 401 Unauthorized"); $title="Invalid Login"; include( 'header.inc' ); ?> In order to proceed you will need a valid username/password. <?include ("footer.inc"); exit; } if(!isset($PHP_AUTH_USER)) { authenticate(); } else { mysql_pconnect("localhost","root") or die("Unable to connect to SQL server"); mysql_select_db( "$auction" ) or die("Unable to select database"); $login_id=strtolower($PHP_AUTH_USER); $query = mysql_query("select * from admin where cAdminId='$login_id'". " and cPassword='$PHP_AUTH_PW'"); if(!mysql_num_rows($query)) { authenticate(); } else { include( 'header.inc' ); } } ?> ---------------------- cut --------------------------- Hope this is useful. If you use PostgreSQL the calls will be different, and it may be best to use ODBC, then you will truly have portability. Regards - Miles Thompson At 11:27 PM 01/16/2001 -0500, Romulo Roberto Pereira wrote: >hello! > >What is the best user authentication methd for linux (apache)? and for >windows (IIS)?
Opps - Forgot -- dbname.inc just contains the name of the database.<? $auction = "auction" ?> In production it also contains the name of the user and the password. Miles At 08:44 PM 01/17/2001 -0400, Miles Thompson wrote: >IIS I'm not familiar with, and Apache has a native scheme involving .htaccess. > >If you want a portable authentication method, I'd recommend authenticating >against a list of users/passwords contained in a database. Using MySQL, >PostgreSQL or Interbase would keep your database platform neutral, and low >cost. > >Here's code picked up from a Rasmus Lerdorf article which authenticates >against a MySQL database, there are variations on this everywhere. I put >this in a file called auth.inc, and then the top of every page which >requires authentication simply includes "auth.inc". > >------------cut------------ ><? require( "dbname.inc" ); > function authenticate() { > Header("WWW-authenticate: basic realm=\"Auction Maintenance\""); > Header("HTTP/1.0 401 Unauthorized"); > $title="Invalid Login"; > include( 'header.inc' ); ?> > In order to proceed you will need a valid username/password. > <?include ("footer.inc"); > exit; > } > > if(!isset($PHP_AUTH_USER)) { > authenticate(); > } else { > mysql_pconnect("localhost","root") > or die("Unable to connect to SQL server"); > mysql_select_db( "$auction" ) or die("Unable to select database"); > $login_id=strtolower($PHP_AUTH_USER); > $query = mysql_query("select * from admin where > cAdminId='$login_id'". > " and cPassword='$PHP_AUTH_PW'"); > if(!mysql_num_rows($query)) > { > authenticate(); > } > else > { > include( 'header.inc' ); > } > } >?> >---------------------- cut --------------------------- > >Hope this is useful. If you use PostgreSQL the calls will be different, >and it may be best to use ODBC, then you will truly have portability. > >Regards - Miles Thompson > > > >At 11:27 PM 01/16/2001 -0500, Romulo Roberto Pereira wrote: >>hello! >> >>What is the best user authentication methd for linux (apache)? and for >>windows (IIS)? > > > > >-- >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]
Alistair, I am working on Win NT/IIS Thanks -Mujahid
Hi all, have anyone of you ever experienced any problem w/ passing values when you used enctype="multipart/form-data" inside file upload form? I see none of them inside the action script :-(((. Thank you -- __________________________________________________________________________________________ ========================================================================================== Jan Walter, called John LERACH, s.r.o. phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61 on emergency call cell phone: +420-602-385 760 work e-mail mailto:[EMAIL PROTECTED] private e-mail mailto:[EMAIL PROTECTED] ICQ#: 28353428 __________________________________________________________________________________________ ==========================================================================================
Have you put the <INPUT NAME="userfile" TYPE="file"> line at the end of the form? It seems that any <input> tags after this line are ignored (not sent by browser?). ----- Original Message ----- From: "Jan Walter" <[EMAIL PROTECTED]> To: "PHP Mailing list" <[EMAIL PROTECTED]> Sent: Thursday, January 18, 2001 1:59 PM Subject: [PHP-WIN] Passing values > Hi all, > > have anyone of you ever experienced any problem w/ passing values when > you used enctype="multipart/form-data" inside file upload form? I see > none of them inside the action script :-(((. > > Thank you > -- > ____________________________________________________________________________ ______________ > > ============================================================================ ============== > > Jan Walter, called John > LERACH, s.r.o. > phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61 > on emergency call cell phone: +420-602-385 760 > work e-mail mailto:[EMAIL PROTECTED] > private e-mail mailto:[EMAIL PROTECTED] > ICQ#: 28353428 > ____________________________________________________________________________ ______________ > > ============================================================================ ============== > > > > > -- > PHP Windows 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]
Michael Cartmel wrote: > Have you put the <INPUT NAME="userfile" TYPE="file"> line at the end of the > form? It seems that any <input> tags after this line are ignored (not sent > by browser?). It is not at the end, but in the middle. Nevertheless the problem relies on the server settings, because the same code works on another machine w/o any problem. It depends on presence of enctype="multipart/form-data". If I put it out, all variables are passed properly, otherwise none of them :-(((. I'm not the administrator of the server, it's settings can be seen at http://banana.ecn.cz/phpinfo.php. -- __________________________________________________________________________________________ ========================================================================================== Jan Walter, called John LERACH, s.r.o. phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61 on emergency call cell phone: +420-602-385 760 work e-mail mailto:[EMAIL PROTECTED] private e-mail mailto:[EMAIL PROTECTED] ICQ#: 28353428 __________________________________________________________________________________________ ==========================================================================================
what does your FORM tag look like? (something like this?) <FORM name="upload" ENCTYPE="multipart/form-data" ACTION="<?php echo $PHP_SELF; ?>" METHOD=POST> ----- Original Message ----- From: "Jan Walter" <[EMAIL PROTECTED]> To: "Michael Cartmel" <[EMAIL PROTECTED]> Cc: "PHP Mailing list" <[EMAIL PROTECTED]> Sent: Thursday, January 18, 2001 2:57 PM Subject: Re: [PHP-WIN] Passing values > Michael Cartmel wrote: > > > Have you put the <INPUT NAME="userfile" TYPE="file"> line at the end of the > > form? It seems that any <input> tags after this line are ignored (not sent > > by browser?). > > It is not at the end, but in the middle. Nevertheless the problem relies on the > server settings, because the same code works on another machine w/o any problem. > > It depends on presence of enctype="multipart/form-data". If I put it out, all > variables are passed properly, otherwise none of them :-(((. > > I'm not the administrator of the server, it's settings can be seen at > http://banana.ecn.cz/phpinfo.php. > -- > ____________________________________________________________________________ ______________ > > ============================================================================ ============== > > Jan Walter, called John > LERACH, s.r.o. > phone nr. work: +420-2-78 22 619, home: +420-2-35 35 27 61 > on emergency call cell phone: +420-602-385 760 > work e-mail mailto:[EMAIL PROTECTED] > private e-mail mailto:[EMAIL PROTECTED] > ICQ#: 28353428 > ____________________________________________________________________________ ______________ > > ============================================================================ ============== > > > > > -- > PHP Windows 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]
Hello, Im running windows 2000, IIS5, php4. Im trying to use: header("Status: 404 File not found") or die('Unable to connect to execute header command!'); to redirect to my errordocument, but its not doing anything...it goes to the "or die" command (which i set up to see if it works or not) anyone have any suggestions? thanks
Hi Romulo, If you're only working (and all your clients, too) with M$, means M$-Win, M$-IIS, M$-IE, so the best method is NTLM, but all Users must be registered in your PDC as Users. Its very usable in Intranets. Greetinx, Mike (Germany) -----Ursprüngliche Nachricht----- Von: Romulo Roberto Pereira [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 17. Januar 2001 05:27 An: php-general; php-windows Betreff: [PHP-WIN] best user authentication method? hello! What is the best user authentication methd for linux (apache)? and for windows (IIS)?
I'm a newcomer to PHP, and I'm trying to use it to simplify the process of creating an HTML help file. I have two questions: the first is, is there any way to change the newline string that the "\n" escape produces? At the moment it is outputting 0x0A, while I would prefer it if it would produce 0x0D 0x0A. My second question is related to the following .php source: <?php include( myinc.php ) myfunc(); /* myfunc defined in myinc.php */ ?> <b>Normal HTML stuff goes here</b> <?php include( myinc.php ) myfunc(); ?> The problem is that this produces an error message from the second include(): Fatal error: Cannot redeclare myfunc() in myinc.php on line 2 However, if I remove this second include statement, then the second php script doesn't appear to call myfunc(). Can anyone help? Thanks in advance, Andrew --------------------------------------- This message was sent mekong webmail. https://mekong.southcom.com.au/mailman/
I'm kinda new to this php stuff. The server I'm working on only has php3 and the script I have is a PHP4 script. It has this command in it. foreach($l_array_of_elements as $l_search_element){ if ($l_search_element != "") if ($case_sensitive) { $l_search_condition.="(INSTR(name,'$l_search_element') OR INSTR (description,'$l_search_element')) $concatenation "; } else { $l_search_condition.="(name LIKE '%$l_search_element%' OR description LIKE '%$l_search_element%') $concatenation "; } } Does anyone now of a clean work around. I have tried a few differant things and none seem to work correctly. Thanks in advanced. ============================================== Charles Williams Accent Computer & Network Services Markt 2 D-95679 Waldershof Tel: +49 (0) 9231 972670 Fax: +49 (0) 9231 972671 http://www.acns-online.com ==============================================
I think "\r\n" should work. The second question sound strange: try: <?php include("myinc.php") /* think double quotes are needed */ ?> <?php myfunc(); /* myfunc defined in myinc.php */ ?> <b>Normal HTML stuff goes here</b> <?php myfunc(); ?> > I'm a newcomer to PHP, and I'm trying to use it to simplify the process of > creating an HTML help file. > I have two questions: the first is, is there any way to change the newline > string that the "\n" escape produces? At the moment it is outputting 0x0A, > while I would prefer it if it would produce 0x0D 0x0A. > > My second question is related to the following .php source: > > <?php include( myinc.php ) > myfunc(); /* myfunc defined in myinc.php */ > ?> > > <b>Normal HTML stuff goes here</b> > > <?php include( myinc.php ) > myfunc(); > ?> > > The problem is that this produces an error message from the second include(): > Fatal error: Cannot redeclare myfunc() in myinc.php on line 2 > However, if I remove this second include statement, then the second php script > doesn't appear to call myfunc(). Can anyone help? > > Thanks in advance, > > Andrew > > > --------------------------------------- > This message was sent mekong webmail. > https://mekong.southcom.com.au/mailman/ > > > > -- > PHP Windows 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] > >
> The second question sound strange: > try: > <?php > include("myinc.php") /* think double quotes are needed */ > ?> > > <?php > myfunc(); /* myfunc defined in myinc.php */ > ?> > > <b>Normal HTML stuff goes here</b> > <?php > myfunc(); > ?> Silly me: First I forgot those quotes when I was typing the example, and then I realised what was going wrong -- nothing with PHP, just my own density: the function myfunc() output the </body> and </html> tags, which caused the browser to stop rendering. Anyway, thanks for your help. --------------------------------------- This message was sent mekong webmail. https://mekong.southcom.com.au/mailman/
Hello... I'm a newbie and having a bit of a problem uploading files with php. So please help... The problem: ========== I'm having a problem uploading a file from a client (through a browser) to my server (http/post). If a choose a file on the client - for example "C:\Program Files\Netscape\Communicator\Program\nareadme.htm" I get the following message when I try to send the file: nareadme.htm /* my debug none /* my debug Warning: Unable to open 'none' for reading: No such file or directory in D:\DOKUMENTER\CornerTechnology\tester\uploadHandle.php It seems that PHP is trying to fetch the file from the same directory as where my "form" and "php-scrip"t are placed and NOT from the chosen directory on client's directory! What am I doing wrong? Per ------ Code and config below --- The Code ======= The form code: ------------ <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Adobe GoLive 5"> <title>Pick a file</title> </head> <body bgcolor="#ffffff"> <FORM ENCTYPE="multipart/form-data" ACTION="uploadHandle.php" METHOD=POST> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> Send this file: <INPUT NAME="userfile" TYPE="file"> <INPUT TYPE="submit" VALUE="Send File"> </FORM> </body> </html> The "uploadHandle.php" file ---------------------------------------- <? echo($userfile_name); echo("<BR>"); echo($userfile); if (copy($userfile, "upload.txt")) { echo("<B>The file is now uploaded....</B>"); } else { echo("Error: Damm..!"); } unlink($userfile); ?> System configuration /SERVER ======================= Win NT Service pack 5 Microsoft Information Server PHP v. 4.0.3 p1 PHP.ini: file_uploads = on upload_tmp_dir = C:\UPLOADS ---- End --- ---------------------------------------------------------- Web: www.CornerTechnology.com E-Mail: [EMAIL PROTECTED] ---------------------------------------------------------- Per Nielsen Corner Technology ApS Sanatorievej 75 Tel.: (+45) 75 11 74 82 6710 Esbjerg V. Fax: (+45) 75 11 76 55 Denmark, Europe ----------------------------------------------------------
Hi I want to use an object which looks like the Windows Explorer File Tree in a database application. Does anhone have any code to do this (or know of the COM object or whatever that can be used to build it - I will also want to enable left and right click events at some stage) Cheers Tom