Re: [PHP] ZCE Reccommendations
Chris Shiflett wrote: hitek wrote: I'm taking my ZCE exam soon and would like general advice on what to study up on. This is a good resource: http://zend.com/store/education/certification/zend-php-certification-objectives.php You picked a good month to take the exam, since it's $125 this month (normally $200). Chris Thanks for the tip. For the record, I passed :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ZCE Reccommendations
Hey yall, I'm taking my ZCE exam soon and would like general advice on what to study up on. I've been using php since 97 so I'm pretty confident with day-today stuff, but I'm pretty new to OOP and and looking for any study pointers I can get. Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ZCE Reccommendations
Scott Noyes wrote: I'm taking my ZCE exam soon and would like general advice on what to study up on. I've been using php since 97 so I'm pretty confident with day-today stuff, but I'm pretty new to OOP and and looking for any study pointers I can get. Remember that the ZCE still uses PHP 4. Classes and objects changed between versions 4 and 5. If you've done some development in 5 and gotten used to it, study carefully the differences between the two. Good point. I switched over to php 5 about 6 months ago, so I guess I'll freshen up on php 4. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir, Shared Hosting?
More than likely, your host has safe mode on. Safe mode is a pain in the ass if you need to create directories or write to files, but seems to be the defacto standard for shared hosts using php. [EMAIL PROTECTED] wrote: Thanks, but I've tried that when I first got the Error message, it still gave me the error. Thanks though! In a message dated 8/7/2005 1:29:26 A.M. Central Standard Time, [EMAIL PROTECTED] writes: Open up your FTP client and log into your website, then change the permissions on your folder so that the apache process has write access to it. Its really hit and miss depending on your setup. The sure fire way (but highly insecure) way is to change the permissions to the directory in question to 777. A better solution would be 755, but it may not work. Try it, and see what you get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
This isn't *quite* editing, but I have had success using FPDF (http://www.fpdf.org/) for PDF generation. There is an extension class called FPDI (http://fpdi.setasign.de/) that allows you to import an existing PDF as a template, and you could add text over it. Hope this helps. Keith From: Sam Smith [EMAIL PROTECTED] Date: 2005/05/10 Tue AM 08:36:13 EDT To: PHP php-general@lists.php.net Subject: [PHP] Editing PDF I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? 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: Re: [PHP] Pop-up message
Is there some reason you can't simply use a javascript alert on the page refresh? if(isset($queue)){ echo script type=\text/javascript\ !-- alert(\$queue\); -- /script; } From: Lester Caine [EMAIL PROTECTED] Date: 2005/03/01 Tue AM 03:18:58 EST To: php-general@lists.php.net Subject: Re: [PHP] Pop-up message Richard Lynch wrote: Lester Caine wrote: At the risk of being shouted at because *I* know it's not a PHP problem! Actually, it's a client problem :-) Yep - but with so many different ways of doing it, which client method would be best ;) I have a page that is being refreshed every 30 seconds or so, and displays a list of 'tickets' waiting to be dealt with on a list from a database query. No problems there, but a couple of sites now want me to add a pop-up warning when a ticket is added that has a staff ID matching the logged in user. Your first task is to convince the client what an incredibly stupid idea this is. Actually it's not - which is part of the problem - these are all private networks and this is to replace 'reception' trying to phone the member of staff - who may already be on the phone - to tell them an appointment has arrived. So I just ant to 'queue' something on the their machine. And that it won't work with all the popup blockers. Have a handle on that, and the customer knows the problem, they are even willing to consider a switch to Firefox if that will help. Tabbed browsing with queue's on different tabs makes a lot of sense :) And if it did work, it would just annoy the [bleep] out of their users. I know I'm preaching to the choir, here, but I have to go on record with this statement. I know all the arguments, but hopefully you can see the problem - how do we tell the 'target' that there is someone waiting - and the clock is running on performance figures :( I can drive a sounder in the target browser, but need kicking in the A sounder? You mean like make my browser make noise? ICK!!! Yep - and if they are on the phone they may not here it either. right direction for a method of adding a pop-up window. Ideally it needs to be browser agnostic, which is where the problem comes given the pop-up blockers and other 'toys' that are being added to the browser end of things. You're not going to defeat the popup blockers in the long run. As I said - we have control over machine configurations - to a certain extent, and if a user decides they want to be clever it's their performance figures that will be affected ;) You are better off using clean simple code in an onLoad in your body tag to open the new window. Something like: body onLoad=window.open(URL); where the URL loads in that user's recently added items. Either the users will accept the popup and whitelist it in their popup blocker, or they won't. That is probably where I am at, but I was looking to see if anybody had any other ideas for passing messages. Probably should have explained better what I was trying to do, but I often see 'Did you try so and so' which provides another avenue to look at. And if a lot of them don't accept it, as they shouldn't, that tells you right there what a dumb idea this was. :-) But running around to find code to defeat the popup blockers will be a total waste of time -- and you'll end up with something so hacked and so un-maintainable that you'll have to fix it every six months, even if the popup blockers don't find workarounds to block your workarounds that popup the windows that they don't want popped up. Already covered that, but there *IS* a need for a controlled way of passing messages from the server to the client ... So can anybody point me in the right direction for a CURRENT method of achieving this, many of the bits I've found so far are somewhat antiquated, and fail in one way or another :( Perhaps it would be better to segregate the tickets into those associated with the User logged in, and those that are not. Or to at least sort them that way, regardless of their other sorting options. For that matter, don't even *BOTHER* to show me items that aren't mine, unless I specifically ask for them. Other people in a department need to be able to see who is waiting on a queue, only some callers are appointments, so a browser is left logged in with that queue selected so people can monitor things. As soon as an appointment is logged, the page changes to a staff ID specific page, and as long as it is visible in the background, it can be seen, but 'other systems' insist on being displayed full screen, which is what is being the pain. If (actually probably WHEN) we can get the applications that don't want to share to play nicely ... Build a system that detects tickets that sit un-assigned for too long, and randomly assigns them, or, better yet, assigns them based on factors such as: Ticket
Re: [PHP] Re: imagettftext color problem
You are using imagecreate() with png, which creates an indexed color image. $img=imagecreate($width, $height); Use Imagecreatetruecolor() instead. From: Anni Hienola [EMAIL PROTECTED] Date: 2005/02/11 Fri AM 02:27:03 EST To: php-general@lists.php.net Subject: [PHP] Re: imagettftext color problem And to correct one mistake in the code that was kindly pointed out but is here just a typo: $bg=imagecolorallocate($img, 255, 255, 255); $font_color=imageallocatecolor($img, 0, 0, 0); Should be: $bg=imagecolorallocate($img, 255, 255, 255); $font_color=imagecolorallocate($img, 0, 0, 0); Full error check is on and the colors are correctly indexed as far as I can tell, but the TTF text stubbornly shows up yellow. Anni H. -- 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] Image Creation and Saving
Are you making sure the $_SESSION['user_sn'] folder exists before saving the image into it? I'm asking because I originally thought it was a permission problem but php will tell you 'permission denied' if that was the case. At 05:05 PM 1/29/2005, NathanielGuy#21 wrote: Hello everyone, I have been troubleshooting a problem with one of my scripts for a while now, its purpose is to allow a user to upload a file, save it to the server, resize it into a thumbnail, and save the thumbnail as well. In my script all goes well until it comes to saving the images, the script throws these errors: Warning: imagepng(): Unable to open '/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15.png' for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on line 91 Warning: imagepng(): Unable to open '/home/blacknut/public_html/picserv/picserv_mysql/pictures/blacknute/15t.png' for writing in /home/blacknut/public_html/picserv_mysql/addpic.php on line 95 Picture ffq was added to our database! The following is what we have generated and it is what others will see Here is the important part of the script, if more is needed i can post it as well. if ($mime_type == 'jpeg') { $new_image = imagecreatefromjpeg($_FILES['new_image']['tmp_name']); //Create an image refrence } elseif ($mime_type == 'png') { $new_image = imagecreatefrompng($_FILES['new_image']['tmp_name']); //Create an image refrence } elseif ($mime_type == 'gif') { $new_image = imagecreatefromgif($_FILES['new_image']['tmp_name']); //Create an image refrence } //Image Sizes list($new_image_width, $new_image_height) = getimagesize($_FILES['new_image']['tmp_name']);//Get img size if ($new_image_width $new_image_height) {//Get thumb size $percent_image_size = (200 / $new_image_width); } elseif ($new_image_width $new_image_height) { $percent_image_size = (200 / $new_image_height); } else { $percent_image_size = (200 / $new_image_height); } $new_thumb_width = ($percent_image_size * $new_image_width); $new_thumb_height = ($percent_image_size * $new_image_height); $new_thumb_file = imagecreatetruecolor($new_image_width, $new_image_height); imagepng($new_image, '/home/blacknut/public_html/picserv/picserv_mysql/pictures/' . strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . '.png'); //Copy pic to user dir as pic_id.png $new_thumb_image = imagecreatetruecolor($new_thumb_width, $new_thumb_height); // Create Thumb file imagecopyresampled($new_thumb_image, $new_image, 0, 0, 0, 0, $new_thumb_width, $new_thumb_height, $new_image_width, $new_image_height); //Copy resized to new thumb file imagepng($new_thumb_image, '/home/blacknut/public_html/picserv/picserv_mysql/pictures/' . strtolower($_SESSION['user_sn']) . '/' . $new_pic_filename . 't.png'); //Save image thumb I am very new to file/image manipulation in php so if you see any errors, or unnecessary code please tell me. I'm not quit sure how everything works, although I do have a theoretical picture of how it does. Any comments will be appreciated. --nathan -- http://www.blacknute.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: Re: [PHP] String to Date and Date to String Functions?
How about the strtotime() function? http://us4.php.net/manual/en/function.strtotime.php From: Ben Edwards [EMAIL PROTECTED] Date: 2005/01/24 Mon PM 12:03:34 EST To: Jay Blanchard [EMAIL PROTECTED] CC: PHP General List php-general@lists.php.net Subject: Re: [PHP] String to Date and Date to String Functions? On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] String to Date Function return date stringToDate( str Date, str Format ) e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); Date to String Function return str dateToString( date Date, str Format ) e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' ); Anyone know of any functions that do this or have pointers as to how it can be done. [/snip] You've looked at http://www.php.net/date ? Yes. It douse the dateToString bit but how do I do the reverse. I can use it to convert a timestamp to a string but how do I convert a string to a timestamp. I must say i've used a few languages in my time and the PHP data/time functions are a mess. Generaly when you find a function to do something to a data item there is an obvious way of reversing this (i.e. it has a simeler name). This douse not seem to be the case with PHP;( Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- 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] PHP5 sprintf() function borken
I ran your code through 3000 iterations and it always results in 0.09. This is on Suse 9.2, Apache 2.0.52 and php 5.0.3 From: Thomas Munz [EMAIL PROTECTED] Date: 2005/01/11 Tue AM 11:10:37 EST To: php-general@lists.php.net Subject: [PHP] PHP5 sprintf() function borken Today i think i found an bu in the PHP5 version 5.0.3 ( allready exits also in the version 5.0.2 , i try this version also ). When tryo one of this scripts: $i_test = 0.085007667542; $tm_total = sprintf('%.2f', $i_test); echo $tm_total; $i_test = 0.085007667542; $tm_total = sprintf('%.2f', $i_test); echo $tm_total; $i_test = 0.085007667542; $tm_total = sprintf('%.2f', floatval($i_test)); echo $tm_total; i always get an other result. Some time it get a result like that: -2681561585988522000.00 my friend try it also and have the same problems... is that a bug in php5? -- 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] first letter
Not sure if it's deprecated or not, but you can reference it as an array: echo $name[0]; or the more accepted method: echo substr($name,0,1); From: Ahmed Abdel-Aliem [EMAIL PROTECTED] Date: 2004/12/20 Mon PM 12:59:49 EST To: [EMAIL PROTECTED] Subject: [PHP] first letter hi if i have for example this variable $name = John; how can i echo the first letter only so the result on the browser will be J can anyone help ? -- Ahmed Abdel-Aliem www.ApexScript.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: Re: [PHP] Parse Error... how to fix?
You are inside a function and not either passing the variable to the function or declaring it global within the function. In other words, as far as your function is concerned, the $language['program_name'] is empty. From: GH [EMAIL PROTECTED] Date: 2004/12/16 Thu PM 01:09:48 EST To: Marek Kilimajer [EMAIL PROTECTED] CC: php-general [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error... how to fix? However, I can not get any results into the title tags all three options are not displaying On Thu, 16 Dec 2004 13:03:57 -0500, GH [EMAIL PROTECTED] wrote: Ok... thank you. On Thu, 16 Dec 2004 19:02:37 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . either one: 1. TITLE $language[program_name] /TITLE\n . 2. TITLE {$language['program_name']} /TITLE\n . 3. TITLE . $language['program_name'] . /TITLE\n . -- 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] For Loop
$i = $months_arr_length is an assignment, not a comparison, so it will always evaluate to true, and you are setting your counter var to 12 every time the loop runs, that's why it runs infinitely. From: R. Van Tassel [EMAIL PROTECTED] Date: 2004/12/08 Wed PM 04:41:00 EST To: 'PHP general' [EMAIL PROTECTED] Subject: [PHP] For Loop I have a question about the following code: ** $months_arr = array(JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC); $months_arr_length = count($months_arr); for($i = 0; $i = $months_arr_length; $i++){ echo $months_arr[1]. br /; } *** When I run the code above it continues and never stops. According to the PHP documentation the second condition works as follows: In the beginning of each iteration, expr2 is evaluated. If it evaluates to TRUE, the loop continues and the nested statement(s) are executed. If it evaluates to FALSE, the execution of the loop ends. In the first iteration of the loop $i would equal 0 and the array length is 12. 12 is consistent. To it seems that the loop should STOP when the counter reaches 12, equal to the length of the array. Why is it continuing in a neverending loop? What am I missing? Changing the condition of the for loop to $i = $months_arr_length; fixes everything and it works properly. Can someone please explain where my confusion is? Thanks, ~R. Van Tassel -- 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: RE: [PHP] dirty words
What I find interesting is that you managed to use 4 variations on the word viagra, and your email still made it past my ISP's spam filters :) Keith From: Graham Cossey [EMAIL PROTECTED] Date: 2004/10/18 Mon PM 06:27:02 EDT To: [EMAIL PROTECTED] Subject: RE: [PHP] dirty words Skippy does have a point. If you still receive spam emails you'll know what he means. I must have seen 20 different ways of spelling viagra, using various accented characters etc: viagra, viagra, viiagra etc etc As for the legit words, there is the tale of Scunthorpe town council having ALL its email blocked by filtering. (Scunthorpe is a UK town BTW). But then again I could be talking total b0llocks, [EMAIL PROTECTED] and shit. (Sorry for any offense caused, but you see the problem) Graham -Original Message- From: Skippy [mailto:[EMAIL PROTECTED] Sent: 18 October 2004 18:13 To: [EMAIL PROTECTED] Subject: Re: [PHP] dirty words On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote: I am useing file_get_contents on a remote page then using stristr() to make sure there are no bad words and its a family site. May I point out this is a lost battle from the start? If someone really wants to enter bad words they will, by masking them in various ways; humans will interpret the bad words correctly in far more cases than you can filter with software. Additionally, you will end up filtering parts of legit words that look like bad words. -- Skippy - Romanian Web Developers - http://ROWD.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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] avi to wmv convert
Try looking up ffmpeg. It can convert between many video formats, runs on linux or windows(compile under mingw) and can be called via backtick, system() or exec() functions. I use it from a php script to convert flash FLV files to MPG. At 04:03 AM 8/21/2004, Peter Clarke wrote: John Nichel wrote: Peter Clarke wrote: John Nichel wrote: Jay Blanchard wrote: [snip] In what manual? [/snip] TFM! I'm sorry, I didn't quite catch that. Could you hold my hand, and point it out to me? If you were a real pal, you would write the code for me too. ;) The only manual I know of is at www.php.net It provides a tool for searching the online documentation. Searching for 'avi' produces just one result of: http://www.php.net/function.getimagesize in which a user posts about finding dimensions etc from media files. I cannot find anywhere that mentions converting avi files to wmv files. The point of the razzing is to get one to do some research. If you don't see it in the manual, chances are PHP cannot do it on it's own. Without seeing any 'video' functions listed in 'THE MANUAL', I would hazard a guess that converting between two different video formats is a bit beyond the scope of PHP. Not to say that this cannot be done, as I'm sure there is an API out there that PHP can interact with, but someplace like Google would be a better place to start a search like there. Agreed, my issue is with the pure unhelpfulness of the responses to the question. The response was: There are a few listed in the manual. which is totally wrong. Peter -- 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] http to https
try placing an exit(); after your header line. At 04:27 PM 6/17/2004, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] triggering php scripts...
At 10:19 PM 5/30/2004, you wrote: Chris Wagner wrote: i am wondering if there is a good way to trigger a php script from a web page *without* sending the user to a new page or opening a new browser windows. for instance, suppose you wanted to make a button/link on a web page that, when clicked, would cause a database entry to be decremented. however, you do not want to refresh the page or open a popup window or any stinky little tricks like that. Use a virtual include to call the php script. I like to use dummy image files for this purpose and a little bit of javascript to change the image src. On page load, a simple spacer.gif is loaded. If a particular link or button is clicked, I'll replace the image src with, for example, dosomething.php?action=changeitvalue=newvalue. dosomething.php performs the required functions and simply returns a blank gif image as output. The result is that your script is executed and the page doesn't have to reload. This method can also be used with real images. I use it with a file cart on my site as well, only this time, the first image loaded is cart_add.gif and when they click it, it calls the script to add the file to their cart and that script returns cart_remove.gif I wouldn't suggest using this in mission critical settings, unless you plan on making sure the user has javascript turned on, but on a hobby site it works well. or, if this is not possible, does anyone know how to trigger a php script when someone accesses a particular file from an apache server? or if a file from a particular directory is downloaded... I don't think you can do that unless the php script is used to access the file or perform the download you speak of. I also use this method to count downloads. php script fetches the actual file and serves it up, at the same time incrementing the download count. This is also handy, as you can prevent people from getting to the actual files by placing them in a directory outside the webroot. cheers, Travis -- Travis Low mailto:[EMAIL PROTECTED] http://www.dawnstar.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] Query Query
This may sound stupid, but are you actually EXECUTING the query? $doit = mysql_query($query); At 12:32 PM 5/30/2004, The Digital E wrote: This may be better suited to the MySQL lists, but I'd appreciate it if someone could help. I'm probably just missing something stupid here but have been coding non-stop for a week and need another set of eyes. Here's the line of code giving me an issue. I can print all the variables in the script to screen and know that they're ok. It returns successfully, but fails to update the database. I'm sure I'm about to feel pretty stupid, so fire away... just please fire the answer too. $query=UPDATE $table_name SET company_name='$company', first_name='$first_name', last_name='$last_name', address='$address', city='$city', state_province='$state', postal_code='$postal', office_phone='$office', fax_phone='$fax', email='$email' WHERE company_name='$mod_dataset'; 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] Multiple substring replacement
why not use nl2br() ? At 01:28 PM 5/24/2004, GodFoca wrote: What's the best way of replacing every ocurrence of a substring in a LARGE string by another (longer) substring? Specifically, I have read the contents of a file into a tring with fread, and now I want to replace all \n with br Thanks in advance Nicolas Sanguinetti -- 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] Regex Help
Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot -Original entry in list Cameras Digital Cannon XLRshot -Desired result. I can use str_replace() for the underscore, but I also want to be able to split on lowercase char followed by an uppercase char. I have not worked with regular expressions much before, and I just need a push in the right direction. Thanks in advance, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help
Curt, That's perfect. Works like a charm. Thanks, Keith At 03:54 PM 5/10/2004, Curt Zirzow wrote: * Thus wrote hitek ([EMAIL PROTECTED]): Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot -Original entry in list Cameras Digital Cannon XLRshot -Desired result. One possiblity: echo preg_replace('/([a-z])_?([A-Z])/', '$1 $2', 'CamerasDigital_CannonXLRshot'); explanation: match a lower case character preceding an uppercase character, with an optional underscore between them. Replace that match with the matched lowercase character, space and matched uppercase character. Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Pulling Certain Data
Sounds like you need a where clause in your sql query: $r1=SELECT * FROM $main_tbl where status='A'; replace 'status' with whatever you called the status field in your table. Keith At 12:40 PM 4/6/2004, Jason T. Davidson wrote: Community- I am a first time databaser and am having trouble pulling information from a database to display on a site. Not every entry is supposed to show up on the web page, but does so. I have tried IF statements without any help. Here is what I have so far: ? $r1=SELECT * FROM $main_tbl; $rsql=mysql_query($r1,$db); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr td font size=5ZMP Rosters/fontfont size=5 - font size=2a href=http://www.vatusa.org/html/modules.php?op=modloadname=PN_Contentfile =indexreq=visitartid=26VATUSA listing/a/font/font/td /tr /table br/br table width=600 tr td font size=5Active Controllers/font/td /tr /table table width=600 tr bgcolor=#99 td width=180div align=centerfont size=3strongCONTROLLER/strong/font/div/td td width=60div align=centerfont size=3strongCID/strong/font/div/td td width=100div align=centerfont size=3strongRATING/strong/font/div/td td width=130div align=centerfont size=3strongPOSITION/strong/font/div/td td width=130div align=centerfont size=3strongDATE JOINED/strong/font/div/td /tr ? while ($a_row=mysql_fetch_array($rsql)) { ? tr bgcolor=#CC td width=180 align=leftfont size=2? echo $a_row[LNAME], $a_row[FNAME];?/font/td td width=60 align=centerfont size=2? echo $a_row[CID];?/font/td td width=100 align=centerfont size=2? echo $a_row[RATING];?/font/td td width=130 align=centerfont size=2? echo $a_row[POSITION];?/font/td td width=130 align=centerfont size=2? echo $a_row[JDATE];?/font/td /tr ?} ? /table /body I would like to only show people who are active within our roster and within the database I have identified those people by putting a A, I or L depending on their status with our organization. I guess I am looking for a way for the code to see how that person is labeled and then put them in the proper roster. www.zmpartcc.com/roster/roster.php -- Jason T. Davidson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail sending from nobody to nobody...
Details? How are you calling the mail function? At 11:59 PM 4/4/2004, Jonathan Villa wrote: For some reason mail is being sent from nobody to nobody every time. I have tried hardcoding the sendmail path, which is the default anyway, and it still doesn't work? Has anyone encountered this before? -- 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] Mail sending from nobody to nobody...
Try getting rid of the stripslashes, or if you need to remove them, add an additional \n to the message after the strip slashes, like so: if(mail([EMAIL PROTECTED],Added To Mailing List,stripslashes($message).\n,$from) == false) die('failed'); Also, see http://www.php.net/manual/en/function.mail.php if you haven't checked there yet. There are some good examples. At 12:17 AM 4/5/2004, Jonathan Villa wrote: $from = From: .$email.\n; $from .= Reply-to: .$email.\n; $message = The following person has been added to the Mailing List.\n\n; $message .= $name. (.$email.) from .$city. has been added to the mailing list.; if(mail([EMAIL PROTECTED],Added To Mailing List,stripslashes($message),$from) == false) die('failed'); On Mon, 2004-04-05 at 02:13, hitek wrote: Details? How are you calling the mail function? At 11:59 PM 4/4/2004, Jonathan Villa wrote: For some reason mail is being sent from nobody to nobody every time. I have tried hardcoding the sendmail path, which is the default anyway, and it still doesn't work? Has anyone encountered this before? -- 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] Possible Leap Year bug with strtotime (4.3.4)?
I don't think it's so much a bug as it is just some odd behavior. If you use 'this monday' the results are correct. $start = strtotime('this monday'); Keith At 02:44 PM 2/28/2004, Rob Petty wrote: I am getting incorrect results from strtotime: [dali]$ uname -a Linux dali 2.4.24-grsec+w+fhs5+gr1913+nfs+++p3+c3+bu+gr0b-v6.182 #1 SMP Mon Jan 5 12:43:44 PST 2004 i686 unknown [dali]$ date Sat Feb 28 14:33:39 PST 2004 [dali]$ cat t1.php ? $start = strtotime('next monday'); echo ('Start timestamp: '.$start.'br'.\n); echo ('Next Monday: '.date('l, M d Y',$start).'br'.\n); $first = strtotime('first Monday',$start); echo ('First Monday: '.date('l, M d Y',$first).'br'.\n); $oneth = strtotime('1 Monday',$start); echo ('1 Monday: '.date('l, M d Y',$oneth).'br'.\n); $next = strtotime('next Monday',$start); echo ('Next Monday: '.date('l, M d Y',$next).'br'.\n); $twoth = strtotime('2 Monday',$start); echo ('2 Monday: '.date('l, M d Y',$twoth).'br'.\n); $third = strtotime('third Monday',$start); echo ('Third Monday: '.date('l, M d Y',$third).'br'.\n); $threeth = strtotime('3 Monday',$start); echo ('3 Monday: '.date('l, M d Y',$threeth).'br'.\n); ? [dali]$ php t1.php Content-type: text/html X-Powered-By: PHP/4.3.4 Start timestamp: 1078732800br Next Monday: Monday, Mar 08 2004br First Monday: Monday, Mar 08 2004br 1 Monday: Monday, Mar 08 2004br Next Monday: Monday, Mar 15 2004br 2 Monday: Monday, Mar 15 2004br Third Monday: Monday, Mar 22 2004br 3 Monday: Monday, Mar 22 2004br [dali]$ next monday should be Mar 01 2004 instead of Mar 08 2004. Any ideas? -- 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] Odd strtotime behavior
Sorry, had my return address set up wrong, apparently the list doesn't like that. Actually, it appears to be caused by Daylight Savings time. Leap years yield 143.95833 Other years yield 142.95833 At 10:07 PM 1/9/2004, Chris W wrote: The following code doesn't do what I expect and I was wondering if someone could tell me why and how to make it do what I want. $NowT = strtotime(January 9 2004); $EventT = strtotime(June 1 2004); print ($EventT - $NowT)/86400; I get 143.95833 Why don't I get 144? Chris W -- 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] looping problem?
Shorter version of the script: ? $line = file(fa.csv); for($i=0;$icount($line);$i++){ $data = explode(,, $line[$i]); echo host $data[0] {br /\nhardware ethernet $data[1];br /\nfixed-address $data[2];br /\n}br /\n; } ? At 08:10 AM 12/30/2003, Jas wrote: Problem with looping over a CSV file (3 results for each line)? Here is the CSV file contents... MTPC-01,00:02:B3:A2:9D:ED,155.97.15.11 MTPC-02,00:02:B3:A2:B6:F4,155.97.15.12 MTPC-03,00:02:B3:A2:A1:A7,155.97.15.13 MTPC-04,00:02:B3:A2:07:F2,155.97.15.14 MTPC-05,00:02:B3:A2:B8:4D,155.97.15.15 Here is the script... ?php $row = 1; $file = fa.csv; $id = fopen($file,r); while($data = fgetcsv($id,100,,)) { $num = count($data); $row++; for($c = 0; $c $num; $c++) { echo host $data[0] {br /\nhardware ethernet $data[1];br /\nfixed-address $data[2];br /\n}br /\n; } } fclose($id); ? And this is the output... (notice 3 results for the first line in the CSV file) host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } Any help is appreciated... Jas -- 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] imagecreatefromjpeg crash
Greetings, I am having a very peculiar problem trying to use imagecreatefromjpeg (indeed, ANY of the imagecreatefrom... functions) under both Windows and FreeBSD. First off, here are my server specs: Win: apache 1.3.23, php 4.2.1, GD 2.0 or better BSD: apache 1.3.26, php 4.2.3, GD 2.0 or better And now the problem: I am trying to use imagecreatefromjpg() to load in an image so that I can copy parts of it to other images. Here;s the code: $orig = imagecreatefromjpeg('46880_img.jpg'); // initialize the image parts for the email form $cell1 = imagecreate (468, 29); $cell2 = imagecreate (231, 25); $cell5 = imagecreate (468, 26); //copy the parts of the original banner to the individual cell images imagecopy($cell1, $orig, 0,0,0,0,468, 29); imagecopy($cell2, $orig, 0,0,0,29,231, 25); imagecopy($cell5, $orig, 0,0,0,54,486, 26); $c1 = imagejpeg ( $cell1, cell1_img.jpg,80); $c2 = imagejpeg ( $cell2, cell2_img.jpg,80); $c5 = imagejpeg ( $cell5, cell5_img.jpg,80); $c7 = imagejpeg ( $orig, orig_img.jpg,80); On windows, I get: php.exe has generated errors and will be closed by windows. The apache error log shows: Premature end of script headers: f:/nusphere/apache/php/php.exe On BSD, I get: DNS error in IE Netscape just waits forever. If I comment out the imagecreatefromjpeg function, the script behaves as expected on both systems: The imagecopy functions complain that the original image doesn't exist. Note: I have tried to fopen the image, and use imagecreatefromstring with the exact same results. Is this a problem with GD? Is there a workaround? Thanks, Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php's future with Asp .NET?
IMHO, and without even comparing the feature sets, php has one distinct advantage for me: It's free. I'm pretty sure a lot of hosting companies feel the same way. Keith At 11:07 PM 1/15/2003, Dhaval Desai wrote: Hello ppl, I was just wondering what is php's future with something like Asp .Net coming up...I have read many articles by Php guys who think Asp.Net is the future. If that's the true case...is it really worth sticking to Php at all? Thanx! -Dhaval _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- 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