[PHP] reading txt file - certain lines
Hi there.. .I am displaying info (on music) from a text file with the following code... Now the contents of said text file would read something like the following: Liarby Sex Pistols"Never Mind The Bollocks"Played: 2004/07/28, 1:48:29 PM--Let's Rave Onby The Raveonettes"Chain Gang Of Love"Played: 2004/07/28, 1:46:37 PM--No Remorseby Metallica"Kill 'Em All"Played: 2004/07/28, 1:40:17 PM--This Is Our Emergencyby Pretty Girls Make Graves"The New Romance"Played: 2004/07/28, 1:36:37 PM--Freestylin'by Greyboy"Freestylin'"Played: 2004/07/28, 1:30:25 PM--In My Headby Naked Raygun"Raygun...Naked Raygun (Reissue)"Played: 2004/07/28, 1:26:37 PM--Lust To Loveby The Go-Go's"Return To The Valley Of The Go-Go's"Played: 2004/07/28, 1:23:13 PM--Kim You Bore Me To Deathby Grandaddy"Concrete Dunes"Played: 2004/07/28, 1:18:37 PM--Sonderkommandoby Gwar"This Toilet Earth"Played: 2004/07/28, 1:13:49 PM-- Now what I want to do is read this file, but only say read 5 songs worth, then I would place the PHP code in (another table) and display the next 5 songs and so on This just allows for a more flexible layout in the final presentation. the way I am having the text files written, there is no way to get it to produce seperate text files - otherwise this would be easy to do Is this possible? Thanks in advance! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] reading txt file - certain lines
Yeah I do not really have the option to use a database here since the way the data is output is limited to a text file.. the files are populated by a program that takes the currently playing tracks out of Itunes (mp3 player) on my mac. d On 28-Jul-04, at 3:26 PM, [EMAIL PROTECTED] wrote: From: John Nichel <[EMAIL PROTECTED]> Date: July 28, 2004 2:05:51 PM PDT To: PHP <[EMAIL PROTECTED]> Subject: Re: [PHP] reading txt file - certain lines Dustin Krysak wrote: Hi there.. .I am displaying info (on music) from a text file with the following code... //open the file handler $fp02=fopen("assets/lib/php/itunes/recent.txt","r"); //Read the track info $recent=fgets($fp02); //close the file. echo "$recent"; fclose($fp02); ?> Now the contents of said text file would read something like the following: Liarby Sex Pistols"Never Mind The Bollocks"Played: 2004/07/28, 1:48:29 PM--Let's Rave Onby The Raveonettes"Chain Gang Of Love"Played: 2004/07/28, 1:46:37 PM--No Remorseby Metallica"Kill 'Em All"Played: 2004/07/28, 1:40:17 PM--This Is Our Emergencyby Pretty Girls Make Graves"The New Romance"Played: 2004/07/28, 1:36:37 PM--Freestylin'by Greyboy"Freestylin'"Played: 2004/07/28, 1:30:25 PM--In My Headby Naked Raygun"Raygun...Naked Raygun (Reissue)"Played: 2004/07/28, 1:26:37 PM--Lust To Loveby The Go-Go's"Return To The Valley Of The Go-Go's"Played: 2004/07/28, 1:23:13 PM--Kim You Bore Me To Deathby Grandaddy"Concrete Dunes"Played: 2004/07/28, 1:18:37 PM--Sonderkommandoby Gwar"This Toilet Earth"Played: 2004/07/28, 1:13:49 PM-- Now what I want to do is read this file, but only say read 5 songs worth, then I would place the PHP code in (another table) and display the next 5 songs and so on This just allows for a more flexible layout in the final presentation. the way I am having the text files written, there is no way to get it to produce seperate text files - otherwise this would be easy to do Is this possible? Yes, possible. Worth the time? No. Can you put all that info in a database? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED]
[PHP] unexpected T_VARIABLE
Hi there, I am working with a script that I found online to export a SQL statement (results) to an excel file., now everytime i run the script, i get the error: Parse error: parse error, unexpected T_VARIABLE in /var/www/html/siteadmin/mysql_export/export.php on line 11 Now the code that is located at (and around) that line is (I have included the line numbers for reference): 10for ($i = 0; $i < $count; $i++) { 11 $header .= mysql_field_name($result, $i)."\t"; 12} Now just in case you guys want to reference the entire script - I have included it below: //Written by Dan Zarrella. Some additional tweaks provided by JP Honeywell //pear excel package has support for fonts and formulas etc.. more complicated //this is good for quick table dumps (deliverables) include('../../Connections/db_connection.php'); $result = mysql_query('select * from dealers', $linkID); $count = mysql_num_fields($result); for ($i = 0; $i < $count; $i++) { $header .= mysql_field_name($result, $i)."\t"; } while($row = mysql_fetch_row($result)){ $line = ''; foreach($row as $value){ if(!isset($value) || $value == ""){ $value = "\t"; }else{ # important to escape any quotes to preserve them in the data. $value = str_replace('"', '""', $value); # needed to encapsulate data in quotes because some data might be multi line. # the good news is that numbers remain numbers in Excel even though quoted. $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } # this line is needed because returns embedded in the data have "\r" # and this looks like a "box character" in Excel $data = str_replace("\r", "", $data); # Nice to let someone know that the search came up empty. # Otherwise only the column name headers will be output to Excel. if ($data == "") { $data = "\nno matching records found\n"; } # This line will stream the file to the user rather than spray it across the screen header("Content-type: application/octet-stream"); # replace excelfile.xls with whatever you want the filename to default to header("Content-Disposition: attachment; filename=export_dealers.xls"); header("Pragma: no-cache"); header("Expires: 0"); echo $header."\n".$data; ?> Any ideas? d
[PHP] php/MYSQL remove duplicate records
Hi there - I have an extremely simple table that has a unique Id and an email address. what I am looking for is an example of a PHP script that will poll the MYSQL database and delete the duplicate records leaving only 1 unique (email) record. can someone point me to the right place? thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php - no results - display other message
Hi there... I have a simple search page (mysql database), and I can get it to display the results no issues, but i was wondering how I could display a message stating there were no results, instead of just having the field blank. I am familiar with IF and ELSE statements, but I am not sure how to test the "no result" option from the results of a SQL query thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php - no results - display other message
Actually, after some searching I got it figured out... here is the way I ended up doing it Obviously the "RSdel" and the "MLemail" are specific to my record set and my database field. Show result from database. No matching email address in the database! Thanks everyone! appreciate the help! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking multiple URL parameters
Hi there, I am currently using the following code to display content based on the URL parameters HTML CONTENT else { ?> OTHER HTML CONTENT ?> now what I need to do is modify the code so that the script checks 2 URL parameters, and has 2 variables defined (from the URL parameter)... So I need to also check if $_REQUEST['year'] is set as well as the original (both need to be set to get the first HTML content) AND I also need to set the variable of $year = ($_REQUEST['year'] direction? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] link to append to form
Hi there I have a VERY simple blogging system, and I want to add a link that will append a "" into the end of the existing text whenever it is clicked.. that way users do not need to remember the HTML code. How would i go about this? Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Recommendations for php email list managers?
I am interested in the postfix/php solution as well for a MLM, as well as just form processing. d I wonder why aren't you using PHP to send the messages via Postfix. Anyway, he did not say that he was using a platform that can run Postfix. If he is using Windows 2000 or later with IIS/Exchange, he can actually queue messages much faster than piping to postfix. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] flash php
Can anyone recommend any good tutorials on using flash mx 2004 with PHP to display MYsql content using PHP? Including loading and displaying JPGs and movies (referenced in the database). thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() takes a long time to process
Hi there, I have a script that uses the mail() function, but for some reason the script takes a really long time to finish processing (like 5 minutes). there are some other functions performed (like sql insert, etc) that happen immediately as they should. But the mail takes some time to finish processing. If I remove the mail function, the script finishes immediately. Any ideas? I have included my code below (used for the mail). ideas? $ToMail = $_POST['ccEmail']; $FromMail = "[EMAIL PROTECTED]"; $FromName = "The Name"; $Subject = "Your membership"; $xmailer = "PHP mailer"; $headers = "From: ".$FromName."<".$FromMail.">\r\n"; $headers .= "Reply-To: ".$FromName."<".$FromMail.">\r\n"; $headers .= "X-Mailer: ".$xmailer."\r\n"; $headers .= "Origin: ".$_SERVER['REMOTE_ADDR']."\r\n"; $Message = "Dear ".$_POST['ccfName']."\n,"; $Message .= "Thanks for joining the Coastal Crew!\n"; $Message .= "Below you will find the information required to verfiy your email address.\n"; $Message .= "Upon verification, an e-coupon will be presented to you in which you can print"; $Message .= " off for 20% off of your next purchase.\n\nBy clicking on this hyperlink:\n"; $Message .= $verify_url."\nand follow the directions in your web browser.\n\n"; $Message .= "Thank you,\nThe Coastal Crew.\n".$_SERVER['SERVER_NAME']; $mailer = mail($ToMail, $Subject, $Message, $headers); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP source code formatter for OS X
Does anyone know of a PHP source code formatter to clean up sloppy code that runs on OS X? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] functions vs classes
Novice PHPer, and i am wondering why one would use a function instead of a class (or object)? They seem to server very similar in use. The way I see it, is a function if for repeated use in a project specific manner, where as a class could be used for many projects. is this correct? Although one could just include the function library in multiple projects. Thanks! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dynamic image will not print properly
Hi there - I had my first crack at creating a dynamic image. The thing is - the image is displayed fine in the browser, but when you go to print it, the image is either missing, or part of it is missing. Is there something special needed to print a dynamic image? Here is a code snippet used to create the image header("Content-type: image/jpg"); $image = imagecreatefromjpeg("template_cpn.jpg"); $red = imagecolorallocate( $image, 255,0,0 ); imagestring($image, 2, 306, 200, $couponcode, $red); imagestring($image, 2, 306, 235, $exp, $red); imagestring($image, 2, 175, 338, $myname, $red); imagestring($image, 2, 175, 360, $myemail, $red); imagejpeg($image); imagedestroy($image); Now the way I have it set up, is that there is a PHP file that generates the image (the above code). Then I have a parent PHP page that calls that page like so: $theurl = "cstl.php?dk=soemthinghere echo ""; See any issues in my code or setup? Any ideas? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: dynamic image will not print properly
One thing to add. the issue is only on windows/IE. If it is say windows/Firefox - everything works as it should. d Begin forwarded message: From: DuSTiN KRySaK <[EMAIL PROTECTED]> Date: April 5, 2005 2:26:14 PM PDT To: PHP Subject: dynamic image will not print properly Hi there - I had my first crack at creating a dynamic image. The thing is - the image is displayed fine in the browser, but when you go to print it, the image is either missing, or part of it is missing. Is there something special needed to print a dynamic image? Here is a code snippet used to create the image header("Content-type: image/jpg"); $image = imagecreatefromjpeg("template_cpn.jpg"); $red = imagecolorallocate( $image, 255,0,0 ); imagestring($image, 2, 306, 200, $couponcode, $red); imagestring($image, 2, 306, 235, $exp, $red); imagestring($image, 2, 175, 338, $myname, $red); imagestring($image, 2, 175, 360, $myemail, $red); imagejpeg($image); imagedestroy($image); Now the way I have it set up, is that there is a PHP file that generates the image (the above code). Then I have a parent PHP page that calls that page like so: $theurl = "cstl.php?dk=soemthinghere echo ""; See any issues in my code or setup? Any ideas? d
[PHP] Re:Re: [PHP] dynamic image will not print properly
I wondered that myself, but all the other (not dynamic) images print fine! d On 5-Apr-05, at 4:51 PM, [EMAIL PROTECTED] wrote: From: Andy Pieters <[EMAIL PROTECTED]> Date: April 5, 2005 2:35:22 PM PDT To: php-general@lists.php.net Subject: Re: [PHP] dynamic image will not print properly To test, cstl.php?dk=somethinghere and try to print that? Maybe your browser is configured to NOT print images (or bakckground) ? Maybe your printer is textonly (just kidding) Tada Andy
[PHP] php rich text editors
Can anyone refer me to anything that will work with PHP? Just need it for a blog type application. Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php rich text editors
Problem with that one - does not work in safari (on the mac). d On 7-Apr-05, at 11:22 AM, Ben Ramsey wrote: DuSTiN KRySaK wrote: Can anyone refer me to anything that will work with PHP? Just need it for a blog type application. FCKEditor works well, has a PHP version, and is cross-browser: http://www.fckeditor.net/ -- Ben Ramsey Zend Certified Engineer http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php rich text editors
All of these could work in some form or another - but I am looking for a real scaled down one with less options for the users (or somethign with the option to limit available buttons) Pretty much just bold, italic, bullets, links and images. Since it is for a blog, I want to keep the look and feel of the site somewhat consistent. d On 7-Apr-05, at 11:40 AM, Pablo Gosse wrote: DuSTiN KRySaK wrote: Can anyone refer me to anything that will work with PHP? Just need it for a blog type application. Thanks! d Free - http://www.dynarch.com/projects/htmlarea/ (works okay, but code is different depending on the browser, which can be a real pain). Cheap - http://www.wysiwygpro.com (works brilliantly - I'm using it in a large CMS with minimal issues) HTH. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic image will not print properly
I just wanted to add something to this I moved the script over to another host to test, and it worked fine there. So to me that says it should be something to do with the host... now is there anything in the php.ini that could inflict this kind of behavior? d On 5-Apr-05, at 5:57 PM, Richard Lynch wrote: On Tue, April 5, 2005 2:26 pm, DuSTiN KRySaK said: Hi there - I had my first crack at creating a dynamic image. The thing is - the image is displayed fine in the browser, but when you go to print it, the image is either missing, or part of it is missing. Is there something special needed to print a dynamic image? What you did, *should* work just fine. But we're talking *MICROSOFT* here! These people do *NOT* follow standards. Period. Here is a code snippet used to create the image header("Content-type: image/jpg"); $image = imagecreatefromjpeg("template_cpn.jpg"); $red = imagecolorallocate( $image, 255,0,0 ); imagestring($image, 2, 306, 200, $couponcode, $red); imagestring($image, 2, 306, 235, $exp, $red); imagestring($image, 2, 175, 338, $myname, $red); imagestring($image, 2, 175, 360, $myemail, $red); imagejpeg($image); imagedestroy($image); Now the way I have it set up, is that there is a PHP file that generates the image (the above code). Then I have a parent PHP page that calls that page like so: $theurl = "cstl.php?dk=soemthinghere echo ""; See any issues in my code or setup? Any ideas? Here's what you do: You make it *IMPOSSIBLE* for Microsoft to screw up. This means you make your URL look JUST LIKE any other JPEG URL. $theurl = "cstl/dk=somethinghere/whatever.jpg"; Step 1: Add/Create an .htaccess file with this: ForceType application/x-httpd-php This forces Apache to treat the file named 'cstl' as a PHP script. Step 2: Rename cstl.php to just 'cstl' (see Step 1) Step 3: Instead of using $_GET['dk'] do this: $pathinfo = $_SERVER['PATH_INFO']; $pathinfo = explode('/', $pathinfo); //Key-Value pairs: $_PATH = array(); //Path information buried in URL for source image sub-directories: $PATH = array(); while (list(, $keyval) = each($pathinfo)){ $parts = explode('=', $keyval); switch(count($parts)){ case 0: break; //do nothing with bogus extra '/' in URL case 1: $PATH[] = $keyval; default: $key = $parts[0]; unset($parts[0]); $_PATH[$key] = implode('=', $parts); break; } } Now you can use $_PATH['dk'] instead of $_GET['dk'] to get your dk value from the URL. You'll only change $_GET to $_PATH in cstl (formerly cstl.php) and you're all set. Now, there is *NO* *WAY* Microsoft can manage to screw up your URL and decide that it must not be a JPEG because it has GET data, or ends in .php or whatever. This same technique must be applied to PDF, FDF, SWF/Ming files if you want to avoid a zillion MS IE bugs related to multi-media. So you might as well put the code for $_PATH/$PATH in an include file. I guarantee you'll need it again and again as you use more and more multi-media in your web-site. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic image will not print properly
Replying below. On 11-Apr-05, at 5:05 PM, Richard Lynch wrote: On Mon, April 11, 2005 3:04 pm, DuSTiN KRySaK said: I moved the script over to another host to test, and it worked fine there. So to me that says it should be something to do with the host... now is there anything in the php.ini that could inflict this kind of behavior? "anything" covers a lot of ground... First: Did you use the SAME browser and computer to surf in both cases. If not, re-do the test with the SAME browser and computer. exact same computer. Second: Is GD even installed on the non-working server? Use Either you see "GD" in one of the mini-tables or you don't have GD and it ain't gonna work. It is installed - as the image displays in the browser as it should, but the print output is all messed up. Third: Compare the *VERSIONS* of GD on both servers. Then PHP versions. Then Apache versions. Checking out from the host. Fourth: On the broken server, take *OUT* the header() lines in your script, and surf directly to the image URL. If you see PHP messages, well, fix your script to get rid of them. If you see a bunch of weird characters, that's what it *should* be -- Pretty much the "same" as you would see if you opened up a real JPEG in a text editor. I get the proper JPG results. As I said earlier - the output is only messed in the win/ie combo while printing. Fifth: Re-test on the server and desktop where it didn't work -- It's possible that between test 1 and 2 somebody updated the browser out from under you (like Microsoft auto-update, for example) The tests were done back to back and always testing with the exact same setup. Did one test on another win/ie box just to see if it was the local machine that was fubar - however it had the same results. d -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] scripting workflow
I just have a few questions regarding workflow when producing scripts. First off, do people prefer to have all their code in one file? Or multiple separate files? I know functions and classes are good to keep in separate files, but i am talking about say for example a news system, etc. Next off, how about when actually assembling the files? Do you produce all of your html output, then say build all of your functions - then say build the logic? Does that make sense? I had in the past use DW for building php apps, and as an exercise to myself I am forcing myself to hand code to learn better. But I do however want to increase my productivity. If anyone has any pointers on this type of stuff - it would be much appreciated! Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic image will not print properly
I got it figured out finally! It is so stupid with what the issue was... My image was being created exactly as it should have been - and the code was fine. Now where my issue was: I had a line of code in there that was to prevent people from calling the script directly (had to be referred from a particular page). Well IE did not like that for printing. Even though the script acted exactly as it should have by design. I saved the image to my desktop to test it, and when opening in an image app - it would not even open (even though displaying fine in a browser). So I changed the file ext of the downloaded file to that of a text file and opened it... and what do you know - there was the error my php script generates when the page is not called properly. So I removed that line of code (completely irrelevant to the image itself) And win/IE could print like all the other browsers could. doh! Dustin On 14-Apr-05, at 5:41 PM, Richard Lynch wrote: You'd want to http://php.net/urlencode the text, then. http://example.com/gd_script/text=$text_url/fool_ie.jpg";; ?> On Wed, April 13, 2005 5:42 pm, DuSTiN KRySaK said: One thing I feel is important to point out before I keep banging my head off of the wall here... In the URL parameter that is sent to the file, the url parameter is just carrying text that is printed into the image. It is not actually the image name, or anything. The image is generated in the cstl file (which actually is the image - sends JPEG headers,etc) - with the text on it (grabbed from the URL parameter). d On 13-Apr-05, at 5:03 PM, Richard Lynch wrote: Yup. $_PATH['x'] for the items that look like this: .../x=42/ And $PATH (without the underscore) is a string concatenation of all elements (after the PHP script) that look like this /whatever/ So you might use something like a PHP script named 'scale' and then: http://example.com/scale/width=100/height=100/images/subdir/ bigpic.jpg and then you know that you want to scale the image in your images/subdir naemd bigpic.jpg down to 100x100 at maximum. You'll have: $_PATH['width'] -> 100 $_PATH['height'] -> 100 $PATH = '/images/subdir/bigpic.jpg' On Tue, April 12, 2005 6:21 pm, DuSTiN KRySaK said: And then all I should have to do is change my $_REQUESTS to $PATH in hte cstl file right? d On 12-Apr-05, at 5:46 PM, Richard Lynch wrote: On Mon, April 11, 2005 1:14 pm, DuSTiN KRySaK said: hey - thanks a lot for the code snip - I am trying to use it now Just to confirm - the $path include file is included in the file that calls the cstl file - correct? Yes. Something like: You can use this same technique for not just JPEG, but also PDF, SWF (Ming) and FDF files, all of which Microsoft will screw up if you don't "fool" them with a URL that "looks" like static content. d On 5-Apr-05, at 5:57 PM, Richard Lynch wrote: On Tue, April 5, 2005 2:26 pm, DuSTiN KRySaK said: Hi there - I had my first crack at creating a dynamic image. The thing is - the image is displayed fine in the browser, but when you go to print it, the image is either missing, or part of it is missing. Is there something special needed to print a dynamic image? What you did, *should* work just fine. But we're talking *MICROSOFT* here! These people do *NOT* follow standards. Period. Here is a code snippet used to create the image header("Content-type: image/jpg"); $image = imagecreatefromjpeg("template_cpn.jpg"); $red = imagecolorallocate( $image, 255,0,0 ); imagestring($image, 2, 306, 200, $couponcode, $red); imagestring($image, 2, 306, 235, $exp, $red); imagestring($image, 2, 175, 338, $myname, $red); imagestring($image, 2, 175, 360, $myemail, $red); imagejpeg($image); imagedestroy($image); Now the way I have it set up, is that there is a PHP file that generates the image (the above code). Then I have a parent PHP page that calls that page like so: $theurl = "cstl.php?dk=soemthinghere echo ""; See any issues in my code or setup? Any ideas? Here's what you do: You make it *IMPOSSIBLE* for Microsoft to screw up. This means you make your URL look JUST LIKE any other JPEG URL. $theurl = "cstl/dk=somethinghere/whatever.jpg"; Step 1: Add/Create an .htaccess file with this: ForceType application/x-httpd-php This forces Apache to treat the file named 'cstl' as a PHP script. Step 2: Rename cstl.php to just 'cstl' (see Step 1) Step 3: Instead of using $_GET['dk'] do this: $pathinfo = $_SERVER['PATH_INFO']; $pathinfo = explode('/', $pathinfo); //Key-Value pairs: $_PATH = array(); //Path information buried in URL for source image sub-directories: $PATH = array(); while (list(, $keyval) = each($pathinfo)){ $parts = explode('=', $keyval); switch(count($parts)){ case 0: break; //do nothing with bogus extra '/' in URL case 1: $PAT
[PHP] Re: php-general Digest 18 Apr 2005 08:44:11 -0000 Issue 3404
check out amfphp (opensource php/flash remoting): http://www.amfphp.org/ good tutorials here: http://www.sephiroth.it/tutorials.php AMFPHP allows you to return info from PHP classes as an actionscript object in flash. d On 18-Apr-05, at 1:44 AM, [EMAIL PROTECTED] wrote: From: "Matt Babineau" <[EMAIL PROTECTED]> Date: April 17, 2005 2:15:25 PM PDT To: Subject: Php + flash, need some help making a small .FLA Hi all - Does anyone have any experience with integrating php + flash? Or know of any good tutorial sites? Basically what I want to do is have an animated loading screen, and then pull pictures from a database and display text from a database, text could be scrolling across the bottom like CNN or something. Anyone familiar with some techniques on doing this? Any examples people may have of this would be great, just send me some sample .FLA scripts!! If you've got some examples of exactly what I want to do, and you also have a paypal account, I can make it worth your time :-D Thanks, Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED]
[PHP] CMS backend
Hi there, I was wondering if anyone knows of any existing php/mysql cms back-ends (no need for a front end). I am just looking for one to dissect (for learning purposes) - and would prefer to keep the presentation out of it for the sake of not having to sort through a 1000 extra files. Thanks in advance. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] learning classes - need pointer
Hi there - I am slowly converting all of my projects over to a OOP based structure with classes. Now I had a quick question. In my current case, I am trying to create all the generic SQL functions (IE insert, update, delete, etc). Now what I am wondering - what would be the best way to structure the code so that I can accommodate the possibilities for different fields and databases, etc? Is it something that I should just pass to the class? Or would there be a more efficient way to do it? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] html editor written in PHP
Has anyone seen an example of a HTML editor written in PHP (no JS)? You know the ones - for adding HTML tags to a text field, etc. Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Should this not return true?!?!
Hi there (newbie here) - I have the following snippet of code.. $sexId = $_POST['sex']; $fName = $_POST['fName']; $lName = $_POST['lName']; if ($status = $db->query("INSERT INTO names (nameId, sexId, fName, lName) VALUES ('', $sexId, '$fName', '$lName')")) { print "Your data was added to the database successfully!"; } else { print "Your data could not be added to the database!"; } Assuming my query was successful, should it not return true and print the success message? For some reason it is doing just the opposite. The data is added, but it displays the error instead. Am I misunderstanding something? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php encoders
Can anyone recommend some good php encoders? A variance in price range would be good. Thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] drop down menu populated from a directory
Hi there What I am hoping to do is have a drop down menu that would be populated from the contents of a directory via php. Now The link names would be generated by the file name minus the file extension. Has anyone seen a tutorial on accomplishing something like this? All of the links would be to quicktime movies, but I am hoping to have them embedded in HTML (or PHP). So the movie is displayed in a browser thanks in advance! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: drop down menu populated from a directory
I gave it a go, and I got the error: "Parse error: parse error, unexpected '}'" This was on the last "}". Now I am brand new at php, but should there not be an opening and closing curly bracket? in this code there are one "{" and three "}" So I made my code: if ($file != '.' && $file != '..') $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; closedir($handle); } ?> And it does display the name in the menu... so that is a good start, but the link doesn't work when selected. So I am assuming hte code does need those brackets, and I rather need to open the opening one... d On 31-May-04, at 2:39 AM, [EMAIL PROTECTED] wrote: From: "Torsten Roehr" <[EMAIL PROTECTED]> Date: May 30, 2004 5:14:28 PM PDT To: [EMAIL PROTECTED] Subject: Re: drop down menu populated from a directory "Dustin Krysak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi there What I am hoping to do is have a drop down menu that would be populated from the contents of a directory via php. Now The link names would be generated by the file name minus the file extension. Has anyone seen a tutorial on accomplishing something like this? All of the links would be to quicktime movies, but I am hoping to have them embedded in HTML (or PHP). So the movie is displayed in a browser thanks in advance! This should do the trick: // opening select tag goes here... if ($handle = opendir('/path/to/files')) { while (false !== ($file = readdir($handle))) if ($file != '.' && $file != '..') $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; } } closedir($handle); } // closing select tag goes here Haven't tested it. Hope it works and helps ;) Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: drop down menu populated from a directory
ok, I added brackets and made my code to: if ($file != '.' && $file != '..') { $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; } } closedir($handle); } ?> when viewing my page in a browser, it worked! Now what I am hoping to do is put this menu on a PHP page, and have a qt movie placeholder and when this menu is used - replace the placeholder with the selected qt movie... I am just not sure how to do this. Thanks in advance! d On 31-May-04, at 10:26 AM, Dustin Krysak wrote: I gave it a go, and I got the error: "Parse error: parse error, unexpected '}'" This was on the last "}". Now I am brand new at php, but should there not be an opening and closing curly bracket? in this code there are one "{" and three "}" So I made my code: if ($file != '.' && $file != '..') $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; closedir($handle); } ?> And it does display the name in the menu... so that is a good start, but the link doesn't work when selected. So I am assuming hte code does need those brackets, and I rather need to open the opening one... d On 31-May-04, at 2:39 AM, [EMAIL PROTECTED] wrote: From: "Torsten Roehr" <[EMAIL PROTECTED]> Date: May 30, 2004 5:14:28 PM PDT To: [EMAIL PROTECTED] Subject: Re: drop down menu populated from a directory "Dustin Krysak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi there What I am hoping to do is have a drop down menu that would be populated from the contents of a directory via php. Now The link names would be generated by the file name minus the file extension. Has anyone seen a tutorial on accomplishing something like this? All of the links would be to quicktime movies, but I am hoping to have them embedded in HTML (or PHP). So the movie is displayed in a browser thanks in advance! This should do the trick: // opening select tag goes here... if ($handle = opendir('/path/to/files')) { while (false !== ($file = readdir($handle))) if ($file != '.' && $file != '..') $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; } } closedir($handle); } // closing select tag goes here Haven't tested it. Hope it works and helps ;) Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: drop down menu populated from a directory
Ok - here is the relevant Quicktime code: http://www.apple.com/qtactivex/qtplugin.cab";> http://www.apple.com/quicktime/download/indext.html";> http://www.apple.com/quicktime/download/indext.html"; target="myself"> Now I figure - getting the file name in there would be pretty easy (for the most part), but the thing is getting the dimensions of the movie in there... as it is possible that not all movies are the same dimensions. I am hoping to have just the one PHP that will change dynamically for the QT content - I would like to avoid having a php or html file for each QT movie. d PS - please CC me directly as I am subscribed in digest mode.. thanks much! On 31-May-04, at 3:08 PM, [EMAIL PROTECTED] wrote: "Dustin Krysak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ok, I added brackets and made my code to: if ($file != '.' && $file != '..') { $fileName = str_replace('.mov', '', $file); echo '' . $fileName . ''; } } closedir($handle); } ?> when viewing my page in a browser, it worked! Now what I am hoping to do is put this menu on a PHP page, and have a qt movie placeholder and when this menu is used - replace the placeholder with the selected qt movie... I am just not sure how to do this. This should be easy. Please post your QT placeholder (HTML) code. Then we can help. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] export from mysql to csv file
Can anyone point me to an existing script or tutorial to learn this? Thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] * populate menu from directory *
Hi there - I am a REAL new PHP coder (yeah I mostly use dreamweaver). I was wondering if anyone could point me in the right direction... What I want to do is have a generic template page for say a bunch of quicktime movies... it would have a movie embedded, and a drop down menu below to select the movie you want to watch.. what I was hoping to do was have the menu populated by pulling the file names from the movies in the directory on the server. I want to be able to simply FTP a new movie onto the server, and then have the menu update itself. possible? I would also be looking to do something similar with JPGS. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] isset opposite
Hi there.. I am pretty new to PHP, and I am familiar with php "isset" option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET is not set (not just empty). thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset opposite
Thanks! perfect! d On 16-Nov-04, at 4:13 PM, Robby Russell wrote: On Tue, 2004-11-16 at 15:11 -0800, Dustin Krysak wrote: Hi there.. I am pretty new to PHP, and I am familiar with php "isset" option now i was wondering (I have looked at the PHP site - but can not find it) how can you check if something is not set? I need to test if a $_GET is not set (not just empty). thanks in advance! d isset() returns a boolean. so...try, if (!isset($x)) -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development *--- Now supporting PHP5 --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset opposite
Yeah as soon as I saw this example, I figured that was the case for example something like if (!empty()) and so on. d On 16-Nov-04, at 5:26 PM, Robby Russell wrote: On Tue, 2004-11-16 at 17:19 -0800, Dustin Krysak wrote: Thanks! perfect! d For future reference, just about any function that uses is at the beginning should return a boolean result. So if (is_array()) can also be checked with if (!is_array()) This should apply to all the php included functions that start with is. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development *--- Now supporting PHP5 --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remove first character in text file
Hi there.. I have a text file where I need to remove JUST the first character in the text file. Can anyone point me to a tutorial? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remove first character in text file
Just want to add to this with a little more info my text file is a list of email addresses with a "%" separating them. For example: [EMAIL PROTECTED]@[EMAIL PROTECTED] Now sometimes I end up with a "%" at the beginning. For example: [EMAIL PROTECTED]@[EMAIL PROTECTED] Or: [EMAIL PROTECTED]@[EMAIL PROTECTED] Now that causes me issues else where in the script. So what I need to do is check if the "%" character exists at the beginning of the file and remove any if the "%" is there. ideas? d Hi there.. I have a text file where I need to remove JUST the first character in the text file. Can anyone point me to a tutorial? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] endless loop
Hi there I was making a script that had a loop, and ended up with a endless loop by accident. Now if that script is executed on the server - does the script die as soon as the browser is closed? Or does it keep running as a process on the server? Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get image dimensions
Hi there - I was wondering if there was a way to get PHP to get the dimensions of an image? I want to be able to have PHP dynamically write the image size (of the IMG tag) so that my pages validate when displaying a dynamic image. Thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql insert into 2 tables
Hi there - I was wondering if anyone could point me in the right direction to be able to add data to two different tables (I am using mysql and php V4). I understand joins, etc for the query of the data, however adding the data - still getting my head wrapped around it (multiple tables). Thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] similar function like getimagesize for Quicktime?
Hi there - I was wondering if there was some kind of PHP function to determine hte pixel size of a quicktime movie. Something like what GetImageSize() is to images, but for quicktime. thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] similar function like getimagesize for Quicktime?
On 29-Nov-04, at 3:54 AM, Marek Kilimajer wrote: Dustin Krysak wrote: Hi there - I was wondering if there was some kind of PHP function to determine hte pixel size of a quicktime movie. Something like what GetImageSize() is to images, but for quicktime. Not in php. Search for programs that you can execute from command line for your platform. Just for everyone's reference, here is a pretty cool package for parsing media files (various video and audio) for common information. Works great. http://www.getid3.org/ d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variable not being rendered
Hi there, I have some code where I am using the $_SERVER['PHP_SELF'] array to reference my script for a form action... now for some reason the file name is not being rendered out. I am including only small snippets of my code to see where my error is... $editFormAction = $_SERVER['PHP_SELF']; print "\n"; ?> Now there is much more code, but these are the important points. All I am doing is assigning a variable a value from the $_SERVER array. Then print out a form with PHP, and reference that variable for my form action the HTML is rendered as normal. But the form action page is not there when I view my source. I am sure it is a SIMPLE error... But my brain block is getting larger the more i look at this. help cries the newbie! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: variable not being rendered
Answering within the email below d On 4-Dec-04, at 3:16 AM, [EMAIL PROTECTED] wrote: From: Jason Wong <[EMAIL PROTECTED]> Date: December 4, 2004 12:04:18 AM PST To: [EMAIL PROTECTED] Subject: Re: [PHP] variable not being rendered On Saturday 04 December 2004 15:36, Dustin Krysak wrote: Hi there, I have some code where I am using the $_SERVER['PHP_SELF'] array to reference my script for a form action... now for some reason the file name is not being rendered out. I am including only small snippets of my code to see where my error is... I know this is not your actual code, but did you actually run this? I can't see any errors in it and it should work fine if you're using a recent version of PHP. I did run it... that is the reason I posted. As I stated, When I view source, the result is blank. $editFormAction = $_SERVER['PHP_SELF']; What does print_r($_SERVER) show? What does print $editFormAction show? echo $_SERVER['PHP_SELF']; shows the proper result. print_r($_SERVER['PHP_SELF']); shows the proper result print $editFormAction ; shows the proper result print "\n"; As you're not placing variables inside your print statement you might as well use single-quotes: print ''."\n"; This does away with all the backslashes (which gives me a headache). Well I changed it to: print ''."\n"; and I still had the same result. the source of the page when viewed in the browser was: So as you can see the "$editFormAction" is still not being rendered. So I am going to add the following info, I have a page that is required once that contains my functions. and I defined a function to print out this form. My code for that is: // create subscribe form function sub_form() { print ''."\n"; print ''."\n"; print ''."\n"; print ''; } ?> So would my issue be that I formatted my function wrong? Or that the page is included? Dustin -- Jason Wong -> Gremlins Associates -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: variable not being rendered
Ok - I have been investigating a little more. I now realized it is a question of making my variables available outside of the function. So one thing I want to point out is that: $editFormAction = $_SERVER['PHP_SELF']; is contained in one function. And that: print ''."\n"; is contained in another function. The first function contains all my code for a SQL query to insert a record. And the second function is just to create the form itself. Now i know i also need to use the "result" function. But I am sure that since I am using a few functions here - there might be more hitches than I realize. So I am just asking for some pointers for dealing with this. thanks! d From: Dustin Krysak <[EMAIL PROTECTED]> Date: December 3, 2004 11:36:56 PM PST To: PHP <[EMAIL PROTECTED]> Subject: variable not being rendered Hi there, I have some code where I am using the $_SERVER['PHP_SELF'] array to reference my script for a form action... now for some reason the file name is not being rendered out. I am including only small snippets of my code to see where my error is... $editFormAction = $_SERVER['PHP_SELF']; print "\n"; ?> Now there is much more code, but these are the important points. All I am doing is assigning a variable a value from the $_SERVER array. Then print out a form with PHP, and reference that variable for my form action the HTML is rendered as normal. But the form action page is not there when I view my source. I am sure it is a SIMPLE error... But my brain block is getting larger the more i look at this. help cries the newbie! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and flash
Can anyone point to some good tutorials on using PHP with flash? I am mostly interested in displaying info from a database in the flash movie, as well as loading movies and pictures into the flash file (referenced in the database). thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] class structure.
Hi there, I am pretty new to writing classes (and pretty new to PHP itself), but I was wondering what was the best format for constructing classes. Now for example, i have written 2 versions of a class that accomplish the exact same thing. And I was just wondering if there are any advantages to either, or even if one was formatted more so to standards. Just wanting to learn it the proper way from the get go. My classes are formatted for use in flash remoting (hence the methodTable stuff - you can ignore it). I guess my question refers more towards the declaration of properties, etc. [ VERSION 1 ] function Sql() { $this->methodTable = array( "getRecords" => array( "description" => "return a SQL record", "access" => "remote", "arguments" => array("") ) ); } //SQL //Create method to retreive records function getRecords() { $this->local = mysql_pconnect($this->hostname_local, $this->username_local, $this->password_local) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($this->database_local, $this->local); $this->query_rs_biz = "SELECT * FROM directory ORDER BY Business ASC"; $this->rs_biz = mysql_query($this->query_rs_biz, $this->local) or die(mysql_error()); //return $this->row_rs_biz; return $this->rs_biz; } } ?> [ VERSION 2 ] function Sql2() { $this->methodTable = array( "getRecords" => array( "description" => "return a SQL record", "access" => "remote", "arguments" => array(), "returns" => "sql records" ), "getRecCount" => array( "description" => "return the row count from the getRecords method", "access" => "remote", "arguments" => array(), "returns" => "sql row count" ) ); } //SQL //Create method to retreive records function getRecords() { $local = mysql_pconnect($this->hostname_local, $this->username_local, $this->password_local) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($this->database_local, $local); $query_rs_biz = "SELECT * FROM directory ORDER BY pID ASC"; $rs_biz = mysql_query($query_rs_biz, $local) or die(mysql_error()); //return results; return $rs_biz; } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best flow for this project
ok, i have a project where: -a user adds their email address, name, etc to a database. -a responder sends an email to them to confirm their email address (within 72 hrs). -upon confirmation of their email address, a script will generate a store coupon with a random coupon id # in the browser (which they can print at that time). Now I guess my question relates more to the email confirmation. How would you go about this? Store it in a database? Every-time the script is run it also checks to see which requests are more than 72 hrs old and removes their request from the database? And those that are confirmed, a flag is added to the database so they are not removed? Just looking more for ideas on the script flow to accomplish this. Thanks! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php