[PHP] question about select tag in php
i have two select tags as part of a registration form, city1 city2 where city1 has a list of regions and similar for city2 there are different regions for city1 and city2 so instead of all the regions appearing one after the other i would like to create a blank option followed by the next set of regions for formatting purpose only. ex= value="region1">Select region1 value="nameofregion1">nameofregion1 value="0"> value="nameofregion2">nameofregion2 value="1"> value="region2">Select region2 value="nameofregion1">nameofregion1 value="2"> value="nameofregion2">nameofregion2 value="3"> from a php validation perspective if a user does not select any of the regions or both the regions i am displaying an error message asking them to either select 1 region from either city1 or city2 as of now there is a blank option being displayed which is working fine, i am having an issue with the php validation. until i introduced value=0 my rules for validating the select tag were: 1. user cannot leave both the select tags with the default option which is "Select region1" & "Select region2" 2. user cannot select both the regions from city1 & city2 select tags the code of 2. is if(!($city1 == "region1") && !($city2 == "region2")) { $error.="Please select only 1 Region"; } now by introducing value="0"> there is a conflict with the above php validation code used in point 2. 1. is it correct to use 1,2,3 as part of the following tag or should i only use 0 everywhere value="0"> value="1"> 2. how can i get around the conflict that is being created by introducing this value=0 with if(!($city1 == "region1") && !($city2 == "region2")) { $error.="Please select only 1 Region"; } as i need the above php code and i also need the blank space for formatting purpose please advice. thanks.
[PHP] restricting filesystem access
Hi, I am a new php user and I have a question, for which I couldn't find any answer. I'd like to restrict php code to access the filesystem. I'd like to have only one directory where the php code can write, create or read files, and an other directory hierarchy where the php codes present. I need this to avoid php code to rewrite other php code in case of bug and/or an attack. I already tried the open_basedir directive, but it couldn't work because in this case the executed php have to be in the accessable directory hierarchy. Thanks, Gabor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricting filesystem access
> I'd like to restrict php code to access the filesystem. I'd like to have > only one directory where the php code can write, create or read files, > and an other directory hierarchy where the php codes present. I need > this to avoid php code to rewrite other php code in case of bug and/or > an attack. > > I already tried the open_basedir directive, but it couldn't work because > in this case the executed php have to be in the accessable directory > hierarchy. > > Thanks, > Gabor > it depends, if you run your own server (you have root password). then you can do something about this. but if you run on shared server, i don't think you have a lot of options. if you afraid the php code to rewrite other code (rare case). just chmod all the php files to 644.
[PHP] Problem in a generate password function
Hi, I have the code of a function to generate a random 10 character long password following my signature. To test it i do: $clearpass = create_pass(); print('Clear: ' . $clearpass); die(); But the output is only "Clear:" Why isn't it working ? Any help would be appreciated. Warm Regards, Mário Gamito -- function create_pass () { $length=10; $password = ""; $possible = "0123456789abcdefghijklmnopqrstuvxz"; $i = 0; while ($i < $length) { $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); if (!strstr($password, $char)) { $password .= $char; $i++; } } return $password; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem in a generate password function
Mário Gamito wrote: I have the code of a function to generate a random 10 character long password following my signature. To test it i do: $clearpass = create_pass(); print('Clear: ' . $clearpass); die(); But the output is only "Clear:" Why isn't it working ? Works fine here: http://dev.stut.net/php/mario.php -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricting filesystem access
Hi, Thank you for the answer. I am running my site on a shared server, but I can overwrite the options in the php.ini file. Unfortunately php runs as my user, so changing the permissions to 644 doesn't work, php is still able to write anything. Gabor 2008. 03. 31, hétfő keltezéssel 16.51-kor paragasu ezt írta: > > I'd like to restrict php code to access the filesystem. I'd like to have > > only one directory where the php code can write, create or read files, > > and an other directory hierarchy where the php codes present. I need > > this to avoid php code to rewrite other php code in case of bug and/or > > an attack. > > > > I already tried the open_basedir directive, but it couldn't work because > > in this case the executed php have to be in the accessable directory > > hierarchy. > > > > Thanks, > > Gabor > > > > it depends, if you run your own server (you have root password). then you > can do something > about this. but if you run on shared server, i don't think you have a lot of > options. > if you afraid the php code to rewrite other code (rare case). just chmod all > the php files > to 644. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LDAP in php
Chris schrieb: If ldap can already use a database backend, just use the normal ldap_* functions to do all of the work, don't re-invent it all. http://www.php.net/ldap Just wanted to avoid installing and maintaining a LDAP server and mapping all the data. Perhaps I am underestimating it, but just to read one URI like request, find the data and send it back in some form, does not look difficult to implement. We do not need full LDAP support, just to feel Thunderbird and Squirrelmail address books. Both can't edit LDAP yet anyway. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricting filesystem access
> Thank you for the answer. > > I am running my site on a shared server, but I can overwrite the options > in the php.ini file. Unfortunately php runs as my user, so changing the > permissions to 644 doesn't work, php is still able to write anything. > > Gabor > ok.. your hosting enable the php suexec. i afraid there is not much you can do to modified the php.ini. you may use ini_set() or the .htaccess to override the value anyway. one thing you can do. sanitize input and make sure you code good :p
RE: [PHP] question about select tag in php
Code wise your form options are too bulky and you need to look at slimming that down like below. Not that my example is prefect but easier to control the option enviroment. echo ""; for($d=1; $d<=2; $d++) { if($city1 == "region$d"){ echo "region$d; }ELSE{echo "region$d;} } echo ""; for($d=1; $d<=3; $d++) { if($city1 == "region$d"){ echo "region$d; }ELSE{echo "region$d;} } echo ""; Also I would use some onblur or onsubmit javascript for form validation submitting and then showing the error is NOT a good way to validate a form. Richard L. Buskirk Blame the GUI between your chair and keyboard. i have two select tags as part of a registration form, city1 city2 where city1 has a list of regions and similar for city2 there are different regions for city1 and city2 so instead of all the regions appearing one after the other i would like to create a blank option followed by the next set of regions for formatting purpose only. ex= value="region1">Select region1 value="nameofregion1">nameofregion1 value="0"> value="nameofregion2">nameofregion2 value="1"> value="region2">Select region2 value="nameofregion1">nameofregion1 value="2"> value="nameofregion2">nameofregion2 value="3"> from a php validation perspective if a user does not select any of the regions or both the regions i am displaying an error message asking them to either select 1 region from either city1 or city2 as of now there is a blank option being displayed which is working fine, i am having an issue with the php validation. until i introduced value=0 my rules for validating the select tag were: 1. user cannot leave both the select tags with the default option which is "Select region1" & "Select region2" 2. user cannot select both the regions from city1 & city2 select tags the code of 2. is if(!($city1 == "region1") && !($city2 == "region2")) { $error.="Please select only 1 Region"; } now by introducing value="0"> there is a conflict with the above php validation code used in point 2. 1. is it correct to use 1,2,3 as part of the following tag or should i only use 0 everywhere value="0"> value="1"> 2. how can i get around the conflict that is being created by introducing this value=0 with if(!($city1 == "region1") && !($city2 == "region2")) { $error.="Please select only 1 Region"; } as i need the above php code and i also need the blank space for formatting purpose please advice. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricting filesystem access
On Mon, Mar 31, 2008 at 4:21 AM, Hamar Gábor <[EMAIL PROTECTED]> wrote: > Hi, > > I am a new php user and I have a question, for which I couldn't find any > answer. > > I'd like to restrict php code to access the filesystem. I'd like to have > only one directory where the php code can write, create or read files, > and an other directory hierarchy where the php codes present. I need > this to avoid php code to rewrite other php code in case of bug and/or > an attack. Are you saying that you want to use one file to allow people to write to your server without allowing them to overwrite other files? Try creating a directory, chmod 777 if needed, and then in your write routing, disallow periods (.), slashes (/), backslashes (\), et cetera. And you may also want to look into escapeshellarg() and escapeshellcmd() depending on your code. You can also chmod the directory and all files within where the PHP files are located to 644, which will disallow writing if Apache isn't running suExec. -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 file_get_contents() problems
On Sun, Mar 30, 2008 at 6:03 PM, php <[EMAIL PROTECTED]> wrote: > Thanks Greg...I am aware of the allow_url_fopen/allow_url_include > relationship. > > Your suggestion to look into curl was implemented and there still seems to > be something else afoot. > > I created a simple set of curl functions which just printed a remote url to > the browser window. This tested well on an alternate test site which has PHP > 5 running. > > However back on the hosting client I'm having problems with, curl throws the > following error message: > CURLE_COULDNT_RESOLVE_HOST (6) > > Couldn't resolve host. The given remote host was not resolved. That's a DNS issue, not a PHP issue. Is this a shared web host, or one for which you have root access? If you have at least shell access without a jail (chroot), try PING'ing the domain from the server and see what happens. It could even be something as simple as a typo in the domain, but most likely it's a DNS resolution problem. If you want to test your script on a different server, let me know and I'll set you up with a temporary account on one of mine. -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new lines in textareas?
On Sun, Mar 30, 2008 at 12:26 AM, Mary Anderson <[EMAIL PROTECTED]> wrote: > Hi all, > I have a php script which produces text which is to be displayed in > a textarea. I have the wrap for the text area set to 'hard'. I need to > have newlines inserted in the text. > "\n" and "" don't work. They just get quoted literally in the > text. I suspect I need to use htmlspecialchars , but don't know what > special character to feed it. Sounds like you're using literal quotes here, Mary. Single quotes ('like this')take all data between them as literal, while double quotes ("like this") translate things within. $a = "Hello!"; $b = "I just wanted to say: $a"; $c = 'I just wanted to say: $a'; $d = "The quick brown fox jumped over the lazy dogs.\n"; $e = 'The quick brown fox jumped over the lazy dogs.\n'; The above will output as follows: $a: Hello! $b: I just wanted to say: Hello! $c: I just wanted to say: $a $d: The quick brown fox jumped over the lazy dogs. (with a newline) $e: The quick brown fox jumped over the lazy dogs.\n You may instead want to use HEREDOC syntax. $text =<< Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Pagerank script
On Sun, Mar 30, 2008 at 12:25 PM, tedd <[EMAIL PROTECTED]> wrote: > > Sure, a few years ago I spent a considerable amount of time finding > the code and here it is: > > http://www.webbytedd.com/a/page-rank/index.php > > It used to work, but now it doesn't. > > Anyone care to tell me why it doesn't work anymore and how to fix it? Because it's not there. A lot of times, when you don't have a script installed and you try to access it, it won't work, it'll just lead to a 404, like in your case. ;-P -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto generated PDF
On Sun, Mar 30, 2008 at 5:27 AM, Alain Roger <[EMAIL PROTECTED]> wrote: > Hi, > > i want to implement on my web portal electronic invoicing system. > basically data will be stored into PostgreSQL DB. > > I would like to know if someone already have experiences with such feature > or where could i find some tutorials or help about this topic. > > Concretly, user will buy some products/services online and i would like to > send him a PDF invoice via email. A lot of people don't realize, but if you're using Linux, CUPS has a nice print-to-PDF-file option. It's not native PHP, of course, but it's a nice, quick, reliable alternative. -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: character encoding
Ok I give it a try as soon as I can. >> Hotmail will accept mail delivery from PHP ? > > Sure. There is nothing specific of PHP that prevents Hotmail from > accepting messages sent by PHP scripts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reporting mail as spam
Hi, I wrote a little registration routine, which will send a confirmation letter to the user with a random number in the message body (my site is on a host, so I can't write in the subject, and ask the user to reply), which can be clicked then, and my site will finish the registration. My big problem is, that this host inserts an X header to the mail which identifies my PHP script as the X-PHP. As I recognize, this header adds a huge number to the spam score. Is there any possibility, to reduce the other scores? By the way, what counts most in a spam? Thanks, SanTa
Re: [PHP] Reporting mail as spam
On Mon, Mar 31, 2008 at 12:01 PM, Sándor Tamás (HostWare Kft. ) <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote a little registration routine, which will send a confirmation letter > to the user with a random number in the message body (my site is on a host, > so I can't write in the subject, and ask the user to reply), which can be > clicked then, and my site will finish the registration. My big problem is, > that this host inserts an X header to the mail which identifies my PHP script > as the X-PHP. As I recognize, this header adds a huge number to the spam > score. Is there any possibility, to reduce the other scores? By the way, what > counts most in a spam? Paul Graham wrote an interesting essay several years ago about that, including some great real-world examples using Bayesian filters and scores. I'd recommend giving it a look: http://www.paulgraham.com/spam.html -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Pagerank script
If you do have a index.php file in that directory and you are sure the path is correct check the chmod and chown of the index.php file. Richard L. Buskirk Dont be so -1 cubed. +++ On Sun, Mar 30, 2008 at 12:25 PM, tedd <[EMAIL PROTECTED]> wrote: > > Sure, a few years ago I spent a considerable amount of time finding > the code and here it is: > > http://www.webbytedd.com/a/page-rank/index.php > > It used to work, but now it doesn't. > > Anyone care to tell me why it doesn't work anymore and how to fix it? Because it's not there. A lot of times, when you don't have a script installed and you try to access it, it won't work, it'll just lead to a 404, like in your case. ;-P -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- 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
[PHP] Date Issue
Not understanding why this is happening. $month = date("F", mktime(0,0,0, date(m), date(d), date(Y))); $zomonth = date("F", mktime(0,0,0, date(m)-1, date(d), date(Y))); echoing out the exact same month March March Checked server timezone/date/time all is good. Am I half asleep at the wheel on this one and just not seeing my mistake here? Richard L. Buskirk Hardware Failure: $4,000. Network Outage: $15,000. Always blaming the programmers for everything: Priceless. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 3:07 PM, <[EMAIL PROTECTED]> wrote: > Not understanding why this is happening. > > $month = date("F", mktime(0,0,0, date(m), date(d), date(Y))); > $zomonth = date("F", mktime(0,0,0, date(m)-1, date(d), date(Y))); > > echoing out the exact same month > March > March > > Checked server timezone/date/time all is good. Am I half asleep at the wheel > on this one and just not seeing my mistake here? mktime "will automatically calculate the correct value for out-of-range input." The "31st day of February in 2008" is March 2nd, so both dates are in March. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: character encoding
Hi Manuel >> Hotmail will accept mail delivery from PHP ? > > Sure. There is nothing specific of PHP that prevents Hotmail from > accepting messages sent by PHP scripts. I used your test_smtp_message.php setting "to_address" to my hotmail, localhost to my ip on dyndns, smtp_host to www.hotmail.com, smtp_user to my hotmail, and smtp_password to my hotmail pw. Here's the answer : Error: could not connect to the host "www.hotmail.com": Connection timed out What now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem in a generate password function
Mário Gamito wrote: Hi, I have the code of a function to generate a random 10 character long password following my signature. To test it i do: $clearpass = create_pass(); print('Clear: ' . $clearpass); die(); But the output is only "Clear:" Why isn't it working ? Any help would be appreciated. Warm Regards, Mário Gamito -- function create_pass () { $length=10; $password = ""; $possible = "0123456789abcdefghijklmnopqrstuvxz"; $i = 0; while ($i < $length) { $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); I have a very similar routine, but for the previous line, since you can reference a string as an array, I do this: $char = $possible[mt_rand(0, strlen($possible)-1)]; In this example, it would save ten function calls, if not more. just a suggestion if (!strstr($password, $char)) { $password .= $char; $i++; } } return $password; } -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
You need apostrophes (or quotes) around your args to date() in the parameters... date('m') As it stands now, PHP assumes you mean the constant m (http://php.net/define) and that's not defined, so they are all 0. So you are passing in 0 to ALL the args. You also should use E_ALL for your error_reporting so you would SEE the error messages telling you about this. On Mon, March 31, 2008 2:07 pm, [EMAIL PROTECTED] wrote: > Not understanding why this is happening. > > $month = date("F", mktime(0,0,0, date(m), date(d), date(Y))); > $zomonth = date("F", mktime(0,0,0, date(m)-1, date(d), date(Y))); > > echoing out the exact same month > March > March > > Checked server timezone/date/time all is good. Am I half asleep at the > wheel on this one and just not seeing my mistake here? > > > Richard L. Buskirk > > Hardware Failure: $4,000. > Network Outage: $15,000. > Always blaming the programmers for everything: Priceless. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
I tried that a big no go. Seems if I do a +1 i get 2 months from now and a -1 gives me the current month. $month = date("F", mktime(0,0,0, date('m'), date('d'), date('Y'))); $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"), date("Y"))); $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y"))); $month echo's MARCH should be Feb $zomonth echo's MARCH should be March $nmonth echo's MAY this should be April You will notice i used all options apostrophes double quotes and no quotes exactly the same output. You need apostrophes (or quotes) around your args to date() in the parameters... date('m') As it stands now, PHP assumes you mean the constant m (http://php.net/define) and that's not defined, so they are all 0. So you are passing in 0 to ALL the args. You also should use E_ALL for your error_reporting so you would SEE the error messages telling you about this. On Mon, March 31, 2008 2:07 pm, [EMAIL PROTECTED] wrote: > Not understanding why this is happening. > > $month = date("F", mktime(0,0,0, date(m), date(d), date(Y))); > $zomonth = date("F", mktime(0,0,0, date(m)-1, date(d), date(Y))); > > echoing out the exact same month > March > March > > Checked server timezone/date/time all is good. Am I half asleep at the > wheel on this one and just not seeing my mistake here? > > > Richard L. Buskirk > > Hardware Failure: $4,000. > Network Outage: $15,000. > Always blaming the programmers for everything: Priceless. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 4:15 PM, <[EMAIL PROTECTED]> wrote: > I tried that a big no go. > Seems if I do a +1 i get 2 months from now and a -1 gives me the current > month. > > > > $month = date("F", mktime(0,0,0, date('m'), date('d'), date('Y'))); > $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"), date("Y"))); > $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y"))); > > > $month echo's MARCH should be Feb > $zomonth echo's MARCH should be March > $nmonth echo's MAY this should be April That's because you're using today's date('d');, which is 31. February doesn't have 31 days, nor does April, so mktime() forces them to the following month to correct the error. -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 3:15 PM, <[EMAIL PROTECTED]> wrote: > I tried that a big no go. > Seems if I do a +1 i get 2 months from now and a -1 gives me the current > month. > > > $month = date("F", mktime(0,0,0, date('m'), date('d'), date('Y'))); > $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"), date("Y"))); > $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y"))); > > > $month echo's MARCH should be Feb > $zomonth echo's MARCH should be March > $nmonth echo's MAY this should be April > > You will notice i used all options apostrophes double quotes and no quotes > exactly the same output. > > > > > > > > You need apostrophes (or quotes) around your args to date() in the > parameters... > > date('m') > > As it stands now, PHP assumes you mean the constant m > (http://php.net/define) and that's not defined, so they are all 0. > > So you are passing in 0 to ALL the args. > > You also should use E_ALL for your error_reporting so you would SEE > the error messages telling you about this. > > On Mon, March 31, 2008 2:07 pm, [EMAIL PROTECTED] wrote: > > Not understanding why this is happening. > > > > $month = date("F", mktime(0,0,0, date(m), date(d), date(Y))); > > $zomonth = date("F", mktime(0,0,0, date(m)-1, date(d), date(Y))); > > > > echoing out the exact same month > > March > > March > > > > Checked server timezone/date/time all is good. Am I half asleep at the > > wheel on this one and just not seeing my mistake here? > > > > > > Richard L. Buskirk > > > > Hardware Failure: $4,000. > > Network Outage: $15,000. > > Always blaming the programmers for everything: Priceless. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/from/lynch > Yeah, I get a buck. So? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Well, to re-iterate what Andrew said, you're on the 31st day of the month. Feb 31st translates to March, April 31st translates to May. -- -Dan Joseph "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life."
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 4:15 PM, <[EMAIL PROTECTED]> wrote: > I tried that a big no go. > Seems if I do a +1 i get 2 months from now and a -1 gives me the current > month. Like I said, mktime makes corrections for otherwise invalid dates. Today is March 31. Moving the month number back by one (-1) creates a timestamp for February 31, which gets corrected to become March 2 (March 3 in non-leap years). Moving the month number ahead by one (+1) creates a timestamp for April 31 gets corrected to become May 1. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
Thank you again Dan. Thought never crossed my mind the day being the 31st. That fixed it. Richard L. Buskirk On Mon, Mar 31, 2008 at 4:15 PM, <[EMAIL PROTECTED]> wrote: > I tried that a big no go. > Seems if I do a +1 i get 2 months from now and a -1 gives me the current month. > > > > $month = date("F", mktime(0,0,0, date('m'), date('d'), date('Y'))); > $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"), date("Y"))); > $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y"))); > > > $month echo's MARCH should be Feb > $zomonth echo's MARCH should be March > $nmonth echo's MAY this should be April That's because you're using today's date('d');, which is 31. February doesn't have 31 days, nor does April, so mktime() forces them to the following month to correct the error. -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 4:15 PM, <[EMAIL PROTECTED]> wrote: > I tried that a big no go. > Seems if I do a +1 i get 2 months from now and a -1 gives me the current > month. > > > $month = date("F", mktime(0,0,0, date('m'), date('d'), date('Y'))); > $zomonth = date("F", mktime(0,0,0, date("m")-1, date("d"), date("Y"))); > $nmonth = date("F", mktime(0,0,0, date(m)+1, date(d), date("Y"))); > > > $month echo's MARCH should be Feb > $zomonth echo's MARCH should be March > $nmonth echo's MAY this should be April > > You will notice i used all options apostrophes double quotes and no quotes > exactly the same output. > > > > > > > > You need apostrophes (or quotes) around your args to date() in the > parameters... > > date('m') > > As it stands now, PHP assumes you mean the constant m > (http://php.net/define) and that's not defined, so they are all 0. > > So you are passing in 0 to ALL the args. > > You also should use E_ALL for your error_reporting so you would SEE > the error messages telling you about this. > Just to clarify -- Richard's response fixes a poor coding practice in your original post, but it does not "fix" the problem that you originally asked about. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Issue
On Mon, Mar 31, 2008 at 4:24 PM, <[EMAIL PROTECTED]> wrote: > Thank you again Dan. Thought never crossed my mind the day being the 31st. > That fixed it. Thank Andrew Ballard, actually. He said it even before I did. I'm getting slow in my old age! ;-P -- Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dates Again
Hello All, I have a date in 2008-03-29 12:15:00 format. - How can I reduce one day from it? - How can I reduce one hour from it? - How can I add 1 hour to today's date? Thanks
Re: [PHP] Dates Again
VamVan írta: Hello All, I have a date in 2008-03-29 12:15:00 format. - How can I reduce one day from it? - How can I reduce one hour from it? - How can I add 1 hour to today's date? Thanks just convert it to a timestamp with strtotime() then you can manipulate it by adding/substracting - 86400 for a day - 3600 for an hour then convert back with strftime() http://hu.php.net/strtotime http://hu.php.net/strftime greets, Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates Again
Zoltán Németh wrote: VamVan írta: Hello All, I have a date in 2008-03-29 12:15:00 format. - How can I reduce one day from it? - How can I reduce one hour from it? - How can I add 1 hour to today's date? Thanks just convert it to a timestamp with strtotime() then you can manipulate it by adding/substracting - 86400 for a day - 3600 for an hour then convert back with strftime() http://hu.php.net/strtotime http://hu.php.net/strftime greets, Zoltán Németh I believe you can also use strtoime() http://us.php.net/manual/en/function.strtotime.php $time = strtotime($inputTime); $time = strtotime('-1 day', $time); $outputTime = strftime('%Y-%m%d', $time); I'm not sure which is more efficient, but it helps when you're looking for "next thursday" or other things like that. -- Ray Hauge www.primateapplications.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem in a generate password function
At 12:20 PM -0700 3/31/08, Jim Lucas wrote: I have a very similar routine, but for the previous line, since you can reference a string as an array, I do this: $char = $possible[mt_rand(0, strlen($possible)-1)]; In this example, it would save ten function calls, if not more. just a suggestion Neat -- thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: auto generated PDF
Daniel Brown wrote: > A lot of people don't realize, but if you're using Linux, CUPS has > a nice print-to-PDF-file option. It's not native PHP, of course, but > it's a nice, quick, reliable alternative. Indeed. I always find this very useful and even more so when it's exposed via Samba to all the windows machines too. Quite a pleasant surprise for a lot of Windows users ;) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MS purchase Yahoo
Did they finally do it or is April fools com early? http://digg.com/business_finance/Microsoft_Purchase_Yahoo_For_62_Billion K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
You are pathetic. Spamming your own fake digg article to your own fake news story and didn't even take the effort to host it on another domain? Direct link: http://www.phpro.org/articles/Microsoft-Purchase-Yahoo-For-62-Billion.html Domain Name:PHPRO.ORG Registrant Name:Kevin Waterson Blah. This isn't PHP related. Stop wasting our time. On 3/31/08, Kevin Waterson <[EMAIL PROTECTED]> wrote: > Did they finally do it or is April fools com early? > > http://digg.com/business_finance/Microsoft_Purchase_Yahoo_For_62_Billion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phone number allocation manager
I work for a telephone & internet company. Currently we have a tool that allows us to track the allocation of IP's to customers. What I am looking for is a tool that will allow me to track the allocation of phone numbers to our customers. Building the tool for IP allocation management was pretty easy since the IP world works off a set of rules that govern the allocation of IP's. Unfortunately the phone number world does not have the same rule set. Actually, it has no rules. Has anybody built, heard of, or used a tool like this? Any suggestions would be great. Thanks much! -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > You are pathetic. Spamming your own fake digg article to your own fake > news story and didn't even take the effort to host it on another > domain? BWHAHAHAHHAA Thanks, nice reaction, made my day, do you have more? Kev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
On Tue, 2008-04-01 at 11:55 +1100, Kevin Waterson wrote: > On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > > You are pathetic. Spamming your own fake digg article to your own fake > > news story and didn't even take the effort to host it on another > > domain? > > BWHAHAHAHHAA > > Thanks, nice reaction, made my day, > do you have more? Don't you have something better to do? If not then I pity your sad, sad life. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
On Mon, 2008-03-31 at 21:08 -0400, Robert Cummings wrote: > On Tue, 2008-04-01 at 11:55 +1100, Kevin Waterson wrote: > > On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > > > You are pathetic. Spamming your own fake digg article to your own fake > > > news story and didn't even take the effort to host it on another > > > domain? > > > > BWHAHAHAHHAA > > > > Thanks, nice reaction, made my day, > > do you have more? > > Don't you have something better to do? > > If not then I pity your sad, sad life. I just realized... it's probably April Fool's in Australia. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dates Again
On Monday 31 March 2008, Zoltán Németh wrote: > VamVan írta: > > Hello All, > > > > I have a date in 2008-03-29 12:15:00 format. > > > >- How can I reduce one day from it? > >- How can I reduce one hour from it? > >- How can I add 1 hour to today's date? > > > > Thanks > > just convert it to a timestamp with strtotime() > then you can manipulate it by adding/substracting > - 86400 for a day > - 3600 for an hour > then convert back with strftime() > > http://hu.php.net/strtotime > http://hu.php.net/strftime > > greets, > Zoltán Németh Do not use ints for date/time math. There are WY too many wacky edge cases that can bite you in the butt. http://www.php.net/manual/en/function.date-create.php Use a DateTime object. You can do all sorts of manipulations to it and it will handle all the timezone, daylight savings, leap year, and similar weirdness for you. It also supports 64-bit dates internally so you can cover the entire span of human history and then some. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
You're the first fooled. I really pity what you said. :-( It's 10:04 am, April 1st, China. On Tue, Apr 1, 2008 at 9:21 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Mon, 2008-03-31 at 21:08 -0400, Robert Cummings wrote: > > On Tue, 2008-04-01 at 11:55 +1100, Kevin Waterson wrote: > > > On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > > > > You are pathetic. Spamming your own fake digg article to your own > fake > > > > news story and didn't even take the effort to host it on another > > > > domain? > > > > > > BWHAHAHAHHAA > > > > > > Thanks, nice reaction, made my day, > > > do you have more? > > > > Don't you have something better to do? > > > > If not then I pity your sad, sad life. > > I just realized... it's probably April Fool's in Australia. > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Shelley ( Professional PHP Architecture || http://phparch.cn )
Re: [PHP] MS purchase Yahoo
On Tue, 2008-04-01 at 10:06 +0800, Shelley wrote: > You're the first fooled. I really pity what you said. :-( Sorry, it's not April 1st here... so that makes you and Kevin the fools... my turn to laugh... *bahahahahaahha*. Cheers, Rob. > > It's 10:04 am, April 1st, China. > > On Tue, Apr 1, 2008 at 9:21 AM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > > > On Mon, 2008-03-31 at 21:08 -0400, Robert Cummings wrote: > > > On Tue, 2008-04-01 at 11:55 +1100, Kevin Waterson wrote: > > > > On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > > > > > You are pathetic. Spamming your own fake digg article to your own > > fake > > > > > news story and didn't even take the effort to host it on another > > > > > domain? > > > > > > > > BWHAHAHAHHAA > > > > > > > > Thanks, nice reaction, made my day, > > > > do you have more? > > > > > > Don't you have something better to do? > > > > > > If not then I pity your sad, sad life. > > > > I just realized... it's probably April Fool's in Australia. > > > > Cheers, > > Rob. > > -- -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto generated PDF
On Mar 30, 2008, at 227AM, Alain Roger wrote: i want to implement on my web portal electronic invoicing system. basically data will be stored into PostgreSQL DB. If you're not set on building it yourself, you might take a look at Bamboo Invoice - http://bambooinvoice.org/. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS purchase Yahoo
On Mon, 2008-03-31 at 17:05 -0700, mike wrote: On Mon, 2008-03-31 at 21:08 -0400, Robert Cummings wrote: On Tue, 2008-04-01 at 10:06 +0800, Shelley wrote: :-( On Tue, Apr 1, 2008 at 10:37 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Tue, 2008-04-01 at 10:06 +0800, Shelley wrote: > > You're the first fooled. I really pity what you said. :-( > > Sorry, it's not April 1st here... so that makes you and Kevin the > fools... my turn to laugh... *bahahahahaahha*. > > Cheers, > Rob. > > > > > > It's 10:04 am, April 1st, China. > > > > On Tue, Apr 1, 2008 at 9:21 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > > > > On Mon, 2008-03-31 at 21:08 -0400, Robert Cummings wrote: > > > > On Tue, 2008-04-01 at 11:55 +1100, Kevin Waterson wrote: > > > > > On Mon, 2008-03-31 at 17:05 -0700, mike wrote: > > > > > > You are pathetic. Spamming your own fake digg article to your > own > > > fake > > > > > > news story and didn't even take the effort to host it on another > > > > > > domain? > > > > > > > > > > BWHAHAHAHHAA > > > > > > > > > > Thanks, nice reaction, made my day, > > > > > do you have more? > > > > > > > > Don't you have something better to do? > > > > > > > > If not then I pity your sad, sad life. > > > > > > I just realized... it's probably April Fool's in Australia. > > > > > > Cheers, > > > Rob. > > > -- > > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > -- Regards, Shelley
Re: [PHP] phone number allocation manager
Jim Lucas wrote: > I work for a telephone & internet company. Currently we have a tool > that allows us to track the allocation of IP's to customers. What I > am looking for is a tool that will allow me to track the allocation of > phone numbers to our customers. [snip] > Unfortunately the phone number world does not have the same rule set. > Actually, it has no rules. > Has anybody built, heard of, or used a tool like this? Hi Jim - it sounds like a plain database to me, but surely you've got one of those already. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php