Re: [PHP] Cookie Expire Problem

2001-04-07 Thread Jeffrey Paul


actually, the offending line is:

$cookie_expire = "$time*3";

it may be set too high if you triple it, but i think what might be 
happening is that it's setting $cookie_expire to '986703865*3' which would 
be invalid.

if this is the case (i dont think you can multiply inside of quotes), then 
this is caused by bad programming style.  Better is to only quote when 
dealing with strings... if you know it's math, then leave the quotes at home.

solution:

$cookie_expire = time() + 86000*365*10;

(86000 = number of seconds in the day, times 365 days, times 10 
years).  Order of operations will multiply before adding. bada-bing, bada-boom.

-j


PS: hi everyone out there in php land, i'm new on the list, but you might 
know me from eyearcee.


At 12:15 AM 4/8/2001, Plutarck wrote:
>The problem is that it is too far in the future.
>
>Your cookie is set to expire in the year 2280. You think that's a little
>overkill?
>
>
>And it runs into the UNIX-style Y2K problem which is...um...13 years from
>now? Well anyway...
>
>Make your cookie's expire time a little more reasonable. Like 5 years from
>now, which is this many seconds:
>15768
>
>So set it to time()+15768
>
>If someone has your cookie on their machine in the year 2280 and gets pissed
>that their login failed when it shouldn't of, don't worry about it. You'll
>be dead, too feeble to care, or a god for creating an application that still
>works after 270 years ;P
>
>
>--
>Plutarck
>Should be working on something...
>...but forgot what it was.
>
>
>""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > This code won't set a cookie. I took the time part from a past
> > post to set the time for wy ahead. I must be doing it wrong
> > though:
> >
> > $time = time();
> > $cookie_name = "auth";
> > $cookie_value = "ok";
> > $cookie_expire = "$time*3";
> > $cookie_domain = "";
> > setcookie($cookie_name, $cookie_value, $cookie_expire, "/" ,
>$cookie_domain, 0);
> >
> > Thanks.
> > Jeff Oien
> >
> > --
> > 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]

--
[EMAIL PROTECTED]  -   0x514DB5CB
he who lives these words shall not taste death
becoming nothing yeah yeah
forever liquid cool


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Can't redeclare already declared function

2001-04-11 Thread Jeffrey Paul



better yet, try include_once() instead of all instances of include().  It 
will only include a file once, rather than every time you call include() on 
that path.

Nifty feature.

-j

At 11:17 AM 4/11/2001, Johnson, Kirk wrote:
>The function in question is defined in an included file, right? This
>function definition file is most likely being included twice. The best bet
>is that it is being included from another included file (at least, that's
>how I usually manage to produce this error :) ). Check all your included
>files for a line that re-includes the function definition file a second
>time.
>
>Kirk
>
> > -Original Message-
> > From: kenny.hibs [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 11, 2001 3:10 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Can't redeclare already declared function
> >
> >
> > Anyone help with this
> >
> > Fatal error: Can't redeclare already declared function in
> > header.php3 on
> > line 233
> > The troubl is that there is no line 233 so it must be looking
> > at another
> > page?
> >
>
>--
>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]

--
[EMAIL PROTECTED]  -   0x514DB5CB
he who lives these words shall not taste death
becoming nothing yeah yeah
forever liquid cool


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] return parse error

2001-04-13 Thread Jeffrey Paul

At 03:56 AM 4/13/2001, Peter Harkins wrote:
> This generates a parse error:
> mysql_connect("localhost", "root", "rootpw") or 
> return("bar");
>
> But all the following work fine:
> mysql_connect("localhost", "root", "rootpw") or die("bar");
>
> mysql_connect("localhost", "root", "rootpw") or 
> print("bar");
>
> if (!mysql_connect("localhost", "root", "rootpw")) {
> return("bar");
> }
>
> Why? mysql_connect returns false on failure either way... I 
> notice die


return isn't a function but a language construct.   This is why the third 
working line with the curlybraces works, and without them it doesn't.

include() is a language construct too.  the particulars of using language 
constructs (like return() and include()) with control structure syntax are 
explained on the page for include().

http://us2.php.net/manual/en/function.include.php

-j (aka sneak)



--
[EMAIL PROTECTED]  -   0x514DB5CB
he who lives these words shall not taste death
becoming nothing yeah yeah
forever liquid cool


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] ADV. Natural penis enlargement -without surgery-!

2001-08-01 Thread Jeffrey Paul

At 09:00 PM 7/31/2001, Guaranteed ! wrote:
>We are a serious company, offering a program that will enhance your sex
>life, and  enlarge your penis in a totally natural way.

I think they got the ASP mailinglist mixed up with the PHP one..

-j


--
[EMAIL PROTECTED]   -  0xF50BB9D7
A21A FD82 8C30 EC77   545D A0B3 F501 F50B B9D7
ICQ: 14295546-AIM: kw34hd1


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie: Site search, more than one directory

2001-08-01 Thread Jeffrey Paul

At 04:11 PM 8/30/2001, Steve Wright wrote:
>Hey,
>
>I have just developed a simple site search.. .and am after learning how to
>get it to search all directories... at present, it only searches the one it
>is in!!




> $cmdstr = "grep -i $searchstr *";


"man grep" on my linux box shows:

-r, --recursive
   Read all files under each directory, recursively; this is 
equivalent to the -d recurse
   option.

change it to:

$cmdstr = "grep -r -i $searchstr *";

In all honesty though, you might want to use an ereg_replace() on 
$searchstr before doing that, so that special shell characters can't get 
through.

Interesting take on searching...

-j



--
[EMAIL PROTECTED]   -  0xF50BB9D7
A21A FD82 8C30 EC77   545D A0B3 F501 F50B B9D7
ICQ: 14295546-AIM: kw34hd1


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WEB LOG

2001-09-24 Thread Jeffrey Paul

At 07:08 AM 9/24/2001, Chris Herring wrote:
>OOPS, again, elseif isn't what needs to be done.
>
>Ok, here we go.
>
>if $pwd == $real_pwd {
>header ("Location: http://therealsite";);
>} else {
>header ("Location: http://badsite";);
>}
>

For the record, that won't stop someone from going to the destination page 
if the password doesn't match, which is what the person asked about.  All 
this will do is send them a redirect to an error page if the password 
doesn't match, it doesn't prevent anyone at all from hitting, in your 
example, http://therealsite.

-j



Jeffrey Paul  [EMAIL PROTECTED]  (877) 748 3467
ICQ: 14295546 AIM: kw34hd1 NXTL/DC: 130*21*16749
PGP: 0xF50BB9D7 A21AFD828C30EC77545DA0B3F501F50BB9D7


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] WEB LOG

2001-09-24 Thread Jeffrey Paul

At 10:09 AM 9/24/2001, Andreas Gietl wrote:
>Well. If you check the HTTP_REFERER on the target-site it would work and give
>you at least some "security". However it is still not really secure.

Wrong.  Many browsers don't send the Referer: header, not to mention it's 
downright trivial to spoof it.  This doesn't afford any more security at all.

-j


--------
Jeffrey Paul  [EMAIL PROTECTED]  (877) 748 3467
ICQ: 14295546 AIM: kw34hd1 NXTL/DC: 130*21*16749
PGP: 0xF50BB9D7 A21AFD828C30EC77545DA0B3F501F50BB9D7


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Running a script with Crontab

2001-09-30 Thread Jeffrey Paul

At 01:25 PM 9/30/2001, [EMAIL PROTECTED] wrote:
>This is what I do, maybe is gonna help you
>
>bash file structure:
>
>  #!/bin/bash
>  ##
>  ##  mysql maintenance
>  ##
>  /usr/bin/mysql -u username --password=yourpassword <  use yourdatabase;
>  YOUR SQL query HERE;
>  exit
>  EOF
>
>then
>  chmod +x yourbashfile
>
>so "cronjob" this file with the desired frecuency


BAD BAD BAD idea.

if this is a public server (linux that's not running the openwall patch, 
for example) then anyone can see your password with a `ps auxwww` while 
it's running.  Scripts I run from cron are usually recalculation scripts in 
the middle of the night that take 10-15 mins to run, and as such would give 
anyone more than enough time to grab it while the script is running, not 
that it's not possible to grab it even with a shorter execution time as well.

-j



Jeffrey Paul  [EMAIL PROTECTED]  (877) 748 3467
ICQ: 14295546 AIM: kw34hd1 NXTL/DC: 130*21*16749
PGP: 0xF50BB9D7 A21AFD828C30EC77545DA0B3F501F50BB9D7


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