php-general Digest 5 Mar 2001 09:43:25 -0000 Issue 548

Topics (messages 42526 through 42592):

question about php sessions
        42526 by: Ed Lazor

User login using session algorithm
        42527 by: Arcady Genkin

NEWEST CRAZE
        42528 by: newmarketing5644.juno.com

anchor "#" not working?
        42529 by: andrew
        42530 by: Brian White
        42531 by: Simon Garner
        42534 by: andrew
        42538 by: Don Read
        42545 by: Brian White
        42547 by: Brian White

Re: IE 5.5,authentication,PHP sessions: IE never stops
        42532 by: Michael A. Peters
        42552 by: Ken
        42553 by: Ken
        42557 by: Simon Garner
        42559 by: Ken
        42560 by: Simon Garner
        42563 by: Mitchell Kirschner
        42572 by: Ken
        42574 by: Ed Lazor
        42575 by: Simon Garner
        42577 by: Don Read

Day of the Week
        42533 by: Chris Anderson
        42535 by: Alexander Wagner

Please help!! how to compare an array with another
        42536 by: Jimmy Bäckström

php, secure pages & htdig
        42537 by: Miles Thompson

Re: PHP & PostgreSQL
        42539 by: Andrew Halliday

configure for WDDX functions
        42540 by: Tom

Why doesnt pass-by-value work?
        42541 by: Andrew Halliday
        42544 by: Andrew Halliday

How to connect to PostgreSQL with phpPgAdmin
        42542 by: Paulo Parola

Re: Change the Input to st different..
        42543 by: David Robley

undefined symbol: xmlXPtrNewContext
        42546 by: Jack Lauman

Re: date
        42548 by: Michael Hall
        42550 by: Simon Garner

Re: Running php code inside of a string within a php  script..
        42549 by: Jovan Sedlan
        42590 by: Tim Ward

connecting do MS Access...
        42551 by: Christian Dechery

Unix-time problem
        42554 by: Nicklas af Ekenstam
        42566 by: Don Read

simple OO question
        42555 by: John LYC
        42556 by: Andrew Halliday
        42562 by: John LYC
        42573 by: Andrew Halliday
        42576 by: Andrew Halliday

Question
        42558 by: Deependra B. Tandukar

Page not found error
        42561 by: Randy Johnson
        42564 by: Lewis Bergman

mail problem
        42565 by: Peter Houchin
        42567 by: David Robley

what does $$ mean?
        42568 by: Ed Lazor
        42569 by: Jason Murray
        42578 by: Philip Olson

Re: Problem getting PostgreSQL to compile
        42570 by: K Old

max array size question..
        42571 by: Jeff

Re: Re : [PHP] NETSCAPE screws QUERY STRING
        42579 by: John LYC

File Upload doesn't work with Netscape Serious problem!
        42580 by: Dhaval Desai

Function to compare an array with another array
        42581 by: Jimmy Bäckström

Object Oriented Databases
        42582 by: Fabian Fabela

dealing with no record
        42583 by: Jacky.lilst
        42586 by: David Robley

NETSCAPE screw query string : THANKS ALL !!!!! SOLVED!!
        42584 by: Thomas Edison Jr.

Re: PHP web based mailing list administrator
        42585 by: Manuel Lemos

comparing values
        42587 by: Paul

Re: IE 5.5,authentication,PHP sessions: IE never stops running?
        42588 by: Harshdeep S Jawanda

how to redirect to other page?
        42589 by: JW

Re: NETSCAPE screws up query string : more problems!
        42591 by: Christian Reiniger

Get remote IP ot Host
        42592 by: Rosen

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 =)

Is it possible to track a user session across multiple domains?  We have 
several related web sites and want to enable a user to login through one 
site and end up logged in to them all. I tested and it didn't work and I'm 
guessing it's a limitation of cookies.  As in, a cookie created under one 
domain isn't available to another.  Is this right or is there a way to 
accomplish what I'm talking about?

Thanks =)

-Ed





I'm planning to write a simple user login module.  I want it to be a
stand-alone class, and not rely on cookies (I'm passing all variables
via GET method anyways, so I just want to pass a session ID in the
URL).

Before I go ahead and do some mistake, could somebody have a look at
the outline of the algorithm I've come up with?  Any opinions greately
appreciated.

http://www.thpoon.com/~antipode/tmp/user_auth.png

The algorithm is presented as a flowchart.

p.s. I'd like to "roll my own", even though I know that there is
authentication code available.

Many thanks,
-- 
Arcady Genkin
Nostalgia isn't what it used to be.





Hey...Janet Here... We Haven't Talked In So Long!!  
How Have You Been?  Thought I would Forward you this email!

I usually delete these but I opened this one, like what I saw, 
and thought you would like to see this.

http://www.geocities.com/anewmarket9999/

IF THE LINK IS NOT HIGHLIGHTED OR YOU CANNOT CLICK ON IT.
COPY AND PASTE IT IN YOUR BROWSER.













hi folks!

I've got a baffling, but probably simple problem (the worst kind)

In my index.php page, I'm dynamically generating links like this:
http://localhost/news.php#1


When I click the link, the url string get's passed in, and looking at the
source of the news.php page shows:

<a href="#1"></a> 

about half-way down.. but the page doesn't align with the anchor tag.

I assume PHP doesn't do anything funky?

Can anyone see what I've overlooked?

tia!
andrew






Try:
    <a name="1"></a>

At 06:02 PM 3/4/01 -0500, andrew wrote:
>hi folks!
>
>I've got a baffling, but probably simple problem (the worst kind)
>
>In my index.php page, I'm dynamically generating links like this:
>http://localhost/news.php#1
>
>
>When I click the link, the url string get's passed in, and looking at the
>source of the news.php page shows:
>
><a href="#1"></a>
>
>about half-way down.. but the page doesn't align with the anchor tag.
>
>I assume PHP doesn't do anything funky?
>
>Can anyone see what I've overlooked?
>
>tia!
>andrew
>
>
>
>--
>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]

-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]





From: "andrew" <[EMAIL PROTECTED]>

> hi folks!
> 
> I've got a baffling, but probably simple problem (the worst kind)
> 
> In my index.php page, I'm dynamically generating links like this:
> http://localhost/news.php#1
> 
> 
> When I click the link, the url string get's passed in, and looking at the
> source of the news.php page shows:
> 
> <a href="#1"></a> 
> 
> about half-way down.. but the page doesn't align with the anchor tag.


Change this to:

<a name="1"></a>




Cheers

Simon Garner





thanks for the feedback, gents, but it's not working :/..

I changed to this, as suggested:

> <a name="1"></a

actually, here is a snippet of the function I'm using the generate the link:

<a href=\"news.php#$row[0]\"><h5>...more</h5></a>

and the subsequent anchor on the next page....

while ($row = mysql_fetch_row($result))
{
        <a name=\"$row[0]\"></a>
        <tr><td><h3>$row[2]</h3></td></tr>
        <tr><td><h4>$row[3]</h4></td></tr>
}

I've verifeid that $row[0] is printing the exact same content on both
pages... quite odd that it's not working.

TIA,
andrew






On 04-Mar-01 andrew wrote:
> thanks for the feedback, gents, but it's not working :/..
> 
> I changed to this, as suggested:
> 
>> <a name="1"></a
> 
> actually, here is a snippet of the function I'm using the generate the link:
> 
> <a href=\"news.php#$row[0]\"><h5>...more</h5></a>
> 
> and the subsequent anchor on the next page....
> 
> while ($row = mysql_fetch_row($result))
> {
>         <a name=\"$row[0]\"></a>
>         <tr><td><h3>$row[2]</h3></td></tr>
>         <tr><td><h4>$row[3]</h4></td></tr>
> }
> 
> I've verifeid that $row[0] is printing the exact same content on both
> pages... quite odd that it's not working.


maybe faulty memory on my part, but i think I've seen something similar
(i.e. "<a name>" is flakey inside tables).

play with putting <a name ..></a> within your <tr> or <h3> tags. 

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. 




OK. The Following code , when put in a file called "anchortest.php". Seems 
to work
properly. Might be a good starting point:

<html>
    <head><title>PHP Anchor Test</title></head>
    <body>
<h2>PHP Anchor Tester</h2>

<?php
   if ( ! $NumAnchors ) { $NumAnchors="20"; }
   $fname="anchortest.php"
?>

<h4>Regenerate Number of Anchors</h4>
<form method="GET" action="<?php print $fname; ?>" >
<p>Please enter the Number of Anchors:
<input type=text name="NumAnchors" value="<?php print $NumAnchors; ?>" >
</form>

<h4>Select An Anchor To Go To:</h4>

<p>
<?php
   for ( $i = 1; $i <= (0 + $NumAnchors) ; $i++ )
   {
     print "<a href=\"$fname?NumAnchors=$NumAnchors#$i\">[$i]</a> ";
   }
?>

<h4>Generated Anchors</h4>

<?php
   for ( $i = 1; $i <= (0 + $NumAnchors) ; $i++ )
   {
     print "<p><a name=\"$i\"></a>Generated Anchor number $i \n";
   }
?>


</body>
</html>



-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]





Well, that came back to me as Garbage, so Just in case - here it is
as an attachment. (I hope this works .. )

At 12:09 PM 3/5/01 +1100, Brian White wrote:
>OK. The Following code , when put in a file called "anchortest.php". Seems 
>to work
>properly. Might be a good starting point:

-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]




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




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




From: "Ken" <[EMAIL PROTECTED]>

>
> 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.
>


Why do they need to be able to log out?

If the user doesn't want their password saved (e.g. they're on a public PC)
then they just uncheck the "Save password" box when logging in, and then
they can close the browser and be "logged out".

If they want their password saved then they can check the "Save password"
box and not worry.

It sounds to me like you're trying to implement something that no users are
actually going to need or want...

However, if you want more control over the authentication process I suggest
making your own login form and using cookies, instead of HTTP
authentication. Then you can log users out just by unsetting the cookie(s).


Cheers

Simon Garner





At 04:11 PM 3/5/01 +1300, Simon Garner wrote:
>From: "Ken" <[EMAIL PROTECTED]>
> > 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.
> >
>
>Why do they need to be able to log out?

Because they are on a shared computer.

>If the user doesn't want their password saved (e.g. they're on a public PC)
>then they just uncheck the "Save password" box when logging in, and then
>they can close the browser and be "logged out".
>
>If they want their password saved then they can check the "Save password"
>box and not worry.

Nope - with IE5.5, even with that box NOT checked, the user remains logged in until 
either a) the computer is restarted, or b) a new user-authentication header is sent, 
AND the user clears out the password field and hits OK.  Otherwise the user stays 
logged in, in spite of the HTTP spec.

>It sounds to me like you're trying to implement something that no users are
>actually going to need or want...

Nope, I'm working with a real client, who has multiple users on the same machine, and 
IE5.5 is installed on it, and, lo and behold, though the rest of the browsers work 
fine, IE5.5 has this awful bug.

>However, if you want more control over the authentication process I suggest
>making your own login form and using cookies, instead of HTTP
>authentication. Then you can log users out just by unsetting the cookie(s).

This is how I will wind up going, EXCEPT the users will be required to click "logout", 
since merely closing the browser, in IE5.5, does not seem to clear the user/password 
from the browser's memory, NOR does it clear any session cookie.  Again, works fine in 
other browsers, per spec.

Thanks,

Ken

>Cheers
>
>Simon Garner





From: "Ken" <[EMAIL PROTECTED]>

>
> Nope - with IE5.5, even with that box NOT checked, the user remains logged
in until either a) the computer is restarted, or b) a new
user-authentication header is sent, AND the user clears out the password
field and hits OK.  Otherwise the user stays logged in, in spite of the HTTP
spec.
>

Admittedly I'm running IE5.01, but if I close and reopen the browser it will
pop up the authentication dialogue again (with values filled out, if I did
Save Password).

Does this really not happen in 5.5?


>
> This is how I will wind up going, EXCEPT the users will be required to
click "logout", since merely closing the browser, in IE5.5, does not seem to
clear the user/password from the browser's memory, NOR does it clear any
session cookie.  Again, works fine in other browsers, per spec.
>

You mean it doesn't clear per-session cookies (expiry=0) either? Cripes...

What Windows version is this under?






>
>Nope, I'm working with a real client, who has multiple users on
>the same machine, and IE5.5 is installed on it, and, lo and
>behold, though the rest of the browsers work fine, IE5.5 has this
>awful bug.
>

I don't have this session-terminating problem with IE 5.5 when using Apache
and PHP locally on my Win95 computer. I'm also pretty sure it works fine
when connected to a Linux/Apache/PHP server where I have some webspace.

Question: Do you have the latest bunch of fixes and security updates for IE
5.5? I remember after I first installed 5.5 a couple of months ago, there
were many megabytes of fixes, patches, security updates, etc. (There are
probably many more since then.) Perhaps there's already a fix for the bug.

Assuming you have an internet connection from each PC, go into IE 5.5, then
select Tools-Windows Update. The MS website should auto-detect the fixes etc
that you need and prompt you to install them.

Mitch





At 04:28 PM 3/5/01 +1300, Simon Garner wrote:
>From: "Ken" <[EMAIL PROTECTED]>
> > Nope - with IE5.5, even with that box NOT checked, the user remains logged
>in until either a) the computer is restarted, or b) a new
>user-authentication header is sent, AND the user clears out the password
>field and hits OK.  Otherwise the user stays logged in, in spite of the HTTP
>spec.
>
>Admittedly I'm running IE5.01, but if I close and reopen the browser it will
>pop up the authentication dialogue again (with values filled out, if I did
>Save Password).
>Does this really not happen in 5.5?

Yes.  Someone else on the list wrote, "I didn't believe you until I tried it for 
myself."  At least, it happens in 5.5 on the PC and Mac that my client has.  Someone 
proposed I download any patches MS has, so I'll ask my client to do that, and we'll 
see if it's fixed.  Some members of the list have verified that this happens in IE 
5.5, and some members indicate that it is not happening in their IE 5.5.  And so far 
no problem fix has been found on MS's site.

> > This is how I will wind up going, EXCEPT the users will be required to
>click "logout", since merely closing the browser, in IE5.5, does not seem to
>clear the user/password from the browser's memory, NOR does it clear any
>session cookie.  Again, works fine in other browsers, per spec.
>
>You mean it doesn't clear per-session cookies (expiry=0) either? Cripes...

Correct.  Expiration is 0.  Other browsers on the same system are clearing the cookie 
when the browser is shut down, including IE 4.

>What Windows version is this under?

Windows 98 and Mac OS 8 or 9.

- Ken






> >However, if you want more control over the authentication process I suggest
> >making your own login form and using cookies, instead of HTTP
> >authentication. Then you can log users out just by unsetting the cookie(s).
>
>This is how I will wind up going, EXCEPT the users will be required to 
>click "logout", since merely closing the browser, in IE5.5, does not seem 
>to clear the user/password from the browser's memory, NOR does it clear 
>any session cookie.  Again, works fine in other browsers, per spec.

I tried to read up on this thread before responding, so please excuse me if 
I don't know all the facts.  Have you tried using PHP's sessions to track 
user logins?  If cookies are available, it takes advantage of them.  If 
not, a session tracking variable is automatically appended to the url.

For my own web site, I register a session variable.  For my situation, it 
happens to be an array, but you may not need this.

         if (! IsSet($user) ) {
                 $user = array();
                 session_register("user");
                 $user["Username"] = "Guest";
         }

 From there, present the visitor with a login form.  Process the login form 
and set the $user["Username"] variable after you've confirmed their 
login.  If you want them to log out, they click a link taking them to a 
page that sets the variable back to $user["Username"] = "Guest".  Best of 
all, if they close their browser, the browser session is lost.

That setup allows people to work at a computer, logout of the web site, and 
allow someone else to login.  Or, they can just close the browser window 
and let someone else sit down to open a new browser window and login.

There's one thing you'll want to keep in mind, in case you don't already 
know it.  Each browser window you spawn from the original uses the same 
session.  If you login and then press CTRL-N to open additional windows, 
they will all use the same session.  Of course, the way around this is to 
just run separate copies of the program to gain additional windows.

Another thing of note, in case it will help, I'm using IE5.5 and don't 
experience the problems you've described.

-Ed





From: "Ken" <[EMAIL PROTECTED]>

>
> >What Windows version is this under?
>
> Windows 98 and Mac OS 8 or 9.
>
> - Ken
>


Is IE set to "Launch browser windows in a separate process" (if that option
still exists in 5.5)? Have a look in Tools > Options > Advanced.

Perhaps if that is not checked, closing the window does not count as exiting
the browser?








On 05-Mar-01 Ken wrote:
> At 04:11 PM 3/5/01 +1300, Simon Garner wrote:
>>From: "Ken" <[EMAIL PROTECTED]>
>> > 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.
>> >
>>
>>Why do they need to be able to log out?
> 
> Because they are on a shared computer.
> 
>>If the user doesn't want their password saved (e.g. they're on a public PC)
>>then they just uncheck the "Save password" box when logging in, and then
>>they can close the browser and be "logged out".
>>
>>If they want their password saved then they can check the "Save password"
>>box and not worry.
> 
> Nope - with IE5.5, even with that box NOT checked, the user remains logged
> in until either a) the computer is restarted, or b) a new
> user-authentication header is sent, AND the user clears out the password
> field and hits OK.  Otherwise the user stays logged in, in spite of the HTTP
> spec.
> 
>>It sounds to me like you're trying to implement something that no users are
>>actually going to need or want...
> 
> Nope, I'm working with a real client, who has multiple users on the same
> machine, and IE5.5 is installed on it, and, lo and behold, though the rest
> of the browsers work fine, IE5.5 has this awful bug.
> 
>>However, if you want more control over the authentication process I suggest
>>making your own login form and using cookies, instead of HTTP
>>authentication. Then you can log users out just by unsetting the cookie(s).
> 
> This is how I will wind up going, EXCEPT the users will be required to click
> "logout", since merely closing the browser, in IE5.5, does not seem to clear
> the user/password from the browser's memory, NOR does it clear any session
> cookie.  Again, works fine in other browsers, per spec.
> 

Is this a NT-Domain network ? It's been a few years since i was sysadmining,
but the user might have to log off the network domain/workgroup to
re-select the credential file (luser.pwl file or whatever Bill & the boys
from Redmond call it now).
But i'll agree that if IE keeps the authentication after you close the browser,
it _is_ borken. 

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. 




Is there a function to return the day of the week? Or at least a number that I can use 
to determine this?

Thanks




Chris Anderson wrote:
> > Is there a function to return the day of the week? Or at least a
> number that I can use to determine this?

RTM
http://php.net/date

Have a look at "D", "l" (lowercase L) and "w".

regards
Wagner

-- 
Assumption is the mother of all fuck-ups.




Shu!
I am currently working on a site where I want to randomly show pictures. I am using 
sessions to save the id's of the pictures that a user has seen during his/hers visit. 
My first question is: Can I use an array as a session variable? like this:
$arr = array(1, 2, 3, 4, 5);
session_start();
session_register("arr");

This array is to be passed on as an argument to a function used to find a random id, 
that has not yet been seen. This array should be compared to another array with the 
picture id's. There is two functions to accomplish the following: Create a randomized 
array consisting of all the pictures id. Find one id in that randomized array that 
does not exist in the array of allready seen pictures. These are the functions:

function show_pic($pics_voted, $cat, $sex) {
 srand ((double) microtime() * 1000000);
 $result = query("SELECT id FROM $cat WHERE sex='$sex'");
 while ($row = mysql_fetch_row($result)) {
  $arr[] = $row[0];
 }
 shuffle($arr);
 $picture_id = find_id($pics_voted, $arr);
 echo "picture_id => $picture_id";
 return $picture_id;
}//show_pic


//Hitta id som inte finns bland $pics_voted[]
function find_id($pics_voted, $random, $x = 0) {
 for ($i = 0; $i < count($pics_voted); $i++) {
  if ($random[$x] == $pics_voted[$i] AND $x >= count($random)) return "no_pics"; //If 
current key in $random[] is equal to current key in $pics_voted[] AND $x is greater 
than, or equal to the number of keys in $random[], that is if the last key in 
$random[] has been reached, return "no_pics"
  elseif ($random[$x] == $pics_voted[$i]) {
   find_id($pics_voted, $random, $x+1); //If current key in $random[] is equal to 
current key in $pics_voted[] run the function again, with $x+1 as an argument to be 
used in the $random[] array, that is: do the funtion again with the next key in 
$random[]
  }//elseif
 }//for
 return $random[$x];

}//find_id


Does anyone know why this ain't working? I get the same id over and over again. Maybe 
there is an easuer way to achive what I want?
Please help!!





I've protected my PHP pages with this little fragment of script, at the 
very top of the page

<? session_start();
if( !session_is_registered( "member_id" ) )
{
        header("Location: user_logon.php\n");
}
?>

When I try indexing the pages, using htdig, all I get is a redirect 
message. And of course the basic authentication won't work.

Has anyone had any experience of this?

What I am thinking of trying is creating a PHP page to establish a session 
and then exec'ing htdig from within the page. If that works it will be 
pretty useful as I'll be able to add it to my Maintenance page. No good, 
though, for running htdig

Before I try this, though, I'm going to r ead through Coli Viebrock's 
"Search This!" article.

If anyone has any experience or suggestions for an alternate search engine 
I'll welcome them.

Regards - Miles Thompson





The following is an example demonstrating how to set up a foreign key
constraint in PostgreSQL 7:

CREATE SEQUENCE school_id_seq;
CREATE TABLE school (
  school_id   INT NOT NULL PRIMARY KEY DEFAULT nextval('school_id_seq'),
  school_name VARCHAR(80) NOT NULL
);

CREATE SEQUENCE student_id_seq;
CREATE TABLE student (
  student_id   INT NOT NULL PRIMARY KEY DEFAULT nextval('student_id_seq'),
  student_name VARCHAR(80) NOT NULL,
  school_id    INT NOT NULL,
  CONSTRAINT school_exists
    FOREIGN KEY(school_id) REFERENCES school
    ON DELETE RESTRICT
);

INSERT INTO school (school_name) VALUES ('Alice''s School of Truck
Driving');
INSERT INTO school (school_name) VALUES ('Bob''s School of Underwater
Knitting');

INSERT INTO student (student_name, school_id) VALUES ('Charlie', 1);
INSERT INTO student (student_name, school_id) VALUES ('Doug', 1);
INSERT INTO student (student_name, school_id) VALUES ('Ernie', 2);

Note the 'ON DELETE RESTRICT' which will prevent you from deleting a school
if there is a student going to that school. First look at what's in the
tables:

SELECT * FROM school;
SELECT * FROM student;

Now attempt to delete the school:

DELETE FROM school WHERE school_id = 1;

If you try the above, you should see 'ERROR: school_exists referential
integrity violation - key in school still referenced from student' and
notice that nothing was deleted.

If you want to try the above more than once, the following may be handy:
DROP SEQUENCE school_id_seq;
DROP TABLE school;
DROP SEQUENCE student_id_seq;
DROP TABLE student;

Cascade & Update
Instead of 'ON DELETE RESTRICT' you could specify 'ON DELETE CASCADE'. This
would allow the delete (instead of preventing it like in the example above),
but it would 'cascade' the delete to the student table so that any students
going to the school you deleted would also be deleted.

As well as the 'ON DELETE ...' clause you can also specify what is to happen
on an update of the foreign key with either:

  a.. ON UPDATE RESTRICT or
  b.. ON UPDATE CASCADE
ON UPDATE RESTRICT would prevent UPDATE school SET school_id = 20 WHERE
school_id = 1 from proceeding if there were any students with a school_id of
1.

You might be able to guess that ON UPDATE CASCADE would allow the UPDATE
school SET school_id = 20 WHERE school_id = 1 to proceed, but it would also
update the school_id field in the student table appropriately.

Foreign Keys where the field names are different
Consider the following table setup:

CREATE SEQUENCE school_id_seq;
CREATE TABLE school (
  id   INT NOT NULL PRIMARY KEY DEFAULT nextval('school_id_seq'),
  name VARCHAR(80) NOT NULL
);

CREATE SEQUENCE student_id_seq;
CREATE TABLE student (
  id        INT NOT NULL PRIMARY KEY DEFAULT nextval('student_id_seq'),
  name      VARCHAR(80) NOT NULL,
  school_id INT NOT NULL,
  CONSTRAINT school_exists
    FOREIGN KEY(school_id) REFERENCES school(id)
    ON DELETE RESTRICT
);

INSERT INTO school (name) VALUES ('Alice''s School of Truck Driving');
INSERT INTO school (name) VALUES ('Bob''s School of Underwater Knitting');

INSERT INTO student (name, school_id) VALUES ('Charlie', 1);
INSERT INTO student (name, school_id) VALUES ('Doug', 1);
INSERT INTO student (name, school_id) VALUES ('Ernie', 2);

Note how the field names don't match (school.id as opposed to
student.school_id); in this case we can put the field name in brackets after
the table name.

As before, the following will fail:

DELETE FROM school WHERE id = 1;


- AndrewH

----- Original Message -----
From: "Marcelo Pereira" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 1:00 AM
Subject: [PHP] PHP & PostgreSQL


Hi, All.

I have to build a web site and I was
studying postgreSQL, but, whether I am
quite wrong or this database does not
support Foreign Key.

Does anyone use postgreSQL and know
how handle Foreign Keys ???

Thanks,

Marcelo Pereira
Computer Programmer


__________________________________________________________________________
O BOL é Top10 no iBest! Vote já para torná-lo Top3!
http://www.bol.com.br/ibest.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]







I am getting the dreaded
"Call to undefined function: wddx_serialize_vars()"
from code that previously ran/now runs fine on 4.0.2pl1 (win32)

Here's what I have:

I am on an server farm that has 4.0.4pl1 installed (FreeBSD)

phpinfo shows XML enabled - but not 'additional modules' are shown (where 
WDDX module is typically shown as enabled by defult

the 'configuration directives' as seen in phpinfo have _no_ mention of WDDX

I do have control of the php.ini file 
-- I tried the "php_flag wddx on" approach in php.ini but it had no effect 
(in phpinfo() output either)

Any clues as to what I am missing?

Many thanks,
Tom




When I call this function:

   function getColumnName($col)
   {
      if ($col > 0 && $col < pg_numfields($this->lastResultSet))
         return pg_fieldname($this->lastResultSet,$col);
      else
         return null;
   }


It returns null all the time !
The condition is NOT the problem ... Ive tested that with:

   function getColumnName($col)
   {
         return pg_fieldname($this->lastResultSet,$col);
      if ($col > 0 && $col < pg_numfields($this->lastResultSet))
         return pg_fieldname($this->lastResultSet,$col);
      else
         return null;
   }

And it still returns null.

If I do this:

   function getColumnName($col)
   {
         echo pg_fieldname($this->lastResultSet,$col);
         return pg_fieldname($this->lastResultSet,$col);
      if ($col > 0 && $col < pg_numfields($this->lastResultSet))
         return pg_fieldname($this->lastResultSet,$col);
      else
         return null;
   }

I do get the correct result printed to the browser ...
So what the HELL is going on?   Dont tell me that pass by reference doesnt
work with pg_* functions?
Just to test this, I did this:

   function getColumnName($col)
   {
         $test = pg_fieldname($this->lastResultSet,$col);
         return $test;
      if ($col > 0 && $col < pg_numfields($this->lastResultSet))
         return pg_fieldname($this->lastResultSet,$col);
      else
         return null;
   }


This made no difference ... WHAT AM I DOING WRONG?!

AndrewH





Ahh - dont worry about this post ... :)

AndrewH


----- Original Message -----
From: "Andrew Halliday" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 10:51 AM
Subject: [PHP] Why doesnt pass-by-value work?


> When I call this function:
>
>    function getColumnName($col)
>    {
>       if ($col > 0 && $col < pg_numfields($this->lastResultSet))
>          return pg_fieldname($this->lastResultSet,$col);
>       else
>          return null;
>    }
>
>
> It returns null all the time !
> The condition is NOT the problem ... Ive tested that with:
>
>    function getColumnName($col)
>    {
>          return pg_fieldname($this->lastResultSet,$col);
>       if ($col > 0 && $col < pg_numfields($this->lastResultSet))
>          return pg_fieldname($this->lastResultSet,$col);
>       else
>          return null;
>    }
>
> And it still returns null.
>
> If I do this:
>
>    function getColumnName($col)
>    {
>          echo pg_fieldname($this->lastResultSet,$col);
>          return pg_fieldname($this->lastResultSet,$col);
>       if ($col > 0 && $col < pg_numfields($this->lastResultSet))
>          return pg_fieldname($this->lastResultSet,$col);
>       else
>          return null;
>    }
>
> I do get the correct result printed to the browser ...
> So what the HELL is going on?   Dont tell me that pass by reference doesnt
> work with pg_* functions?
> Just to test this, I did this:
>
>    function getColumnName($col)
>    {
>          $test = pg_fieldname($this->lastResultSet,$col);
>          return $test;
>       if ($col > 0 && $col < pg_numfields($this->lastResultSet))
>          return pg_fieldname($this->lastResultSet,$col);
>       else
>          return null;
>    }
>
>
> This made no difference ... WHAT AM I DOING WRONG?!
>
> AndrewH
>
>
> --
> 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]
>





For the phpPgAdmin users, if you might help!!!....

I am running PostgreSQL 7.1 over RedHat.

When trying to connect through the web everything goes right. A script that
is currently working:

<?php

    $link = pg_Connect("host=localhost port=5432 dbname=teste")
      or die ("Could not connect");

    $comando = "select * from teste";
    $result = pg_exec($link,$comando);
    $linhas_retornadas = pg_numrows($result);

    echo "<table><td><b>nome</b></td><td><b>sobrenome</b>";
    for ($i=0; $i < $linhas_retornadas; $i++) {
      $row=pg_fetch_array($result,$i);
      echo "<tr><td>" . $row["nome"] . "</td>";
      echo "<td>" . $row["sobrenome"] . "</td></tr>";
    }
    echo "</table>";

    pg_close ($link);
?>


All *my databases are owned by user 'postgres'* and I had to create another
PostgreSQL *user 'apache' and give ownership of table 'teste' in database
'teste' to this user* (apache) in order for this connection to work.

My 'pg_hba.conf' file reads:
local        all
trust
host         all         127.0.0.1     255.255.255.255     trust

With phpPgAdmin I configured file 'config.inc.php' as follows:

// The default database is used to connect to the database to check the
adv_auth
//      This can actually be any database you currently have on your system.
It just
//      needs _a_ database to connect and check the system tables.
$cfgDefaultDB   = "teste";

// You should change the superuser if different from postgres
//      This is just used to filter out the system functions when listing
$cfgSuperUser   = "postgres";

//  Set to true if you want to authenticate against the passwd as well as
the username
//       In order to use adv_auth, you must update the passwords in the user
admin section.
//       It is suggested that you leave this as false until you are able to
get in and update the passwords.
$cfgUsePass             = false;
$cfgServers[1]['local']         = true;
$cfgServers[1]['host']          = 'localhost';
$cfgServers[1]['port']          = '5432';
$cfgServers[1]['adv_auth']      = false;
$cfgServers[1]['stduser']       = 'apache';

No matter if I set
  $cfgServers[1]['host']  as 'localhost' or as '127.0.0.1'
  $cfgServers[1]['stduser'] as 'apache' or as 'postgres' or as none


No matter what I always get a blank Web page with the following messages:

================
ERROR
The requested URL could not be retrieved

While trying to retrieve the URL: [no URL]

The following error was encountered:
Zero Sized Reply

Squid did not receive any data for this request.
Your cache administrator is webmaster.
Generated Sun, 04 Mar 2001 23:15:30 GMT by internet.gst.com.br
(Squid/2.3.STABLE3)
================

Please help!!! This shall most probably be some problem of permission, but
how do I manage to make phpPgAdmin to correctly connect and access my
databases?

TIA,
Paulo






On Mon,  5 Mar 2001 08:59, Erdinc Guler wrote:
> hi..
> my problem is to change some characters from input data coming from a
> form to something..i mean like :
> input    output
> -----    ------
> i    -->  y
> fire -->  fyre
>
> Is it possible??
>
> erdinc..

Have a look in the String Functions section of the manual. In particular, 
substr_replace, str_replace or strtr. Also the Regular Expressions 
section if you want more complex replacement capabilities.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




I get the following error when I attempt to start Apache 1.3.19
(RedHad 7.0):

apachectl start

Syntax error on line 230 of /etc/httpd/conf/httpd.conf:
Cannot load /usr/lib/apache/libphp4.so into server:
/usr/lib/apache/libphp4.so:
undefined symbol: xmlXPtrNewContext
/usr/sbin/apachectl start: httpd could not be started

I'm using libxml 2.3.3, and I assume the error is from the ./configure
statement --xith-dom

I'd appreciate any suggestions on how to resolve it.

TIA

Jack





Yes you can. Include a field in your db called 'date' or whatever.

Generate the date in your script using:

        $today = date("Y-m-d");

Then simply add the date to the db along with everything else.
There are lots of ways to format dates, too many to describe here.
Have a look at the PHP manual.
Also, if you make the data-type of the date field 'date', your options for
formatting are more limited. That stuff is all in the MySQL manual.

Michael


On Sun, 4 Mar 2001, george wrote:

>   Can you mark the date when an entry is placed in the db and then get that
> date to display  when the info is pulled out
> 
> TIA
> 
> george
> 
> 
> 
> 
> -- 
> 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]
> 
> 





From: "Michael Hall" <[EMAIL PROTECTED]>

>
> Yes you can. Include a field in your db called 'date' or whatever.
>
> Generate the date in your script using:
>
> $today = date("Y-m-d");
>
> Then simply add the date to the db along with everything else.
> There are lots of ways to format dates, too many to describe here.
> Have a look at the PHP manual.
> Also, if you make the data-type of the date field 'date', your options for
> formatting are more limited. That stuff is all in the MySQL manual.
>
> Michael
>
>
> On Sun, 4 Mar 2001, george wrote:
>
> >   Can you mark the date when an entry is placed in the db and then get
that
> > date to display  when the info is pulled out
> >
> > TIA
> >
> > george
> >


If you make the field in the database of type "DATETIME" then you can insert
dates and select formatted date values using MySQL's date and time
functions. (I assume you're using a MySQL database.) There is no need to use
PHP's date functions.


Examples:

CREATE TABLE mytable (
    ...
    mydate DATETIME,
    ...
)

To insert the current date, use NOW() as the date value:

INSERT INTO mytable VALUES (..., NOW(), ...)

To select the date formatted as "Saturday March 5th 2001 12:30 PM":

SELECT
    col1,
    col2,
    DATE_FORMAT(mydate, '%W %M %D %Y %r') AS mydate,
    col4
FROM mytable


http://www.mysql.com/doc/D/a/Date_and_time_functions.html


Cheers

Simon Garner





You can save the string to, say, "temp.php" and then use
include("temp.php").

--
Jovan Sedlan
[EMAIL PROTECTED]
http://www.sedlan.com
#7 Components Home

"Aviv Revach" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey!
>
> At 14:29 02/03/01 -0300, Lucas Persona wrote:
> >Hy there!
> >
> >Aviv Revach wrote:
> > > How can I make those php3 commands to work as they supposed
to?
> >
> >   Take a look at the eval() function
> >http://www.php.net/manual/en/function.eval.php
> >   It does exactly what you are looking for...
>
> Actually it doesn't. My string does not(!!) contains only php
code.
> It contains HTML tags, text, and php code (called with <?php
?>).
>
> Now, What should I do in order to run both the html tags and
the php commands
> in it?
>
>
> Thank you in advance -
>
>    Aviv Revach
>
>      BRILLIANeT Website -
>    http://www.brillianet.com/
>
>
> --
> 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]
>






Writing the string to a file and then include()ing it would work. It does
seem a bit heavy handed, but unless there's a string equivelant of include()
this may actually be the best way.

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: Aviv Revach [mailto:[EMAIL PROTECTED]]
> Sent: 01 March 2001 18:02
> To: Lucas Persona; php-list
> Subject: Re: [PHP] Running php code inside of a string within a php
> script..
> 
> 
> Hey!
> 
> At 14:29 02/03/01 -0300, Lucas Persona wrote:
> >Hy there!
> >
> >Aviv Revach wrote:
> > > How can I make those php3 commands to work as they supposed to?
> >
> >   Take a look at the eval() function
> >http://www.php.net/manual/en/function.eval.php
> >   It does exactly what you are looking for...
> 
> Actually it doesn't. My string does not(!!) contains only php code.
> It contains HTML tags, text, and php code (called with <?php ?>).
> 
> Now, What should I do in order to run both the html tags and 
> the php commands
> in it?
> 
> 
> Thank you in advance -
> 
>    Aviv Revach
> 
>      BRILLIANeT Website -
>    http://www.brillianet.com/
> 
> 




which is the best way to connect to MS Access and process and request queries?
is it with odbc_*() functions? cuz I found that not that good...
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Hi!

I wrote this simple function to return the current date minus supplied 
number of years:

function get_birthdate($age_in_years)   {
        
        // get the current timestamp into an array
        $timestamp =  time();
        $date_time_array =  getdate($timestamp);
        $hours =  $date_time_array["hours"];
        $minutes =  $date_time_array["minutes"];
        $seconds =  $date_time_array["seconds"];
        $month =  $date_time_array["mon"];
        $day =  $date_time_array["mday"];
        $year =  $date_time_array["year"];
        
        // use mktime to recreate the unix timestamp
        // subtracting age_low and age_high from the years
        $timestamp =  mktime($hours, $minutes,$seconds ,$month, $day,$year - 
$age_in_years);
        $birthdate = strftime("%d/%m/%Y", $timestamp);

        return($birthdate);
}

You, obviously, call it like this: echo get_birthdate(1);
Which would return a datestring that looks like this: 05/03/2000

Works nice, but the problem occurs when I try to subtract more than 31 
years which is naturall since, as far as UNIX is concerned, the world 
didn't exist then.
(Took me a while to figure this one out though.)

Any clues on how to fix this so that I can go beyond the past 31 years?

Sincerely,
Nicklas






On 05-Mar-01 Nicklas af Ekenstam wrote:
> Hi!
> 
> I wrote this simple function to return the current date minus supplied 
> number of years:
> 
> function get_birthdate($age_in_years) {
>       
<snip>

> You, obviously, call it like this: echo get_birthdate(1);
> Which would return a datestring that looks like this: 05/03/2000
> 
> Works nice, but the problem occurs when I try to subtract more than 31 
> years which is naturall since, as far as UNIX is concerned, the world 
> didn't exist then.
> (Took me a while to figure this one out though.)
> 
> Any clues on how to fix this so that I can go beyond the past 31 years?
> 

function get_birthdate($age_in_years) {
  list ($y,$m,$d) =explode('-', date('Y-m-d'));
  $bdstr=sprintf("%02d/%02d/%04d", $m, $d, $y - $age_in_years);
  return($bdstr);
}

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. 




can i do this..?

//declaring class

class myclass{

//declaring properties
...
....

//declaring methods..
function mymethod(){

//can i declared variable in method?
var $myvar;
...
//do something

}//end of mymethod

///////////////////

if yes, do i access myvar like this.
$item = new myclass;
print $item->mymethod()->myvar;


thanks
john








yes you can do all of this

but in no OO language so far have i seen the ability to access a variable
inside a method...you would have to do this:

class myclass
{
 var $myvar;
 function setmyvar($newmyvar)
 {
     $this->myvar = $newmyvar;
 }
}

Then you could do this:

$myclassObj = new myclass();
$myclassObj->setmyvar(10);
echo $myclassObj->myvar;

This would print '10'...

Cut and paste that exact program in and it should be a working demonstration
...

You should read the php manual more ...
see
www.php.net

AndrewH
----- Original Message -----
From: "John LYC" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 1:36 PM
Subject: [PHP] simple OO question


> can i do this..?
>
> //declaring class
>
> class myclass{
>
> //declaring properties
> ...
> ....
>
> //declaring methods..
> function mymethod(){
>
> //can i declared variable in method?
> var $myvar;
> ...
> //do something
>
> }//end of mymethod
>
> ///////////////////
>
> if yes, do i access myvar like this.
> $item = new myclass;
> print $item->mymethod()->myvar;
>
>
> thanks
> john
>
>
>
>
>
> --
> 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]
>





class myclass{

$fields = mysql_list_fields("database1", "table1", $link);
$columns = mysql_num_fields($fields);

for ($i = 0; $i < $columns; $i++) {
    var mysql_field_name($fields, $i);
}

}//class

now.. can i do this?
is there a performnance issue here?
can i put this in the constructor?

john




Andrew Halliday wrote:

> yes you can do all of this
>
> but in no OO language so far have i seen the ability to access a variable
> inside a method...you would have to do this:
>
> class myclass
> {
>  var $myvar;
>  function setmyvar($newmyvar)
>  {
>      $this->myvar = $newmyvar;
>  }
> }
>
> Then you could do this:
>
> $myclassObj = new myclass();
> $myclassObj->setmyvar(10);
> echo $myclassObj->myvar;
>
> This would print '10'...
>
> Cut and paste that exact program in and it should be a working demonstration
> ...
>
> You should read the php manual more ...
> see
> www.php.net
>
> AndrewH
> ----- Original Message -----
> From: "John LYC" <[EMAIL PROTECTED]>
> To: "PHP List" <[EMAIL PROTECTED]>
> Sent: Monday, March 05, 2001 1:36 PM
> Subject: [PHP] simple OO question
>
> > can i do this..?
> >
> > //declaring class
> >
> > class myclass{
> >
> > //declaring properties
> > ...
> > ....
> >
> > //declaring methods..
> > function mymethod(){
> >
> > //can i declared variable in method?
> > var $myvar;
> > ...
> > //do something
> >
> > }//end of mymethod
> >
> > ///////////////////
> >
> > if yes, do i access myvar like this.
> > $item = new myclass;
> > print $item->mymethod()->myvar;
> >
> >
> > thanks
> > john
> >
> >
> >
> >
> >
> > --
> > 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]





No, you cant do this as you coded it, however minor alterations will allow
this.
Last time i checked, you couldnt initialise variables in object scope ...
you can only declare them.  This makes sense, because thats what the
constructor is for.

Altered code for what you want to do is as follows:




class myclass{
   var $fields;
   var $columns;

function myclass { // constructor
  $this->fields =  mysql_list_fields("database1", "table1", $link);
  $this->columns = mysql_num_fields($fields);
 }

// all code must be declared in a function !! - This isnt Java Script :)
function doSomething() {
for ($i = 0; $i < $this->columns; $i++) {
    var mysql_field_name($this->fields, $i);
   }
 }//function doSomething()
}//class


$myobj = new myclass();  // creates object and runs constructor (see above)
$myobj->doSomething(); // do whatever you want the object to do



Andrew H




> class myclass{
>
> $fields = mysql_list_fields("database1", "table1", $link);
> $columns = mysql_num_fields($fields);
>
> for ($i = 0; $i < $columns; $i++) {
>     var mysql_field_name($fields, $i);
> }
>
> }//class
>
> now.. can i do this?
> is there a performnance issue here?
> can i put this in the constructor?
>
> john
>
>
>
>
> Andrew Halliday wrote:
>
> > yes you can do all of this
> >
> > but in no OO language so far have i seen the ability to access a
variable
> > inside a method...you would have to do this:
> >
> > class myclass
> > {
> >  var $myvar;
> >  function setmyvar($newmyvar)
> >  {
> >      $this->myvar = $newmyvar;
> >  }
> > }
> >
> > Then you could do this:
> >
> > $myclassObj = new myclass();
> > $myclassObj->setmyvar(10);
> > echo $myclassObj->myvar;
> >
> > This would print '10'...
> >
> > Cut and paste that exact program in and it should be a working
demonstration
> > ...
> >
> > You should read the php manual more ...
> > see
> > www.php.net
> >
> > AndrewH
> > ----- Original Message -----
> > From: "John LYC" <[EMAIL PROTECTED]>
> > To: "PHP List" <[EMAIL PROTECTED]>
> > Sent: Monday, March 05, 2001 1:36 PM
> > Subject: [PHP] simple OO question
> >
> > > can i do this..?
> > >
> > > //declaring class
> > >
> > > class myclass{
> > >
> > > //declaring properties
> > > ...
> > > ....
> > >
> > > //declaring methods..
> > > function mymethod(){
> > >
> > > //can i declared variable in method?
> > > var $myvar;
> > > ...
> > > //do something
> > >
> > > }//end of mymethod
> > >
> > > ///////////////////
> > >
> > > if yes, do i access myvar like this.
> > > $item = new myclass;
> > > print $item->mymethod()->myvar;
> > >
> > >
> > > thanks
> > > john
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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]
>





Ahh damn - minor omission - add a '( )' after myclass constructor name :-)

AndrewH

----- Original Message -----
From: "Andrew Halliday" <[EMAIL PROTECTED]>
To: "John LYC" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 2:47 PM
Subject: Re: [PHP] simple OO question


> No, you cant do this as you coded it, however minor alterations will allow
> this.
> Last time i checked, you couldnt initialise variables in object scope ...
> you can only declare them.  This makes sense, because thats what the
> constructor is for.
>
> Altered code for what you want to do is as follows:
>
>
>
>
> class myclass{
>    var $fields;
>    var $columns;
>
> function myclass { // constructor
>   $this->fields =  mysql_list_fields("database1", "table1", $link);
>   $this->columns = mysql_num_fields($fields);
>  }
>
> // all code must be declared in a function !! - This isnt Java Script :)
> function doSomething() {
> for ($i = 0; $i < $this->columns; $i++) {
>     var mysql_field_name($this->fields, $i);
>    }
>  }//function doSomething()
> }//class
>
>
> $myobj = new myclass();  // creates object and runs constructor (see
above)
> $myobj->doSomething(); // do whatever you want the object to do
>
>
>
> Andrew H
>
>
>
>
> > class myclass{
> >
> > $fields = mysql_list_fields("database1", "table1", $link);
> > $columns = mysql_num_fields($fields);
> >
> > for ($i = 0; $i < $columns; $i++) {
> >     var mysql_field_name($fields, $i);
> > }
> >
> > }//class
> >
> > now.. can i do this?
> > is there a performnance issue here?
> > can i put this in the constructor?
> >
> > john
> >
> >
> >
> >
> > Andrew Halliday wrote:
> >
> > > yes you can do all of this
> > >
> > > but in no OO language so far have i seen the ability to access a
> variable
> > > inside a method...you would have to do this:
> > >
> > > class myclass
> > > {
> > >  var $myvar;
> > >  function setmyvar($newmyvar)
> > >  {
> > >      $this->myvar = $newmyvar;
> > >  }
> > > }
> > >
> > > Then you could do this:
> > >
> > > $myclassObj = new myclass();
> > > $myclassObj->setmyvar(10);
> > > echo $myclassObj->myvar;
> > >
> > > This would print '10'...
> > >
> > > Cut and paste that exact program in and it should be a working
> demonstration
> > > ...
> > >
> > > You should read the php manual more ...
> > > see
> > > www.php.net
> > >
> > > AndrewH
> > > ----- Original Message -----
> > > From: "John LYC" <[EMAIL PROTECTED]>
> > > To: "PHP List" <[EMAIL PROTECTED]>
> > > Sent: Monday, March 05, 2001 1:36 PM
> > > Subject: [PHP] simple OO question
> > >
> > > > can i do this..?
> > > >
> > > > //declaring class
> > > >
> > > > class myclass{
> > > >
> > > > //declaring properties
> > > > ...
> > > > ....
> > > >
> > > > //declaring methods..
> > > > function mymethod(){
> > > >
> > > > //can i declared variable in method?
> > > > var $myvar;
> > > > ...
> > > > //do something
> > > >
> > > > }//end of mymethod
> > > >
> > > > ///////////////////
> > > >
> > > > if yes, do i access myvar like this.
> > > > $item = new myclass;
> > > > print $item->mymethod()->myvar;
> > > >
> > > >
> > > > thanks
> > > > john
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > 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]
> >
>
>
> --
> 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]
>





Greetings !

I am using PHP4 and MySQL for database in the web. I am using two tables. I
made a search script for one table which displys the list on the web page
and want to put a link in one of the fields on that web page so that the
link takes browserts to the data of the other page.

I could not achieve this function.  Can anyone help?

Looking forward to hearing from you.

Warm Regards,
DT





if I leave my browser on a php and then I click a link after lets say 5 or
10 minutes that links to another php page it says page not found even though
the page is there.  has anybody else experienced this error?


thanks

randy

-----Original Message-----
From: Randy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 03, 2001 11:44 AM
To: Ernest E Vogelsinger; Randy Johnson
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Converting String to Variable


it may look weird but that is the way it needs to be done. here is a better
example

$str=myfunct()  this returns monday

then i want the monday to turn into this

$monday

so i can do this

$monday="BlaH";

thanks

randy

-----Original Message-----
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 03, 2001 11:35 AM
To: Randy Johnson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Converting String to Variable


At 17:09 03.03.2001, Randy Johnson said:
--------------------[snip]--------------------
>Is there anyway to convert a string to a variable
>
>example
>
>$str="monday";
>
>I would like to then do this:
>
>$monday="blah";
--------------------[snip]--------------------

RTFM ;->

$$str = "blah";
print $monday;



     ...ebird

   >O     Ernest E. Vogelsinger
   (\)    http://www.1-at-web.at/
    ^     ICQ#   13394035



--
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]






> if I leave my browser on a php and then I click a link after lets say 5
> or 10 minutes that links to another php page it says page not found
> even though the page is there.  has anybody else experienced this
> error?
Is this link passed as a value or something that might expire with a 
session? Just a wild guess.





Hiya,
am near completeion of a site only i can't get any mail to send to multiple recipients 
at all .. either in the  "To:" section or having on email in "To" and one email 
address in "CC" section.. and i need to be able to do this ... can any one offer any 
suggestions ...( I'd prefer to have one in the "To" section and one in the "CC" 
section 
I'm am using sendmail on solaris 2.6 to send the actual emails

<-- Start of snip--->
$address .= $email  ;
$subject = "VFSA-eRentals Calculation Results";
$body="blah blah\n";
$headers .= "CC: [EMAIL PROTECTED] "; 
mail("$address", "$subject", "$body", "$headers \nContent-Type: text/plain; 
charset=iso-8859-1\nContent-Transfer-Encoding: 64bit"  );
<--- end of snip--->


any help would be greatful :)
Peter Houchin
Sun Rentals
[EMAIL PROTECTED]





On Mon,  5 Mar 2001 14:17, Peter Houchin wrote:

> > Hiya,
> am near completeion of a site only i can't get any mail to send to
> multiple recipients at all .. either in the  "To:" section or having on
> email in "To" and one email address in "CC" section.. and i need to be
> able to do this ... can any one offer any suggestions ...( I'd prefer
> to have one in the "To" section and one in the "CC" section 
 I'm am
> using sendmail on solaris 2.6 to send the actual emails 
> <-- Start of snip--->
> $address .= $email  ;
> $subject = "VFSA-eRentals Calculation Results";
> $body="blah blah\n";
> $headers .= "CC: [EMAIL PROTECTED] "; 
> mail("$address", "$subject", "$body", "$headers \nContent-Type:
> text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 64bit"  );
> <--- end of snip--->
> 
> 
> any help would be greatful :)
> Peter Houchin
> Sun Rentals
> [EMAIL PROTECTED]
> 
Two things that may or may not be part of your problem; 

first, if there is already something in $headers then appending the cc to 
it may give you an invalid string; and

second, you might try Cc: instead of CC:

Cheers
-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




I'm studying some code from the net and was kinda curious.  There are 
places where it references variables like this:

        $$testvar

What's the difference between that and

        $testvar

?

-Ed





> I'm studying some code from the net and was kinda curious.  There are 
> places where it references variables like this:
> 
>       $$testvar
> 
> What's the difference between that and
> 
>       $testvar
> 
> ?

$testvar means "the value of the variable named 'testvar'".

$$testvar means "the value of the variable with the name of the 
value of 'testvar'". ie - testvar is "foo", $$testvar is equivalent
to $foo.

Jason




Check out :

    http://php.net/manual/en/language.variables.variable.php

Example :

    $a  = 'hi';

    $$a = 'sup';

$hi now equals 'sup'


Regards,

Philip Olson
http://www.cornado.com/

On Sun, 4 Mar 2001, Ed Lazor wrote:

> I'm studying some code from the net and was kinda curious.  There are 
> places where it references variables like this:
> 
>       $$testvar
> 
> What's the difference between that and
> 
>       $testvar
> 
> ?
> 
> -Ed
> 
> 
> -- 
> 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]
> 






Yes, I've checked phpinfo() and not it is not compiled in.  That is the 
problem.  I have recompiled PHP with pgsql support and there is some 
problem.  I'm not sure why it isn't compiling it in.  I've tried everything 
I know....the installation goes fine...no error messages, everything seems 
ok.

Any ideas?


>From: The Hermit Hacker <[EMAIL PROTECTED]>
>To: K Old <[EMAIL PROTECTED]>
>CC: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
>Subject: Re: [PHP] Problem getting PostgreSQL to compile
>Date: Fri, 2 Mar 2001 22:30:11 -0400 (AST)
>
>
>have you checked phpinfo() to make sure that pgsql support is actually
>compiled in?  if so, any errors on connection, or just silently fails?
>
>On Fri, 2 Mar 2001, K Old wrote:
>
> > Hello,
> >
> > I'm running RH 7 and Apache.  I have the latest version of PostgreSQL 
>and it
> > is installed and running correctly.  I have installed PHP with the
> > --with-pgsql and it seems to install everything needed, but when I try 
>to
> > use pg_connect() it fails to connect.  Any ideas what I can do?
> >
> > Thanks,
> > Kevin
> > [EMAIL PROTECTED]
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
> >
> >
> > --
> > 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]
> >
> >
>
>Marc G. Fournier                   ICQ#7615664               IRC Nick: 
>Scrappy
>Systems Administrator @ hub.org
>primary: [EMAIL PROTECTED]           secondary: 
>scrappy@{freebsd|postgresql}.org
>
>
>--
>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]
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com





I'm trying to read in a text file that has 42620 lines.  Each line has
zip code information separated by commas.  I have no problem reading the
file into an array.  But when I try and read each element in the array
and put it into another array I get a "500 server error".  The second to
last line is what's causing the problem.

After doing some debugging I found out that at around iteration 18000 is
when the server error occurs.  Any ideas?  I know I should use a
database, but i'm intrigued by this problem.

Here's the code that does the work...

# read the file in, each line in the file is it's own element in the
array
$lineArray = file( "zips.txt" );

# initialize variable, showing that there's nothing in $ZIPS
$ZIPS = array();

# iterate through each element in the array, foreach() is probably
cleaner
for($i = 0; $i < count($lineArray); $i++ ) {
    # set variable
    $value = $lineArray[ $i ];

    # set $tempArray to a new array
    $tempArray = array();

    # convert the line into an array
    $tempArray = explode( ",", $value );

    # add the line to the array in the format
    # $ZIPS[ "zip code" ] = array( "zip code", "state", "city", "lat",
"long" )
    $ZIPS[ $tempArray[ 0 ] ] = $tempArray;
}

Thanks in advance.

Jeff






try this
printf(" <a href=\"pro_page1.php3?title='%s\"> ", urlencode($myrow[title])')

john

"Thomas Edison Jr." wrote:

> The urlencode() is working fine with an echo statement
> & normal query string.
>
> But it's NOT working with complex query string in
> printf() including $myrow[something] being picked up
> by mySQL db.
>
> this works :
>
> <a href="add_pro_over.php3?title=<? echo
> urlencode($title) ?>">
>
> this doesn't work :
>
> printf("<a
> href=\"pro_page1.php3?title='urlencode($myrow[title])'\">")
>
> OR such combinations as given in the manual. I tried
> out almost all!!!
>
> HELP!!!!
>
> T. Edison jr.
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> --
> 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]





Hi!


File upload doesn't work with Netscape Navigato. I
have Netscape COmmunicator 4.5. I try to upload files
and I get Network Error.


If it is working for any of you guys please give me
the URL so that I can test it out and check my
problem..

Help me out.!!!!


Thank You!
Cheers!~
Dhaval Desai

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




Shu!
I need some help here.
I have a script where I want to compare two arrays with eachother, and return one 
value from that does not exists in both arrays. I have an array of pictures id number 
created from a database query. I use sessions to save id numbers of pictures into an 
array. I want the first array to be compared to the second and return the first 
key/value-pair that are not found in the session array...
Is there a way I can do this? 

Thankful for any help!
/Broder B




Hello.


I want to use an object oriented database, I have not researched a lot in this theme 
but I hope you can help me.

I want to use php, can I use it with any object oriented database, like goods, sod, 
groovy, ozone, objstore, db40?

Thank you for your help.


Fabian Fabela
[EMAIL PROTECTED]
www.vacagorda.com

"La información transmitida en el presente mensaje tiene la intención de estar 
dirigida únicamente a la persona o entidad que se refiere y puede contener información 
privilegiada y/o confidencial. Cualquier, revisión, retransmisión, diseminación o 
cualquier uso impropio o relacionado con dicha información por persona alguna distinta 
a la que fue dirigido este mensaje queda estrictamente prohibido. Si Usted ha recibido 
 este mensaje o sus anexos por error, favor de contactar al remitente y elimine el 
material de cualquier computadora."

"The information transmitted is intended only for the person or entity to which it is 
addressed and may contain confidential and/or privileged material.  Any review, 
retransmission, dissemination or other use of, or taking of any action in reliance 
upon, this information by persons or entities other than the intended recipient is 
prohibited.   If you received this in error, please contact the sender and delete the 
material from any computer."




People
If I run a sniplet like this:

**********************
$query="select name from foo";
$result= mysql_query($query);
while($row = mysql_fetch_row($result))
 stuffssss.......to display record found....
...
***********************
what am I suppose to do if I also want the code to be able to deal with the case that 
no record found  and redirect user to other page?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"




On Tue,  6 Mar 2001 06:36, [EMAIL PROTECTED] wrote:

> > People
> If I run a sniplet like this:
>
> **********************
> $query="select name from foo";
> $result= mysql_query($query);
> while($row = mysql_fetch_row($result))
>  stuffssss.......to display record found....
> ...
> ***********************
> what am I suppose to do if I also want the code to be able to deal with
> the case that no record found  and redirect user to other page? Jack

$query="select name from foo";
$result= mysql_query($query);
if(mysql_num_rows($result) ==0)) {
  redirect
 }
else...


-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




Thanks to all of you guys for helpin me out solve this
otherwise horrendous task of making the query string
work in netscape. 

much thanks to Julian!!

Cheers,
T. Edison jr.


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




Hello Peter,

On 03-Mar-01 10:00:55, you wrote:

>does there exist a web based mailing list administrator in PHP (Tying in 
>with some open source mailing list software)?
>Ideally, something like egroups (now groups.yahoo.com). I just want to be 
>able to easily administrate (or have other people administrate) mailing 
>lists. I have access to my own server (linux, php4, ...)

Maybe you would like to try this Ezmlm mailing list manager class that was
just released:

http://phpclasses.UpperDesign.com/browse.html/package/177

Web interface class to create and manage mailing lists with ezmlm. It features:

- Displays a table with the lists already created, showing the list local and domain 
parts and the number of current subscribers.
- Creation and alteration of list properties.
- Alteration of list automatic message texts.
- Support for list virtual hosts.
- Multi-idiom Web interface.

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--





below is the code I am using, $sourcefile is a url var
for example http://url/?sourcefile=/this/path/to/whatever.php

$filelist = array("",
            "db_auth.conf",
            "config.php",
            "master.functions.inc"
            );        /* these are the files I want to protect from this
script */

function check_hackers($sourcefile, $filelist) {
        $checkfile = explode("/", $sourcefile);        /* seperate the
sourcefile var */
        $disallowed = $checkfile[count($checkfile) -1];    /* use only
the last  part (filename.ext) */
        $filecount = count($filelist);    /* count how many files in
array */
        while ($tempcount < $filecount) {
        $tempfile = $filelist[$tempcount];
        if ($tempfile == $disallowed) {
                $sourcefile = "source.inc";        /* this is not
returned to the global space .... why not ??? */
                echo $disallowed;                    /* this will echo
the correct thing (config.php) */
                echo $tempfile;                        /* this will echo
the correct thing (config.php) */
                return $sourcefile;                /* this doesn't work
either ???? what the ??? */
        }
        $tempcount++;
        }
}

check_hackers($sourcefile, $filelist);

Can somebody tell me why this is not return $sourcefile = "source.inc"
.... what am I doing wrong.
Can you please reply to [EMAIL PROTECTED]  PLEASE PLEASE PLEASE





Hi,

Ken wrote:

> I'm experiencing strange behavior with my user authentication scheme in my PHP app, 
>with users using IE 5.5 (PC and Mac).
>
> I am using browser authentication (WWW-Authenticate and 401 headers), "no cache" 
>headers, and PHP 4 sessions.
>
> I am finding that even when the user totally quits IE, if he then restarts IE, one 
>or both (haven't isolated for sure yet) of the following happen:
>
> - The browser still knows the user and password, and so will send it to the server 
>upon an authentication request under the same realm, without prompting the user.  
>(The user does NOT have "save this password" checked on the user/password prompt when 
>it first comes up.)
> - The session is still active.  A call to session_start() returns the pre-existing 
>session, instead of getting a new one.

Yes, this is a problem with IE. A lot depends on how IE is configured and exactly what 
shortcut users are using to start IE.

In IE's Tools > Internet Options > Advanced tab, make sure that the "Launch browser 
windows in separate processes" option is checked.

DO NOT use Ctrl + N to start up a new IE window - that way users will not get prompted 
for passwords.

Using any other shortcut to start IE should make it prompt for password.

All of the above is based on my experience with IE 5.0 but should be equally 
applicable to IE 5.5.

--
Regards,
Harshdeep Singh Jawanda.







i have used header to redirect to other page. however, it has said that i
have written something out the screen before header. would anyone please to
help me?

the following is all my code.
<?php
    include "config.php3";
    include "functions.php3";

    $result = checkUser($nUserNo, $cPassword);
    if ($result == false)
    {
        header ("HTTP/1.0 404 Not Found");
        exit;
    }
    else
    {
        header ("../Form/first.html");
    }
?>

The above function "checkUser" just used to check whether the user exist or
not. nothing will be written out to the screen if the user is found in the
database.






On Sunday 04 March 2001 20:38, you wrote:
> Julian,
> i tried :
>
> <a
> href=\"pro_page1.php3?title=".urlencode($myrow[title])."\">
>
> instead
>
> <a
> href=\"pro_page1.php3?title='".urlencode($myrow[title])."'\">
>
> notice the single quote ' missing. And that WORKED!!!
> It displayed the right value in the next PHP page.
> Unfortunately there's another problem. it only
> DISPLAYED the right value...but when it adds the value
> in the database...it adds with the plus + sign. i.e.,
> it adds : Project+One instead of Project One.

try rawurlencode instead of urlencode

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...




Hi,
I have problem with "REMOTE_ADDR" or "REMOTE_DOST".

"REMOTE_ADDR" always return me 127.0.0.1 (localhost) !!!
The php program is on remote server ( not locally ) - www.f2s.com.

How can I get IP or HOST of the visitor ?

Thanks,
Rosen Marinov





Reply via email to