php-general Digest 8 Apr 2001 13:02:16 -0000 Issue 615 Topics (messages 47606 through 47645): gd 2.0 47606 by: J.R. Lillard odd cookie behaviour 47607 by: matt thompson 47614 by: shaun 47634 by: matt thompson Re: putting a list of data into 3 columns? 47608 by: Jack Dempsey 47630 by: Lindsay Adams Wrapping Text 47609 by: Chris Anderson 47612 by: shaun 47616 by: Philip Olson Re: adding methods to classes 47610 by: Yasuo Ohgaki Re: new php.net look 47611 by: Yasuo Ohgaki Re: PEAR Standards (was Re: equivalent of asp's <%= strTest %>) 47613 by: Philip Olson 47618 by: Plutarck 47639 by: Felix Kronlage PHP & asp 47615 by: Kittiwat Manosuthi 47620 by: Plutarck 47625 by: Kittiwat Manosuthi Re: Checking the REFERER 47617 by: Plutarck image validation 47619 by: Michael Hall 47643 by: Christian Reiniger Re: Cookie Expire Problem 47621 by: Plutarck 47622 by: Jeffrey Paul 47642 by: Christian Reiniger Segfaults with t1lib 47623 by: Lars Magne Ingebrigtsen 47628 by: Lars Magne Ingebrigtsen Re: equivalent of asp's <%= strTest %> 47624 by: Plutarck "configure" not doing anything and file not found 47626 by: Plutarck submitting to a remote form 47627 by: Joseph Bannon 47631 by: Plutarck 47633 by: Joseph Bannon 47635 by: Matt McClanahan 47636 by: Joseph Bannon 47644 by: Christian Reiniger unable to run lynx from exec or passthru 47629 by: Junaid MAnsoor 47632 by: Lindsay Adams DB Problem 47637 by: Adam Charnock Selecting Dates 47638 by: Jordan Elver Re: [PHP-DB] Selecting Dates 47640 by: B. van Ouwerkerk 47641 by: Jordan Elver where might I find a good php page 47645 by: Engström 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] ----------------------------------------------------------------------
has anyone gotten php to compile with gd 2.0? i know gd 2.0 is still in beta, but i was able to compile and install it without any problems. when compiling php, however, i end up with some error in regards to the libmysql extension. if i switch back to gd 1.8, all works fine. -jr
hey, i'm designing a small shopping cart w/ cookies where the cookie is used as an array (the array id being the product id) and the array value being the number of items selected. anyways, for the most part everything works fine, but with certain items if they're added to the cart, they get added, but unfortunately do not display in the cart until a few other items are added (the quantity of that product continues to increase regardless of whether or not it's shown in the cart). i have absolutely no idea why this is happening, and feel like i've tried most things that have come to mind. my cookie is being set like: if (!isset($cookie[0])) setcookie("cookie[0]", "0"); i do not have a product w/ id of zero (0), so i use that as the default id / value to set the cookie with. any suggestions _at_all_ would be appreciated. :) thanks, matt
I think you might wanna check if $cookie is set, not $cookie[0], if that doesn't work just check if $cookie[0] = 0 -Shaun On Saturday 07 April 2001 21:10, matt thompson wrote: > hey, > > i'm designing a small shopping cart w/ cookies where the cookie is used as > an array (the array id being the product id) and the array value being the > number of items selected. anyways, for the most part everything works > fine, but with certain items if they're added to the cart, they get added, > but unfortunately do not display in the cart until a few other items are > added (the quantity of that product continues to increase regardless of > whether or not it's shown in the cart). i have absolutely no idea why this > is happening, and feel like i've tried most things that have come to mind. > my cookie is being set like: > > if (!isset($cookie[0])) setcookie("cookie[0]", "0"); > > i do not have a product w/ id of zero (0), so i use that as the default id > / value to set the cookie with. any suggestions _at_all_ would be > appreciated. :) > > thanks, > matt
same results. certain items don't immediately show up in the cart until i add numerous other items. it's funny, because some items show up all the time, regardless of what order, etc. they're placed in the cart. very weird. thanks for your help though! "shaun" <[EMAIL PROTECTED]> wrote in message 01040720420304.01567@box">news:01040720420304.01567@box... > I think you might wanna check if $cookie is set, not $cookie[0], if that > doesn't work just check if $cookie[0] = 0 > > -Shaun > > On Saturday 07 April 2001 21:10, matt thompson wrote: > > hey, > > > > i'm designing a small shopping cart w/ cookies where the cookie is used as > > an array (the array id being the product id) and the array value being the > > number of items selected. anyways, for the most part everything works > > fine, but with certain items if they're added to the cart, they get added, > > but unfortunately do not display in the cart until a few other items are > > added (the quantity of that product continues to increase regardless of > > whether or not it's shown in the cart). i have absolutely no idea why this > > is happening, and feel like i've tried most things that have come to mind. > > my cookie is being set like: > > > > if (!isset($cookie[0])) setcookie("cookie[0]", "0"); > > > > i do not have a product w/ id of zero (0), so i use that as the default id > > / value to set the cookie with. any suggestions _at_all_ would be > > appreciated. :) > > > > thanks, > > matt > > -- > 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] >
the method i gave you will do this......if you use the if clause i showed and work with it for more than a minute you'll see how you can test to see if you should add an </td><td> to your data, and this will let you make your columns.....play with it and you'll see...... -jack -----Original Message----- From: DRN [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 07, 2001 7:55 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] putting a list of data into 3 columns? Lindsay Adams <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | Assuming your items are in an array | $items =array() //assume a bunch of items in this array | For($i = 0; $i< (count($items)/3); $i +=1){ | printf("%s\t%s\t%s",$items[$i],$items[$i+3],$items[$i+6]); | } | | Should print 3 columns of tab separated text. | Note: typed this quickly, untested, but the theory is sound. Might have to | twiddle the $i<(count... Section. | | If you have 8 itesm, as shown and you divide by 3 you get 2.xx | So, the the loop will print out: | | $items[0] $items[3] $items[6] | $items[1] $items[4] $items[7] | $items[2] $items[5] $items[8} | // because $items[8] doesn't exist, it won't print. | // if it spits out an error there, put a @in front of printf to turn off | error reporting. | | | On 4/7/01 11:58 AM, "Jack Dempsey" <[EMAIL PROTECTED]> wrote: | | > You don't need to count...in your loop you can do something like this: | > if($current_pos%3==0){ //then you're at a multiple of three | > //code to start new column here | > } | > | > -jack | > Neither of these were quite what I was looking for, I was hoping I could make a table with 3 <td>'s side by side, each having a third of the list of products (with <br> between them). Is this possible? If not I will try to adapt one of these methods. Cheers for your help, Donald -- 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]
This is exactly what I sent you. You have to realize that you can't print down one column, and then start a new one. You have to print across, left to right before you go down. You have to modify the print statement to put it into a table, but that is easy: Print should be: printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>",$items[$i],$items[$i+3], $items[$i+6]); That will print your 3 columns in a table. And it is essentially identical to to what I sent. Just have to modify the format of the printf statement. You can also do it in a regular print statement: Print("<tr><td>$items[$i]</td><td>$items[$i+3]</td><td>$items[$i+6]</td></tr >\n"); Or how about a here doc for php4 Print <<EOF <tr><td>$items[$i]</td><td>$items[$i+3]</td><td>$items[$i+6]</td></tr>\n EOF The for loop stays the same, only the print statement changes. Lindsay Adams --- On 4/7/01 4:55 PM, "DRN" <[EMAIL PROTECTED]> wrote: > > Lindsay Adams <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > | Assuming your items are in an array > | $items =array() //assume a bunch of items in this array > | For($i = 0; $i< (count($items)/3); $i +=1){ > | printf("%s\t%s\t%s",$items[$i],$items[$i+3],$items[$i+6]); > | } > | > | Should print 3 columns of tab separated text. > | Note: typed this quickly, untested, but the theory is sound. Might > have to > | twiddle the $i<(count... Section. > | > | If you have 8 itesm, as shown and you divide by 3 you get 2.xx > | So, the the loop will print out: > | > | $items[0] $items[3] $items[6] > | $items[1] $items[4] $items[7] > | $items[2] $items[5] $items[8} > | // because $items[8] doesn't exist, it won't print. > | // if it spits out an error there, put a @in front of printf to turn > off > | error reporting. > | > | > | On 4/7/01 11:58 AM, "Jack Dempsey" <[EMAIL PROTECTED]> wrote: > | > | > You don't need to count...in your loop you can do something like > this: > | > if($current_pos%3==0){ //then you're at a multiple of three > | > //code to start new column here > | > } > | > > | > -jack > | > > > Neither of these were quite what I was looking for, I was hoping I > could make a table with 3 <td>'s side by side, each having a third of > the list of products (with <br> between them). > Is this possible? If not I will try to adapt one of these methods. > > Cheers for your help, Donald > >
I've been having large problems with this so I decided to ask you guys(and gals ^_^). I have a textarea where you can type your text and it is saved to a file. Then another script includes that. Unfortunately I can't find a way for the textarea to wrap the text, or make it so it shows it they way they typed it in. Any help would be appreciated
one thing that would help is to str_replace("\n", "<br>"); I think textarea has a wrap attribute doesn't it? On Wednesday 04 April 2001 13:20, Chris Anderson wrote: > I've been having large problems with this so I decided to ask you guys(and > gals ^_^). I have a textarea where you can type your text and it is saved > to a file. Then another script includes that. Unfortunately I can't find a > way for the textarea to wrap the text, or make it so it shows it they way > they typed it in. Any help would be appreciated
Or better yet, use nl2br() : http://www.php.net/manual/en/function.nl2br.php Regarding the html WRAP attribute, this little tutorial looks interesting : http://www.web-wise-wizard.com/html-tutorials/ html-form-forms-textarea-wrap.html (note: it's one link, had to split up as it's so long!) Regards, Philip On Sat, 7 Apr 2001, shaun wrote: > one thing that would help is to str_replace("\n", "<br>"); > > I think textarea has a wrap attribute doesn't it? > > > > On Wednesday 04 April 2001 13:20, Chris Anderson wrote: > > I've been having large problems with this so I decided to ask you guys(and > > gals ^_^). I have a textarea where you can type your text and it is saved > > to a file. Then another script includes that. Unfortunately I can't find a > > way for the textarea to wrap the text, or make it so it shows it they way > > they typed it in. Any help would be appreciated > > -- > 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] >
""Dean Hall"" <[EMAIL PROTECTED]> wrote in message 9ao8dc$s6t$[EMAIL PROTECTED]">news:9ao8dc$s6t$[EMAIL PROTECTED]... > Stupid me. Just extend the class. > > Now the real question: > > Is there any dynamic binding in PHP? You can do simlar thing with Variable Function. For example. class foo { var $function_name; function foo($fname) {$this->function_name = $fname; $this->$function_name;} function a() {echo 'a';} function b() {echo 'b';} } foo('b'); // calls foo::b() >Can I override a method in a subclass? Yes. -- Yasuo Ohgaki > > Dean. > > > > > -- > 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] >
Read FAQ. Description is in there. Regards, -- Yasuo Ohgaki "jaxon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > The older look was neat to show off to people re: pop up menus, etc., > > but this is > > a real speed demon, and will be much more useful for searching around. > > Speaking of which - there used to be a little HOWTO for doing those kind of > popups - does anyone know where it has gone to? > > regards, > jaxon > > > > > > > Thanks again! > > > > > > > -- > 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] >
> "shaun" <[EMAIL PROTECTED]> wrote : > I'm pretty sure you can make php use the asp style % though too, not > sure if that's for short tags, regular tags or both, I know it's in > the config though, anyone know? Info related to the above can be seen here : http://www.php.net/manual/en/language.basic-syntax.php http://www.php.net/manual/en/configuration.php#ini.asp-tags Regarding PEAR standards, I think they're good to teach. For instance, imagine if all written PHP books and tutorials followed such a standard, would that be cool? Yes. From there us PHP minions can do as we choose. A related article is as such (see user comments too) : http://phpbuilder.com/columns/tim20010101.php3 Regards, Philip
As long as PEAR standars are enforced ONLY for the PEAR library, then it's ok. It makes it alot easier to read such code if all of it's contents use the same style. But when they try to reach over and make all applications do it, then it's too far. But I don't see them trying to do that. When PEAR says not to use short-tags, they aren't saying it just becase they "prefer that style". They say it for this exact reason. The standard tags work great with XML, but with short tags xml may break. ASP tags should be avoided, because what if your application get's installed on a server that supports ASP? So your PHP code get's passed to an ASP parser, and it gets all confused, and it could accidentally totally screw up your app and open a security hole. Don't look at PEAR as trying to set standards for _you_. Look at the standards as for PEAR library content, and ask why they say such things. For instance, when they say not to use 4 spaces (or was it 3?) instead of tabs? I think that's stupid, and I don't do it. But they did it for a reason, even if I don't understand it. I will abide by it if I want my stuff included in PEAR, but in my own apps I keep using tabs (it's easier to use backspace/delete on a tab, for one thing). PEAR servers a valuable role as instructor. You may never have thought there was a reason to add that extra "php" on your opening tag, but now you know why they reccommend it ;) Let's not try and restrict what the developers of an entirely seperate standard (XML) do with their code just so we can avoid writing our code like it was intended to be written :) As long as PEAR is a restriction on PEARlib content, and just a suggestion to everyone else, then PEAR is great. If PEAR trys to force me to use their standards in my programming in any way, then they've become "code police", and we sure as heck don't need that. Remember, PHP is a "loosely typed" language. That's why I like it. However I often treat it as strictly typed to ensure I don't create any errors, but I like having that choice to just be "loose". Ya know? -- Plutarck Should be working on something... ...but forgot what it was. ""Dean Hall"" <[EMAIL PROTECTED]> wrote in message 9ao32a$n7v$[EMAIL PROTECTED]">news:9ao32a$n7v$[EMAIL PROTECTED]... > I have some problems with the PEAR "standards", and I'm wondering what > others have to say about what the PHP developers are doing to overcome PHP's > obvious shortcomings. > > <bitch> > <moan> > It seems that one obvious improvement to be made to PHP would be the > implementation of real namespaces. It seems pretty simple to implement this > and stay backwards compatible with PHP3/4. Does anyone know if plans are in > the work for this? > > The PEAR standards try to make up for the lack of namespaces . . . and I > suppose its the best that can be done, but it's simply awful! It not only > proposes a standard, it proposes to mandate naming conventions and coding > style as well! > > I think the PHP developers should look to the example that Perl has set for > graceful, non-obtrusive namespaces that don't enforce coding style or naming > conventions for classes. (I mean, I don't have to name a subclass of "DB" > "DB_mysql" -- it can be "DB::Mysql".) > </moan> > </bitch> > > "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > If the people defining the PEAR standards really were that interested in > > standards, why include alternate ways of doing something? <?=$blah;?> > > And if the 'short tag' method is useful enough for people, why 'exclude' > it > > from a standard? This notion of 'PEAR standards' does irk me some, > because > > it's been so long in coming, and people are deferring to it before it's a > reality. > > First of all, I think that the PEAR folk are on a different endeavor than > the PHP developers. The PEAR people seem to be trying to propose a good > standard for a language that needs some improvement. They're doing a decent > job, but I think PEAR should wait till PHP matures a bit. > > Second, there is one very good reason not to use short tags: XML. All the > same, I'd rather just enable ASP tags than do away with short tags, as short > tags are irreplacable in templates rich in content and sparse on code. > > My $0.02. > > Dean Hall. > http://hall.apt7.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] >
On Sat, Apr 07, 2001 at 10:19:04PM -0500, Plutarck wrote: > For instance, when they say not to use 4 spaces (or was it 3?) instead of > tabs? I think that's stupid, and I don't do it. But they did it for a > reason, even if I don't understand it. tabs might break going from one platform to another, thus making the code hard to read. 4 spaces stay 4 spaces. on every platform. That's probably the reason. -fkr, who is the only one that uses spaces instead of tabs at work -- gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0 8A48 0D31 9BD3 D9AC 74D0 |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE | |all your base are belong to us | shame on me | fkr@IRCnet |
I guess this one is quite interesting... http://www.sitepointforums.com/showthread.php?threadid=19417 and the battle begins... -km
Bah. No matter how fast I read, by the time I get to the end of a page a new page has filled with comments. I'd say something witty about TIMTOWTDI, microwaves, and what a drunk sorrority girl has in common with R2D2, but I can't get to the end of the friggin' thread! It never ends! *cries* -- Plutarck Should be working on something... ...but forgot what it was. ""Kittiwat Manosuthi"" <[EMAIL PROTECTED]> wrote in message 008f01c0bfd5$9b78d320$3d88aacb@notebook">news:008f01c0bfd5$9b78d320$3d88aacb@notebook... > I guess this one is quite interesting... > > http://www.sitepointforums.com/showthread.php?threadid=19417 > > and the battle begins... > > -km > > > > -- > 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] >
Well.. I forgot to warn that read it "only" when you've free time. Having read though all those made me feel sick, and wanted to stop programming for a year. He he. -km ----- Original Message ----- From: "Plutarck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 08, 2001 10:54 AM Subject: Re: [PHP] PHP & asp > Bah. No matter how fast I read, by the time I get to the end of a page a new > page has filled with comments. > > I'd say something witty about TIMTOWTDI, microwaves, and what a drunk > sorrority girl has in common with R2D2, but I can't get to the end of the > friggin' thread! It never ends! *cries* > > > -- > Plutarck > Should be working on something... > ...but forgot what it was.
There really isn't a way to be truly sure. You might not even need to be in the first place. If for instance you have a login page that will display an error message ff the login data was invalid, but if someone just typed in the address to the login page you don't want to show that error message or even check to see if it's valid, you can do a few things. For one thing you can give the "submit" button on your form a name attribute, so that it will send it's value with the form if someone uses it. So then you can just check if that data was submitted. But that doesn't stop anyone from just including "?submitbutton=Submit" into the title. One thing you can do is use some crypt function on the current unix timestamp, and include that data onto the form. Then have your login page decrypt the data, and ensure that is recent enough to be considered valid. That way you can ensure someone is using the newest version of your form, and if someone is trying to fake you out then they can only do it for a few hours before having to remake the fake form. Since they can never guess what the crypted string will be, then they will have to try and do it either manually or dynamically. If you get creative you can stop them from doing that, but... If you really have to be _that_ sure that a user is physically using your form, then your application is probably too unsecure, and it's design needs to be altered. -- Plutarck Should be working on something... ...but forgot what it was. "Jochen Kaechelin" <[EMAIL PROTECTED]> wrote in message NFBBLHGFAKNLFNPOHMPHOEKLCFAA.jk@intern">news:NFBBLHGFAKNLFNPOHMPHOEKLCFAA.jk@intern... > Waht might be the most secure method to check, > if a certain page was reached by submitting a form > instead of typing the adress directly? > > I read, the the $HTTP_REFERER may be changed, e.g. > when WEBWASHER or other programs are in use! > > Pleas help! > > Thanx > > -- > Jochen Kaechelin - Ihr WEBberater > Stuttgarter Str.3, D-73033 Goeppingen > Tel. 07161-92 95 94, Fax 07161-92 95 98 > http://www.wa-p.de, mailto:[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] >
I'm wondering if there is any sure way for PHP to determine whether an uploaded file is definitely an image file. I have a script that checks for size and mime type ('image/png' or 'image/jpeg'). The script works fine, but I've heard that it is possible to add those mime type headers to files that aren't images at all, and possibly something mailicious. Mick
On Sunday 08 April 2001 03:57, you wrote: > I'm wondering if there is any sure way for PHP to determine whether an > uploaded file is definitely an image file. > > I have a script that checks for size and mime type ('image/png' or > 'image/jpeg'). The script works fine, but I've heard that it is > possible to add those mime type headers to files that aren't images at > all, and possibly something mailicious. Well, if you get some images you won't try to execute them (images off bill gates aside :), right? So you don't really have to worry about "something malicious". But if you want to check, just try opening them with one of the image extensions (gd, imagemagick, ...) -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) void sleep(){for(long int sheep=0;!asleep();sheep++);}
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: 157680000 So set it to time()+157680000 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 waaaay 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] >
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: >157680000 > >So set it to time()+157680000 > >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 waaaay 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
On Sunday 08 April 2001 06:15, you wrote: > 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... 2038 with a 32bit processor -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) void sleep(){for(long int sheep=0;!asleep();sheep++);}
php-4.0.4pl1 compiled with --with-t1lib alternatively segfaults or gives error messages, depending on where you call ImagePsText(). This is the warning: [Sun Apr 8 06:16:57 2001] [error] PHP Warning: libt1 returned error 11 in /var/www/larsi/lib/chart.php on line 493 And this is what apache says when being run under gdb, and php segfaults: GDB 4.16 (i386-redhat-linux), Copyright 1996 Free Software Foundation, Inc... (gdb) run -X Starting program: /usr/local/lib/apache-1.3/bin/httpd-1.3.19-php-4.0.4pl1-oci-xml-ssl-gettext -X Program received signal SIGSEGV, Segmentation fault. 0x40028561 in T1_SetString () at t1set.c:1142 1142 } (gdb) bt #0 0x40028561 in T1_SetString () at t1set.c:1142 #1 0x4002e840 in T1_AASetString () at t1aaset.c:741 #2 0x80ba9bb in php_if_imagepstext (ht=12, return_value=0x847e784, this_ptr=0x0, return_value_used=0) at gd.c:2468 #3 0x810ebe5 in execute (op_array=0x83bda24) at ./zend_execute.c:1519 #4 0x810edd9 in execute (op_array=0x83ba734) at ./zend_execute.c:1559 #5 0x810edd9 in execute (op_array=0x834fa7c) at ./zend_execute.c:1559 #6 0x80a4a90 in zend_execute_scripts (type=8, file_count=3) at zend.c:729 #7 0x80b0e28 in php_execute_script (primary_file=0xbffffb24) at main.c:1221 #8 0x80aeed7 in apache_php_module_main (r=0x833d01c, display_source_mode=0) at sapi_apache.c:89 #9 0x809900a in send_php () #10 0x809903b in send_parsed_php () #11 0x812f886 in ap_invoke_handler () #12 0x813f5ed in process_request_internal () #13 0x813f63b in ap_process_request () #14 0x8138254 in child_main () #15 0x813849f in startup_children () #16 0x8138bf9 in standalone_main () #17 0x8139643 in main () (gdb) I have seen this being reported several times before, but as far as I can see, it hasn't been fixed. Has ImagePsText become unsupported? -- (domestic pets only, the antidote for overdose, milk.) [EMAIL PROTECTED] * Lars Magne Ingebrigtsen
[EMAIL PROTECTED] (Lars Magne Ingebrigtsen) writes: > php-4.0.4pl1 compiled with --with-t1lib alternatively segfaults or > gives error messages, depending on where you call ImagePsText(). I don't know anything about php's internals, but since 4.0.3 worked, and 4.0.4pl1 didn't I just compared the two versions of the function. The following patch fixes the segfault problem for me: --- gd.c~ Wed Nov 29 16:25:42 2000 +++ gd.c Sun Apr 8 06:45:44 2001 @@ -2390,6 +2390,7 @@ if (zend_get_parameters_ex(12, &img, &str, &fnt, &sz, &fg, &bg,\ &px, &py, &sp, &wd, &ang, &aas) == FAILURE) { RETURN_FALSE; } + convert_to_string_ex(str); convert_to_long_ex(sp); convert_to_long_ex(aas); convert_to_long_ex(wd); The other problem (the warning) was due to me calling ImagePsText with a non-integer px or py parameter. I'm guessing it's a bug that gd.c doesn't coerce those parameters to integers, but I leave that to others to fix. -- (domestic pets only, the antidote for overdose, milk.) [EMAIL PROTECTED] * Lars Magne Ingebrigtsen
> And if the 'short tag' method is useful enough for people, why 'exclude' it from a standard? Because no matter what installation of PHP you have, this works: <?php echo $var; ?> But this: <?=$var?> Or this: <? echo $var; ?> Or this: <% echo $var; %> ...is made invalid if short_tags are disabled (and the last only works with ASP tag support, and I'd say 90% of PHP users don't have it enabled). And if the tags are turned off, guess what happens to all the code between those tags? woops ;) And as mentioned, short_tags must be disabled on .xml pages. Or they at least "should" be. While there are work-arounds, if you didn't use short-tags you wouldn't ever have a problem with any standard unless <?php becomes part of their markup, lol. And if it does, they will have to be "dealt with" :) -- Plutarck Should be working on something... ...but forgot what it was. "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Yes yes I'm a zealot. :) > > If the people defining the PEAR standards really were that interested in > standards, > why include alternate ways of doing something? <?=$blah;?> > And if the 'short tag' method is useful enough for people, why 'exclude' it > from a standard? This notion of 'PEAR standards' does irk me some, because > it's been so long in coming, and people are deferring to it before it's a reality. > > At least, that's the impression that I get. > > > > Philip Olson wrote: > > > > > 1. Is PHP4+ specific > > 2. Won't work if short_open_tag setting is off (in php.ini) > > - One reason to turn this off, to enable XML support > > 3. Doesn't follow up-and-coming PEAR coding standards > > > > And as you've seen, many don't even know what <?= is. You'll find zealots > > on both sides of this use, the choice is yours. ;-) > > > -- > 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'm trying to compile PHP version 4.0.4pl1 (module and/or cgi) on my windows 98 system using Microsoft Visuall C++, and I have two "little" problems. For one thing, doing anything like this in my DOS prompt: ./configure ./configure --with-mysql configure /configure et al ...returns: Bad command or file name. I've heard that means that "Dev Tools" aren't on my system, which is why "make" or "make install" didn't do anything. But I installed cygwin utilities and UnxUtils. I also have Active Perl installed on my system. So what do I need to do to get such commands to do what they are supposed to? And I'm not sure if this is related, but when I try to compile the source code as an apache module I get: fatal error C1083: Cannot open source file: 'C:\php-4.0.4pl1\Zend\zend_language_scanner.cpp': No such file or directory Seing as how there are no .cpp files in the source code from php.net, I imagine it would be hard to find that file ;) I'm using this article for instruction: http://www.mm4.de/php4win/article.php3?id=2&language=en -- Plutarck Should be working on something... ...but forgot what it was.
I have a remote php script on a remote server that I need to submit information to. Does PHP have the ability for me to submit information remotely? J Say I'm Hot! - Post Your Picture! http://www.sayimhot.com
You can use fopen/fread to open the script remotely. Just append the query string onto the url something like this: www.example.com/example.php?var1=var ...and example.php will have $var1 with the value "var". That's basically like using GET on a form. I believe that's what you wanted to do? -- Plutarck Should be working on something... ...but forgot what it was. ""Joseph Bannon"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a remote php script on a remote server that I need to submit > information to. Does PHP have the ability for me to submit information > remotely? > > J > > > Say I'm Hot! - Post Your Picture! > http://www.sayimhot.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] >
> You can use fopen/fread to open the script remotely. > > Just append the query string onto the url something like this: > > www.example.com/example.php?var1=var > > ...and example.php will have $var1 with the value "var". That's basically > like using GET on a form. > > I believe that's what you wanted to do? I have to use POST on the form. I wish I could use GET. J
On Sun, Apr 08, 2001 at 12:31:35AM -0500, Joseph Bannon wrote: > > You can use fopen/fread to open the script remotely. > > > > Just append the query string onto the url something like this: > > > > www.example.com/example.php?var1=var > > > > ...and example.php will have $var1 with the value "var". That's basically > > like using GET on a form. > > > > I believe that's what you wanted to do? > > I have to use POST on the form. I wish I could use GET. For that, you'll need to open a socket. The function to do this is usually called PostToHost, and I don't know why it isn't in even the annoted manual page for fsockopen. A quick google search should turn up copies of it in all the PHP mailing list archives. But, here's the version that I use (It's been modified to support both GET and POST): function sendToHost($host,$method,$path,$data,$useragent=0) { // Supply a default method of GET if the one passed was empty if (empty($method)) $method = 'GET'; $method = strtoupper($method); $fp = fsockopen($host,80); if ($method == 'GET') $path .= '?' . $data; fputs($fp, "$method $path HTTP/1.1\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Content-length: " . strlen($data) . "\n"); if ($useragent) fputs($fp, "User-Agent: MSIE\n"); fputs($fp, "Connection: close\n\n"); if ($method == 'POST') fputs($fp, $data); while (!feof($fp)) $buf .= fgets($fp,128); fclose($fp); return $buf; } $data should be the variables of the query string, minus the question mark. That is, var1=value1&var2=value2, etc. The function doesn't encode it, so you'll need to do that. HTH, Matt
Thanks for the info. Question: Is there a simple way to encode text? J
On Sunday 08 April 2001 08:50, you wrote: > Thanks for the info. Question: Is there a simple way to encode text? > > J rawurlencode() -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) void sleep(){for(long int sheep=0;!asleep();sheep++);}
Hi! i have php as an apache mod. i want to exec lynx from php. but when i have typed the following command exec("lynx http://mywebsite.com"); OR passthru("lynx http://mywebsite.com"); it simply does not show any output, just a blank page. I think its the prb of permission. Please help me how can i configure it to work for me. Junaid Mansoor _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Most likely, lynx is not in the PATH of the user that the webserver is running as, and may not have permission, if it was. Try telneting in and finding the absolute pathname to lynx, and user that in your exec statement and see what happens. Might also help if you redirected stderr to a file so you could read the error that it encounters when you try to exec lynx in a script. On 4/7/01 10:15 PM, "Junaid MAnsoor" <[EMAIL PROTECTED]> wrote: > Hi! > > i have php as an apache mod. i want to exec lynx from php. but when i have > typed the following command > > exec("lynx http://mywebsite.com"); > > OR > passthru("lynx http://mywebsite.com"); > > > > > it simply does not show any output, just a blank page. I think its the prb > of permission. Please help me how can i configure it to work for me. > > Junaid Mansoor > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. >
Hi. I know that this isn't strictly PHP, but this is the only place I know to ask - so apologies in advance. I am trying to make this query work but I am having very little luck: SELECT links.id, COUNT(clicks.id) AS tot_clicks FROM links INNER JOIN clicks ON links.id = clicks.linkid GROUP BY links.id; I want to output the links which have had the most clicks. However, I store the links in one table, and each individual click is stored in another table. Each click has a linkid that identifies the id of the link that was clicked on. I know this sounds confusing, but I would appreciate any help you can give. Thank you Adam
Hi, I'm trying to select records based on dates. I have a table with dates in the format 2001-04-08 and I'm using the query: SELECT name, description, date_time FROM events WHERE YEAR(date_time) = 2001 AND MONTH(date_time) = 04 AND DAYOFMONTH(date_time) = 08 But it doesn't yield any records? I don't really understand why? It seems to be the last bit 'DAYOFMONTH(date_time) = 08' which cause a problem because if I leave it out of the query, it selects all records for a particular month in a particular year as expected. Cheers, Jord
>I'm trying to select records based on dates. >I have a table with dates in the format 2001-04-08 and I'm using the query: > >SELECT name, description, date_time FROM events WHERE YEAR(date_time) = 2001 >AND MONTH(date_time) = 04 AND DAYOFMONTH(date_time) = 08 WHERE field_holding_date="2001-04-08" should work. Bye, B.
That's what I thought but that doesn't work either? On Sunday 08 April 2001 10:13, you wrote: > >I'm trying to select records based on dates. > >I have a table with dates in the format 2001-04-08 and I'm using the > > query: > > > >SELECT name, description, date_time FROM events WHERE YEAR(date_time) = > > 2001 AND MONTH(date_time) = 04 AND DAYOFMONTH(date_time) = 08 > > WHERE field_holding_date="2001-04-08" should work. > > Bye, > > > B.
I'd really like to learn PHP but where ? I know some basic perl but havent lookt that deep in PHP yet. any leads ?? =) sincerly // Ken