[PHP] cookie expiring with session
I urgently need to store a cookie that expires with session. This cookie has to be read by a section written in jsp, therefore I don't think I can use $_SESSION variables. Can anyone help me? Andrea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beginner question : Removing spaces in forms
you could start with something like: $old_string=44 55 99 111; $new_string=ereg_replace( ,,$old_string); echo $new_string; should display 445599111 There are other regular expression aids listed on the page at: http://www.php.net/manual/en/function.ereg-replace.php Hope this helps, Hugh - Original Message - From: Andrew Wilson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 12, 2002 7:19 PM Subject: [PHP] Beginner question : Removing spaces in forms Hay guys i was wondering if there was a form parameter of something equivalent for input text boxes that when a user enters a number or series of numbers that it removes the spaces. If there is no alternative how would you go about solving this issue. Your help is appreciated. Thanks. Netway Networks Pty Ltd (T) 8920 8877 (F) 8920 8866 -- 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] errorno error codes
In reality this is a linux question. If I use in PHP passthru or system, the linux OS will return an error number. Somebody can provide me with a link where they are listed and explained? -- René www.comunica2.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading changes via Email
Hi there people, I am currently working on a database front-end for a company database and I would like to know if it would be possible to email access.db to [EMAIL PROTECTED] and a script would be run on it to save it over the top of the database that is already on the server (and a few little tweaks as well) instead of having to manually upload seeing as ftp connections are not allowed. I have searched on Google but dont find anything specific to this idea, if someone could point me in the right direction that would be great. Cheers, Ian. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex question
Troy May wrote: How would take a regular non-formatted text link (http://www.link.com) and turn it into ready to post HTML? (a href=http://www.link.comhttp://www.link.com/a) Darn, Outlook formats it, but you get the idea. It would just be typed out normally. Any ideas? function MakeUrl ($text) { $text = preg_replace(/(www\.[a-zA-Z0-9\.\/#~:?+=%@!_\\-]+)/, http://\\1; ,$text);#make www. - http://www. $text = preg_replace(/(http:\/\/)(?!www)([a-zA-Z0-9\.\/#~:?+=%@!_\\-]+)/, \\1\\2 ,$text); #eg-- http://kernel.org $text = preg_replace(/(http:\/\/)(www\.)([a-zA-Z0-9\.\/#~:?+=%@!\\-_]+)/, \\1\\2\\3 ,$text); #eg -- http://www.google.com - a hrefhttp://www.google.com;www.google.com/a return $text; } -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookie expiring with session
Andrea wrote: I urgently need to store a cookie that expires with session. This cookie has to be read by a section written in jsp, therefore I don't think I can use $_SESSION variables. Can anyone help me? Andrea to set a cookie that expires with the session do setcookie (name, value) this cookie can then also be read by jsp (as long as it is on the same domain) and you are right that the jsp will not be able to read related $_SESSION variables (unless it can access the file/database where php is storing that information). -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to send an MSWORD email?
Hi experts, I have an email database which I want to send out newsletter to. I want to send emails that have graphics, for example the pub logo. I know that there are 2 ways to do so (maybe there are more, pls enlighten me): 1. use html email with img src=http://www.mydomain.com/logo.gif; 2. use MSWORD to insert the logo into the email. MSWORD will then send the logo.gif as an attachment and will ALSO use img tags. Due to web space concerns, I cannot point the img source to the http location of the logo.gif, thus I have to use attachments. However, I only know how to include the logo.gif using MSWORD emails (currently using outlook xp), this in turn gives me another problem: how do I send the email created in MSWORD to the emails I have in the database using PHP? Please teach me one of the following methods: 1. create an email with the same logic as MSWORD does, so that I can use a web interface to create the email then send the logo.gif as an attachment. 2. send the code to send MSWORD emails not as a document attachment to ANOTHER email, but an email itself. 3. some other better methods. I really need to know this urgently, Thanks in advance.
[PHP] Sesssion help
Hi, I am just starting to use PHP sessions... very interesting. I have two test scripts which is working fine on my PC. However when i upload the script to my Unix server there is a problem. I am trying to pass on the variable from file1 to file2. I have a link to file2 with the session id on file1. When i view file2 i can see only the session id not the other values. I have below the two files...I hope some one can help. I can retrieve the variable on file1 so this means that the variables are being saved in the session store. Cannot understand why it does not appear on file2. FILE 1 ?php session_start(); $sid = session_id(); $form_agent_id = agent; $form_agent_pass = pass; $_SESSION[cookie_agtuser] = $form_agent_id; $_SESSION[cookie_agtpasswd] = $form_agent_pass; $cookie_agtuser = $_SESSION['cookie_agtuser']; $cookie_agtpasswd = $_SESSION['cookie_agtpasswd']; echo agt = $cookie_agtuser; ? HTML BODY a href=file2.php?PHPSESSID=? echo $sid; ?File2/a /BODY /HTML FILE 2 === ?php session_start(); $cookie_agtuser = $_SESSION['cookie_agtuser']; $cookie_agtpasswd = $_SESSION['cookie_agtpasswd']; global $cookie_agtuser; echo $PHPSESSID; echo agt = $cookie_agtuser; echo pass = $cookie_agtpasswd; ? Cheers, Hasan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ping...
I can exec ping OK... but I need a way to ping and basically give me a OK or Not OK... any ideas? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to send an MSWORD email?
3.some other better methods. Have a look on pear.php.net for the mime mail class. It has things for attaching images and including them in an html email Cheers John Wards SportNetwork.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to send an MSWORD email?
On Friday 13 December 2002 17:59, See Kok Boon wrote: Hi experts, I have an email database which I want to send out newsletter to. I want to send emails that have graphics, for example the pub logo. I know that there are 2 ways to do so (maybe there are more, pls enlighten me): There's a class called phpmailer at www.phpclasses.org which allows you to send html mail along with image attachments which appear within the mail (depending on your mail client). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Dew on the telephone lines. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading changes via Email
On Friday 13 December 2002 17:17, Roke, Ian wrote: Hi there people, I am currently working on a database front-end for a company database and I would like to know if it would be possible to email access.db to [EMAIL PROTECTED] and a script would be run on it to save it over the top of the database that is already on the server (and a few little tweaks as well) instead of having to manually upload seeing as ftp connections are not allowed. It is possible to send mail to an email address and have it processed by a script. It depends on your mailserver, eg with sendmail you can its alias mechanism, with qmail you can use dot-qmail files. But I'm not sure how you would process access.db assuming that it is a file created by MS Access. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Who is W.O. Baker, and why is he saying those terrible things about me? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sorry if repost - more ftp problems
Fatal error: Maximum execution time of 90 seconds exceeded in :\apache\htdocs\fnusa\releases\ftp.php on line 28 This means that after entering in passive mode it has used 90 seconds of processor time and times out. Set this timeout higher in php.ini. And I would add this to the source just before the most time consuming statement: . . . set_time_limit(); fputs( $fp, STOR $source_file\r\n ); . . . When called, set_time_limit() restarts the timeout counter from zero. Still when the uploading takes more than 90 seconds, it will be interrupted. And in fact you will never know how long it takes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ping...
On Fri, Dec 13, 2002 at 10:02:54AM -, Brian McGarvie wrote: I can exec ping OK... but I need a way to ping and basically give me a OK or Not OK... any ideas? This isn't really a PHP question, since ping is a command in the OS and not in PHP itself. And of course, you didn't mention what OS you run. I run FreeBSD. In FreeBSD, ping has options that could be used thusly: $target=209.238.46.67; exec(/sbin/ping -c 1 -t 3 $target, $junk, $ret); if ($ret==0)// In shell, 0 means success print Wahoo! I can see $ipaddr!\n; else print Bummer... $ipaddr seems to be down.\n; The option -c specifies a count (the number of pings to send), and -t specifies a timeout in seconds. If your operating system is UNIX or Linux, you can man ping from a shell to see what you need to do to duplicate this functionality, or check out various OS man pages at http://www.freebsd.org/docs.html#man . If you're running a Microsoft operating system, you're most likely out of luck. -- Paul Chvostek [EMAIL PROTECTED] Operations / Abuse / Whatever +1 416 598- it.canada - hosting and development http://www.it.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ping...
On Friday 13 December 2002 18:02, Brian McGarvie wrote: I can exec ping OK... but I need a way to ping and basically give me a OK or Not OK... any ideas? So you have something like: $result = `ping -c 3 www.example.com`; echo $result; Then you have to parse $result to work out whether the pings are successful or not. - PING www.example.com (10.0.0.1) from 10.0.0.2 : 56(84) bytes of data. 64 bytes from www.example.com (10.0.0.1): icmp_seq=1 ttl=224 time=466 ms 64 bytes from www.example.com (10.0.0.1): icmp_seq=2 ttl=224 time=477 ms 64 bytes from www.example.com (10.0.0.1): icmp_seq=3 ttl=224 time=465 ms --- www.example.com ping statistics --- 3 packets transmitted, 3 received, 0% loss, time 2001ms rtt min/avg/max/mdev = 465.948/469.969/477.728/5.515 ms - The simplest measure would be how many packets transmitted and how many received. So something along the lines of: (preg_match(/^(\d{,}) packets transmitted, (\d{1,}) received,.*$/im, $result, $matches)) might work. Untested, so use with extreme caution. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The debate rages on: Is PL/I Bachtrian or Dromedary? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading changes via Email
The database is an access db but all I want to do is upload it, but check first wether it is newer or not. I plan to have the email automatically sent each day but only upload it if it is newer. All I am trying to do is bypass the ftp part which I cant do. Is there a reference on how to pull out the email from qmail? I am new to this concept. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: 13 December 2002 10:14 To: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading changes via Email On Friday 13 December 2002 17:17, Roke, Ian wrote: Hi there people, I am currently working on a database front-end for a company database and I would like to know if it would be possible to email access.db to [EMAIL PROTECTED] and a script would be run on it to save it over the top of the database that is already on the server (and a few little tweaks as well) instead of having to manually upload seeing as ftp connections are not allowed. It is possible to send mail to an email address and have it processed by a script. It depends on your mailserver, eg with sendmail you can its alias mechanism, with qmail you can use dot-qmail files. But I'm not sure how you would process access.db assuming that it is a file created by MS Access. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Who is W.O. Baker, and why is he saying those terrible things about me? */ -- 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] Uploading changes via Email
On Friday 13 December 2002 18:30, Roke, Ian wrote: The database is an access db but all I want to do is upload it, but check first wether it is newer or not. I plan to have the email automatically sent each day but only upload it if it is newer. All I am trying to do is bypass the ftp part which I cant do. Is there a reference on how to pull out the email from qmail? I am new to this concept. Have a look at this thread first: http://marc.theaimsgroup.com/?l=php-generalm=103757608904303w=2 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The only reward of virtue is virtue. -- Ralph Waldo Emerson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passthru returns with errno 11
What could that mean errno 11 when I try to run a small program with four parameters. From a shell prompt it works. What does it mean errno 11? -- René www.comunica2.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: errorno error codes
I guess that depends on what exactly you're executing? If the return_var argument is present, the return status of the *Unix command* will be placed here. Bogdan [EMAIL PROTECTED] wrote: In reality this is a linux question. If I use in PHP passthru or system, the linux OS will return an error number. Somebody can provide me with a link where they are listed and explained? -- René www.comunica2.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Beginner question : Removing spaces in forms
Hi Andrew, Andrew Wilson [EMAIL PROTECTED] wrote in message: Hay guys i was wondering if there was a form parameter of something equivalent for input text boxes that when a user enters a number or series of numbers that it removes the spaces. If there is no alternative how would you go about solving this issue. Am I right in thinking that you want the form input variable to contain numbers only? If so, you could simply do this: $variable = preg_replace(![^0-9]!s, , $variable); Which would strip out everything that's not numbers. OR, are you expecting strings like: Here's a number you can call for tech support: 12345 6789 - be patient, they take *forever* to answer! If so, you could probably craft some regular expression up to remove the spaces. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Escaping '#' Sign
-Original Message- From: Mike Smith [mailto:[EMAIL PROTECTED]] Sent: 12 December 2002 14:47 Rendered results of a href... = http://company.com/custmaint.php?id=70class=cust=company T/T #29type=OEM id is the record id class is Null so that's OK. cust=company T/T #29 type=OEM I present the info in a form... echo td\n; echo input type=\text\ name=\cust\ value=\$cust\\n; echo /td\n; This gives me: ++ |company T/T | ++ *Note lack of #29 which I do see in the HTML table. If I save (UPDATE WHERE id=$id) this record cust will now be company T/T All the other fields fill in correctly. Is it seeing the # as a comment? Nope -- as an anchor name. Written like this, you're telling your browser to load the page identified by http://company.com/custmaint.php?id=70class=cust=company T/T (which, by the way, is probably invalid in itself, but we'll come to that!), and then go to the anchor named 29type=OEM on that page. What you need to do is urlencode() the value of the cust parameter before inserting it in your A href= tag, so that any characters which might cause problems (such as # or , or even space) don't appear in the rendered URL, but instead are encoded as a %xx value (or maybe + for a space -- can't remember which urlencode() does). This is all you need to do -- as it's a URL, it automatically gets URL-decoded by the Web server before being passed to your script, so you should see what you want. (But don't forget to re-urlencode it if you need to pass it on in another URL!) Hope this helps! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Odd Strpos Behavior
-Original Message- From: Steve Keller [mailto:[EMAIL PROTECTED]] Sent: 12 December 2002 22:09 At 12/11/2002 08:09 PM, you wrote: Okay, so how do you know what to replace something like [author] with? What exactly are you doing again? I've forgotten the original question. :) Ok, got a sentence, like: a pile of [metal] 600 feet wide and 30 feet tall. On top of it is a [monster]. The items in the [] represent the names of files containing lists of possible results. So I need to grab the first one, metal, open up metal.php, grab a random item from it, such as gold, and replace [metal] in the original sentence with the result. I should now have: a pile of gold 600 feet wide and 30 feet tall. On top of it is a [monster]. Well, I think I'd approach this using preg_match_all() to break out all your elements for replacement into an array, then look them up and produce a second array of the desired replacements, and then do a preg_replace using those two arrays to do your desired replaces. Something like (completely untested!): $matches = preg_match_all('|\[(.*\)]|U', $sentence, $items); if ($matches): $replacements = array(); foreach ($items[1] as $i=$item): $replacements[$i] = /* random item looked up in $item.php */; $items[1][$i] = '|\['.$item.'\]|'; // reconstruct as valid preg pattern endforeach; $new_sentence = preg_replace($items[1], $replacements, $sentence); endif; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's the Difference?
I can't quite figure this out... What exactly is the difference between str_replace() and ereg_replace()? Don't they both do the exact same thing? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] database to rtf
How to convert data from database to rtf file. Example: database : column_1 column_2 column_3 1 aa 123456 2 bb234der ... And I need rtf file which have this informations: column_1 : 1 column_2 : aa column_3 : 123456 next rtf file have this informations column_1 : 2 column_2 : bb column_3 : 2345der and so on... Every trf file have name like value in column_1. Thanks you roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (PHP) $_SERVER['PATH_TRANSLATED']
Hi friends, on my box (w2k, apache2.0.40) the phpinfo(); doesn't show the above. I need this for the package moregroupware, which makes use of $_SERVER['PATH_TRANSLATED']. How to set this or how to change anything to get this? Thanks in advance -- fritzek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's the Difference?
str_replace() doesn't have regex. Stephen wrote: I can't quite figure this out... What exactly is the difference between str_replace() and ereg_replace()? Don't they both do the exact same thing? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reconfigure not showing in phpinfo
Recently reconfigured php to add in support for some extensions we were previously not using (Pear among others). switched to src directory, backed up config.nice edited config.nice to remove/alter the appropriate --without lines rm config.cache ./config.nice make (no errors) make install (no errors) pretty seemless... in checking phpinfo() it doesn't show the altered config line though and stil shows the original config line from when we upgraded this server 4.2.2. Is there a cache of this that needs to be deleted somewhere? All the extensions and changes DID take place though and work just fine, just annoying that the phpinfo() which we use to check configurations isn't correctly displaying the current config. We do run a binary and module installation on the same server, and am referring primarily to the mod install. Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple php errors in error log
Hello, I was looking through my error_log, and noticed these errors: PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/imap.so' - /usr/lib/php4/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/ldap.so' - /usr/lib/php4/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/mysql.so' - /usr/lib/php4/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/odbc.so' - /usr/lib/php4/odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/pgsql.so' - /usr/lib/php4/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/snmp.so' - /usr/lib/php4/snmp.so: cannot open shared object file: No such file or directory in Unknown on line 0 Any ideas on how to fix those? I just installed PHP 4.3.0 RC3 on Redhat 8. -Jody Cleveland Winnefox Library System Computer Support Specialist [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] readdir() output question
Hello all! Ok, I have a readdir() reading pictures files from a directory. But now I want to output them into a html table, say 5 across the top row, then 5 the next row, etc. What I cant figure out is how to make this happen. Right now, I am not reading the files into an array. Should I do this and then create a while loop? Thanks, Ron Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] readdir() output question
$img_count = 0; echo( table tr td colspan=5My Images/td): (loop through filenames) { if (($img_count % 5) == 0) echo( /trtr); echo( tdimg_src=\$filename\/td); $img_count = $img_count + 1; } while (($img_count % 5) != 0) { echo( tdnbsp;/td); } echo( /tr /table) Matt RClark [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello all! Ok, I have a readdir() reading pictures files from a directory. But now I want to output them into a html table, say 5 across the top row, then 5 the next row, etc. What I cant figure out is how to make this happen. Right now, I am not reading the files into an array. Should I do this and then create a while loop? Thanks, Ron Clark -- 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] What's the Difference?
...therefore it's faster. Only use it when you really need regexp functionality - same with all other functions which are dual straight string/regexp matching. Leif K-Brooks wrote: str_replace() doesn't have regex. Stephen wrote: I can't quite figure this out... What exactly is the difference between str_replace() and ereg_replace()? Don't they both do the exact same thing? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's the Difference?
Ok, you get the meaning even though my mail is confusing: only use *regexp functions* when you need regexp [etc] Bogdan Stancescu wrote: ...therefore it's faster. Only use it when you really need regexp functionality - same with all other functions which are dual straight string/regexp matching. Leif K-Brooks wrote: str_replace() doesn't have regex. Stephen wrote: I can't quite figure this out... What exactly is the difference between str_replace() and ereg_replace()? Don't they both do the exact same thing? Thanks, Stephen Craton http://www.melchior.us What is a dreamer that cannot persevere? -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with text files from a Mac
I am working on an application for a school district and am having some problems with the files they are supplying for import. They are supplying data files and I am writing routines to populate the database using these files. Its a simple file upload then I just need to parse through the tab separated value file. I am using the most recent PHP build on Windows with IIS ISAPI and a MSSQL database. They are sending text files from a Macintosh application. I noticed on the documentation for fgetcsv() that it cannot read the end of line character on Mac files. I have not been able to find a good work around for this issue. When I grab the entire contents of the file then try doing a string replacement on the \r or even \t for that matter it does not work. Has anyone found a good solution for dealing with Mac files? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alternate location for PEAR downloadable documentation
Is there one? http://pear.php.net/distributions/manual/pear_manual_en.html.gz (and all the other downloadable documentation) seem to have gone awol. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sesssion help
Hi all, I finally found a solution. When i session_register(cookie_agtuser); instead of $cookie_agtuser = $_SESSION['cookie_agtuser']; the variable is seen. I don't know why but if anyone know why this could happen it would help a lot. thanks, Hasan - Original Message - From: Hasan / Impex Holidays Maldives [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 3:00 PM Subject: [PHP] Sesssion help Hi, I am just starting to use PHP sessions... very interesting. I have two test scripts which is working fine on my PC. However when i upload the script to my Unix server there is a problem. I am trying to pass on the variable from file1 to file2. I have a link to file2 with the session id on file1. When i view file2 i can see only the session id not the other values. I have below the two files...I hope some one can help. I can retrieve the variable on file1 so this means that the variables are being saved in the session store. Cannot understand why it does not appear on file2. FILE 1 ?php session_start(); $sid = session_id(); $form_agent_id = agent; $form_agent_pass = pass; $_SESSION[cookie_agtuser] = $form_agent_id; $_SESSION[cookie_agtpasswd] = $form_agent_pass; $cookie_agtuser = $_SESSION['cookie_agtuser']; $cookie_agtpasswd = $_SESSION['cookie_agtpasswd']; echo agt = $cookie_agtuser; ? HTML BODY a href=file2.php?PHPSESSID=? echo $sid; ?File2/a /BODY /HTML FILE 2 === ?php session_start(); $cookie_agtuser = $_SESSION['cookie_agtuser']; $cookie_agtpasswd = $_SESSION['cookie_agtpasswd']; global $cookie_agtuser; echo $PHPSESSID; echo agt = $cookie_agtuser; echo pass = $cookie_agtpasswd; ? Cheers, Hasan -- 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] Escaping '#' Sign
Thanks. That did it. What I came up with is: echo a href=\custmaint.php?id=$row[0]class=$row[1]cust=.urlencode($row[2]).ty pe=$row[3]\img alt=\Edit\ src=\images/edit.gif\ height=\24\ width=\24\ border=\0\ //a; Is this fundamentally flawed? You mentioned ...is probably invalid in itself, but we'll come to that. Were you referring to the space or the whole pasing of array variables in an URL. I'm trying to come up with a simple Edit form (custmaint.php) with a list of customers below the form. When you click on the edit.gif it links to itself ($PHP_SELF really). I've actually come a long way since I've started scripting in PHP, but would appreciate any pointers. Thanks for pointing me in the right direction! Mike Smith -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 4:22 AM To: 'Mike Smith'; PHP General Subject: RE: [PHP] Escaping '#' Sign -Original Message- From: Mike Smith [mailto:[EMAIL PROTECTED]] Sent: 12 December 2002 14:47 Rendered results of a href... = http://company.com/custmaint.php?id=70class=cust=company T/T #29type=OEM id is the record id class is Null so that's OK. cust=company T/T #29 type=OEM I present the info in a form... echo td\n; echo input type=\text\ name=\cust\ value=\$cust\\n; echo /td\n; This gives me: ++ |company T/T | ++ *Note lack of #29 which I do see in the HTML table. If I save (UPDATE WHERE id=$id) this record cust will now be company T/T All the other fields fill in correctly. Is it seeing the # as a comment? Nope -- as an anchor name. Written like this, you're telling your browser to load the page identified by http://company.com/custmaint.php?id=70class=cust=company T/T (which, by the way, is probably invalid in itself, but we'll come to that!), and then go to the anchor named 29type=OEM on that page. What you need to do is urlencode() the value of the cust parameter before inserting it in your A href= tag, so that any characters which might cause problems (such as # or , or even space) don't appear in the rendered URL, but instead are encoded as a %xx value (or maybe + for a space -- can't remember which urlencode() does). This is all you need to do -- as it's a URL, it automatically gets URL-decoded by the Web server before being passed to your script, so you should see what you want. (But don't forget to re-urlencode it if you need to pass it on in another URL!) Hope this helps! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternate location for PEAR downloadable documentation
On Fri, 13 Dec 2002 08:41:12 -0600 Chris Boget [EMAIL PROTECTED] wrote: Is there one? http://pear.php.net/distributions/manual/pear_manual_en.html.gz (and all the other downloadable documentation) seem to have gone awol. I saw that yesterday when I went to download it myself. I put an entry into the bug-tracker about it. http://bugs.php.net/bug.php?id=20959 Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF Lib problem with Gif files
Fatal error: PDFlib error: Bad image number -1 in PDF_place_image Anyone to have any idea Best regards Bogomil Shopov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Don't get variable to be passed to the page on submit
I have this code whitch I have been staring at for hours and I just cant figure out what is going on... it is about as simple as it gets I just need to pass a variable from this page to it self, and that would be tha variable $nafn I have this included code included into another page that is why I use the aAction and sAction variables in the from action so the script knows where to go after submiting. I have done similar things on this site Im working on an that works but this i just cant get to work. It is prob. just somthing silly and wery eazy but I could use some assistance to finde out what. Regards, David ?php if(!isset($submit)){ session_register(nafn); ? form action=?php echo $PHP_SELF?aAction=$aActionsAction=$sActionsubmit=1test=test; ? method=post enctype=text/plain name=form table width=450 border=0 cellspacing=0 cellpadding=0 tr tdNafn yfirflokks:/td tdinput type=text name=nafn id=nafn/td /tr /table p input type=submit name=Submit value=Vista flokk /p /form ?php } else{ print($test); print($nafn); $newQuery = INSERT INTO $db_imgCat (catName, subCat) VALUES ('$nafn', 0); if(mysql_query($newQuery, $db) or die(mysql_error())){ print(Flokkur vistaður); } else{ print(fail); } } ?
[PHP] Re: PDF Lib problem with Gif files (2)
Warning: Internal PDFlib warning: Color depth other than 8 bit not supported in GIF file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: reconfigure not showing in phpinfo
Dave [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Recently reconfigured php to add in support for some extensions we were previously not using (Pear among others). switched to src directory, backed up config.nice edited config.nice to remove/alter the appropriate --without lines rm config.cache ./config.nice make (no errors) make install (no errors) pretty seemless... in checking phpinfo() it doesn't show the altered config line though and stil shows the original config line from when we upgraded this server 4.2.2. Is there a cache of this that needs to be deleted somewhere? All the extensions and changes DID take place though and work just fine, just annoying that the phpinfo() which we use to check configurations isn't correctly displaying the current config. Since the old C object files (*.o) were probably still around, a lot of code wasn't compiled again, so your phpinfo() function probably wasn't either. To start from scratch, run 'make distclean'. You may want to backup some files before doing so (config.status and maybe others) or write down how you configured PHP before. Regards, Martijn. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookie expiring with session
Set it without a expire time, then it will expire whenever the user closes their browser windows. If the jsp that needs to read the cookie on the same domain for wich it's set, it shouldn't have any problem reading it, but yes, you won't be able to use php's $_SESSION in jsp. Andrea wrote: I urgently need to store a cookie that expires with session. This cookie has to be read by a section written in jsp, therefore I don't think I can use $_SESSION variables. Can anyone help me? Andrea -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and mysql4 connectivity
Hello, does anybody know how to make PHP work with MySQL4. ? I would like to use PHP version 4.0.6-7 and MySQL-4.0.5-0.i386.rpm on a Redhat 7.2 system. Well if somebody has allready done a rpm package of php-mysql.rpm please tell us where to find it. Otherwise any hint on how to compile php as similar (same features: --mcrypt,...) as the redhad rpm is wellcome. thank you very much Ornella and Marc
Re: [PHP] Don't get variable to be passed to the page on submit
Read this: http://www.php.net/variables.external Pay special attention to the parts about the PHP directive register_globals. If on, both $_GET['nafn'] and $nafn will exist. If off, $nafn will not exist. As of PHP 4.2.0, the default for this in php.ini went from on to off. This applies to all variables, even web server variables such as PHP_SELF so you'd use: $_SERVER['PHP_SELF'], etc. Regards, Philip Olson P.s. So you want your query to look more like this: $sql = INSERT INTO $db_imgCat (catName, subCat) VALUES ('{$_GET['nafn']}', 0); P.s.s. Consider validating nafn first, users are evil. P.s.s.s. Use $_SESSION instead of session_register On Fri, 13 Dec 2002, [iso-8859-1] Davíð Örn Jóhannsson wrote: I have this code whitch I have been staring at for hours and I just cant figure out what is going on... it is about as simple as it gets I just need to pass a variable from this page to it self, and that would be tha variable $nafn I have this included code included into another page that is why I use the aAction and sAction variables in the from action so the script knows where to go after submiting. I have done similar things on this site Im working on an that works but this i just cant get to work. It is prob. just somthing silly and wery eazy but I could use some assistance to finde out what. Regards, David ?php if(!isset($submit)){ session_register(nafn); ? form action=?php echo $PHP_SELF?aAction=$aActionsAction=$sActionsubmit=1test=test; ? method=post enctype=text/plain name=form table width=450 border=0 cellspacing=0 cellpadding=0 tr tdNafn yfirflokks:/td tdinput type=text name=nafn id=nafn/td /tr /table p input type=submit name=Submit value=Vista flokk /p /form ?php } else{ print($test); print($nafn); $newQuery = INSERT INTO $db_imgCat (catName, subCat) VALUES ('$nafn', 0); if(mysql_query($newQuery, $db) or die(mysql_error())){ print(Flokkur vistaður); } else{ print(fail); } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PostgeSQL LIMIT pg_numrows
In PostgreSQL, I'd like to be able to use a UNION and a LIMIT clause and have some kind of function to determine how many rows could have come back without the LIMIT clause. Is there some kind of function like pg_numrows() that IGNORES the LIMIT clause? I sure couldn't find it, but maybe I'm just missing it. I suppose I could do a sub-query: select count(*) from (select ... union select ...) but that seems kinda lame... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypt and decrypt cookie
Hi, I am using libmcrypt-2.5.3 to do encryption in php. I use exactly the steps provided in mcrypt_module_open available on php website http://php.benscom.com/manual/en/function.mcrypt-module-open.php I can encrypt and decrypt a string correctly. However, if i encrypt a cookie to write to user's browser, the decryption is incorrect when i try to decrypt this cookie when user comes again. I found out the main cause is the function mcrypt_module_open. This function return a different resource everytime it is called. Eventually it cause the decryption on cookie to be incorrect. Can someone give me suggestion on how to encrypt and decrypt a cookie? Thanks very much. Kim __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Formatting
How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint
[PHP] [solved] Re: [PHP] my cgi version of php prints Content-type:text/html on web page
hi all, i solved this one. i was using an old php.ini file. -lucas On Thu, 12 Dec 2002, Lucas Rockwell wrote: hi all, i have successfully run php as a cgi on Solaris and on another OS X machine, but now, with php 4.2.3, my pages are spitting out Content-type: text/html at the top. of course, Content-type: text/html is important, but why is it showing up on my page...? maybe apache is already outputting Content-type: text/html somewhere... does anyone know why it is doing this? i am also testing this with IE 5.2 on OS X. maybe it is IE's problem... many thanks in advance. -lucas -- 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] Escaping '#' Sign
-Original Message- From: Mike Smith Is this fundamentally flawed? You mentioned ...is probably invalid in itself, but we'll come to that. Were you referring to the space or the whole pasing of array variables in an URL. Yup, I meant the spaces, not the whole concept -- when I wrote that I intended to come back to invcalid characters in URLs, but got distracted between then and hitting Send! Your solution looks just about spot on. Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Formatting
Use this: function makedate($format, $indate) { $temp = explode(-, $indate); $fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]); $temp = date($format, $fulldate); return ($temp); } and call it with this: makedate(F d, Y, $row-datefield); where $row-datefield is the variable of the date field in your table. Peter At 11:55 AM 12/13/2002 -0600, you wrote: How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint - - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions [EMAIL PROTECTED] http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4 / sessions
Hi, I'm trying to get a session variable to work. Here's the code at the start of my script: session_name('CLIENTFILTER'); session_start(); session_register( 'client_filter' ); As I understand it, the variable $client_filter should now be available to me? But I can't see it with either just $client_filter or even $HTTP_SESSION_VARS['client_filter']. It's definitely setting a cookie in the browser, but it doesn't seem to be picking up the variable on subsequent pages. I'm on PHP 4.0.6 with register_globals turned on. (Apache on Solaris) Any help greatly appreciated TIA, - Kev ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A little regex help
Hi, I'm trying to work out the regex needed to split either one of the following lines Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information Windows XP Hotfix (SP2) See Q327696 for more information Into one of these Windows 2000 Hotfix (Pre-SP4) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'Q 322842/a for more information Windows XP Hotfix (SP2) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696Q3 27696/a for more information I can work out half of the expression but not the other half lol, I've used a combination of ereg and split but I'm sure this can be done with 1 ereg statement. Here is my code $ms = http://support.microsoft.com/default.aspx?scid=kb;en-us;;; if (ereg((\[See )([Q|q][0-9]+)( for more information\]), $name)) { $sp = split(\[See , $name); ereg(([Q|q][0-9]+)( for more information\]), $sp[1], $qb); $url = $sp[0] . See a href='$ms . $qb[1] . ' target='_blank' . $qb[1] . /a for more information; } Any ideas? Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4 / sessions
I would set it with $HTTP_SESSION_VARS['client_filter'] = $client_filter; Maybe that will work? I think they are trying to get people to quit using the session_register? I could be wrong. Anyways, take out the session_register and do it like I showed you above. One way to see if it is set before setting it is to: if (!isset($_SESSION['client_filter'])) { $_SESSION['client_filter'] = $client_filter; } That way it will be set before the rest of the script commences. Hope this works for you! If not, I'm not sure what the problem is and someone else will have to help you. --Joseph Guhlin http://www.josephguhlin.com/ Was I helpful? Let others know: http://svcs.affero.net/rm.php?r=bahwi Kevin Porter wrote: Hi, I'm trying to get a session variable to work. Here's the code at the start of my script: session_name('CLIENTFILTER'); session_start(); session_register( 'client_filter' ); As I understand it, the variable $client_filter should now be available to me? But I can't see it with either just $client_filter or even $HTTP_SESSION_VARS['client_filter']. It's definitely setting a cookie in the browser, but it doesn't seem to be picking up the variable on subsequent pages. I'm on PHP 4.0.6 with register_globals turned on. (Apache on Solaris) Any help greatly appreciated TIA, - Kev ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP Listings for HTML page
Hi guys, I am maintaining a list of files on an FTP server and it would be great if I could get a very simple list of all the files and their directory names so I can generate a HTML page with the information. Is this doable? Randum Ian [EMAIL PROTECTED] DJ / Reviewer / Webmaster, DancePortal (UK) Limited DancePortal.co.uk - Global dance music media
[PHP] RE: Paging / Navigation Help
I'd appreciate it if you didn't email me personally for PHP related issues. That's what the php list is for. I would guess that most other people on the list feel the same way. Take care, Nik -Original Message- From: William Martell [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 11:56 AM To: phplist; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Paging / Navigation Help Hello ALL. Can anyone tell me why the number of rows is always 1 and count is the total number of records in my database. Thanks in Advance, William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A little regex help
Why not... $url = ereg_replace(See ([^ ]*) for, See a href='urlgoeshere?key=\1'\1/a for, $original_string) or something close to that. On Fri, 13 Dec 2002, Gareth Hastings wrote: Hi, I'm trying to work out the regex needed to split either one of the following lines Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information Windows XP Hotfix (SP2) See Q327696 for more information Into one of these Windows 2000 Hotfix (Pre-SP4) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'Q 322842/a for more information Windows XP Hotfix (SP2) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696Q3 27696/a for more information I can work out half of the expression but not the other half lol, I've used a combination of ereg and split but I'm sure this can be done with 1 ereg statement. Here is my code $ms = http://support.microsoft.com/default.aspx?scid=kb;en-us;;; if (ereg((\[See )([Q|q][0-9]+)( for more information\]), $name)) { $sp = split(\[See , $name); ereg(([Q|q][0-9]+)( for more information\]), $sp[1], $qb); $url = $sp[0] . See a href='$ms . $qb[1] . ' target='_blank' . $qb[1] . /a for more information; } Any ideas? Gareth -- 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] php4 / sessions
The variable must exist before you can register it in the session.. $client_filter = 'filter'; session_register('client_filter'); ..or simply.. $_SESSION['client_filter'] = 'filter'; -Kevin - Original Message - From: Kevin Porter [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:15 AM Subject: [PHP] php4 / sessions Hi, I'm trying to get a session variable to work. Here's the code at the start of my script: session_name('CLIENTFILTER'); session_start(); session_register( 'client_filter' ); As I understand it, the variable $client_filter should now be available to me? But I can't see it with either just $client_filter or even $HTTP_SESSION_VARS['client_filter']. It's definitely setting a cookie in the browser, but it doesn't seem to be picking up the variable on subsequent pages. I'm on PHP 4.0.6 with register_globals turned on. (Apache on Solaris) Any help greatly appreciated TIA, - Kev ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** -- 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] FTP Listings for HTML page
Yes it is doable. see. open_dir(); @ www.php.net You can also find a number of premade scripts on HotScripts.com or one of the class stores. Do a search on Google. -Kevin - Original Message - From: Randum Ian [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:38 AM Subject: [PHP] FTP Listings for HTML page Hi guys, I am maintaining a list of files on an FTP server and it would be great if I could get a very simple list of all the files and their directory names so I can generate a HTML page with the information. Is this doable? Randum Ian [EMAIL PROTECTED] DJ / Reviewer / Webmaster, DancePortal (UK) Limited DancePortal.co.uk - Global dance music media -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Listings for HTML page
On Saturday 14 December 2002 02:38, Randum Ian wrote: Hi guys, I am maintaining a list of files on an FTP server and it would be great if I could get a very simple list of all the files and their directory names so I can generate a HTML page with the information. Is this doable? Yep, even without php. Just ask people to point their browser at your ftp site! -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* One learns to itch where one can scratch. -- Ernest Bramah */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A little regex help
I'm trying to work out the regex needed to split either one of the following lines Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information Windows XP Hotfix (SP2) See Q327696 for more information Into one of these Windows 2000 Hotfix (Pre-SP4) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'Q 322842/a for more information Windows XP Hotfix (SP2) See a href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696Q3 27696/a for more information $new_string = preg_replace(/Q[0-9]{6}/,urlgoeshere/default.aspx?scid=kb;en-us;$1,$old_ string); I didn't put the actual URL because OE mangles it and turns it into a link. Hopefully that helps. You can use Q|q or /Q[0-9]{6}/i to make it case insensitive, too, if you want. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Formatting
Just a small question, but why not just do this through the SQL statement instead of using php? http://www.mysql.com/doc/en/Date_and_time_functions.html#IDX1295 [from the mysql manual] mysql SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y'); - 'Saturday October 1997' mysql SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s'); - '22:23:00' mysql SELECT DATE_FORMAT('1997-10-04 22:23:00', '%D %y %a %d %m %b %j'); - '4th 97 Sat 04 10 Oct 277' - Original Message - From: Clint Tredway [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:55 AM Subject: [PHP] Date Formatting How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Formatting
Use DATE_FORMAT() in your query, or UNIX_TIMESTAMP() to pull it out as a unix timestamp and use date() in PHP to format it. Chapter 6, Date and Time Functions in the MySQL Manual has the syntax for each of the MySQL functions. ---John Holmes... - Original Message - From: Clint Tredway [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 12:55 PM Subject: [PHP] Date Formatting How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Formatting
MYSQL will do all the formatting that you need. Look up sect 6.3.4, Date and Time Functions in mysql manual. Look at the DATE_FORMAT(date,format) command - Original Message - From: Clint Tredway [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:55 AM Subject: [PHP] Date Formatting How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Odd Strpos Behavior
Do you really want to pursue the solution you're using? A solution with preg_replace_callback() would probably be a lot faster and easier to manage. If that doesn't matter, just let me know and I'll look over your code to try and figure out what's going on. I don't have time right now, though, to do it. ---John Holmes... - Original Message - From: Steve Keller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 12, 2002 5:09 PM Subject: RE: [PHP] Odd Strpos Behavior At 12/11/2002 08:09 PM, you wrote: Okay, so how do you know what to replace something like [author] with? What exactly are you doing again? I've forgotten the original question. :) Ok, got a sentence, like: a pile of [metal] 600 feet wide and 30 feet tall. On top of it is a [monster]. The items in the [] represent the names of files containing lists of possible results. So I need to grab the first one, metal, open up metal.php, grab a random item from it, such as gold, and replace [metal] in the original sentence with the result. I should now have: a pile of gold 600 feet wide and 30 feet tall. On top of it is a [monster]. Now, what I was doing before was strpos'ing the []'s and grabbing what as in between to be the file name, then repeating in a loop until I've eliminated all of the [] items. The reason I'm doing it in a loop is because the results of the metal.php random item may include their own [] items, which also need to be run exactly the same way. A result might be gold [objects] and then I have to run through the objects.php file and get a result from that. This is what I started with: ? $a = [adjective] [beginning]; // temporary item for testing $e = strpos($a,]); while ($e) { echo A: .$a.br /; echo E: .$e.br /; $f = strpos($a, [); echo F: .$f.br /; $tmp = substr($a, 0, $f); $table=substr($a, $f+1, $e-1); echo Table: .$table.br /; $a = substr($a, $e+1, strlen($a)); $dataFile = $table..php; //$b = getFileElement($dataFile); $tmp .= $b; $tmp .= $a; $a = $tmp; $e = strpos($a,]); } echo $a; ? That should work just fine. I cut out everything up to the first [ and add it to $tmp. Then I get the next sequence of characters up to the first ] and use it as a file name for the getFileElement function. Add the result to $tmp, add what was left after the first ], and viola. My problem is that, on the first loop through, strpos returns exactly where the first ] is, so I can chop up to that no problem. However, the second time through the loop, it's one off, which breaks the logic of the loop, I end up with beginning] as my file name. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- 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] newbie - decimal places in arthimetic functions
Hi- How can I control the decimal places returned by an arthimetic function? I would like this divsion function to only return two decimal places (rounded up). $calcsize = $value / $oneGig; Thanks in advance, Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Listings for HTML page
Would I be able to do this for an ftp server where I have to log in? -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: 13 December 2002 19:07 To: Randum Ian; [EMAIL PROTECTED] Subject: Re: [PHP] FTP Listings for HTML page Yes it is doable. see. open_dir(); @ www.php.net You can also find a number of premade scripts on HotScripts.com or one of the class stores. Do a search on Google. -Kevin - Original Message - From: Randum Ian [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:38 AM Subject: [PHP] FTP Listings for HTML page Hi guys, I am maintaining a list of files on an FTP server and it would be great if I could get a very simple list of all the files and their directory names so I can generate a HTML page with the information. Is this doable? Randum Ian [EMAIL PROTECTED] DJ / Reviewer / Webmaster, DancePortal (UK) Limited DancePortal.co.uk - Global dance music media -- 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] Question about if statement evaluating (0==string) as TRUE
Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 Is that becuase PHP is not properly comparing the numerical value with the string value? ? $no = 0; if ($no == string) { print this eval's to TRUE... since when is '0' == 'no' ?; } if ($no == string) { print whereas this eval's to FALSE, as you'd expect; } ? -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: newbie - decimal places in arthimetic functions
round it http://www.php.net/manual/en/function.round.php -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- Max Clark [EMAIL PROTECTED] wrote in message atdba1$2id$[EMAIL PROTECTED]">news:atdba1$2id$[EMAIL PROTECTED]... Hi- How can I control the decimal places returned by an arthimetic function? I would like this divsion function to only return two decimal places (rounded up). $calcsize = $value / $oneGig; Thanks in advance, Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - decimal places in arthimetic functions
You can use the format() function for this. http://www.php.net/format - Original Message - From: Max Clark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 1:10 PM Subject: [PHP] newbie - decimal places in arthimetic functions Hi- How can I control the decimal places returned by an arthimetic function? I would like this divsion function to only return two decimal places (rounded up). $calcsize = $value / $oneGig; Thanks in advance, Max -- 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] Sesssion help
Hasan / Impex Holidays Maldives wrote: Hi all, I finally found a solution. When i session_register(cookie_agtuser); instead of $cookie_agtuser = $_SESSION['cookie_agtuser']; the variable is seen. I don't know why but if anyone know why this could happen it would help a lot. thanks, Hasan which version of php do you have installed ?? -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Listings for HTML page
As long as the script has reading capabilities for the directory then yes. - Original Message - From: Randum Ian [EMAIL PROTECTED] To: 'Kevin Stone' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 1:25 PM Subject: RE: [PHP] FTP Listings for HTML page Would I be able to do this for an ftp server where I have to log in? -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: 13 December 2002 19:07 To: Randum Ian; [EMAIL PROTECTED] Subject: Re: [PHP] FTP Listings for HTML page Yes it is doable. see. open_dir(); @ www.php.net You can also find a number of premade scripts on HotScripts.com or one of the class stores. Do a search on Google. -Kevin - Original Message - From: Randum Ian [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:38 AM Subject: [PHP] FTP Listings for HTML page Hi guys, I am maintaining a list of files on an FTP server and it would be great if I could get a very simple list of all the files and their directory names so I can generate a HTML page with the information. Is this doable? Randum Ian [EMAIL PROTECTED] DJ / Reviewer / Webmaster, DancePortal (UK) Limited DancePortal.co.uk - Global dance music media -- 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] newbie - decimal places in arthimetic functions
I'm sorry, posted the wrong link. It is the number_format() function. http://www.php.net/number_format - Original Message - From: Joseph W. Goff [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED]; Max Clark [EMAIL PROTECTED] Sent: Friday, December 13, 2002 1:31 PM Subject: Re: [PHP] newbie - decimal places in arthimetic functions You can use the format() function for this. http://www.php.net/format - Original Message - From: Max Clark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 1:10 PM Subject: [PHP] newbie - decimal places in arthimetic functions Hi- How can I control the decimal places returned by an arthimetic function? I would like this divsion function to only return two decimal places (rounded up). $calcsize = $value / $oneGig; Thanks in advance, Max -- 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] Question about if statement evaluating (0==string)as TRUE
I think this is happening because you're comparing apples to oranges. Your first comparison causes an integer to be compared to a string. Because the string string evaluates to the integer value 0, the comparison succeeds. The manual recommends the use of the identical comparison operator (===) instead, or--better yet--the strcmp() function when comparing two strings. Cheers, Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! ---BeginMessage--- Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 Is that becuase PHP is not properly comparing the numerical value with the string value? ? $no = 0; if ($no == string) { print this eval's to TRUE... since when is '0' == 'no' ?; } if ($no == string) { print whereas this eval's to FALSE, as you'd expect; } ? -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between 2 Dates
I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Question about if statement evaluating (0==string) as TRUE
When you define $no, you define it without quotes, so PHP assumes it is a numeral. What you're asking in your conditional statement is: Does the numeral 0 equal the integer evaluation of string. The answer is True. But when you put $no into quotes you cast it as a string. Now what you're asking is Does the string 0 equal the string string. The answer is False. -Kevin - Original Message - From: Scott Hurring [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 12:27 PM Subject: [PHP] Question about if statement evaluating (0==string) as TRUE Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 Is that becuase PHP is not properly comparing the numerical value with the string value? ? $no = 0; if ($no == string) { print this eval's to TRUE... since when is '0' == 'no' ?; } if ($no == string) { print whereas this eval's to FALSE, as you'd expect; } ? -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- -- 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
Fw: [PHP] Difference between 2 Dates
Oh dear. In what format are you storing the date in your database? If you can convert what you have into UNIX EPOCH then you can simply subtract your date against mktime(); then echo the result through getdate() and be done with it in three lines of code. -Kevin - Original Message - From: vernon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 12:43 PM Subject: [PHP] Difference between 2 Dates I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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] real password value
Hi all; do you know how to decrypt password('xxx'); value? For example I have a function that mails password to user's mail address but result is here; User Name: xjunky Password :1ef781ad7c4b0dc2 Thanks. I've inserted the password as password('$passw'); and selected as belove function notify_password($username,$email){ if (!($conn = db_connect())) return false; $result = mysql_query(select email,pass from site_members where User_Name='$username' and email='$email'); $email = mysql_result($result, 0, email); $password=mysql_result($result, 0, pass); $from = From: [EMAIL PROTECTED] \r\n; $mesg = User Name: $username\r\n .Password : $password \r\n .Thanks.\r\n; if (mail($email, Password Information, $mesg, $from)){ return true; }else{ return false; } } how to send the true value of th password? thanks everybody who cares with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] real password value
On Friday 13 December 2002 20:58, empty wrote: do you know how to decrypt password('xxx'); value? You can't do this. The only thing you could do is to send the User who lost his password a new one with an activation link. The new Password is saved somewhere else. Then the user clicks on the link and has a _new_ password. johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] real password value
The better strategy would be to generate a new random password and assign that as the password. MySQL's password function is one-way, meaning you can encrypt it, but not decrypt it. The way you test it is by taking what the user has entered, along with the salt, and encrypting that and seeing if it matches the stored, encrypted password. There is no way to decrypt it without brute forcing it. So just assign a new password and mail it to the user. Hope this helps. --Joseph Guhlin http://www.josephguhlin.com/ Was I helpful? Let others know: http://svcs.affero.net/rm.php?r=bahwi empty wrote: Hi all; do you know how to decrypt password('xxx'); value? For example I have a function that mails password to user's mail address but result is here; User Name: xjunky Password :1ef781ad7c4b0dc2 Thanks. I've inserted the password as password('$passw'); and selected as belove function notify_password($username,$email){ if (!($conn = db_connect())) return false; $result = mysql_query(select email,pass from site_members where User_Name='$username' and email='$email'); $email = mysql_result($result, 0, email); $password=mysql_result($result, 0, pass); $from = From: [EMAIL PROTECTED] \r\n; $mesg = User Name: $username\r\n .Password : $password \r\n .Thanks.\r\n; if (mail($email, Password Information, $mesg, $from)){ return true; }else{ return false; } } how to send the true value of th password? thanks everybody who cares with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Formatting
thanks for all the replies. I was able to use the date_format() from MySQL. Clint - Original Message - From: Rick Emery [EMAIL PROTECTED] To: Clint Tredway [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 1:13 PM Subject: Re: [PHP] Date Formatting MYSQL will do all the formatting that you need. Look up sect 6.3.4, Date and Time Functions in mysql manual. Look at the DATE_FORMAT(date,format) command - Original Message - From: Clint Tredway [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 11:55 AM Subject: [PHP] Date Formatting How can I format a date coming out of a MySQL? I know how to format today's date but not a date coming out of MySQL. I have looked through the manual, but I must be blind because I cannot figure it out. Thanks, Clint -- 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] Testing smtp server
Hi- I would like to open a connection to tcp port 25 (smtp) as a conditional in a script (if succeeds to this, else to that). I found the socket_create function that is listed as experimental and requires a re-compile of php. Is there a built in way to perform this kind of test? Thanks in advance, Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Testing smtp server
On Friday 13 December 2002 21:30, Max Clark wrote: I found the socket_create function that is listed as experimental and requires a re-compile of php. Is there a built in way to perform this kind of test? Based upon the second example on http://www.php.net/manual/en/ref.sockets.php : echo h2TCP/IP Connection/h2\n; /* Get the service for TCP-Port 25. */ $service_port = getservbyport (25, 'tcp'); /* Get the IP address for the target host. */ $address = gethostbyname ('www.example.com'); /* Create a TCP/IP socket. */ $socket = socket_create (AF_INET, SOCK_STREAM, 0); if ($socket 0) { echo socket_create() failed: reason: . socket_strerror ($socket) . \n; } else { echo OK.\n; } echo Attempting to connect to '$address' on port '$service_port'...; $result = socket_connect ($socket, $address, $service_port); if ($result 0) { echo socket_connect() failed.\nReason: ($result) . socket_strerror($result) . \n; } else { echo OK.\n; } johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java in PHP
Hi there. Question. How do you access a custom java class in php that has its own define packages? meaning when I access a java class in php the java class calls other classes to do the job. But when I call the class I get an error: java.lang.NoClassDefFoundError: CaseManager (wrong name: com/company/support/admin/CaseManager) Any thoughts? The Chaos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reloading page in frame after SQL Insert
Hi, I'm building a frameset based app which displays a list of pages. The left hand frame contains a list of pages, the middle frame has a New Page page. After the new page information is inserted into the DB, how can I get the left hand frame to refresh itself, to show the new page. It must be a combination of PHP and JavaScript? Thanks, Jim Johnson
Re: [PHP] Difference between 2 Dates
I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? On Friday, December 13, 2002, at 01:43 PM, vernon wrote: I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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] Difference between 2 Dates
Again the solution is to convert the dates into timestamps for easy comparison. In your case you can use the strtotime() function. I believe that -mm-dd is a standard date format that the function will recognize, is it not? $ts1 = strtotime($date1); $ts2 = strtotime($date2); if ($ts1 $ts2) { // .. blah blah blah. } -Kevin - Original Message - From: Colin Bossen [EMAIL PROTECTED] To: vernon [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 2:50 PM Subject: Re: [PHP] Difference between 2 Dates I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? On Friday, December 13, 2002, at 01:43 PM, vernon wrote: I found this code on the php.net web site but am new to php and can't figure out how to dispaly the difference once calucuated. Belowis the code I'm using: # --- Date Difference --- #Date 1 from MySQL database recordset row $date1 = $row_rsMESSAGES['privmsgs_date']; #Date 2 - now $date2 = date(ymd H:is); #function function date_diff($date1, $date2) { $s = strtotime($date2)-strtotime($date1); $d = intval($s/86400); $s -= $d*86400; $h = intval($s/3600); $s -= $h*3600; $m = intval($s/60); $s -= $m*60; return array(d=$d,h=$h,m=$m,s=$s); } #what I thought would dispaly the diffence but returns and error. echo date_diff($m, $d, $h, $m); Thanks -- 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] Shared Memory in PHP
Hi all, I am new to PHP and would like the expert opinion of this forum on something that I am trying to do I have about 500K entries (name,value pairs) for which I want ti implement a very fast lookup. I have access to an Oracle database server but I am afraid that it does not have any power to handle the volume. Instead I am thinking of loading these entries in shared memory on each (Apache) web server and look it up from my PHP script. (I have enough memory on the server to set aside enough shared memory area to hold these entries). Going through the PHP Documentation, I find 2 sets of functions: 1.shm_attach,shm_put_var,shm_get_var etc. 2. shmop_open,shmop_write,shmop_read etc. Which set of functions is the correct one to use (I am running PHP 4.1.x) Ideally, I'd like to implement a hash (to use a PERL term) in shared memory that is accessible from PHP. Is this proposed approach too outrageous? Any thoughts on this would be greatly appreciated. TIA Krishnan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
Colin, I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? Treat the dates as strings not numbers: $DateOne = 2002-12-13; $DateTwo = 2001-11-12; if ( $DateOne = $DateTwo ) echo DateOne comes first; You can do comparisons like this but don't try any 'arithmetic'! Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
On Fri, 13 Dec 2002, Colin Bossen wrote: I have a similar problem. I am trying to figure out which of two dates is greater. Both are in the -mm-dd format. Is there any easy function that allows this sort of comparison or am I missing something? You have a simpler problem. -mm-dd is the ISO format, and one of the reasons it is a great format is, you can sort it any way you like, and it just works. So the simplest way to do it is to compare strings in alphabetic order: if($a$b) echo $a earlier than $b\n; else echo $b earlier than $a\n; Cheers, Jean-Marc Libs -- Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat drinking beer all day. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Parse Syntax Error
I am working on an XML parser and trying to learn about them. All the scripts I get from the net in various tutorials and such all return nothing but XML error: syntax error at line 1. I checked the variables with PHPINFO() and it says that XML support is on. I also know that keeping the PHP up to date is not a priority around here as we are still on PHP3. Any thoughts on what this might be? Is the server jsut showing it's need for an update again? -tom here is one example of the code I am using: $xml_file = data.xml; echo table border=0 cellpadding=5; echo trth colspan=2XML Articles/th/tr; function startElement($parser_instance, $element_name, $attrs) { switch($element_name) { case URL :echo trtda href=\; break; case SUMMARY :echo td; break; } } function characterData($parser_instance, $xml_data) { echo $xml_data; } function endElement($parser_instance, $element_name) { switch($element_name) { case URL :echo \; break; case TITLE :echo /a/td; break; case SUMMARY :echo /td/tr; break; } } $parser = xml_parser_create(); xml_set_element_handler($parser, startElement, endElement); xml_set_character_data_handler($parser, characterData); if (!($filehandler = fopen($xml_file, r))) { die(could not open XML input); } while ($data = fread($filehandler, 4096)) { if (!xml_parse($parser, $data, feof($filehandler))) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } } fclose($filehandler); xml_parser_free($parser); echo /table; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: printf %d
- Original Message - From: William Martell [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Sent: Friday, December 13, 2002 2:13 PM Subject: printf %d Hello All. Can anyone tell me what this '%d' refers to? A pointer would be great. Thanks [snip] if (!$result) die (Query Failed\n); else printf (Number of rows returned: %d\nbrbr, -HERE '%d' mysql_num_rows ($result)); while ($query_data = mysql_fetch_array ($result)) { echo Part#: .$query_data[holman_part].br; echo Description: .$query_data[part_desc].brbrbr; } [/snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: PHP script needs to timeout upon FOPEN to URL
- Original Message - From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 5:13 PM Subject: PHP script needs to timeout upon FOPEN to URL I have the following line: while (!($file = @fopen(http://www.myurl.com;, r)) time() $startTime + $time); if (!$file){ echo Timed out, try again later; } else { // do stuff } Problem is, when it attempts to connect to the remote server, it's supposed to time out after 2-5 seconds, but it doesn't, it just locks up :( Any suggestions? Phil mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse out text
I have a form that is submitting a Javascript to validate fields before the form casn be submitted. The problem is that the field name has to be prefixed with required. So, if I have a field called email, it has to be called requiredemail in order for the javascript to work. How can I remove the required before the form is submitted? All I need is a hint... Thanks, Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between 2 Dates
I'm trying to do a mail function where if the date the email was posted was today then a new message would display, otherwise not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newer version of PHP causing code incompatibilities
All of our pages which were previously running on a PSA 2.5 server which were done in php used the syntax ? echo hello world; ?. In PSA 5 (or the different install of PHP) you must use the proper ?php hello world; ? syntax. We are now on PHP Version 4.1.2 Our server crashed and we have installed newer software, now most of the PHP does not work because of the above difference in coding. Is there any easy way of allowing the old code to run without having to rewrite thousands of lines of code??? Or any suggestions would be appreciated Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newer version of PHP causing code incompatibilities
Check out the php.ini configuration file, or read about it at the website. I do believe there is an option there where you can declare what your script delimeter is. Most notable an option called Short open tag HTH -Brad Paul Keenan wrote: All of our pages which were previously running on a PSA 2.5 server which were done in php used the syntax ? echo hello world; ?. In PSA 5 (or the different install of PHP) you must use the proper ?php hello world; ? syntax. We are now on PHP Version 4.1.2 Our server crashed and we have installed newer software, now most of the PHP does not work because of the above difference in coding. Is there any easy way of allowing the old code to run without having to rewrite thousands of lines of code??? Or any suggestions would be appreciated Thanks in advance -- 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] File Handles?
The following is a script from the php.net site for supposedly uploading files via ftp. My question is, why do we have to build handles, what is the purpose of creating this array? //Build handles for uploaded image $imageUpFile = $_FILES['photo_file']['tmp_name']; $imageType = $_FILES['photo_file']['type']; $imageName = $_FILES['photo_file']['name']; //Open the uploaded pic (temp file) if ($thePic = fopen ($imageUpFile, rb)) { //read temp file into var $savePic = fread($thePic, filesize($imageUpFile)); //Open a new file in the correct directory using the name of the uploaded pic file if ($fileHandle = fopen(ftp://username:password@put/directory/here/$imageName;, w)) { //Put data into just opened file pointer if (fwrite ($fileHandle, $savePic)) { echo file b$imageName/b successfully written; } else { echo file b$imageName/b was NOT written; } } fclose ($fileHandle); fclose ($thePic); } else { // The file was not created. Inform the user. echo (b The file: $imageUpFile could not be created!/b ); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Handles?
They aren't really handles (whatever a handle might be) they are simply copies of the data from the $_FILES array so you can use $imageName instead of $_FILES['photo_file']['name'] everywhere throughout the rest of the script. -Rasmus On Fri, 13 Dec 2002 [EMAIL PROTECTED] wrote: The following is a script from the php.net site for supposedly uploading files via ftp. My question is, why do we have to build handles, what is the purpose of creating this array? //Build handles for uploaded image $imageUpFile = $_FILES['photo_file']['tmp_name']; $imageType = $_FILES['photo_file']['type']; $imageName = $_FILES['photo_file']['name']; //Open the uploaded pic (temp file) if ($thePic = fopen ($imageUpFile, rb)) { //read temp file into var $savePic = fread($thePic, filesize($imageUpFile)); //Open a new file in the correct directory using the name of the uploaded pic file if ($fileHandle = fopen(ftp://username:password@put/directory/here/$imageName;, w)) { //Put data into just opened file pointer if (fwrite ($fileHandle, $savePic)) { echo file b$imageName/b successfully written; } else { echo file b$imageName/b was NOT written; } } fclose ($fileHandle); fclose ($thePic); } else { // The file was not created. Inform the user. echo (b The file: $imageUpFile could not be created!/b ); } -- 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] Parse out text
Hi, Saturday, December 14, 2002, 10:12:28 AM, you wrote: SM I have a form that is submitting a Javascript to validate fields before the SM form casn be submitted. The problem is that the field name has to be SM prefixed with required. So, if I have a field called email, it has to be SM called requiredemail in order for the javascript to work. SM How can I remove the required before the form is submitted? All I need is SM a hint... SM Thanks, SM Shane In php on the recieving end like this: $input_vars = array(); while(list($key,$var) = each($_POST)){ if(substr($key,0,7) == 'required'){ $key = substr($key,8); } $input_vars[$key] = $val; } Then use the values from $input_vars -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: Paging / Navigation Question Solved!
Thank you all for your input. Here is the answer that I was looking for. I am posting it here so that anyone else looking for this answer can benefit as well. Thank you all again for your responses. Merry Christmas!! William - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'William Martell' [EMAIL PROTECTED] Sent: Friday, December 13, 2002 6:03 AM Subject: RE: Paging / Navigation Question [snip] [snip] Or another way if you don't want a result when it's zero. $rslt = mysql_query(SELECT count(*) as cnt FROM tbl having cnt 0); [/snip] $result = mysql_query(SELECT * FROM tbl); $number_of_rows = mysql_num_rows($result); You don't have to do the count in the SQL, as John said earlier a SELECT COUNT(*) FROM tbl will always return one row, even if the value of the row is 0. Of course you could always test for that. CountingRows Solution #317 :^] I was reading your post regarding paging and SELECT COUNT(*) I don't understand why $number_of_rows will always equal 1. I thought that if you SELECT COUNT(*), that you are telling mySQL to count all of the rows WHERE some condition is met. Please explain??? [/snip] A COUNT query always returns one row, the row which explains how many records were counted. It is easier to understand if you know that a row is not necessarily equal to a record. For example, look at these count results from MySQL monitor; mysql SELECT COUNT(*) FROM tblSubscriber; +--+ | COUNT(*) | +--+ |71896 | +--+ 1 row in set (0.01 sec) See the last line? 1 row in set (0.01 sec) Of course this is not a record, for the record would have subscriber information over multiple columns. Let me know if this is clear. Thanks! jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php