[PHP] Re: Previous and Next Month and Year
time() returns a unix timestamp of the current moment in time (now), so in effect you are adding or subtracting 6 seconds to that. calling: date('m/d/Y', time()); is the same as calling: date('m/d/Y'); On the other hand: mktime(hour, minute, second, month, day, year) generates a timestamp such that: mktime(0, 0, 0, date('d'), date('m') + 6, date('Y')); would generate a date timestamp 6 months in the future. or mktime(0, 0, 0, 0, date('m'), date('Y')); would generate last day from last month this year. Word of wisdom: don't rely solely on timestamp calculations e.g. now + 24 hours and so on, because you may need to take into account daylight savings times and such otherwise your calculations may be off. Vlad Keith Spiller wrote: Hi, RE: Previous and Next Month and Year This is my code: $next_month = date('F Y', time()+$month); $prev_month = date('F Y', time()-$month); echo "$prev_month \n"; #Result "June 2007" echo "$next_month \n"; #Result "June 2007" What I am trying to do is get the month and year based upon a + or - $month value. The variable $month being "6" for the month of June of the present year of 2007. For example ($month -7) would be December 2006, and ($month +7) would be January 2006. Please help... Thank you. Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Previous and Next Month and Year
Hi, RE: Previous and Next Month and Year This is my code: $next_month = date('F Y', time()+$month); $prev_month = date('F Y', time()-$month); echo "$prev_month \n"; #Result "June 2007" echo "$next_month \n"; #Result "June 2007" What I am trying to do is get the month and year based upon a + or - $month value. The variable $month being "6" for the month of June of the present year of 2007. For example ($month -7) would be December 2006, and ($month +7) would be January 2006. Please help... Thank you. Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Appending to an Array
Awesome Vlad. You fixed it with your second example perfectly! Thank you so much. Keith - Original Message - From: "Vlad Vlasceanu" <[EMAIL PROTECTED]> To: Sent: Saturday, June 16, 2007 10:43 PM Subject: [PHP] Re: Appending to an Array "." is the concatenation operator, usually applies only to strings try: $days[] = array($this_day=>array("#","today-day")); or actually: $days[$this_day] = array("#","today-day"); since it looks like you're indexing based on the day Keith Spiller wrote: Hi Folks, RE: Appending to an Array Here is my code: # PREVIOUS MONTH - $days = array( 10=>array("/weblog/archive/2004/Jan/02","linked-day"), 12=>array("/weblog/archive/2004/Jan/03","linked-day"), 25=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month-1, $days, $month_href); # # CURRENT MONTH -- $days = array( 2=>array("/weblog/archive/2004/Jan/02","linked-day"), 3=>array("/weblog/archive/2004/Jan/03","linked-day"), 8=>array("/weblog/archive/2004/Jan/08","linked-day"), 22=>array("/weblog/archive/2004/Jan/22","linked-day")); phpcalendar($year, $month, $days, $month_href); # # NEXT MONTH - $days = array( 17=>array("/weblog/archive/2004/Jan/02","linked-day"), 18=>array("/weblog/archive/2004/Jan/03","linked-day"), 19=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month+1, $days, $month_href); # function phpcalendar($year, $month, $days, $month_href) { $weekday_lth = 1; # TODAY -- $this_day = date('j',time()); $this_month = date('n', time()); $this_year = date('Y', time()); $month_href = "?year=$year&month=$month"; $days .= array($this_day=>array("#","today-day")); # echo ""; echo generate_calendar($year, $month, $days, $weekday_lth, $month_href); echo ""; } My problem is with the 7th line from the end: $days .= array($this_day=>array("#","today-day")); I want to append these values to the $days array (if the month, day and year match) but this technique causes a parse error. Any ideas? Thanks for your help... Keith -- 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
RE: [PHP] I have a problem with nobody!
Can't you just set the "From" and "Reply-to" headers? BTW, if you look at Stut's post, and you're response, you've placed the "parameters" parameter in the "headers" parameter location, thus totally borking the purpose of setting the "parameters" parameter >:) Cheers, Rob. On Sun, 2007-06-17 at 00:39 -0400, BSumrall wrote: > Let's take it one step further for arguments sake. > > What is I wanted to change "nobody" as the sender to, let's just say Larry > or Curly, or Moe? > Making message header as; > Larry Shmuckatelli [EMAIL PROTECTED] > Or > Curly Shmuckatelli [EMAIL PROTECTED] > Or > Moe Shmuckatelli [EMAIL PROTECTED] > > What is the php driving force that controls the "who sent me" function? > > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 17, 2007 12:31 AM > To: php-general@lists.php.net > Subject: RE: [PHP] I have a problem with nobody! > > Well, I am now 1 step closer > > The php file do nor reference the importance of "having no spaces" between > the -f and email address. > [EMAIL PROTECTED] is key! > > But, still can't get rid of nobody. > > How do I make nobody disappear? > > Here is my message header now. > > Nobody [EMAIL PROTECTED] > > Using: > > mail ($to, $subject, $message, $header, > '[EMAIL PROTECTED]'); > > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 17, 2007 12:19 AM > To: 'Stut' > Cc: php-general@lists.php.net > Subject: RE: [PHP] I have a problem with nobody! > > PS > mail ($to, $subject, $message, $header, '-f > [EMAIL PROTECTED]'); > > doesn't work either. > > Still have nobody to deal with. > As per being RFC compliant! > > -Original Message- > From: Stut [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 17, 2007 12:15 AM > To: BSumrall > Cc: php-general@lists.php.net > Subject: Re: [PHP] I have a problem with nobody! > > BSumrall wrote: > > I have read about a -f function. > > I tried > > mail ($to, $subject, $message, -f$header); > > mail -f($to, $subject, $message, $header); > > > > both result in parse error. > > Boy did you not read the documentation carefully! > > mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); > > Go back and read http://php.net/function.mail properly. > > -Stut -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody! SOLVED!
The last paragraph of the page Go figure! The appropriate code is; mail ($to, $subject, $message, $header = 'From: "Larry, Curly and Moe" <[EMAIL PROTECTED]>'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:39 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Let's take it one step further for arguments sake. What is I wanted to change "nobody" as the sender to, let's just say Larry or Curly, or Moe? Making message header as; Larry Shmuckatelli [EMAIL PROTECTED] Or Curly Shmuckatelli [EMAIL PROTECTED] Or Moe Shmuckatelli [EMAIL PROTECTED] What is the php driving force that controls the "who sent me" function? -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:31 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- 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 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Appending to an Array
"." is the concatenation operator, usually applies only to strings try: $days[] = array($this_day=>array("#","today-day")); or actually: $days[$this_day] = array("#","today-day"); since it looks like you're indexing based on the day Keith Spiller wrote: Hi Folks, RE: Appending to an Array Here is my code: # PREVIOUS MONTH - $days = array( 10=>array("/weblog/archive/2004/Jan/02","linked-day"), 12=>array("/weblog/archive/2004/Jan/03","linked-day"), 25=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month-1, $days, $month_href); # # CURRENT MONTH -- $days = array( 2=>array("/weblog/archive/2004/Jan/02","linked-day"), 3=>array("/weblog/archive/2004/Jan/03","linked-day"), 8=>array("/weblog/archive/2004/Jan/08","linked-day"), 22=>array("/weblog/archive/2004/Jan/22","linked-day")); phpcalendar($year, $month, $days, $month_href); # # NEXT MONTH - $days = array( 17=>array("/weblog/archive/2004/Jan/02","linked-day"), 18=>array("/weblog/archive/2004/Jan/03","linked-day"), 19=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month+1, $days, $month_href); # function phpcalendar($year, $month, $days, $month_href) { $weekday_lth = 1; # TODAY -- $this_day = date('j',time()); $this_month = date('n', time()); $this_year = date('Y', time()); $month_href = "?year=$year&month=$month"; $days .= array($this_day=>array("#","today-day")); # echo ""; echo generate_calendar($year, $month, $days, $weekday_lth, $month_href); echo ""; } My problem is with the 7th line from the end: $days .= array($this_day=>array("#","today-day")); I want to append these values to the $days array (if the month, day and year match) but this technique causes a parse error. Any ideas? Thanks for your help... Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody!
Let's take it one step further for arguments sake. What is I wanted to change "nobody" as the sender to, let's just say Larry or Curly, or Moe? Making message header as; Larry Shmuckatelli [EMAIL PROTECTED] Or Curly Shmuckatelli [EMAIL PROTECTED] Or Moe Shmuckatelli [EMAIL PROTECTED] What is the php driving force that controls the "who sent me" function? -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:31 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- 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 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
RE: [PHP] I have a problem with nobody!
Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Appending to an Array
Hi Folks, RE: Appending to an Array Here is my code: # PREVIOUS MONTH - $days = array( 10=>array("/weblog/archive/2004/Jan/02","linked-day"), 12=>array("/weblog/archive/2004/Jan/03","linked-day"), 25=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month-1, $days, $month_href); # # CURRENT MONTH -- $days = array( 2=>array("/weblog/archive/2004/Jan/02","linked-day"), 3=>array("/weblog/archive/2004/Jan/03","linked-day"), 8=>array("/weblog/archive/2004/Jan/08","linked-day"), 22=>array("/weblog/archive/2004/Jan/22","linked-day")); phpcalendar($year, $month, $days, $month_href); # # NEXT MONTH - $days = array( 17=>array("/weblog/archive/2004/Jan/02","linked-day"), 18=>array("/weblog/archive/2004/Jan/03","linked-day"), 19=>array("/weblog/archive/2004/Jan/08","linked-day")); phpcalendar($year, $month+1, $days, $month_href); # function phpcalendar($year, $month, $days, $month_href) { $weekday_lth = 1; # TODAY -- $this_day = date('j',time()); $this_month = date('n', time()); $this_year = date('Y', time()); $month_href = "?year=$year&month=$month"; $days .= array($this_day=>array("#","today-day")); # echo ""; echo generate_calendar($year, $month, $days, $weekday_lth, $month_href); echo ""; } My problem is with the 7th line from the end: $days .= array($this_day=>array("#","today-day")); I want to append these values to the $days array (if the month, day and year match) but this technique causes a parse error. Any ideas? Thanks for your help... Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody!
PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- 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
Re: [PHP] I have a problem with nobody!
BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I have a problem with nobody!
I have been googling this to death and have many references to this, but all solutions seem to either 1 not apply 2 result in parse error The code: mail ($to, $subject, $message, $header); The error Email is sent to recipient as [EMAIL PROTECTED] (fqdn = fully qualified domain name) I have read about a -f function. I tried mail ($to, $subject, $message, -f$header); mail -f($to, $subject, $message, $header); both result in parse error. I read about changing a php_value in my httpd.conf Couldn't find any reference. So, I turn to my friends on the php_list Any assistance would really be appreciated! Running CentOS Cpanel Exim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SERVER['HTTP_ACCEPT_ENCODING'] unavailable
Did anyone experience this? I am working on a script that compresses the output, thus relying on $_SERVER['HTTP_ACCEPT_ENCODING'] to figure out how to encode it. The problem is 'http_accept_encoding' is missing from $_SERVER. I realize the value may not be available all the time, but it seems to be missing regardless of browser / site / etc. Firebug on Firefox shows the http request containing the accept_encoding header being sent to the server and it looks like it gets lost on the way. Is it a config issue in PHP, or in Apache? Can anybody help? Thanks a lot, Vlad My platform is: PHP 5.2.1 + Apache 2.0.58 on Gentoo 2006.0 My $_SERVER looks roughly like this: [HTTP_HOST] => lab.vvvlad.com [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 [HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 [HTTP] => [HTTP_ACCEPT_CHARSET] => UTF-8,* [HTTP_KEEP_ALIVE] => 300 [HTTP_CONNECTION] => keep-alive [HTTP_COOKIE] => tid=b0005b4e81a3dd4d1067884308f4d9fbdc6b169e802298eacdecdb6e9c34aa1a; sid=a55f5a7ea8d512c7115d53fedbcf8375 [PATH] => /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache [SERVER_NAME] => lab.vvvlad.com [SERVER_ADDR] => 192.168.2.6 [SERVER_PORT] => 80 [DOCUMENT_ROOT] => /srv/hosts/lab.vvvlad.com/htdocs [SERVER_ADMIN] => [EMAIL PROTECTED] [SCRIPT_FILENAME] => /srv/hosts/lab.vvvlad.com/htdocs/server.php [REMOTE_PORT] => 1752 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /server.php [SCRIPT_NAME] => /server.php [PHP_SELF] => /server.php [REQUEST_TIME] => 1182044854 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php framework, large site
hi, can some body help me, how to start php framwork for large site? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to catch any url request
On Sat, 2007-06-16 at 16:52 -0700, gd007 wrote: > Hi, > > I want to catch any request of the form http://www.abcd.com/somereq.php > without creating the somereq.php file. > Thanks in advance. You can either use mod_rewrite in Apache, or set a 404 handler. Probably similar things for webservers other than Apache. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to catch any url request
Hi, I want to catch any request of the form http://www.abcd.com/somereq.php without creating the somereq.php file. Thanks in advance. --Gautam http://www.funnydomainnames.com/ -- View this message in context: http://www.nabble.com/How-to-catch-any-url-request-tf3934596.html#a11159190 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The data get lost when click back button
At 12:47 PM -0300 6/16/07, Tom wrote: My problem: I have a form for that the users register indicating a user's name and password and other data. Previously to add the user in the data base I verify that user's name doesn't already exist. In that case I show an error message and I ask him to attempt it again. But, when the user returns to the form all the data of the fields disappeared! Then the user has enter all the information again. How can I make in simple way that, the data in the fields don't get lost when the user returning to the form? Ahead of time, thank you very much, Tom. Try Googling "sticky forms". http://www.informit.com/articles/article.asp?p=412930&seqNum=3&rl=1 Cheers, 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
Re[7]: [PHP] Need a more elegant way of bitwise ORing values
Hi tedd, Saturday, June 16, 2007, 1:18:58 PM, you wrote: > How about? > switch (1) > { > case $allow_fraction: > $filter['flags'] = FILTER_FLAG_ALLOW_FRACTION; > break; > case $allow_thousand: > $filter['flags'] = FILTER_FLAG_ALLOW_THOUSAND; > break; > case $allow_scientific: > $filter['flags'] = FILTER_FLAG_ALLOW_SCIENTIFIC; > break; > } > Would that not work? Sorry but no because it doesn't allow for multiple flags to be set. It's perfectly valid to have one, two or all three flags active on the filter_var call. Even if the switch statement was re-run again, it wouldn't bitwise OR the values together, it'd just replace them. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Are IP addresses reliable?
On Sat, 16 Jun 2007, PHP Developer wrote: I wanna know that is there a way to forge someone's IP address? for example, I have a client with an static ip address, and she is a superuser. Can i rely on her IP address? or somebody else can forge her IP? I don't want her to enter a username and a password.. For purposes of above question only (and assuming application is PHP and thus running on HTTP which is TCP-based protocol) the answer is that you can rely on the ip address. For general purposes the answer is you can forge ip address and can not rely on them (due to NAT and other issues) but its very very not easy and a lot depends on protocol in question. -- William Leibzon Elan Networks [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Are IP addresses reliable?
On 6/16/07, PHP Developer <[EMAIL PROTECTED]> wrote: I wanna know that is there a way to forge someone's IP address? for example, I have a client with an static ip address, and she is a superuser. Can i rely on her IP address? or somebody else can forge her IP? I don't want her to enter a username and a password.. Cheers, Daniel Only if she is running a proxy server, or has her computer open in some way that someone can connect through her computer, then somebody can use her IP. else it is fine to rely on her IP. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Are IP addresses reliable?
I wanna know that is there a way to forge someone's IP address? for example, I have a client with an static ip address, and she is a superuser. Can i rely on her IP address? or somebody else can forge her IP? I don't want her to enter a username and a password.. Cheers, Daniel - Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
[PHP] Re: Undefined index:
There is obviously something else wrong. That's the purpose of isset(); Comment out your line and see what happens. I'd guess the real problem is later in your code when you are trying to do something with $HTTP_COOKIE_VARS["LoggedIn"] even though your isset() test said it didn't exist. WeberSites LTD wrote: I'm using this code to check if a cookie has a value : If(!IsSet($HTTP_COOKIE_VARS["LoggedIn"])) In case that this cookie is not set, how can i avoid the Undefined index: line in the error log? berber -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The data get lost when click back button
On Sat, 2007-06-16 at 12:47 -0300, Tom wrote: > How can I make in simple way that, the data in the fields don't get lost > when the user returning to the form? You can add the field data to a session: $field1 = $_GET['field1']; $_SESSION['field1'] = $field1; // then to get them back again if(isset($_SESSION['field1'])) { $field1 = $_SESSION['field1']; } --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The data get lost when click back button
My problem: I have a form for that the users register indicating a user's name and password and other data. Previously to add the user in the data base I verify that user's name doesn't already exist. In that case I show an error message and I ask him to attempt it again. But, when the user returns to the form all the data of the fields disappeared! Then the user has enter all the information again. How can I make in simple way that, the data in the fields don't get lost when the user returning to the form? Ahead of time, thank you very much, Tom. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
if(@sizeof($profanity) > 0) { echo "Please REMOVE the profanity in the following fields. Immediately!"; foreach($profanity as $field => $value) { echo " {$label_array[$field]}"; //line 114 } } - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "kvigor" <[EMAIL PROTECTED]> Cc: Sent: Saturday, June 16, 2007 9:40 AM Subject: Re: [PHP] Form Data Filtering kvigor wrote: if (in_array(strtolower($value), $profanity)) { $profanity[$field] = "bad"; } on php.net I haven't seen any example on using strtolower w/ arrays. I tried this an I get the following output: Please REMOVE the profanity in the following fields. Immediately! Notice: Undefined offset: 0 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 1 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 2 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 3 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 ...etc. I also tried (in_array(strtolower($_POST[$value]), $profanity)) same result. Which line is 114? I'm betting it's not the in_array line. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index:
WeberSites LTD wrote: I'm using this code to check if a cookie has a value : If(!IsSet($HTTP_COOKIE_VARS["LoggedIn"])) In case that this cookie is not set, how can i avoid the Undefined index: line in the error log? The isset function does not give an error if you pass it a non-existant variable. Are you sure it's this line that's causing the undefined index error? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Data Filtering
kvigor wrote: if (in_array(strtolower($value), $profanity)) { $profanity[$field] = "bad"; } on php.net I haven't seen any example on using strtolower w/ arrays. I tried this an I get the following output: Please REMOVE the profanity in the following fields. Immediately! Notice: Undefined offset: 0 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 1 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 2 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 Notice: Undefined offset: 3 in C:\htdocs\Sweepstakes\sosValidate.php on line 114 ...etc. I also tried (in_array(strtolower($_POST[$value]), $profanity)) same result. Which line is 114? I'm betting it's not the in_array line. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Automatic mail forwarding (using cpanel) --------------------------------------------------> (Maybe a bit 0T)
In news: [EMAIL PROTECTED] - Ryan A wrote : >> Hey! >> >> I have a pal who has a pretty interesting domain, he wants to offer >> emails @ his_domain_name.com (example) which gets forwarded to thier >> normal email address. >> >> eg: >> i make an account at x.com with username genphp and give my real >> email address of genphp AT yahoo.com >> >> all email sent to [EMAIL PROTECTED] comes to my real email address. >> >> This is already possible via cpanel but rather than enter each >> address by hand in cpanel... is there anyway to do this via a php >> script so that as the user creates a userid and specifies his real >> address the forward is created? >> >> Thanks in advance! >> >> Cheers! >> R >> >> >> -- >> - The faulty interface lies between the chair and the keyboard. >> - Creativity is great, but plagiarism is faster! >> - Smile, everyone loves a moron. :-) >> >> - >> Get the Yahoo! toolbar and be alerted to new email wherever you're >> surfing. In short yes- but you will need a lot more than that - control of email size,storage size,bandwidth ect. Google is your friend for this one (Web Hosting Tools) Chris -- Cheap As Chips Broadband http://yeah.kick-butt.co.uk Superb hosting & domain name deals http://host.kick-butt.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Automatic mail forwarding (using cpanel) --------------------------------------------------> (Maybe a bit 0T)
On Saturday 16 June 2007 22:00, Ryan A wrote: > This is already possible via cpanel but rather than enter each > address by hand in cpanel... is there anyway to do this via a php > script so that as the user creates a userid and specifies his real > address the forward is created? Yeah, find out how cpanel does it then have php do the same. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating dropdown list
At 12:38 PM -0600 6/11/07, Ashley M. Kirchner wrote: I have a page containing two drop down lists. I need to figure out a way to populate/update the second drop down list based on a selection of the first one (the data for both drop down lists is in a MySQL database). Is this something I need to do in JavaScript? Or can I somehow trick PHP to do this? Ashley: In this case, I think js would be a better choice. You can get the code here: http://www.webbytedd.com/b/dyn-select/ Cheers, 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] Automatic mail forwarding (using cpanel) --------------------------------------------------> (Maybe a bit 0T)
Hey! I have a pal who has a pretty interesting domain, he wants to offer emails @ his_domain_name.com (example) which gets forwarded to thier normal email address. eg: i make an account at x.com with username genphp and give my real email address of genphp AT yahoo.com all email sent to [EMAIL PROTECTED] comes to my real email address. This is already possible via cpanel but rather than enter each address by hand in cpanel... is there anyway to do this via a php script so that as the user creates a userid and specifies his real address the forward is created? Thanks in advance! Cheers! R -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
Re: [PHP] Undefined index:
At 2:37 PM +0200 6/16/07, WeberSites LTD wrote: I'm using this code to check if a cookie has a value : If(!IsSet($HTTP_COOKIE_VARS["LoggedIn"])) In case that this cookie is not set, how can i avoid the Undefined index: line in the error log? berber berber: Try this: $loggedIn = isset($HTTP_COOKIE_VARS["LoggedIn"]) ? ($HTTP_COOKIE_VARS["LoggedIn"]) : "not logged in"; echo($loggedIn); Cheers, 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
Re: [PHP] Updating dropdown list
At 8:57 PM +0200 6/11/07, Tijnema wrote: On 6/11/07, Ashley M. Kirchner <[EMAIL PROTECTED]> wrote: Tijnema wrote: But Javascript != PHP, so if this is what you want, you're on the wrong list... Ik weet dat meneer. But I also hate JavaScript. So if I can avoid it and use PHP, then I will. Hence me asking here first to see if I can get it accomplished with PHP. :) Just keep in mind that PHP is server side, and can't do anything on the client, except that you can make PHP request calls with ajax, but then there's still not really PHP involved. Tijnema Tijnema: In most of my ajax solutions, I still use php. Here's an example: http://xn--nvg.com/ajax All the html is provided/generated by php. However, the example is very much out of date with respect to unobtrusive javascript. DOM scripting is mondo kewl. Cheers, 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
Re: [PHP] Updating dropdown list
At 12:55 PM -0600 6/11/07, Ashley M. Kirchner wrote: But I also hate JavaScript. So if I can avoid it and use PHP, then I will. Hence me asking here first to see if I can get it accomplished with PHP. :) Don't hate it -- Javascript is just another cool language. You can do some amazing things with it. Like this: http://www.webbytedd.com/a/move/ Couple php, js, css, mysql, and html together, you have yourself a nice package for doing stuff. They all look like parts of a single web language same to me. Cheers, 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] Undefined index:
I'm using this code to check if a cookie has a value : If(!IsSet($HTTP_COOKIE_VARS["LoggedIn"])) In case that this cookie is not set, how can i avoid the Undefined index: line in the error log? berber
Re: [PHP] PHP Competition - Win a copy of Zend Studio
At 1:08 AM +0100 6/16/07, Stut wrote: tedd wrote: At 12:45 PM +0100 6/14/07, Stut wrote: Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio/ -Stut No offense meant to zend, but I consider it a challenge to get the zend-studio professional to work on a virtual host. I bought it a few years back and could never use it. That would be where the year of support would come in handy. Worth mentioning I've never had any issues getting it to work, so I don't know what issues you were having but I'm sure Zend would be able to help. -Stut Yes, I'm sure it was all my fault in not understanding. Cheers, 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
Re[6]: [PHP] Need a more elegant way of bitwise ORing values
At 3:19 PM +0100 6/13/07, Richard Davey wrote: $filter['flags'] = 0; > if( $allow_fraction ) { > $filter['flags'] |= FILTER_FLAG_ALLOW_FRACTION; } > if( $allow_thousand ) { > $filter['flags'] |= FILTER_FLAG_ALLOW_THOUSAND; } > if( $allow_scientific ) { > $filter['flags'] |= FILTER_FLAG_ALLOW_SCIENTIFIC; } ?>> I don't think it's *terribly* verbose, as it has good sentence structure to it, but your version is certainly more efficient, hence I've swapped to that. Any other takers? ;) Rich: How about? switch (1) { case $allow_fraction: $filter['flags'] = FILTER_FLAG_ALLOW_FRACTION; break; case $allow_thousand: $filter['flags'] = FILTER_FLAG_ALLOW_THOUSAND; break; case $allow_scientific: $filter['flags'] = FILTER_FLAG_ALLOW_SCIENTIFIC; break; } Would that not work? Cheers, 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] resize and upload image problem
Here is my script. The file is not uploading. In my orignal script it is $_FILES['userfile']['tmp_name'][$i]; that gets uploaded as I have an array of images and it loops through. It must be something to do with this line $tmpName = imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); that breaks it. - $total= count($_FILES['userfile']['name']); for ($i=0; $i <$total; $i++) { $fileName = $_FILES['userfile']['name'][$i]; $tmpName = $_FILES['userfile']['tmp_name'][$i]; $fileSize = $_FILES['userfile']['size'][$i]; $fileType = $_FILES['userfile']['type'][$i]; $image = imagecreatefromjpeg($tmpName); if ($image === false) { exit; } Get original width and height echo $width = imagesx($image); echo $height = imagesy($image); // New width and height $new_width = 200; $new_height = 150; // Resample $image_resized = imagecreatetruecolor($new_width, $new_height); $tmpName = imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); $position=$i+1; $img_url = $_SERVER['DOCUMENT_ROOT']."/images/$customer_id/". basename( $_FILES['userfile']['name'][$i]); //$img_url= $target_path . basename( $_FILES['userfile']['name'][$i]); if(move_uploaded_file($tmpName, $img_url)) { chmod('images/'.$customer_id, 0777); chmod($img_url, 0777); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php