php-windows Digest 5 Mar 2001 09:49:10 -0000 Issue 475

Topics (messages 5817 through 5825):

Re: Cash By Fax
        5817 by: cashbyfax2412231.aol.com

Re: [PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
        5818 by: Don Read
        5819 by: Michael A. Peters

Reading data from MySQL
        5820 by: James Duncan
        5821 by: Mitchell Kirschner
        5825 by: Tom Mathews

Re: IE 5.5,authentication,PHP sessions: IE never stops
        5822 by: Ken
        5823 by: Ken

swflib
        5824 by: Tomasz Abramowicz

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]


----------------------------------------------------------------------



hi there,
please take a moment to check out the newest cash offer.
cash is waiting for you!  Click Below 
Or copy the link and paste it in your browser

http://www.geocities.com/arushhour7777/





On 04-Mar-01 Ken wrote:
> Thanks for the idea, John.
> 
> I know about the auth logout.  Unfortunately, that means that when a user
> clicks "logout", he gets a "log in" prompt!  And, in IE, he has to
> deliberately blank out the password field, THEN hit enter, THEN the prompt
> will come again, and he has to hit escape.

<snip>

> Any suggestions?
> 

I'm still playing with this but ...

My script handles the authentication against a MySQL table;
and this might (probably) have to get tweaked to play well with .htaccess

The logout script creates a "mark" (tmpfile, db entry, whatever)
then redirects to a non-protected page. 

On entry to a protected script:

function authuser($realm) {
  global $PHP_AUTH_USER, $PHP_AUTH_PW;

  if (isset($PHP_AUTH_USER)) {
    if (markset($PHP_AUTH_USER)) {
      markunset($PHP_AUTH_USER);
      // send a 401 to force re-authenticate 
      Header('WWW-authenticate: basic realm="'.$realm .'"');
      Header('HTTP/1.0 401 Unauthorized');
      echo "\n\n";
      echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL='.SITEHOME.'/">';
      exit;
    }
    
    if (! (validlogin($PHP_AUTH_USER,$PHP_AUTH_PW, $realm))) {
      Header('WWW-authenticate: basic realm="'.$realm .'"');
      Header('HTTP/1.0 401 Unauthorized');
      echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL='.SITEHOME.'/">';
      echo '<CENTER>Failed Login<P>Invalid name or password';
      exit;
    }
  }
  return(true);
}


Regards,
-- 
Don Read                                         [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy. 
                  God will forgive you but the bureaucrats won't. 




On Sun, 04 Mar 2001 15:11:55 -0600 (CST)
Don Read <[EMAIL PROTECTED]> wrote:

> 
> On 04-Mar-01 Ken wrote:
> > Thanks for the idea, John.
> > 
> > I know about the auth logout.  Unfortunately, that means that when a user
> > clicks "logout", he gets a "log in" prompt!  And, in IE, he has to
> > deliberately blank out the password field, THEN hit enter, THEN the prompt
> > will come again, and he has to hit escape.

I fricken hate IE.
They extend Microsofts lack of case sensitivity where it shouldn't- when I use IE to 
log into Basilix or other stuff where my login name is michael, it Capitalizes my name 
and I have to go back and change it. I'm sure there's a way to turn that off somehow- 
but I'm literally starting to get sick of IE for all its crap assumptions at what it 
thinks the user really wants to do, and situations where support issues cost companies 
money because IE capitalized the first letter of the persons login name and the 
customer wasn't therefore authenticated.

"I didn't capitalize it. Your server capitalized it when I tried to log on.
You should fix your server if its case sensitive"

I've hears that more than once.

*sigh*

Sorry for the rant...

Generally, I don't think a login prompt when a user clicks logout is such bad thing.

It lets the user know they are logged out, and the software is waiting for another 
login.

If they choose to go elsewhere, that's fine.

I personally in your situation would use php to determine the browser.
If its IE 5.5 state "Due to a bug in IE 5.5 that browser is not supported for use with 
this page."

You could give them the choice to continue anyway, or possibly do session 
authentication only with IE 5.5 if you really wanted to go out of your way to cover up 
for Microsofts bug.

Don't lessen security because of a browser bug, though- instead, refuse to support the 
browser.

Just my opinion.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
Abriasoft Senior Developer




Hi folks,

I have a problem. I think it's the way I'm inputting data into MySQL table.
What I'm trying to do is insert data from a DOS text file into a MySQL
Table. The DOS text file has a country name on each line, like:

United Kingdom
United States

I'm trying to populate a MySQL table called Countries from the MySQL client
like:

LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries;

All the records are created but when I echo them to screen with PHP every
country has a space after it, like:

"United Kingdom "

What am I doing wrong? It's not my PHP code because if I create a table and
manually fill it with values the space isn't present. However, I don't want
to manually have to enter 290 odd countries into the table! So I'm assuming
it's the input file format or I'm missing something on the LOAD DATA
command? However, I have tried saving in every format present in Word (such
as Text Only, MS DOS Only, etc) but with no success.

The MySQL documentation says you can set the end of line marker explicitly
in the LOAD DATA statement. How do you do this?

Many thanks

James







If you're unable to get to the bottom of this problem, you could probably
use PHP's trim() function to massage the data after the table's been
created. The basic algorithm would be to iterate through each record and
replace e.g. $country_name with trim ( $country_name ). Annoying to do, but
much quicker than manually entering data. Again, that suggestion applies
only if somebody doesn't have insight into the underlying cause.

Mitch

>-----Original Message-----
>From: James Duncan [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, March 04, 2001 5:21 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP-WIN] Reading data from MySQL
>
>
>Hi folks,
>
>I have a problem. I think it's the way I'm inputting data into MySQL table.
>What I'm trying to do is insert data from a DOS text file into a MySQL
>Table. The DOS text file has a country name on each line, like:
>
>United Kingdom
>United States
>
>I'm trying to populate a MySQL table called Countries from the MySQL client
>like:
>
>LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries;
>
>All the records are created but when I echo them to screen with PHP every
>country has a space after it, like:
>
>"United Kingdom "
>
>What am I doing wrong? It's not my PHP code because if I create a table and
>manually fill it with values the space isn't present. However, I don't want
>to manually have to enter 290 odd countries into the table! So I'm assuming
>it's the input file format or I'm missing something on the LOAD DATA
>command? However, I have tried saving in every format present in Word (such
>as Text Only, MS DOS Only, etc) but with no success.
>
>The MySQL documentation says you can set the end of line marker explicitly
>in the LOAD DATA statement. How do you do this?
>
>Many thanks
>
>James
>
>
>
>--
>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]
>





When I load data in from a file, I always make sure that the data is seperated
using a character which doesn't occur within the data itself - eg if you have
data with spaces in it, then don't use space a seperator.

eg
LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries FIELDS TERMINATED BY
';';

If however you only have single column data, then your problem is probably in
the file format  - DOS and UNIX use different line terminators.
By default, MySQL will look for the newline character (\n) to terminate lines.
If you have a good text editor (ie not NotePad) then you should be able to
convert the file format from DOS to UNIX (some kind of save as command usually),
and hey presto, your problem should go away. You should also check that there
isn't actually a space at the end of each line in your text file?

Failing that, try specifying the line terminator
eg
LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries LINES TERMINATED BY
' \n';
(the syntax I've exampled will terminate lines when it encounters the
space_newline combination)

Tom
Mitchell Kirschner wrote:

> If you're unable to get to the bottom of this problem, you could probably
> use PHP's trim() function to massage the data after the table's been
> created. The basic algorithm would be to iterate through each record and
> replace e.g. $country_name with trim ( $country_name ). Annoying to do, but
> much quicker than manually entering data. Again, that suggestion applies
> only if somebody doesn't have insight into the underlying cause.
>
> Mitch
>
> >-----Original Message-----
> >From: James Duncan [mailto:[EMAIL PROTECTED]]
> >Sent: Sunday, March 04, 2001 5:21 PM
> >To: [EMAIL PROTECTED]
> >Subject: [PHP-WIN] Reading data from MySQL
> >
> >
> >Hi folks,
> >
> >I have a problem. I think it's the way I'm inputting data into MySQL table.
> >What I'm trying to do is insert data from a DOS text file into a MySQL
> >Table. The DOS text file has a country name on each line, like:
> >
> >United Kingdom
> >United States
> >
> >I'm trying to populate a MySQL table called Countries from the MySQL client
> >like:
> >
> >LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries;
> >
> >All the records are created but when I echo them to screen with PHP every
> >country has a space after it, like:
> >
> >"United Kingdom "
> >
> >What am I doing wrong? It's not my PHP code because if I create a table and
> >manually fill it with values the space isn't present. However, I don't want
> >to manually have to enter 290 odd countries into the table! So I'm assuming
> >it's the input file format or I'm missing something on the LOAD DATA
> >command? However, I have tried saving in every format present in Word (such
> >as Text Only, MS DOS Only, etc) but with no success.
> >
> >The MySQL documentation says you can set the end of line marker explicitly
> >in the LOAD DATA statement. How do you do this?
> >
> >Many thanks
> >
> >James
> >
> >
> >
> >--
> >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]
> >
>
> --
> 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]




At 03:11 PM 3/4/01 -0600, Don Read wrote:
>On 04-Mar-01 Ken wrote:
> > I know about the auth logout.  Unfortunately, that means that when a user
> > clicks "logout", he gets a "log in" prompt!  And, in IE, he has to
> > deliberately blank out the password field, THEN hit enter, THEN the prompt
> > will come again, and he has to hit escape.
>
>I'm still playing with this but ...
>
>My script handles the authentication against a MySQL table;
>and this might (probably) have to get tweaked to play well with .htaccess
>
>The logout script creates a "mark" (tmpfile, db entry, whatever)
>then redirects to a non-protected page. 

My script does something very similar, but it's more advanced than that, because it 
handles these various scenarios:

- Someone clicks "logout", then closes browser, then starts new browser and logs in as 
same of different user
- Someone clicks "logout", then tries to log in again as same or different user
- Someone just closes browser, without clicking "logout"

This would all work perfectly if it weren't for IE5.5 completely refusing to behave 
like it has closed when it has closed.  So I have to require IE5.5 users to click 
logout, which is really no good.

Your script suffers the same problem: An IE5.5 user in the 3rd scenario would just get 
logged right back on without being prompted.

- Ken





At 03:18 PM 3/4/01 -0800, Michael A. Peters wrote:
...
>Generally, I don't think a login prompt when a user clicks logout is such bad thing.
>
>It lets the user know they are logged out, and the software is waiting for another 
>login.
>
>If they choose to go elsewhere, that's fine.

Why it's bad is that, if the user clicks "cancel", they are not logged out.  They have 
to manually clear the field, THEN OK, then they get prompted AGAIN, THEN they hit 
cancel.  That's nuts, and my users aren't going to understand that.

>I personally in your situation would use php to determine the browser.
>If its IE 5.5 state "Due to a bug in IE 5.5 that browser is not supported for use 
>with this page."
>
>You could give them the choice to continue anyway, or possibly do session 
>authentication only with IE 5.5 if you really wanted to go out of your way to cover 
>up for Microsofts bug.
>
>Don't lessen security because of a browser bug, though- instead, refuse to support 
>the browser.
...

Well, I guess nothing is going to solve my problem of making people hit "logout" 
instead of just closing the browsers, if they're using IE5.5, since both the 
user/password are still remembered by the browser, and the session is kept active.  I 
would love to not support IE5.5, but my client uses this version primarily.  I will 
ask them to downgrade...but I wouldn't be surprised if IE doesn't let you install an 
older version!

Anyway, can someone please test to see if this doesn't happen in IE5.0?

I really hate this situation, yessir.

- Ken




I was looking around, and i cant seem to find a compiled version of the
swflib extensions for PHP4.0.4pl1 / IIS 4 / NT4server...

Are they availiable?
If so where? and if someone has 'em, can they send it to me?
otherwise is there a way to use the linux compiled version on NT?
again, if so, can someone send them to me, or tell me where to find
the compiled version?

tnx.
t.



Reply via email to