php-general Digest 20 May 2002 15:44:01 -0000 Issue 1356

Topics (messages 98411 through 98444):

Running php program when mail received
        98411 by: CDitty
        98414 by: Manuel Lemos
        98415 by: CDitty

Re: Arrays and Forms
        98412 by: Jason Wong
        98421 by: Miguel Cruz

multiply by 2
        98413 by: Martin Towell
        98438 by: Jason Wong

Variable won't work in function, even when I global it?
        98416 by: Leif K-Brooks
        98418 by: Miguel Cruz
        98419 by: Martin Towell
        98420 by: Leif K-Brooks
        98423 by: Leif K-Brooks
        98424 by: Miguel Cruz
        98426 by: Leif K-Brooks
        98427 by: Miguel Cruz
        98428 by: Leif K-Brooks
        98429 by: Miguel Cruz
        98430 by: Miguel Cruz
        98431 by: Paul Roberts

Re: MSIE & GZIP problem?
        98417 by: Miguel Cruz

Re: Can someone check this mysql code
        98422 by: Miguel Cruz
        98425 by: Balaji Ankem

how to select a file on a random basis?
        98432 by: Andy
        98435 by: Craig Vincent
        98442 by: The_RadiX

Email harvesters
        98433 by: Richard Baskett
        98436 by: Jason Wong
        98437 by: Richard Baskett
        98439 by: Richard Baskett
        98440 by: Miguel Cruz

Re: Bulletin Boards
        98434 by: Brian McGarvie

gmdate
        98441 by: SP

dtcm interface?
        98443 by: Billy S Halsey

Problem with mktime()
        98444 by: Johannes Tyra [BrainData]

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]


----------------------------------------------------------------------
--- Begin Message ---
Hello all.  I am trying to write a small program that will run everytime an 
email is received at a certain mailbox on my sever.  I had this running at 
one time, but for some reason, it will not run.  I am not getting any 
errors and I can't figure out what is going on.  Below is the code that I 
am trying to run.

#!/usr/bin/php -q
### CHANGE VALUES OF THE FOLLOWING VARIABLES ###

$to = "[EMAIL PROTECTED]";
$subj = "message";
$hdrs = "From: [EMAIL PROTECTED]\n";
$msg = "This is going out";

mail($to, $subj, $msg, $hdrs);

This is what is returned in the maillog file.
May 19 22:29:07 server1 sendmail[3502]: WAA03501: 
to="|/path/to/file/imap.php", delay=00:00:00, xdelay=00:00:00, mailer=prog, 
stat=Sent

Can anyone point me in the right direction?  The script has been chmod 755.

--- End Message ---
--- Begin Message ---
On 05/20/2002 12:38 AM, Cditty wrote:
> Hello all.  I am trying to write a small program that will run everytime 
> an email is received at a certain mailbox on my sever.  I had this 
> running at one time, but for some reason, it will not run.  I am not 
> getting any errors and I can't figure out what is going on.  Below is 
> the code that I am trying to run.
> 
> #!/usr/bin/php -q
> ### CHANGE VALUES OF THE FOLLOWING VARIABLES ###
> 
> $to = "[EMAIL PROTECTED]";
> $subj = "message";
> $hdrs = "From: [EMAIL PROTECTED]\n";
> $msg = "This is going out";
> 
> mail($to, $subj, $msg, $hdrs);
> 
> This is what is returned in the maillog file.
> May 19 22:29:07 server1 sendmail[3502]: WAA03501: 
> to="|/path/to/file/imap.php", delay=00:00:00, xdelay=00:00:00, 
> mailer=prog, stat=Sent
> 
> Can anyone point me in the right direction?  The script has been chmod 755.
> 

What happens when you do /usr/bin/php -q /path/to/file/imap.php ?

-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
I get this error and the program code outputted to the screen.

Failed loading 
/usr/local/Zend/lib/ZendOptimiser.so: 
/usr/local/Zend/lib/ZendOptimiser.so: cannot open shared object file: No 
such file or directory

I just looked in that directory and there is a ZendOptimizer.so file.  I 
copied it to ZendOptimiser.so and ran it again.  No error, but still 
getting the code output.

Chris

At 11:17 PM 5/19/2002, you wrote:
>On 05/20/2002 12:38 AM, Cditty wrote:
>>Hello all.  I am trying to write a small program that will run everytime 
>>an email is received at a certain mailbox on my sever.  I had this 
>>running at one time, but for some reason, it will not run.  I am not 
>>getting any errors and I can't figure out what is going on.  Below is the 
>>code that I am trying to run.
>>#!/usr/bin/php -q
>>### CHANGE VALUES OF THE FOLLOWING VARIABLES ###
>>$to = "[EMAIL PROTECTED]";
>>$subj = "message";
>>$hdrs = "From: [EMAIL PROTECTED]\n";
>>$msg = "This is going out";
>>mail($to, $subj, $msg, $hdrs);
>>This is what is returned in the maillog file.
>>May 19 22:29:07 server1 sendmail[3502]: WAA03501: 
>>to="|/path/to/file/imap.php", delay=00:00:00, xdelay=00:00:00, 
>>mailer=prog, stat=Sent
>>Can anyone point me in the right direction?  The script has been chmod 755.
>
>What happens when you do /usr/bin/php -q /path/to/file/imap.php ?
>
>--
>
>Regards,
>Manuel Lemos
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Monday 20 May 2002 07:05, Navid Y. wrote:
> Hello Everyone,
>
> I'm having trouble sending array values through forms.
> Will the following syntax create a variable called $product['desc'] on
> the next page?
> If not, what am I doing wrong here?
>
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.

I don't see anything wrong with the code below. You're saying ...

   <input type="text" name="product">

   and

   echo $product;

... works (on the same server without any other changes)?


> menu_add.php
> -------------
> <form method="post" action="menu_list.php">
> <input type="text" name="product[desc]">
> </form>
>
>
> menu_list.php
> -------------
> echo $product['desc'];
>
>
> Result output
> -------------
> no output

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality.
                -- Albert Einstein
*/

--- End Message ---
--- Begin Message ---
Your code looks fine. Are you sure you haven't edited away significant 
parts of it when posting to the list? Maybe a <input name="product"> 
somewhere?

miguel

On Sun, 19 May 2002, Navid Y. wrote:
> I'm having trouble sending array values through forms.
> Will the following syntax create a variable called $product['desc'] on
> the next page?
> If not, what am I doing wrong here?
> 
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.
> 
> 
> menu_add.php
> -------------
> <form method="post" action="menu_list.php">
> <input type="text" name="product[desc]">
> </form>
> 
> 
> menu_list.php
> -------------
> echo $product['desc'];
> 
> 
> Result output
> -------------
> no output
> 
> 
> 

--- End Message ---
--- Begin Message ---
I was doing some timing of a function on the weekend and in one of the
loops, I had to multiply a variable by 2 - easy enough - $i*2

but then I remembered that in C, it's quicker to do a left shift - so $i<<1

but this actually took longer to execute in php than the $i*2 - can anyone
confirm my test? I iterated ~28,000 times. Each time, there was 2 places
where I was doing the left shift. The time (including all the other stuff I
was doing in the function) for $i*2 was ~12secs, and $i<<1 was ~19secs.

I am running PHP4.0.6 (download cgi version from php.net) on a win98 system
(500MHz Celeron if that changes anything)
--- End Message ---
--- Begin Message ---
On Monday 20 May 2002 12:03, Martin Towell wrote:
> I was doing some timing of a function on the weekend and in one of the
> loops, I had to multiply a variable by 2 - easy enough - $i*2
>
> but then I remembered that in C, it's quicker to do a left shift - so $i<<1
>
> but this actually took longer to execute in php than the $i*2 - can anyone
> confirm my test? I iterated ~28,000 times. Each time, there was 2 places
> where I was doing the left shift. The time (including all the other stuff I
> was doing in the function) for $i*2 was ~12secs, and $i<<1 was ~19secs.
>
> I am running PHP4.0.6 (download cgi version from php.net) on a win98 system
> (500MHz Celeron if that changes anything)

My tests don't show much difference, shifting is slightly faster.

<?php
  ini_set('max_execution_time', 600);
  function gettime() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
  }
  $start=gettime();
  $j = 24;
  for($i = 1; $i <= 1000000; $i++) {
    $p = $j * 2; #echo $p;
  }
  $end=gettime();
  echo $end - $start, "\n";
  $start=gettime();
  $j = 24;
  for($i = 1; $i <= 1000000; $i++) {
    $p = $j << 1; #echo $p;
  }
  $end=gettime();
  echo $end - $start, "\n";
?>

Results
=======

[jason@x27 jason]$ php -q doo.php
7.4377170801163
7.2966409921646
[jason@x27 jason]$ php -q doo.php
7.4303779602051
7.2926670312881


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
When in doubt, tell the truth.
                -- Mark Twain
*/

--- End Message ---
--- Begin Message ---
  On my website, I open my header (and footer) file with fileopen and 
then eval() it.  I know I should include them, but I knew nothing about 
php when I did this.  Anyway, I'm working on "groups" for my website. 
 They will be a kind of club.  At the top of every group page, I include 
a group function file.  Among those functions is one that checks if the 
user trying to go to the group is a member of it.  If not, it gives them 
an error message and exits.  It is also supposed to eval() the footer 
before exiting.  My code is as follows:

    function checkmember(){
    global $groupid;
    global $userinfo;
    global $footertext;
    if($groupid != $userinfo['groupid']){
    print "<b>Error:</b> you're not a member of this group.";
    eval($footertext);
    exit;
    }
    return;
    }


The thing is, it doesn't seem to eval() the footer.  I've even tried 
getting $footertext out of the $GLOBALS array.  I have also tried 
printing $footertext to make sure it wasn't a problem with evel(). 
 Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
worked however.  Thanks to anybody who can help.

--- End Message ---
--- Begin Message ---
I don't know what $footertext looks like, but I can tell you that just 
eval()ing a chunk of text won't have any apparent effect. 

When you eval() code in a string, that code has to either return() 
something, or have direct effects on its own (such as calling functions or 
setting values). eval() != echo.

miguel

On Mon, 20 May 2002, Leif K-Brooks wrote:
>   On my website, I open my header (and footer) file with fileopen and 
> then eval() it.  I know I should include them, but I knew nothing about 
> php when I did this.  Anyway, I'm working on "groups" for my website. 
>  They will be a kind of club.  At the top of every group page, I include 
> a group function file.  Among those functions is one that checks if the 
> user trying to go to the group is a member of it.  If not, it gives them 
> an error message and exits.  It is also supposed to eval() the footer 
> before exiting.  My code is as follows:
> 
>     function checkmember(){
>     global $groupid;
>     global $userinfo;
>     global $footertext;
>     if($groupid != $userinfo['groupid']){
>     print "<b>Error:</b> you're not a member of this group.";
>     eval($footertext);
>     exit;
>     }
>     return;
>     }
> 
> 
> The thing is, it doesn't seem to eval() the footer.  I've even tried 
> getting $footertext out of the $GLOBALS array.  I have also tried 
> printing $footertext to make sure it wasn't a problem with evel(). 
>  Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
> worked however.  Thanks to anybody who can help.
> 
> 

--- End Message ---
--- Begin Message ---
what's that value of $footertext?
        is it the actual contents of the footer file?
have you tried displaying the contents of $footertext just before you call
checkmember()?
        does it contain what you're expecting?

-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 3:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Variable won't work in function, even when I global it?


  On my website, I open my header (and footer) file with fileopen and 
then eval() it.  I know I should include them, but I knew nothing about 
php when I did this.  Anyway, I'm working on "groups" for my website. 
 They will be a kind of club.  At the top of every group page, I include 
a group function file.  Among those functions is one that checks if the 
user trying to go to the group is a member of it.  If not, it gives them 
an error message and exits.  It is also supposed to eval() the footer 
before exiting.  My code is as follows:

    function checkmember(){
    global $groupid;
    global $userinfo;
    global $footertext;
    if($groupid != $userinfo['groupid']){
    print "<b>Error:</b> you're not a member of this group.";
    eval($footertext);
    exit;
    }
    return;
    }


The thing is, it doesn't seem to eval() the footer.  I've even tried 
getting $footertext out of the $GLOBALS array.  I have also tried 
printing $footertext to make sure it wasn't a problem with evel(). 
 Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
worked however.  Thanks to anybody who can help.

--- End Message ---
--- Begin Message ---
I know that.  Footertext prints out the footer for my site.  The bottom 
of my layout.  Also, as I said, I even tried printing $footertext. 
 Thanks for trying to help, though.

Miguel Cruz wrote:

>I don't know what $footertext looks like, but I can tell you that just 
>eval()ing a chunk of text won't have any apparent effect. 
>
>When you eval() code in a string, that code has to either return() 
>something, or have direct effects on its own (such as calling functions or 
>setting values). eval() != echo.
>
>miguel
>
>On Mon, 20 May 2002, Leif K-Brooks wrote:
>
>>  On my website, I open my header (and footer) file with fileopen and 
>>then eval() it.  I know I should include them, but I knew nothing about 
>>php when I did this.  Anyway, I'm working on "groups" for my website. 
>> They will be a kind of club.  At the top of every group page, I include 
>>a group function file.  Among those functions is one that checks if the 
>>user trying to go to the group is a member of it.  If not, it gives them 
>>an error message and exits.  It is also supposed to eval() the footer 
>>before exiting.  My code is as follows:
>>
>>    function checkmember(){
>>    global $groupid;
>>    global $userinfo;
>>    global $footertext;
>>    if($groupid != $userinfo['groupid']){
>>    print "<b>Error:</b> you're not a member of this group.";
>>    eval($footertext);
>>    exit;
>>    }
>>    return;
>>    }
>>
>>
>>The thing is, it doesn't seem to eval() the footer.  I've even tried 
>>getting $footertext out of the $GLOBALS array.  I have also tried 
>>printing $footertext to make sure it wasn't a problem with evel(). 
>> Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
>>worked however.  Thanks to anybody who can help.
>>
>>
>
>
>

--- End Message ---
--- Begin Message ---
I won't send the whole value of $footertext, it's too long.  Yes, it 
contains the contents of the footer file.  I have tried displaying it 
before the function and it works fine.

Martin Towell wrote:

>what's that value of $footertext?
>       is it the actual contents of the footer file?
>have you tried displaying the contents of $footertext just before you call
>checkmember()?
>       does it contain what you're expecting?
>
>-----Original Message-----
>From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
>Sent: Monday, May 20, 2002 3:23 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP] Variable won't work in function, even when I global it?
>
>
>  On my website, I open my header (and footer) file with fileopen and 
>then eval() it.  I know I should include them, but I knew nothing about 
>php when I did this.  Anyway, I'm working on "groups" for my website. 
> They will be a kind of club.  At the top of every group page, I include 
>a group function file.  Among those functions is one that checks if the 
>user trying to go to the group is a member of it.  If not, it gives them 
>an error message and exits.  It is also supposed to eval() the footer 
>before exiting.  My code is as follows:
>
>    function checkmember(){
>    global $groupid;
>    global $userinfo;
>    global $footertext;
>    if($groupid != $userinfo['groupid']){
>    print "<b>Error:</b> you're not a member of this group.";
>    eval($footertext);
>    exit;
>    }
>    return;
>    }
>
>
>The thing is, it doesn't seem to eval() the footer.  I've even tried 
>getting $footertext out of the $GLOBALS array.  I have also tried 
>printing $footertext to make sure it wasn't a problem with evel(). 
> Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
>worked however.  Thanks to anybody who can help.
>
>
>


--- End Message ---
--- Begin Message ---
Rather than continuing to shroud this in mystery, could you at least give 
us a taste of what is in $footertext? 

miguel

On Mon, 20 May 2002, Leif K-Brooks wrote:
> I won't send the whole value of $footertext, it's too long.  Yes, it 
> contains the contents of the footer file.  I have tried displaying it 
> before the function and it works fine.
> 
> Martin Towell wrote:
> 
> >what's that value of $footertext?
> >     is it the actual contents of the footer file?
> >have you tried displaying the contents of $footertext just before you call
> >checkmember()?
> >     does it contain what you're expecting?
> >
> >-----Original Message-----
> >From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, May 20, 2002 3:23 PM
> >To: [EMAIL PROTECTED]
> >Subject: [PHP] Variable won't work in function, even when I global it?
> >
> >
> >  On my website, I open my header (and footer) file with fileopen and 
> >then eval() it.  I know I should include them, but I knew nothing about 
> >php when I did this.  Anyway, I'm working on "groups" for my website. 
> > They will be a kind of club.  At the top of every group page, I include 
> >a group function file.  Among those functions is one that checks if the 
> >user trying to go to the group is a member of it.  If not, it gives them 
> >an error message and exits.  It is also supposed to eval() the footer 
> >before exiting.  My code is as follows:
> >
> >    function checkmember(){
> >    global $groupid;
> >    global $userinfo;
> >    global $footertext;
> >    if($groupid != $userinfo['groupid']){
> >    print "<b>Error:</b> you're not a member of this group.";
> >    eval($footertext);
> >    exit;
> >    }
> >    return;
> >    }
> >
> >
> >The thing is, it doesn't seem to eval() the footer.  I've even tried 
> >getting $footertext out of the $GLOBALS array.  I have also tried 
> >printing $footertext to make sure it wasn't a problem with evel(). 
> > Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
> >worked however.  Thanks to anybody who can help.
> >
> >
> >
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Ok, I guess I'll send it.  Thanks for trying to help.  Here it is:

    $ip = $REMOTE_ADDR;
    $query = mysql_query("select COUNT(*) as rowexists from ips where ip
    = '$ip'");
    $result = mysql_fetch_array($query);
    if(($result['rowexists'] == 0) && ($loggedin)){
    mysql_query("INSERT INTO `ips` (ip,username) VALUES
    ('$ip','$userinfo[username]')") or print "Error: ".mysql_error();
    }
    $time_end = getmicrotime();
    $time_taken = $time_end - $time_start;
    $query = mysql_query("select COUNT(*) as cnt from ips");
    $result = mysql_fetch_array($query);
    $visits = $result['cnt'] + 2800;
    eval($getlayout['footer']);


Miguel Cruz wrote:

>Rather than continuing to shroud this in mystery, could you at least give 
>us a taste of what is in $footertext? 
>
--- End Message ---
--- Begin Message ---
Okay, I'm pretty sure your problem is this:

All those variables referenced in $footertext ($REMOTE_ADDR, $userinfo, 
etc.) need to be brought into the local context in the function calling 
eval(), using the global keyword. Otherwise they won't be available.

miguel

On Mon, 20 May 2002, Leif K-Brooks wrote:

> Ok, I guess I'll send it.  Thanks for trying to help.  Here it is:
> 
>     $ip = $REMOTE_ADDR;
>     $query = mysql_query("select COUNT(*) as rowexists from ips where ip
>     = '$ip'");
>     $result = mysql_fetch_array($query);
>     if(($result['rowexists'] == 0) && ($loggedin)){
>     mysql_query("INSERT INTO `ips` (ip,username) VALUES
>     ('$ip','$userinfo[username]')") or print "Error: ".mysql_error();
>     }
>     $time_end = getmicrotime();
>     $time_taken = $time_end - $time_start;
>     $query = mysql_query("select COUNT(*) as cnt from ips");
>     $result = mysql_fetch_array($query);
>     $visits = $result['cnt'] + 2800;
>     eval($getlayout['footer']);
> 
> 
> Miguel Cruz wrote:
> 
> >Rather than continuing to shroud this in mystery, could you at least give 
> >us a taste of what is in $footertext? 
> >
> 

--- End Message ---
--- Begin Message ---
No good.  :-(

Miguel Cruz wrote:

>Okay, I'm pretty sure your problem is this:
>
>All those variables referenced in $footertext ($REMOTE_ADDR, $userinfo, 
>etc.) need to be brought into the local context in the function calling 
>eval(), using the global keyword. Otherwise they won't be available.
>
>miguel
>
>On Mon, 20 May 2002, Leif K-Brooks wrote:
>
>>Ok, I guess I'll send it.  Thanks for trying to help.  Here it is:
>>
>>    $ip = $REMOTE_ADDR;
>>    $query = mysql_query("select COUNT(*) as rowexists from ips where ip
>>    = '$ip'");
>>    $result = mysql_fetch_array($query);
>>    if(($result['rowexists'] == 0) && ($loggedin)){
>>    mysql_query("INSERT INTO `ips` (ip,username) VALUES
>>    ('$ip','$userinfo[username]')") or print "Error: ".mysql_error();
>>    }
>>    $time_end = getmicrotime();
>>    $time_taken = $time_end - $time_start;
>>    $query = mysql_query("select COUNT(*) as cnt from ips");
>>    $result = mysql_fetch_array($query);
>>    $visits = $result['cnt'] + 2800;
>>    eval($getlayout['footer']);
>>
>>
>>Miguel Cruz wrote:
>>
>>>Rather than continuing to shroud this in mystery, could you at least give 
>>>us a taste of what is in $footertext? 
>>>
>
>

--- End Message ---
--- Begin Message ---
No good as in "that doesn't solve it" or as in "I sure wish it didn't have 
to be that way"?

miguel

On Mon, 20 May 2002, Leif K-Brooks wrote:

> No good.  :-(
> 
> Miguel Cruz wrote:
> 
> >Okay, I'm pretty sure your problem is this:
> >
> >All those variables referenced in $footertext ($REMOTE_ADDR, $userinfo, 
> >etc.) need to be brought into the local context in the function calling 
> >eval(), using the global keyword. Otherwise they won't be available.
> >
> >miguel
> >
> >On Mon, 20 May 2002, Leif K-Brooks wrote:
> >
> >>Ok, I guess I'll send it.  Thanks for trying to help.  Here it is:
> >>
> >>    $ip = $REMOTE_ADDR;
> >>    $query = mysql_query("select COUNT(*) as rowexists from ips where ip
> >>    = '$ip'");
> >>    $result = mysql_fetch_array($query);
> >>    if(($result['rowexists'] == 0) && ($loggedin)){
> >>    mysql_query("INSERT INTO `ips` (ip,username) VALUES
> >>    ('$ip','$userinfo[username]')") or print "Error: ".mysql_error();
> >>    }
> >>    $time_end = getmicrotime();
> >>    $time_taken = $time_end - $time_start;
> >>    $query = mysql_query("select COUNT(*) as cnt from ips");
> >>    $result = mysql_fetch_array($query);
> >>    $visits = $result['cnt'] + 2800;
> >>    eval($getlayout['footer']);
> >>
> >>
> >>Miguel Cruz wrote:
> >>
> >>>Rather than continuing to shroud this in mystery, could you at least give 
> >>>us a taste of what is in $footertext? 
> >>>
> >
> >
> 
> 

--- End Message ---
--- Begin Message ---
So in function checkmember(), do you now have:

   global $REMOTE_ADDR, $userinfo, $loggedin, $time_start, $getlayout;

??

miguel


On Mon, 20 May 2002, Leif K-Brooks wrote:
> No good as in "that doesn't solve it".  Thanks for trying to help.
> 
> Miguel Cruz wrote:
> 
> >No good as in "that doesn't solve it" or as in "I sure wish it didn't have 
> >to be that way"?
> >
> >miguel
> >
> >On Mon, 20 May 2002, Leif K-Brooks wrote:
> >
> >>No good.  :-(
> >>
> >>Miguel Cruz wrote:
> >>
> >>>Okay, I'm pretty sure your problem is this:
> >>>
> >>>All those variables referenced in $footertext ($REMOTE_ADDR, $userinfo, 
> >>>etc.) need to be brought into the local context in the function calling 
> >>>eval(), using the global keyword. Otherwise they won't be available.
> >>>
> >>>miguel
> >>>
> >>>On Mon, 20 May 2002, Leif K-Brooks wrote:
> >>>
> >>>>Ok, I guess I'll send it.  Thanks for trying to help.  Here it is:
> >>>>
> >>>>   $ip = $REMOTE_ADDR;
> >>>>   $query = mysql_query("select COUNT(*) as rowexists from ips where ip
> >>>>   = '$ip'");
> >>>>   $result = mysql_fetch_array($query);
> >>>>   if(($result['rowexists'] == 0) && ($loggedin)){
> >>>>   mysql_query("INSERT INTO `ips` (ip,username) VALUES
> >>>>   ('$ip','$userinfo[username]')") or print "Error: ".mysql_error();
> >>>>   }
> >>>>   $time_end = getmicrotime();
> >>>>   $time_taken = $time_end - $time_start;
> >>>>   $query = mysql_query("select COUNT(*) as cnt from ips");
> >>>>   $result = mysql_fetch_array($query);
> >>>>   $visits = $result['cnt'] + 2800;
> >>>>   eval($getlayout['footer']);
> >>>>
> >>>>
> >>>>Miguel Cruz wrote:
> >>>>
> >>>>>Rather than continuing to shroud this in mystery, could you at least give 
> >>>>>us a taste of what is in $footertext? 
> >>>>>
> >>>
> >>
> >
> >
> >
> 
> 


--- End Message ---
--- Begin Message ---
try

eval("?>$footertext");

also take the code out of the function and try it, you may need to global some more 
variables.

Paul Roberts
[EMAIL PROTECTED]
++++++++++++++++++++++++
----- Original Message ----- 
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 6:23 AM
Subject: [PHP] Variable won't work in function, even when I global it?


>   On my website, I open my header (and footer) file with fileopen and 
> then eval() it.  I know I should include them, but I knew nothing about 
> php when I did this.  Anyway, I'm working on "groups" for my website. 
>  They will be a kind of club.  At the top of every group page, I include 
> a group function file.  Among those functions is one that checks if the 
> user trying to go to the group is a member of it.  If not, it gives them 
> an error message and exits.  It is also supposed to eval() the footer 
> before exiting.  My code is as follows:
> 
>     function checkmember(){
>     global $groupid;
>     global $userinfo;
>     global $footertext;
>     if($groupid != $userinfo['groupid']){
>     print "<b>Error:</b> you're not a member of this group.";
>     eval($footertext);
>     exit;
>     }
>     return;
>     }
> 
> 
> The thing is, it doesn't seem to eval() the footer.  I've even tried 
> getting $footertext out of the $GLOBALS array.  I have also tried 
> printing $footertext to make sure it wasn't a problem with evel(). 
>  Nothing has worked.  When I did isset() on $GLOBALS['footertext'], it 
> worked however.  Thanks to anybody who can help.
> 
> 

--- End Message ---
--- Begin Message ---
On Sun, 19 May 2002, Jason Caldwell wrote:
> I have several browsers installed; NS4.x, NS6.02, Opera 6.x, and MSIE 6.0 --
> I'm using gzip compression on my site through the ob_gzhandler.  My pages
> seem to load fine, however, ONLY in MSIE when I REFRESH (i.e.. with the
> Refresh Button) the page seems to lose it's table or table format, and
> everything looks all jacked up. This ONLY happens on a page reload.  The
> other browsers don't seem to have this problem --

I see something similar with Windows IE 5, 5.5, and 6 all the time,
particularly when I have a combination of absolute and relative
table/table cell widths. Sometimes it'll be messed up the first time
through, sometimes after a refresh. Never consistent, never predictable.

miguel

--- End Message ---
--- Begin Message ---
On Mon, 20 May 2002, PhilipNZ Staff wrote:
> My code below don't want to insert the code into the database what am I
> doing wrong?
> 
> <?php
> 
>  $answers="$band, $middlename, $pot";
>  $date=date ("l dS of F Y h:i:s A");
>  
>  $sql = "INSERT INTO `prizeline` (`id`, `email`, `name`, `address`, `answers`, 
>`date`) VALUES ('', 'email', 'name', 'address', 'answers', 'date');";

What is the error message shown when you printed mysql_error() ?

And you probably don't want the semicolon at the end of the query string 
(the one inside the double quotes).

miguel

--- End Message ---
--- Begin Message ---
Try this..

<?php
> 
>  $answers="$band, $middlename, $pot";
>  $date=date ("l dS of F Y h:i:s A");
>  
>  $sql = "INSERT INTO prizeline VALUES ('', 'email', 'name', 'address',
'answers', 
> 'date');";

-Balaji
-----Original Message-----
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Monday, May 20, 2002 11:12 AM
To: PhilipNZ Staff
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can someone check this mysql code


On Mon, 20 May 2002, PhilipNZ Staff wrote:
> My code below don't want to insert the code into the database what am 
> I doing wrong?
> 
> <?php
> 
>  $answers="$band, $middlename, $pot";
>  $date=date ("l dS of F Y h:i:s A");
>  
>  $sql = "INSERT INTO `prizeline` (`id`, `email`, `name`, `address`, 
> `answers`, `date`) VALUES ('', 'email', 'name', 'address', 'answers', 
> 'date');";

What is the error message shown when you printed mysql_error() ?

And you probably don't want the semicolon at the end of the query string

(the one inside the double quotes).

miguel


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

**************************Disclaimer************************************************** 
   
 
 Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' 
and 'confidential' and intended for use only by the individual or entity to which it 
is 
addressed. You are notified that any use, copying or dissemination of the information 
contained in the E-MAIL in any manner whatsoever is strictly prohibited.

****************************************************************************************
--- End Message ---
--- Begin Message ---
Hi there,

I would like to pick a file out of a directory by random. There are 400
files and I just want to pick on of those by random.

Is there a way with rand() and file ?

Thanx for any hint,

Andy


--- End Message ---
--- Begin Message ---
> I would like to pick a file out of a directory by random. There are 400
> files and I just want to pick on of those by random.
>
> Is there a way with rand() and file ?

Well there's a couple ways you could do this...it's too early in the morning
to post code but with some quick searches in the manual you should find all
you need.

The most dynamic way to do this is to grab all the filenames in the
directory you want, then randomize the array using shuffle....then use the
first cell value in the array.

If you don't understand what I'm suggesting just lmk =)  I'll try explaining
in better detail when I'm more awake hehe.

Sincerely,

Craig Vincent


--- End Message ---
--- Begin Message ---
Ok well that array idea could work..


but what's the filename format of these files??

if they're all contigous or in some kind of pattern there maybe a faster and
easier way such as if you have them for example named:
file1.ext, file2.ext

or some pattern or other.. then you can just use random number func's to do
some work with you and all should be good..


:::::::::::::::::::::::::::::::::::::::::::
:  Julien Bonastre [The-Spectrum.org CEO]
:  A.K.A. The_RadiX
:  [EMAIL PROTECTED]
:  ABN: 64 235 749 494
:  QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::
----- Original Message -----
From: "Craig Vincent" <[EMAIL PROTECTED]>
To: "Andy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 6:18 PM
Subject: RE: [PHP] how to select a file on a random basis?


> > I would like to pick a file out of a directory by random. There are 400
> > files and I just want to pick on of those by random.
> >
> > Is there a way with rand() and file ?
>
> Well there's a couple ways you could do this...it's too early in the
morning
> to post code but with some quick searches in the manual you should find
all
> you need.
>
> The most dynamic way to do this is to grab all the filenames in the
> directory you want, then randomize the array using shuffle....then use the
> first cell value in the array.
>
> If you don't understand what I'm suggesting just lmk =)  I'll try
explaining
> in better detail when I'm more awake hehe.
>
> Sincerely,
>
> Craig Vincent
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I wrote this email to the php Archive list and I would like to get your
opinions on it.. Thanks! :)

"Is there any way that we could get the archives password protected?  Apple
does a nice thing where they tell you the username and password to login and
the whole purpose of it is so that email harvesters can not go through and..
Well.. Harvest our emails from the list :)  I think a lot of people would
not mind having something like this added to the pages since my guess is
that we're all sick and tired of spam and junkmail and eliminating one
possible garden for harvesters would be nice :)  I am going to email this to
the list also to see what kind of feedback comes from it."

Rick

"How wonderful it is that nobody need wait a single moment to improve the
world." - Anne Frank

--- End Message ---
--- Begin Message ---
On Monday 20 May 2002 15:46, Richard Baskett wrote:
> I wrote this email to the php Archive list and I would like to get your
> opinions on it.. Thanks! :)
>
> "Is there any way that we could get the archives password protected?  Apple
> does a nice thing where they tell you the username and password to login
> and the whole purpose of it is so that email harvesters can not go through
> and.. Well.. Harvest our emails from the list :)  I think a lot of people
> would not mind having something like this added to the pages since my guess
> is that we're all sick and tired of spam and junkmail and eliminating one
> possible garden for harvesters would be nice :)  I am going to email this
> to the list also to see what kind of feedback comes from it."

If they're password protected then how would search engines like google crawl 
through the archives? The best thing that could be done is hide (remove) the 
email addresses when the posts are placed in the archive -- something like 
what geocrawler does.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Green's Law of Debate:
        Anything is possible if you don't know what you're talking about.
*/

--- End Message ---
--- Begin Message ---
No Im not saying you do anything about it at all :)  I have already emailed
one of the lists about doing this and after some discussion here if more
people agree with me and would like to see some precautions taken then it
gives my emails a little weight to the webmasters of these archive lists.
Plus if others feel strongly about it they don¹t have to just voice their
opinion they could also email the lists.

So no worries Rasmus, it's just a poll of sorts.  Also something to help
people become more aware of email harvesters and to do something about it to
protect their email addresses when using these mailing lists.

Cheers!

Rick

"There is no such thing as a sudden heart-attack. It takes years of
preparation." - Unknown

> From: Rasmus Lerdorf <[EMAIL PROTECTED]>
> Date: Mon, 20 May 2002 01:14:03 -0700 (PDT)
> To: Richard Baskett <[EMAIL PROTECTED]>
> Cc: PHP General <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Email harvesters
> 
> If there was just one archive of this list and we controlled it, then this
> would be ok.  But the fact is that there are dozens, and we don't control
> any of them.  So I don't see how this could be done.
> 
> -Rasmus
> 
> On Mon, 20 May 2002, Richard Baskett wrote:
> 
>> I wrote this email to the php Archive list and I would like to get your
>> opinions on it.. Thanks! :)
>> 
>> "Is there any way that we could get the archives password protected?  Apple
>> does a nice thing where they tell you the username and password to login and
>> the whole purpose of it is so that email harvesters can not go through and..
>> Well.. Harvest our emails from the list :)  I think a lot of people would
>> not mind having something like this added to the pages since my guess is
>> that we're all sick and tired of spam and junkmail and eliminating one
>> possible garden for harvesters would be nice :)  I am going to email this to
>> the list also to see what kind of feedback comes from it."
>> 
>> Rick
>> 
>> "How wonderful it is that nobody need wait a single moment to improve the
>> world." - Anne Frank
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
That's an even better idea, precisely why I wanted to ask your opinions on
this subject.  Thanks.. I think I will wait to re-email that archive list
until I have a lot of great ideas we could combine to get one great idea.
Thanks a lot for your input!

Rick

"A good head and good heart are always a formidable combination. But when
you add to that a literate tongue or pen, then you have something very
special" - Nelson Mandela

> From: Jason Wong <[EMAIL PROTECTED]>
> Organization: Gremlins Associates
> Reply-To: [EMAIL PROTECTED]
> Date: Mon, 20 May 2002 16:26:38 +0800
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Email harvesters
> 
> On Monday 20 May 2002 15:46, Richard Baskett wrote:
>> I wrote this email to the php Archive list and I would like to get your
>> opinions on it.. Thanks! :)
>> 
>> "Is there any way that we could get the archives password protected?  Apple
>> does a nice thing where they tell you the username and password to login
>> and the whole purpose of it is so that email harvesters can not go through
>> and.. Well.. Harvest our emails from the list :)  I think a lot of people
>> would not mind having something like this added to the pages since my guess
>> is that we're all sick and tired of spam and junkmail and eliminating one
>> possible garden for harvesters would be nice :)  I am going to email this
>> to the list also to see what kind of feedback comes from it."
> 
> If they're password protected then how would search engines like google crawl
> through the archives? The best thing that could be done is hide (remove) the
> email addresses when the posts are placed in the archive -- something like
> what geocrawler does.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> /*
> Green's Law of Debate:
> Anything is possible if you don't know what you're talking about.
> */
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
If you're concerned and don't have effective anti-spam filtering on your 
email box, I'd suggest coming up with a second address to use for "public" 
purposes such as this. 

The list shows up all over the place. For instance, Google groups picks it
up off the news.php.net server, and you're surely not going to convince
them to hide email addresses.

miguel

On Mon, 20 May 2002, Richard Baskett wrote:
> No Im not saying you do anything about it at all :)  I have already emailed
> one of the lists about doing this and after some discussion here if more
> people agree with me and would like to see some precautions taken then it
> gives my emails a little weight to the webmasters of these archive lists.
> Plus if others feel strongly about it they don¹t have to just voice their
> opinion they could also email the lists.
> 
> So no worries Rasmus, it's just a poll of sorts.  Also something to help
> people become more aware of email harvesters and to do something about it to
> protect their email addresses when using these mailing lists.
> 
> Cheers!
> 
> Rick
> 
> "There is no such thing as a sudden heart-attack. It takes years of
> preparation." - Unknown
> 
> > From: Rasmus Lerdorf <[EMAIL PROTECTED]>
> > Date: Mon, 20 May 2002 01:14:03 -0700 (PDT)
> > To: Richard Baskett <[EMAIL PROTECTED]>
> > Cc: PHP General <[EMAIL PROTECTED]>
> > Subject: Re: [PHP] Email harvesters
> > 
> > If there was just one archive of this list and we controlled it, then this
> > would be ok.  But the fact is that there are dozens, and we don't control
> > any of them.  So I don't see how this could be done.
> > 
> > -Rasmus
> > 
> > On Mon, 20 May 2002, Richard Baskett wrote:
> > 
> >> I wrote this email to the php Archive list and I would like to get your
> >> opinions on it.. Thanks! :)
> >> 
> >> "Is there any way that we could get the archives password protected?  Apple
> >> does a nice thing where they tell you the username and password to login and
> >> the whole purpose of it is so that email harvesters can not go through and..
> >> Well.. Harvest our emails from the list :)  I think a lot of people would
> >> not mind having something like this added to the pages since my guess is
> >> that we're all sick and tired of spam and junkmail and eliminating one
> >> possible garden for harvesters would be nice :)  I am going to email this to
> >> the list also to see what kind of feedback comes from it."
> >> 
> >> Rick
> >> 
> >> "How wonderful it is that nobody need wait a single moment to improve the
> >> world." - Anne Frank
> >> 
> >> 
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >> 
> > 
> > 
> > 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
phpbb2 has improved alot since the earlier versions

> -----Original Message-----
> From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
> Sent: 18 May 2002 3:02 PM
> To: Richard Baskett; PHP General
> Subject: Re: [PHP] Bulletin Boards
> 
> 
> Never used Phorums as it didn't have what I was looking for.  
> Tried phpBB
> but the admins ection is awful IMHO.  I currently use YaBB SE 
> which has a
> very fast development time.
> 
> Jeff
> ----- Original Message -----
> From: "Richard Baskett" <[EMAIL PROTECTED]>
> To: "PHP General" <[EMAIL PROTECTED]>
> Sent: Saturday, May 18, 2002 4:51 AM
> Subject: [PHP] Bulletin Boards
> 
> 
> > Has anybody used phpBB && Phorum?  And if so, which did you 
> like better
> and
> > why?  And if you've used other systems.. Which did you like 
> best and why?
> > Thanks! :)
> >
> > Rick
> >
> > "We should be taught not to wait for inspiration to start a 
> thing.  Action
> > always generates inspiration.  Inspiration seldom generates 
> action." -
> Frank
> > Tibolt
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
I am using gmdate to get the GMT timezone and it's
working but how does it know what timezone my
server is to make the time adjustment?  



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system
(http://www.grisoft.com).
Version: 6.0.361 / Virus Database: 199 - Release
Date: 07/05/02
 
--- End Message ---
--- Begin Message ---
Hi all,

Just curious whether anyone knows where I can find a class or other 
interface to the dtcm calendar manager that is a part of CDE on Solaris, 
AIX, etc. Unfortunately, it would seem that dtcm doesn't support RFC 
standards, so I don't think I can use mcal or anything like that to 
interface with it. (If I'm wrong, please let me know!)

Thanks in advance for your help.

/bsh/

-- 


/---------------------------------------------=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| "All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer."                 |
\--=[ [EMAIL PROTECTED] ]=--------------------------------------------/

--- End Message ---
--- Begin Message ---
Hi,

I want to read out the asterisk from a birthdate.

First off all I need the timestamp:

        $startDate['Steinbock']         = mktime (0, 0, 0, 12, 22,
1999);
        $startDate['Wassermann']        = mktime (0, 0, 0, 01, 21,
2000);
        $startDate['Fisch']             = mktime (0, 0, 0, 02, 21,
2000);
        $startDate['Widder']            = mktime (0, 0, 0, 03, 21,
2000);
        $startDate['Stier']             = mktime (0, 0, 0, 04, 21,
2000);
        $startDate['Zwilling']          = mktime (0, 0, 0, 05, 21,
2000);
        $startDate['Krebs']             = mktime (0, 0, 0, 06, 22,
2000);
        $startDate['Löwe']              = mktime (0, 0, 0, 07, 23,
2000);
        $startDate['Jungfrau']          = mktime (0, 0, 0, 08, 24,
2000);
        $startDate['Waage']             = mktime (0, 0, 0, 09, 24,
2000);
        $startDate['Skorpion']          = mktime (0, 0, 0, 10, 24,
2000);
        $startDate['Schütze']           = mktime (0, 0, 0, 11, 23,
2000);
        $startDate['Steinbock2']        = mktime (0, 0, 0, 12, 22,
2000);

but with 'Jungfrau' AND 'Waage' something is wrong!!

if I want to debug this lines with:

        echo date("m - Y",$startDate['Steinbock'])."<BR>";
        echo date("m - Y",$startDate['Wassermann'])."<BR>";
        echo date("m - Y",$startDate['Fisch'])."<BR>";
        echo date("m - Y",$startDate['Widder'])."<BR>";
        echo date("m - Y",$startDate['Stier'])."<BR>";
        echo date("m - Y",$startDate['Zwilling'])."<BR>";
        echo date("m - Y",$startDate['Krebs'])."<BR>";
        echo date("m - Y",$startDate['Löwe'])."<BR>";
        echo date("m - Y",$startDate['Jungfrau'])."<BR>";
        echo date("m - Y",$startDate['Waage'])."<BR>";
        echo date("m - Y",$startDate['Skorpion'])."<BR>";
        echo date("m - Y",$startDate['Schütze'])."<BR>";
        echo date("m - Y",$startDate['Steinbock2'])."<BR>";

to read out the month and year of the asterisks PHP returns:

12 - 1999
01 - 2000
02 - 2000
03 - 2000
04 - 2000
05 - 2000
06 - 2000
07 - 2000
12 - 1999 <<<< error
12 - 1999 <<<< error
10 - 2000
11 - 2000
12 - 2000

all other asterisks are ok...

Does anyone know how to fix it??
Or is it a bug??
Anyone knows a better idea to get the asterisk from a given date???

Thanx...

-- 
Mit freundlichem Gruß,
Johannes Tyra

--- End Message ---

Reply via email to