Re: [PHP] Transferring files between computers using php
Rahul wrote: I have a small file to be transferred between two computers every few seconds. I'm using unix with a bare bones version of php, i.e. just the original thing that gets installed when I run "yum install php". As there is no webserver on any of these machines, I was wondering if there is a way to transfer a small file between them and if there is, could someone be kind enough to provide me with an example please? Thank You You can use netcat (nc), but that doesn't run in daemon mode. You can use them both ways (client / server, sending / receiving). You can use them on the commandline with a cronjob or whatever. Netcat makes it possible to do this, to send content over to port 2200 of 192.168.1.1: cat textfile.txt | nc 192.168.1.1 2200 On 192.168.1.1 all you do is something like this: nc -l -p 2200 > textfile.txt I don't know all the options in depth and may not work like scp does (which is way more secure). So I would go with scp in a cronjob, but netcat is still an option. -- Aschwin Wesselius What you would like to be done to you, do that to the other -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CVS Scripts
Thanks Chris and to everyone else who actually replied with some useful info, it's much appreciated. I am going to code this up myself with wrappers around the cvs commands I need. It would have been nice if there was some sort of framework for doing this already. The reason I joined this list was to try and get some helpful insights not to face a barrage of emails about my signature. OK so I sent a message with a signature I should have stripped out, big deal. Anyway, that's the end of the matter on the signature from me. Thanks again to all those who replied with constrictive comments. Cheers, Adrian. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: 07 March 2008 00:40 To: tedd Cc: php-general@lists.php.net Subject: Re: [PHP] CVS Scripts > If you want to ask, and have answered, a question that's important to > you, then consider asking it in a way that's respectful. That's > understandable, is it not? He did ask a question. "I would like to be able to automatically check projects out from a CVS repository using PHP rather than a traditional CVS client as part of a build process? Has anyone done this successfully before and if so can they point me in the right direction on how to go about this? " Out of 20-odd replies, 2 or 3 were actually helpful - the rest were complaining about his signature. -- Postgresql & php tutorials http://www.designmagick.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] Transferring files between computers using php
Aschwin Wesselius wrote: > Rahul wrote: >> I have a small file to be transferred between two computers every few >> seconds. I'm using unix with a bare bones version of php, i.e. just >> the original thing that gets installed when I run "yum install php". >> As there is no webserver on any of these machines, I was wondering if >> there is a way to transfer a small file between them and if there is, >> could someone be kind enough to provide me with an example please? >> >> Thank You > > You can use netcat (nc), but that doesn't run in daemon mode. You can > use them both ways (client / server, sending / receiving). You can use > them on the commandline with a cronjob or whatever. > > Netcat makes it possible to do this, to send content over to port 2200 > of 192.168.1.1: > > cat textfile.txt | nc 192.168.1.1 2200 > > On 192.168.1.1 all you do is something like this: > > nc -l -p 2200 > textfile.txt > > I don't know all the options in depth and may not work like scp does > (which is way more secure). > > So I would go with scp in a cronjob, but netcat is still an option. > > Here's overkill: use "fuse" to make two sshfs filesystems :) # Make some directories to mount the remote stuff onto mkdir -p mount_point_for_B mkdir -p mount_point_for_C # Use 'fuse' to make SSHFS mounts from the remotes to the new directories sshfs B:/path_to_where_the_file_ismount_point_for_B sshfs C:/path_to_where_the_file_goes mount_point_for_C # Copy the file across: repeat this step every few seconds (cron job?) cp mount_point_for_B/the_file_to_copy mount_point_for_C # Unmount the SSHFS mounts when you're finished fusermount -u mount_point_for_B fusermount -u mount_point_for_C Still not PHP though... -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transferring files between computers using php
Peter Ford wrote: Here's overkill: use "fuse" to make two sshfs filesystems :) # Make some directories to mount the remote stuff onto mkdir -p mount_point_for_B mkdir -p mount_point_for_C # Use 'fuse' to make SSHFS mounts from the remotes to the new directories sshfs B:/path_to_where_the_file_ismount_point_for_B sshfs C:/path_to_where_the_file_goes mount_point_for_C # Copy the file across: repeat this step every few seconds (cron job?) cp mount_point_for_B/the_file_to_copy mount_point_for_C # Unmount the SSHFS mounts when you're finished fusermount -u mount_point_for_B fusermount -u mount_point_for_C That's overkill indeed and can make for some cool flaws on you filesystem too. When an unmount won't succeed the next execution via cron will fail since the mount point already exists etc. Every few seconds an update over to 2 systems is somehow weird. I think it is very intensive and like I said if somehow one part of the syncing 'hangs', it can fill memory or bandwidth very quickly. So, I can't still figure out what has to be done over to these computers every minute or whatever. The situation is not really clear to me. -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
Re: [PHP] CVS Scripts
On Fri, Mar 7, 2008 at 3:58 AM, Adrian Walls <[EMAIL PROTECTED]> wrote: > I am going to code this up myself with wrappers around the cvs commands I > need. Good luck! Sounds like that might be the best solution since you have such specific needs. The whole signature thing was just some friendly prodding because I see them all over the place. I just happened to be between things at work enough to waste some time on it. I even threw in the ;) to hopefully get that across. :) I'd better stop typing now before tedd counts my bytes. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transferring files between computers using php
Peter Ford wrote: > Aschwin Wesselius wrote: >> Rahul wrote: >>> I have a small file to be transferred between two computers every few >>> seconds. I'm using unix with a bare bones version of php, i.e. just >>> the original thing that gets installed when I run "yum install php". >>> As there is no webserver on any of these machines, I was wondering if >>> there is a way to transfer a small file between them and if there is, >>> could someone be kind enough to provide me with an example please? >>> >>> Thank You >> You can use netcat (nc), but that doesn't run in daemon mode. You can >> use them both ways (client / server, sending / receiving). You can use >> them on the commandline with a cronjob or whatever. >> >> Netcat makes it possible to do this, to send content over to port 2200 >> of 192.168.1.1: >> >> cat textfile.txt | nc 192.168.1.1 2200 >> >> On 192.168.1.1 all you do is something like this: >> >> nc -l -p 2200 > textfile.txt >> >> I don't know all the options in depth and may not work like scp does >> (which is way more secure). >> >> So I would go with scp in a cronjob, but netcat is still an option. >> >> > > Here's overkill: use "fuse" to make two sshfs filesystems :) > > # Make some directories to mount the remote stuff onto > mkdir -p mount_point_for_B > mkdir -p mount_point_for_C > > # Use 'fuse' to make SSHFS mounts from the remotes to the new directories > sshfs B:/path_to_where_the_file_ismount_point_for_B > sshfs C:/path_to_where_the_file_goes mount_point_for_C > > # Copy the file across: repeat this step every few seconds (cron job?) > cp mount_point_for_B/the_file_to_copy mount_point_for_C > > # Unmount the SSHFS mounts when you're finished > fusermount -u mount_point_for_B > fusermount -u mount_point_for_C > > > Still not PHP though... > > > Easier in a cron: scp [EMAIL PROTECTED]:/path/file /tmp/ scp /tmp/file [EMAIL PROTECTED]:/path/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transferring files between computers using php
On Thu, March 6, 2008 7:58 pm, Rahul wrote: > I have a small file to be transferred between two computers every few > seconds. Use rsync -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Transferring files between computers using php
On Thu, March 6, 2008 11:10 pm, Chris wrote: > >> If ssh keys are installed on the remote hosts then scp works >> transparently and you just stick the scp in a cron job. Am I >> missing >> something? > > Yeh - looks like you have to log in to "A" and then it uses > key-forwarding to let you log in to "B" and "C": > > --- > To login to B and C I should use A because it has a SSH key. I don't > have any other way of accessing these two computers. > --- > > ie B & C can't talk to each other directly (that's my understanding > anyway). Scenario #1: B&C can't talk for a reason. Ergo, you SHOULD use A as a go-between Scenario #2: B&C could talk if you wanted them to. Install SSH key-pairs on B&C and then use rsync over SSH There's still no PHP involved, really... Maybe there should be, in that the two programs should, perhaps, expose something as web services via RCP, REST, or SOAP, but not from what has been explained so far... @OP: Please give us the "big picture" of what B&C are doing, and what info needs to go back and forth. This could change the answers dramatically. Or not. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to measure memory leakage/usage in PHP?
On Wed, March 5, 2008 9:57 pm, Zareef Ahmed wrote: >I am looking into the concepts behind memory management in PHP. > Which > kind of approach will be best to measure memory leakage or usage in a > PHP > script? > > I can measure my apache process but is there any way by which I can > know > which exact part of script is consuming how much memory? valgrind is an excellent tool for this sort of thing. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Universaly Accepted Naming Conventions..?
On Wed, March 5, 2008 1:06 pm, John Papas wrote > Are there any in PHP? > > It seems like there are those that draw upon the C/unix naming > conventions and those that follow the Java/OO style. There are several popular "standards" out there. The PEAR coding standard and the Zend one tend to get mentioned a lot. The most important thing is to be consistent yourself, rather than to follow a specific standard. Anybody halfway decent can follow what you did if you are consistent. > Even PHP's native syntax (like function names pre/post v5) are not > consistent. They ARE consistent with the underlying libraries, which is more important, really, because that means you don't have to waste hours figuring out what PHP did to shoe-horn the other library's functions into some other system. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pear Installation Problem - Ubuntu
SPM decided to move stuff to a different place, namely inside of a /usr/share/php/PEAR directory, instead of just /usr/share/PEAR. So change your include path and be done with it. On Wed, March 5, 2008 11:59 am, Stephen wrote: > My LAMP is on Ubuntu 7.10 > > I am trying to use PEAR, for the first time, and get an error about > the > include file not being found. > > It is not there. > > phpinfo() has include_path set to .:/usr/share/php:/usr/share/pear > > Here is my error: > > Warning: require_once(HTML/QuickForm.php) [function.require-once]: > failed to open stream: No such file or directory in > /home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3 > > Fatal error: require_once() [function.require]: Failed opening > required > 'HTML/QuickForm.php' (include_path='.:/usr/share/php:/usr/share/pear') > in /home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3 > > Now I have always just used the Synaptic Package Manager, and I just > did > a reinstall of PEAR. > > But there is no /usr/share/pear directory. > > I have a /usr/share/php/PEAR and it has things that look like > installation files. > > I am venturing where I have not before. I have never performed any > kind > of CLI install. > > Can anyone help me figure out how to get the installation fixed? > > Thanks > Stephen > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving URL after redirect?
On Wed, March 5, 2008 11:18 am, Skip Evans wrote: > "shortname", in this case "madison", and then sets > a session variables for school ID that allows the > user to access this school's data. > > Then it redirects back to > > http://prepcube.com/ Don't redirect to this. Your session data has "wi/madison" in it, redirect to that: header("Location: http://precube.com/$_SESSION[state]/$_SESSION[shortname]";); -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CVS Scripts
At 8:05 AM -0500 3/7/08, Eric Butera wrote: On Fri, Mar 7, 2008 at 3:58 AM, Adrian Walls <[EMAIL PROTECTED]> wrote: I am going to code this up myself with wrappers around the cvs commands I need. Good luck! Sounds like that might be the best solution since you have such specific needs. The whole signature thing was just some friendly prodding because I see them all over the place. I just happened to be between things at work enough to waste some time on it. I even threw in the ;) to hopefully get that across. :) I'd better stop typing now before tedd counts my bytes. :( Hey, don't jump bad on my ass, I was just commenting about the point you raised. :-) I think this got out of hand anyway -- public apologies to anyone who took offense. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Preserving URL after redirect?
On Thu, March 6, 2008 6:42 am, Jochem Maas wrote: > big boys use mod_rewrite, go grab a kilt :-) If mod_rewrite gives you the willies... You don't really NEED it here... Just don't create /wi/* directories, and use $_SERVER['PATH_INFO'] instead. Store all the school data somewhere else, and let the PHP/AJAX spew it out as needed based on the URL, with only an index.php file running the whole site. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagerotate
On Wed, March 5, 2008 11:17 am, Zeshan Uddin wrote: > * > Code for rotate.php > > // File and rotation > $filename = 'image.png'; > $degrees = 18; > > // Content type > header('Content-type: image/png'); > > // Load > $source = imagecreatefrompng($filename); > > // Rotate > $rotate = imagerotate($source, $degrees, 0); This line does the actual rotation, and, along with $degrees = 18, is all you need to add to the other script. > > // Output > imagepng($rotate); > ?> > > > > Code for resize.php > > $src_img = imagecreatefrompng('image.png'); > $srcsize = getimagesize('image.png'); > > $dest_x = 200; > $dest_y = (200 / $srcsize[0]) * $srcsize[1]; > $dst_img = imagecreatetruecolor($dest_x, $dest_y); > > imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, > $dest_x, $dest_y, $srcsize[0], $srcsize[1]); You can add them here, after the image is resized, and you are done. > header("content-type: image/png"); > > imagepng($dst_img); > imagedestroy($src_img); > imagedestroy($dst_img); > ?> > > > thanks > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array questions...
On Wed, March 5, 2008 9:35 am, Robert Cummings wrote: No textbook, but here's some advice... Think of a variable like a house address for an actual house. 123 Maple Street An array is just an apartment building: 125 Maple Street, Unit 1 125 Maple Street, Unit 2 125 Maple Street, Unit 3 . . . When you want to talk about the whole array (building) you can use just the street address. If you want a specific unit, you have to add the [$unit] part. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable post as array
Are you really using temp_name when you want tmp_name? On Wed, March 5, 2008 4:37 am, Pieter du Toit wrote: > Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it > tells > me that temp_name is also an array, but when i echo > $_FILES['txtPhoto']['name'] it gives me the correct name. Also with a > vardump i can see that temp name is ["tmp_name"]=> string(14) > "/tmp/phplR1WSl" and not an array by itself. > > Im going crazy here > > ""Pieter du Toit"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hi >> >> I have this weird problem, when i select a file to upload, the >> variable >> arrives as an array at the action php file, this is the code, and >> the >> variable name is txtPhoto >> >> >> >> >> >> >> >> Specials Update >> >> >> >> >> >> > >> echo "> name=\"Edit >> Special\" action=\"specials_proc.php\">\n"; >> >> echo "> value=\"$g_client_id\">"; >> >> echo "> value=\"$special\">"; >> >> echo "> value=\"$k_subsystem_id\">"; >> >> echo "> cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">\n"; >> >> >> >> if ($special != "") >> >> { >> >> $new = 0; >> >> echo "Edit >> Special\n"; >> >> $result = mysql("zululandcoza", "select * from client_specials where >> client_id = $g_client_id and special = $special"); >> >> if (list($client_id, $special, $description, $special_type, $price, >> $discount, $startdate, $enddate) = mysql_fetch_row($result)) >> >> { >> >> } >> >> } >> >> else >> >> { >> >> $new = 1; >> >> echo "New Special (this >> page is >> undergoing maintenance, please try again later)\n"; >> >> $result = mysql("zululandcoza", "select max(special) from >> client_specials >> where client_id = $client_id"); >> >> if (list($max_special) = mysql_fetch_row($result)) >> >> { >> >> $special = $max_special + 1; >> >> } >> >> } >> >> >> >> echo "\n"; >> >> echo " > class=\"Prompt\">Special Number\n"; >> >> if ($new) >> >> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\" >> value=\"$special\">\n"; >> >> else >> >> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\" value=\"$special\" >> enabled=\"0\">\n"; >> >> echo "\n"; >> >> echo "\n"; >> >> echo " Description\n"; >> >> echo " > name=\"txtDescription\" maxlength=\"200\" size=\"50\" >> value=\"$description\">\n"; >> >> echo "\n"; >> >> echo "\n"; >> >> echo " > class=\"Prompt\">Special Type\n"; >> >> echo " \n"; >> >> $optPRICE = ""; >> >> $optDISC = ""; >> >> $optFROM = ""; >> >> if ($special_type == "FROM") >> >> $optFROM = " SELECTED"; >> >> elseif ($special_type == "DISC") >> >> $optDISC = " SELECTED"; >> >> else >> >> $optPRICE = " SELECTED"; >> >> echo " \n"; >> >> echo " Special Price\n"; >> >> echo " Discount %\n"; >> >> echo " From\n"; >> >> echo " \n"; >> >> echo " \n"; >> >> echo "\n"; >> >> echo "\n"; >> >> echo " Price\n"; >> >> echo " > name=\"txtPrice\" maxlength=\"20\" size=\"10\" >> value=\"$price\">\n"; >> >> echo "\n"; >> >> if ($k_subsystem_id == 2) >> >> { >> >> if (! $new) >> >> { >> >> echo "\n"; >> >> echo " Current Photo\n"; >> >> echo " > src=\"showpic.php?keySystem_Id=2&keyClient_Id=$g_client_id&keySpecial=$special\">\n"; >> >> echo "\n"; >> >> } >> >> echo "\n"; >> >> echo " New Photo\n"; >> >> echo " > name=\"txtPhoto\" size=\"50\">\n"; >> >> echo "\n"; >> >> } >> >> echo "\n"; >> >> echo " \n"; >> >> if ($new) >> >> { >> >> echo " > value=\"Add\"> \n"; >> >> } >> >> else >> >> { >> >> echo " > value=\"Update\"> \n"; >> >> echo " > value=\"Delete\"> \n"; >> >> } >> >> echo " > value=\"Cancel\">\n"; >> >> echo " \n"; >> >> echo "\n"; >> >> echo "\n"; >> >> echo "\n"; >> >> ?> >> >> >> >> >> >> >> >> >> >> >> >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logging session timeout in DB
On Wed, March 5, 2008 2:08 am, Angelo Zanetti wrote: > I am implementing a system where when a user is logged in and out that > a > date time is set in a database for each action for each used. We can > then > trace who logged in a and when. > > No what I would like to know is how can I record when a user closes > the > browser or the session expires? There is no action for these items. So > what > would the best way be to keep a record of this? Would the use of a > cron job > be appropriate? I read in the archives that the banks use javascript > but I > don't want to go that route. > > If anyone has any idea how to do this please let me know, thanks in > advance. There is no way to know when they quit/closed the browser or even just walked away and let the session time out. But you *CAN* easily log the last time they accessed any page, by adding something like: $query = "update user_profile set last_access = now()"; $access = mysql_query($query, $connection); if (!$access){ //error handling here } So you'll know the last time they actually DID anything, which is probably more interesting than recording when they closed the browser if they were looking at some other tab anyway. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating mysql bound date
Something like this, perhaps: preg_match('/^((19|20)[0-9]{2})-([0-1]?[0-9])-([0-3]?[0-9])$/', $input, $date_parts); var_dump($date_parts); This doesn't completely rule out bogus dates such as 2008-02-30 however. I think MySQL would just convert that to MAR 1, 2008 anyway... But if you want that degree of comparison: list(,$year, $month, $day) = $date_parts; $unix = mktime(1, 0, 0, $month, $day, $year); list($y, $m, $d) = date('Y-m-d', $unix); if ($year != $y || $month != $m || $day != $d){ //handle invalid date input here } If you do all of that (which is really 5 lines of code) you should be pretty sure it's a correct/valid date. On Tue, March 4, 2008 10:12 pm, Larry Brown wrote: > Thanks, > > I ended up doing: > > $incomingQuestDatePieces = explode("-", $incomingQuestDate ); > > if(checkdate($incomingQuestDatePieces[1],$incomingQuestDatePieces[2], > $incomingQuestDatePieces[0])) > { > return true; > } > else > { > return false; > } > > > I was just wondering since a lot of people have to verify correct > format > of the date when working with mysql that there might be some built in > that is faster etc. > > Thanks though... > > On Wed, 2008-03-05 at 14:34 +1100, Chris wrote: >> Larry Brown wrote: >> > Its been a long week already... -MM-DD. >> > >> > On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: >> >> Does anyone know if there is a builtin function for checking the >> >> formatting of an incoming date to verify it is /MM/DD. I >> know how >> >> to convert between formats but want a quick way to check an >> incoming >> >> variable to ensure it will be handled properly by mysqld. >> >> I normally provide dropdown fields for each (except the year which >> is a >> text-field) and put it together how I need it. Validate each part >> separately and you're off and racing. >> >> If you accept any date you'll probably have to split it up first but >> the >> principles will be the same. >> >> >> $date = '-00-00'; >> // if they didn't use exactly two dashes? invalid >> if (substr_count($date, '-') !== 2) { >>die("Invalid date"); >> } >> >> list($year, $month, $day) = explode('-', $date); >> if (strlen($year) != 4) { >>die("Invalid year"); >> } >> >> >> and so on. >> > -- > Larry Brown <[EMAIL PROTECTED]> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions question
The + requires at least one character. The * is "0 or more" characters. http://php.net/pcre On Wed, March 5, 2008 9:13 am, It Maq wrote: > Hi, > > I am using that right now and i have don't know how to include blank > fields. For example if a user does not fill a field in a form i want > to accept it. I tried the code you posted, for now it is blocking > blank fields. > > Thank you > > - Original Message > From: Richard Lynch <[EMAIL PROTECTED]> > To: Adil Drissi <[EMAIL PROTECTED]> > Cc: php-general@lists.php.net > Sent: Tuesday, March 4, 2008 3:09:09 PM > Subject: Re: [PHP] regular expressions question > > On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: >> Is there any way to limit the user to a set of characters for >> example >> say i want my user to enter any character between a and z (case >> insensitive). And if the user enters just one letter not belonging >> to >> [a-z], this will not be accepted. >> >> I tried eregi('[a-z]', $fname) but this allows the user to enter >> abdg4512kdkdk for example. > > What you tried only requires ONE a-z character somewhere in the input. > > Try this: > > preg_match('^[a-z]+$', $fname); > > This will: > ^ "anchor" the string at the beginning > [a-z]+ a to z, with at least one letter > $ "anchor" the string at the end > > Note, however, that some people have other characters in their first > name, such as apostrophe, space, and dash. > > Oh, and the digit 3, for "bo3b" who was a programmer on the first > Apple Macintosh. His parents were hippies, and that really is his > name... > > You may want to obtain a LARGE list of "first names" and run them > through your validator as a test. > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/from/lynch > Yeah, I get a buck. So? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hot job opportunity - Sr. Software Developer/Architect
On Thu, February 28, 2008 10:39 am, Nick Gasparro wrote: > I have an immediate need for a Sr. Developer/Architect; with one of > Denver's > Best employers. They are a Web 2.0 company, rapidly growing and very > profitable. They will pay top compensation and provide relocation > assistance for the right person. It is customary for geographically-challenged job postings to include the location in the subject. Thanks! -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SESSIOn when cookies are disabled
Hi all how can we manage session variables when cookies are disabled. -- Have A pleasant Day Chetan. D. Rane Location: India Contact: +91-9986057255 other ID: [EMAIL PROTECTED] [EMAIL PROTECTED]
Re: [PHP] SESSIOn when cookies are disabled
On Fri, Mar 7, 2008 at 1:15 PM, chetan rane <[EMAIL PROTECTED]> wrote: > Hi all > > how can we manage session variables when cookies are disabled. You can send the request with an appended PHPSESSID. RTFM: http://us.php.net/session -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SESSIOn when cookies are disabled
> Date: Fri, 7 Mar 2008 23:45:51 +0530> From: [EMAIL PROTECTED]> To: > php-general@lists.php.net> Subject: [PHP] SESSIOn when cookies are disabled> > > Hi all> > how can we manage session variables when cookies are disabled.> > > -- > Have A pleasant Day> Chetan. D. Rane> Location: India> Contact: > +91-9986057255> other ID: [EMAIL PROTECTED]> [EMAIL PROTECTED] pass the session id in the URL or add it as a hidden field Bastien _
Re: [PHP] SESSIOn when cookies are disabled
Thank you very much its worked great!!! On Fri, Mar 7, 2008 at 11:50 PM, Bastien Koert <[EMAIL PROTECTED]> wrote: > > > Date: Fri, 7 Mar 2008 23:45:51 +0530> From: [EMAIL PROTECTED]> To: > php-general@lists.php.net> Subject: [PHP] SESSIOn when cookies are > disabled> > Hi all> > how can we manage session variables when cookies are > disabled.> > -- > Have A pleasant Day> Chetan. D. Rane> Location: India> > Contact: +91-9986057255> other ID: [EMAIL PROTECTED]> > [EMAIL PROTECTED] > > > pass the session id in the URL or add it as a hidden field > > > Bastien > _ > > -- Have A pleasant Day Chetan. D. Rane Location: India Contact: +91-9986057255 other ID: [EMAIL PROTECTED] [EMAIL PROTECTED]
[PHP] programming and design fees
hi, maybe my question is not exactly for php list, but since php IS involved and since you are such a great people, I hope the question will not disturb you :D I have a project for one electric wholesale store to build a web site. it has to be dynamic, php, database driven web site. it will have "standard" pages (news, links, about us, history, contact us, contact form, faq, business partners,...) and product catalog. my client wants to have ability to have different prices for the same product for different customers. means, when you come to the site you are going to see "public" prices. after customer logs in he's going to see some products with different price. customers (only registered ones) will be able to select products and create an order. of course, after he submits, he's going to get confirmation email, and one email will be sent to store etc. payment is not involved, the store will charge them later, probably monthly or something like that (not part of my project). even there is not payments or any other sensitive data will be transfered over the internet, I suggested and the store owner accepted to use login to membership area and ordering process SSL. project has administration area too to change content of the site, add/edit/delete (single) products, add/edit/delete customers. I have to build also script to update products using excel sheet - the easiest way to make update of products for store owner. I think I covered almost everything. there will be some more stuff, but noghtin "critical" (new customer registration page, manage my profile, order history,...) now, I didn't have such a big project "on side" ever. and I by default ALWAY suck in calculations how much time I need for a project and what to charge. I think I need about 120 hrs (3 weeks) to build this baby (without design part). I need your opinion. is it enough time (yes, I know it depends of how fast I program :D Let's say, average fast :)) and what are fees these days for such a project? I lost track. $75/hr is lowest price today or I can't ask more than $50/hr? thanks for any advice/help. -lamp - Never miss a thing. Make Yahoo your homepage.
Re: [PHP] programming and design fees
Lamp Lists wrote: > now, I didn't have such a big project "on side" ever. and I by default > ALWAY suck in calculations how much time I need for a project and what > to charge. I think I need about 120 hrs (3 weeks) to build this baby > (without design part). I need your opinion. is it enough time (yes, I > know it depends of how fast I program :D Let's say, average fast :)) > and what are fees these days for such a project? I lost track. $75/hr > is lowest price today or I can't ask more than $50/hr? You can ask whatever you want as long as your customer thinks it's reasonable. (not a joke). Given that you're an individual bidding on a single project, you might want to consider fixed price instead of time and materials. As for estimates wrt time and effort - if those were available on a mailing-list based on about 30 lines of project description, this list would be full of project managers, all with desperate needs to estimate how long takes. :-) /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating mysql bound date
Doesn't checkdate() do the sanity check for a valid date? On Fri, 2008-03-07 at 10:08 -0600, Richard Lynch wrote: > Something like this, perhaps: > > preg_match('/^((19|20)[0-9]{2})-([0-1]?[0-9])-([0-3]?[0-9])$/', > $input, $date_parts); > var_dump($date_parts); > > This doesn't completely rule out bogus dates such as 2008-02-30 however. > > I think MySQL would just convert that to MAR 1, 2008 anyway... > > But if you want that degree of comparison: > > list(,$year, $month, $day) = $date_parts; > $unix = mktime(1, 0, 0, $month, $day, $year); > list($y, $m, $d) = date('Y-m-d', $unix); > if ($year != $y || $month != $m || $day != $d){ > //handle invalid date input here > } > > If you do all of that (which is really 5 lines of code) you should be > pretty sure it's a correct/valid date. > > On Tue, March 4, 2008 10:12 pm, Larry Brown wrote: > > Thanks, > > > > I ended up doing: > > > > $incomingQuestDatePieces = explode("-", $incomingQuestDate ); > > > > if(checkdate($incomingQuestDatePieces[1],$incomingQuestDatePieces[2], > > $incomingQuestDatePieces[0])) > > { > > return true; > > } > > else > > { > > return false; > > } > > > > > > I was just wondering since a lot of people have to verify correct > > format > > of the date when working with mysql that there might be some built in > > that is faster etc. > > > > Thanks though... > > > > On Wed, 2008-03-05 at 14:34 +1100, Chris wrote: > >> Larry Brown wrote: > >> > Its been a long week already... -MM-DD. > >> > > >> > On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: > >> >> Does anyone know if there is a builtin function for checking the > >> >> formatting of an incoming date to verify it is /MM/DD. I > >> know how > >> >> to convert between formats but want a quick way to check an > >> incoming > >> >> variable to ensure it will be handled properly by mysqld. > >> > >> I normally provide dropdown fields for each (except the year which > >> is a > >> text-field) and put it together how I need it. Validate each part > >> separately and you're off and racing. > >> > >> If you accept any date you'll probably have to split it up first but > >> the > >> principles will be the same. > >> > >> > >> $date = '-00-00'; > >> // if they didn't use exactly two dashes? invalid > >> if (substr_count($date, '-') !== 2) { > >>die("Invalid date"); > >> } > >> > >> list($year, $month, $day) = explode('-', $date); > >> if (strlen($year) != 4) { > >>die("Invalid year"); > >> } > >> > >> > >> and so on. > >> > > -- > > Larry Brown <[EMAIL PROTECTED]> > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- Larry Brown <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie - Undefined Index Variable
I have this: page1';}else{print 'page2';} ?> I will get the error: Notice: Undefined index: nowtoctype in ... If the variable has not yet been defined... Is there a way to check if this var is already defined? ... (and then I can define it - if not) -- Thanks - RevDave Cool @ hosting4days . com [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - Undefined Index Variable
On Fri, Mar 7, 2008 at 2:59 PM, revDAVE <[EMAIL PROTECTED]> wrote: > I have this: > > > {print 'page1';}else{print 'page2';} ?> > > I will get the error: > > Notice: Undefined index: nowtoctype in ... Check out isset(): http://php.net/isset Page 1\n"; } else { echo "Page 2\n"; } ?> -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Posting Summary for Week Ending 7 March, 2008: php-general@lists.php.net
Posting Summary for PHP-General List Week Ending: Friday, 7 March, 2008 Messages| Bytes | Sender ++-- 378 (100%) 575642 (100%) EVERYONE 38 (10.1%) 55696 (9.7%) Richard Lynch 27 (7.1%) 25479 (4.4%) tedd 25 (6.6%) 24503 (4.3%) Daniel Brown 16 (4.2%) 23389 (4.1%) Jochem Maas 14 (3.7%) 12495 (2.2%) Chris 14 (3.7%) 27449 (4.8%) Shawn McKenzie 12 (3.2%) 21000 (3.6%) Eric Butera 9 (2.4%) 12466 (2.2%) Wolf 9 (2.4%) 30276 (5.3%) Pieter du Toit 9 (2.4%) 19573 (3.4%) Larry Brown 9 (2.4%) 13238 (2.3%) Stut 8 (2.1%) 12328 (2.1%) Thiago Pojda 8 (2.1%) 19894 (3.5%) Ray Hauge 7 (1.9%) 14455 (2.5%) Nathan Nobbe 7 (1.9%) 9108(1.6%) Jim Lucas 7 (1.9%) 16041 (2.8%) Svevo Romano 6 (1.6%) 4078(0.7%) Stephen 6 (1.6%) 7143(1.2%) Aschwin Wesselius 6 (1.6%) 9885(1.7%) Jason Pruim 5 (1.3%) 4865(0.8%) Steve Finkelstein 5 (1.3%) 9204(1.6%) Richard 5 (1.3%) 8489(1.5%) Zareef Ahmed 5 (1.3%) 12086 (2.1%) Angelo Zanetti 4 (1.1%) 4845(0.8%) Colin Guthrie 4 (1.1%) 9888(1.7%) David Sveningsson 4 (1.1%) 6709(1.2%) Zoltán Németh 4 (1.1%) 2936(0.5%) Greg Donald 4 (1.1%) 3273(0.6%) Richard Heyes 4 (1.1%) 5909(1%)Robert Cummings 4 (1.1%) 6429(1.1%) Adrian Walls 4 (1.1%) 3747(0.7%) movies at biblescramble dot com 4 (1.1%) 5956(1%)Nathan Rixham 3 (0.8%) 3089(0.5%) gary liang 3 (0.8%) 5751(1%)Skip Evans 3 (0.8%) 1448(0.3%) Jay Blanchard 3 (0.8%) 2596(0.5%) Bastien Koert 3 (0.8%) 3725(0.6%) chetan rane 3 (0.8%) 10005 (1.7%) Andrés Robinet 3 (0.8%) 5954(1%)Bojan Tesanovic 2 (0.5%) 2291(0.4%) Adil Drissi 2 (0.5%) 1688(0.3%) Louie Miranda 2 (0.5%) 2652(0.5%) Ben Edwards 2 (0.5%) 1505(0.3%) Per Jessen 2 (0.5%) 1515(0.3%) Brice 2 (0.5%) 1131(0.2%) David Giragosian 2 (0.5%) 2784(0.5%) Ford, Mike 2 (0.5%) 1313(0.2%) Al 2 (0.5%) 1009(0.2%) Ron Piggott 2 (0.5%) 1550(0.3%) Shelley 2 (0.5%) 5783(1%)Rahul 2 (0.5%) 2278(0.4%) Dave M G 1 (0.3%) 540 (0.1%) Rahul 1 (0.3%) 3042(0.5%) Andrés Robinet 1 (0.3%) 1547(0.3%) Zeshan Uddin 1 (0.3%) 2002(0.3%) It Maq 1 (0.3%) 2038(0.4%) M dot Sokolewicz 1 (0.3%) 3045(0.5%) Traina Vigoren 1 (0.3%) 2358(0.4%) Lamp Lists 1 (0.3%) 470 (0.1%) Mark Wiesemann 1 (0.3%) 882 (0.2%) Manuel Lemos 1 (0.3%) 326 (0.1%) John Papas 1 (0.3%) 2990(0.5%) Deroberts Chorney 1 (0.3%) 2011(0.3%) Peter Ford 1 (0.3%) 293 (0.1%) Joey 1 (0.3%) 1973(0.3%) Jonathan Pitcher 1 (0.3%) 3001(0.5%) Dunwoody Poetker 1 (0.3%) 1778(0.3%) Frank Arensmeier 1 (0.3%) 538 (0.1%) revDAVE 1 (0.3%) 2505(0.4%) Casey 1 (0.3%) 494 (0.1%) Edward Kay 1 (0.3%) 636 (0.1%) Dani Castaños 1 (0.3%) 1289(0.2%) David Robley 1 (0.3%) 2250(0.4%) Nuno Mendes 1 (0.3%) 1656(0.3%) Jed Reynolds 1 (0.3%) 611 (0.1%) Rick Pasotto 1 (0.3%) 10027 (1.7%) PostTrack [Dan Brown] 1 (0.3%) 2955(0.5%) Satyam 1 (0.3%) 1173(0.2%) Erik SJMN 1
[PHP] Generating JavaScript menus on-the-fly
Hey - - -- - -- -- I keep a profile of a user's rights and responsibilities in tables. Since this profile defines what a user can do in the system I am designing, I'd like to build a JavaScript menu navigation scheme. I need it to be driven programmatically, because the Admin users can add and remove tasks to the system or to a given user at-will. I already built a similar thing using CSS-only menus, but it just wasn't aesthetically flexible enough. I am exploring other options, but I am wondering if any of you have done something similar and have any samples or advice. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Deprecated configure options
Was just upgrading to 5.2.5 and used the same configure line as I used for 5.2.0. Got the following notice: "Notice: Following unknown configure options were used: --enable-pic --with-dom --with-png --with-xml --enable-track-vars --enable-trans-sid --enable-yp --enable-mbstr-enc-trans --enable-dio --enable-mcal --with-jpeg" Safe to assume those were deprecated? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php