php-general Digest 9 Apr 2006 15:08:24 -0000 Issue 4062
php-general Digest 9 Apr 2006 15:08:24 - Issue 4062 Topics (messages 233601 through 233621): Re: php newbie having trouble going to list page 233601 by: David Tulloh 233609 by: Richard Lynch Re: Date problems 233602 by: Rasmus Lerdorf 233614 by: Satyam looking for shopping cart 233603 by: Lisa A 233607 by: Stephen Lake 233608 by: Stephen Lake 233611 by: Lisa A 233612 by: loveneesh.bansal.csipl.net 233615 by: Stephen Lake 233618 by: Jochem Maas 233619 by: afan.afan.net 233620 by: Dan McCullough 233621 by: Ryan A Re: Mail problems with Outlook 233604 by: Richard Lynch Re: Passing Variables from Script to Script 233605 by: Richard Lynch Re: What is best way to do handle audio files? 233606 by: Richard Lynch 233616 by: Nicholas Couloute 233617 by: Dave Goodchild Re: Timestamp needed in error log 233610 by: Richard Lynch Re: question about magic_quotes_gpc not adding slashes into $_GET 233613 by: Richard Lynch Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- David Doonan wrote: I'm having trouble getting the correct results on a list page. The first query is pulling the name of active authors from the d/b and linking to a list page that is supposed to return essay titles by the requested author. The list page however is displaying essay titles by all authors. No doubt something is wrong with the where clause in the List page query. I've tried countless variations on the syntax for Author.ID = Author.ID without success. Sorry for so basic a question. - author page query = $query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID, Writings.Writings_Author FROM Author, Writings WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = Author.ID; ... author page link = a href=author.php?ID=?php echo $row_GetAuthors['ID']; ??php echo $row_GetAuthors['Autholr_Name']; ?/a - List page query = $query_GetAuthorList = SELECT Writings.Writings_Author, Writings.Writings_Title, DATE_FORMAT(Writings_Date, '%M %D, %Y') as Writings_Date, Writings.Writings_Text, Writings.ID, Author.Autholr_Name, Author.ID FROM Writings, Author WHERE Writings.ID = Writings.ID AND Author.Autholr_Name = Writings.Writings_Author AND Author.ID = Author.ID ORDER BY Writings.Writings_Date desc; ... Nowhere in your query are you actually specifying which author you want to get results for. You need to use the variable passed to the page as part of the query. Try adding something like the following to your where block. Author.ID = .mysql_real_escape_string($_GET['ID']) David ---End Message--- ---BeginMessage--- On Sat, April 8, 2006 10:12 am, David Doonan wrote: I'm having trouble getting the correct results on a list page. The first query is pulling the name of active authors from the d/b and linking to a list page that is supposed to return essay titles by the requested author. The list page however is displaying essay titles by all authors. No doubt something is wrong with the where clause in the List page query. I've tried countless variations on the syntax for Author.ID = Author.ID without success. Sorry for so basic a question. - author page query = $query_GetAuthors = SELECT Distinct Author.Autholr_Name, Author.ID, Writings.Writings_Author FROM Author, Writings WHERE Author.Autholr_Name = Writings.Writings_Author and Author.ID = Author.ID; This gets every author several times over, then throws away the duplicates. Not what you want. First thing: WHERE Author.ID = Author.ID This is just silly -- Author.ID will ALWAYS equal Author.ID It's a tautology, like, WHERE 1 = 1 Get rid of it. Next, you really should NOT be storing the Author Name in both tables. Suppose somebody gets married? Suppose Cassius Clay changes his name to Mohammed Ali. Suppose Madonna writes for you. You should store an Author_ID field ni Writings so that you are comparing the ID Numbers, not names that might change tomorrow. Finally, you are JOINing the Author table and Writings table here, and then throwing away all the info from the Writings table, just to get the Names. Either use JUST the author table to get JUST the names, or get BOTH their Writings *AND* their names. $GetAuthors = mysql_query($query_GetAuthors, $connDerbyTrail) or die (mysql_error()); $row_GetAuthors = mysql_fetch_assoc($GetAuthors); $totalRows_GetAuthors = mysql_num_rows($GetAuthors); author page link = a
php-general Digest 10 Apr 2006 03:30:11 -0000 Issue 4063
php-general Digest 10 Apr 2006 03:30:11 - Issue 4063 Topics (messages 233622 through 233648): Re: looking for shopping cart 233622 by: Jochem Maas 233626 by: tedd 233627 by: tedd 233633 by: Ryan A 233634 by: Ryan A Re: Date problems 233623 by: Rasmus Lerdorf Re: Completing forms offline with PHP/MySQL 233624 by: Rory Browne Re: how to kill session id without closing the window? 233625 by: afan.afan.net Re: Problems with Arrays and print and echo 233628 by: Michael Felt Re: Ajax please 233629 by: Michael Felt 233631 by: tedd 233632 by: Ryan A function by reference 233630 by: tedd 233640 by: Robert Cummings stripping enclosed text from PHP code 233635 by: Winfried Meining 233638 by: Satyam php with ajax - uploading pictures 233636 by: Merlin Re: how to run 'periodic' 233637 by: Frank Arensmeier DDE + PHP 233639 by: C.F. Scheidecker Antunes 233641 by: tedd Implied permissions 233642 by: SLaVKa Var within a var 233643 by: bob pilly 233647 by: Kevin Waterson Variable within a Variable 233644 by: bob pilly 233645 by: Chris 233646 by: Paul Novitski How to use check box in CakePHP? 233648 by: Pham Huu Le Quoc Phuc Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Ryan A wrote: CLIP [EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? -- /CLIPYou forgot to mention that the site (and domain name) also sucks and the cart looks crappy,Thanks for sending us that link to bsdinfotech.com coz now we know if ever we wantquality oursourcing to NEVER visit that site. OH NO ... I didn't forget. I had a whole swathe of abuse ready for this guy about his language /cultural skills and the dodgy design-by-template 1999-dreamweaver HTML crap (view source made me laugh anyway, especially when considered in the light of point 2 on this page: http://www.bsdinfotech.com/doit.htm) but then I thought better of it, heck the sun is shining today :-) SUB-Clipshould we all send you our marketing pitch? /SUB-ClipMaybe we should _all_ send the spammer our marketing pitches.offlist :-)And yes, I do consider what he did SPAM.-Ryan today I have someone trying to takeover my main webserver for use in a botnet, SPAM is the least of my worries ;-) ---End Message--- ---BeginMessage--- At 4:03 PM +0200 4/9/06, Jochem Maas wrote: [EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? Well... if we did advertise, we would do a better job of it. And, most of us have written a better shopping cart as well. tedd -- http://sperling.com ---End Message--- ---BeginMessage--- At 11:36 PM -0400 4/8/06, Lisa A wrote: I need a shopping cart for a website that once I install and set up, my client can easily add merchandise to it. They use Paypal. It has to be very easy for them to upload images and products, prices, etc. If anyone knows of something, please let me know. I host my own websites, so not interested in paying a monthly fee. thanks, Lisa Lisa: There are all sorts of shopping carts including PayPal -- you may want to look into that. I have written forms for clients such that they can upload their products, image, price, product ID, and such and data is automatically posted to their MySQL dB, and from there, is available to their on-line catalog and from there, the products are just a click away from PayPal and PayPal's shopping cart. It's neat, simple, and works. No money other than your time to set it up. shameless plug If you want a more traditional shopping cart, you might look into Shop Script (I'm a distributor). I've installed and set-up a few of those. They cost, but are set up for an easy admin for civilians. If interested, contact me privately. /shameless plug tedd --
Re: [PHP] Re: looking for shopping cart
Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com ([EMAIL PROTECTED]) Regards, Ajay - Original Message - From: Lisa A [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, April 09, 2006 10:07 AM Subject: [PHP] Re: looking for shopping cart I actually just installed OS commerce on my site, but I think it might be hard for my clients to upload their contents. They need it to be real easy. Almost like fill in the blanks. What do you think? Lisa Stephen Lake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Give osCommerce a try, its free and easy to use http://www.oscommerce.com/ Lisa A [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need a shopping cart for a website that once I install and set up, my client can easily add merchandise to it. They use Paypal. It has to be very easy for them to upload images and products, prices, etc. If anyone knows of something, please let me know. I host my own websites, so not interested in paying a monthly fee. thanks, Lisa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about magic_quotes_gpc not adding slashes into $_GET
That is incorrect. There *IS* a setting for another magic_quotes_runtime, which will do addslashes to all data coming FROM the database. That's a particularly silly setting UNLESS your entire application consists of taking date out of one database and shoving it into another database -- which is extremely rare. But, if you *DID* have such an application, and if you *DID* have magic_quotes_runtime turned on, and if you *DID* want to echo something out to see what it was, you'd want to use stripslashes, because magic_quotes_runtime has added slashes to your data on its way OUT of the database. Bottom line: First thing you do is drown all the laywers. SECOND thing you do is turn magic_quotes_gpc *OFF*! And most certainly magic_quotes_runtime should be OFF, as it's just plain silly, really, to ever have it on. On Sat, April 8, 2006 10:03 pm, jonathan wrote: that makes more sense but in that situation, I wouldn't need to stripslashes but most tutorials tell you that you need to stripslashes when echoing the row? it seems like that would be incorrect. On Apr 8, 2006, at 7:57 PM, Richard Lynch wrote: On Sat, April 8, 2006 7:49 pm, jonathan wrote: I have a server where magic_quotes_gpc is set to On. It's my understanding that this should add slashes to something like Joe's so that it's Joe\'s but when I look in the db, it is in there as Joe's. This doesn't seem like it should be the anticipated behavior. It DOES add the slashes to $_GET. But when you put the data *IN* to MySQL, MySQL eats the slashes -- In fact, MySQL *needs* the slashes to distinguish somethings: ' the beginning of a string \' an apostrophe embedded IN a string ' the end of a string. So, in slow-motion: HTTP sends ' PHP Magic Quotes makes it be \' MySQL sees it *INSIDE* a string like 'Joe\'s' MySQL stores this internally: Joe's Is there another setting in either PHP or MySQL that will subsequently strip out slashes from magic_quotes_gpc or override this setting such that the automatic adding of slashes isn't taking place? Just turn Magic Quotes *OFF* and use mysql_real_escape_string For the love of god do *NOT* try to do *both* MagicQuotes and mysql_real_escape_string and then be happy when you've got 'Joe\'s' *inside* your database. That just means you've corrupted your data. TIP: If you find yourself calling http://php.net/stripslashes you almost-for-sure have ended up calling addslashes or some thing similar twice. -- 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 -- 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] Date problems
Timestamps are stored as seconds from a certain date. The base date differ depending on the platform, Windows use 1/1/1980 the rest 1/1/1970, but still seconds. 7 days are 7*24*60*60. Just add that much to a timestamp. It helps having a constant such as: define ('DAY_IN_SECONDS',86400); Satyam - Original Message - From: Mace Eliason [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, April 09, 2006 4:14 AM Subject: [PHP] Date problems Hi, I am having troubles adding 7 days to the current date. I have been reading through php.net date() and this is what I have come up with but it doesn't work $today = date('m/d/Y'); $nextweek = date('m/d/Y',mktime(date(m), date(d)+7, date(Y))); if I echo the above variables they are the same? Shouldn't the $nextweek be different? Thanks for the help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is best way to do handle audio files?
Yea, okay looks like I am going to be using mysql cause I want an organized site by genre, author etc. I going to need some resources of mysql cause I haven't used it before! I have used flatfile for about a year now! On Sun, 9 Apr 2006 12:02 am, Richard Lynch wrote: If the files are constantly changing, scandir is probably as fast as it gets... If you rarely alter the files, do scandir once and store the results in, say, MySQL and you can search/sort MUCH faster. On Sat, April 8, 2006 11:01 am, Nicholas Couloute wrote: On my website http://www.sidekick2music.com ! I use scandir() [php 5.0] to fetch all the files which are all in subfolders of this one folder. like this: public_html/amrs/$cat/$author/*.amr $cat = different catergoried of music $author = Authors of the particular catergory This way isn't fast when you have over 5,000+ files. I use flatfile for everything on the site! site: http://www.sidekick2music.com Would it run faster if I used mysql? How would this be done? Is there another way when dealing with files and organizing them? CMS? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm ~Nick Couloute co-owner/Web Designer Sidekick2Music.Com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is best way to do handle audio files?
You will probably find a great deal of list members well versed in mysql as it meshes so well with php, so ask away old bean. On 09/04/06, Nicholas Couloute [EMAIL PROTECTED] wrote: Yea, okay looks like I am going to be using mysql cause I want an organized site by genre, author etc. I going to need some resources of mysql cause I haven't used it before! I have used flatfile for about a year now! On Sun, 9 Apr 2006 12:02 am, Richard Lynch wrote: If the files are constantly changing, scandir is probably as fast as it gets... If you rarely alter the files, do scandir once and store the results in, say, MySQL and you can search/sort MUCH faster. On Sat, April 8, 2006 11:01 am, Nicholas Couloute wrote: On my website http://www.sidekick2music.com ! I use scandir() [php 5.0] to fetch all the files which are all in subfolders of this one folder. like this: public_html/amrs/$cat/$author/*.amr $cat = different catergoried of music $author = Authors of the particular catergory This way isn't fast when you have over 5,000+ files. I use flatfile for everything on the site! site: http://www.sidekick2music.com Would it run faster if I used mysql? How would this be done? Is there another way when dealing with files and organizing them? CMS? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm ~Nick Couloute co-owner/Web Designer Sidekick2Music.Com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK look out for e-karma, our new venture, coming soon!
Re: [PHP] Re: looking for shopping cart
[EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: looking for shopping cart
Try CRE Loaded. http://www.creloaded.com/ It's osCommerce shopping cart with tons of already pre-loaded contributions (modules). -afan I actually just installed OS commerce on my site, but I think it might be hard for my clients to upload their contents. They need it to be real easy. Almost like fill in the blanks. What do you think? Lisa Stephen Lake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Give osCommerce a try, its free and easy to use http://www.oscommerce.com/ Lisa A [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need a shopping cart for a website that once I install and set up, my client can easily add merchandise to it. They use Paypal. It has to be very easy for them to upload images and products, prices, etc. If anyone knows of something, please let me know. I host my own websites, so not interested in paying a monthly fee. thanks, Lisa -- 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] looking for shopping cart
X-Cart, ZenCart (osCommerce like), http://www.hotscripts.com/PHP/Scripts_and_Programs/E-Commerce/index.html if you look in the archives you will find similar questions with a lot better response. On 4/8/06, Lisa A [EMAIL PROTECTED] wrote: I need a shopping cart for a website that once I install and set up, my client can easily add merchandise to it. They use Paypal. It has to be very easy for them to upload images and products, prices, etc. If anyone knows of something, please let me know. I host my own websites, so not interested in paying a monthly fee. thanks, Lisa -- 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] Re: looking for shopping cart
CLIP [EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? -- /CLIPYou forgot to mention that the site (and domain name) also sucks and the cart looks crappy,Thanks for sending us that link to bsdinfotech.com coz now we know if ever we wantquality oursourcing to NEVER visit that site. SUB-Clipshould we all send you our marketing pitch? /SUB-ClipMaybe we should _all_ send the spammer our marketing pitches.offlist :-)And yes, I do consider what he did SPAM.-Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: looking for shopping cart
Ryan A wrote: CLIP [EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? -- /CLIPYou forgot to mention that the site (and domain name) also sucks and the cart looks crappy,Thanks for sending us that link to bsdinfotech.com coz now we know if ever we wantquality oursourcing to NEVER visit that site. OH NO ... I didn't forget. I had a whole swathe of abuse ready for this guy about his language /cultural skills and the dodgy design-by-template 1999-dreamweaver HTML crap (view source made me laugh anyway, especially when considered in the light of point 2 on this page: http://www.bsdinfotech.com/doit.htm) but then I thought better of it, heck the sun is shining today :-) SUB-Clipshould we all send you our marketing pitch? /SUB-ClipMaybe we should _all_ send the spammer our marketing pitches.offlist :-)And yes, I do consider what he did SPAM.-Ryan today I have someone trying to takeover my main webserver for use in a botnet, SPAM is the least of my worries ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date problems
Satyam wrote: Timestamps are stored as seconds from a certain date. The base date differ depending on the platform, Windows use 1/1/1980 the rest 1/1/1970, but still seconds. 7 days are 7*24*60*60. Just add that much to a timestamp. It helps having a constant such as: define ('DAY_IN_SECONDS',86400); The problem with doing it this way is that it won't take leap seconds, leap years and daylight savings into account, so on any of these edge cases it will appear to be broken. That's why strtotime(+7 days) is the correct way to do this. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Completing forms offline with PHP/MySQL
I haven't thought about this much, but I'd probably create an onSubmit handler, that would hide the form in an iframe, and create a new one. I would then when they are online, submit all the forms. This would require the user to keep the browser window open and at the same page. Alternatively you could have the user allow the script to write files to the local hard disk, and store the form data there. Making a .hta file would probably be the easiest way to do this on windows. On 4/7/06, Miles Thompson [EMAIL PROTECTED] wrote: At 01:06 PM 4/7/2006, Kevin Davies - Bonhurst Consulting wrote: Hi, Apologies if this is the wrong place for this question, but I'm sure there are some experts out there who might be able to point me in the right direction... :) I'm doing some work at the moment where remote teams can submit reports through to our database when connected over the internet to our server. However, I've been asked to look in the possibility of the teams completing the form offline, and uploading when they have access to a connection. It looks like I might be able offer something like Microsoft InfoPath forms (better recommendations?) to generate an XML file, and then use a PHP file to upload the file into the database. Additionally, I could also do with this process uploading a number of other files (e.g. images, text files) to the server. Does anyone have any experience in this area, and would be able to recommend a solution? Thanks in advance for your help... Kevin PHP-GTK+ GTK+ front end, laid out using wGlade (which creates an XML-like file with a .glade extension), and of course, PHP for all of your logic. Works Miles -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.385 / Virus Database: 268.3.5/303 - Release Date: 4/6/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to kill session id without closing the window?
Yup! That works perfect! Thanks Tedd :) -afan At 9:19 PM +0200 4/6/06, [EMAIL PROTECTED] wrote: Hi to all, session_start(); $_SESSION['sessid'] = session_id; echo $_SESSION['sessid']; will show e.g. 699e506bd42ea402985dce24a0ef9 After: unset($_SESSION['sessid']); $_SESSION['sessid'] = session_id(); I'm getting the same SID again. I tried with session_unregister() and session_destroy() but same result. How can I create new, other sesssion id (after I, for example, click on 'Log Out' button) without closing window? Thanks for any help. Look up: http://www.weberdev.com/session_regenerate_id HTH's tedd -- http://sperling.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] Re: looking for shopping cart
At 4:03 PM +0200 4/9/06, Jochem Maas wrote: [EMAIL PROTECTED] wrote: Hi, Why donot u people visit www.indialovesu.com and see the shop cart which is much -2 powerful than oscommerce. U can reach to the design company at www.bsdinfotech.com this mailing list is not a forum for advertising your companies' products or services. probably half the members of this list work for web development related companies; should we all send you our marketing pitch? Well... if we did advertise, we would do a better job of it. And, most of us have written a better shopping cart as well. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for shopping cart
At 11:36 PM -0400 4/8/06, Lisa A wrote: I need a shopping cart for a website that once I install and set up, my client can easily add merchandise to it. They use Paypal. It has to be very easy for them to upload images and products, prices, etc. If anyone knows of something, please let me know. I host my own websites, so not interested in paying a monthly fee. thanks, Lisa Lisa: There are all sorts of shopping carts including PayPal -- you may want to look into that. I have written forms for clients such that they can upload their products, image, price, product ID, and such and data is automatically posted to their MySQL dB, and from there, is available to their on-line catalog and from there, the products are just a click away from PayPal and PayPal's shopping cart. It's neat, simple, and works. No money other than your time to set it up. shameless plug If you want a more traditional shopping cart, you might look into Shop Script (I'm a distributor). I've installed and set-up a few of those. They cost, but are set up for an easy admin for civilians. If interested, contact me privately. /shameless plug tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with Arrays and print and echo
John Wells wrote: echo $this-name[5]\n; echo $this-ID[5]\n; $a1 = $this-name; $a2 = $this-ID; echo \n$a1[5] $a2[5]\n; use curly brackets to help PHP understand what you're after: echo {$this-name[5]}\n; When you're in a string like this, PHP has a hard time knowing when you're wanting to access a variable, and when you're simply trying to output text. Using curly brackets clears it up. HTH, John W Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax please....
tedd wrote: Ryan: Carlin Bingham / Tedd: --- Yes, but then I would have to reload the whole page just to tell the person that the account username was already taken...thats how its traditionally done...but I want to try doing it without reloading the whole page...hence Asynchronous JavaScript And XML (AJAX) although the XML part at the end is not really too accurate because from what I see you can (and i have) use AJAX without any XML...in my case it would be AJAH or AJAT (H=HTML, T=TEXT) :-p Okay, you don't need to stick your tongue out -- I know what ajax is. Please review: http://www.xn--ovg.com/ajax Is that what you want? If so, contact me privately and I'll provide you with the code. It's pretty simple really. tedd And I thought Ajax was a Dutch Football (soccer) team. :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function by reference
Hi gang: Not that I have an immediate need for this, but in other languages one can access a function by reference (in other words, it's address -- such as call(function address) ). In php, one can pass a variable by reference by simply using the ampersand, such a $a. Is there a similar way to reference a function? Rob, was kind enough to post the following code, but I was looking for something where I could store the function's address in a variable. Something like: $a = f_a(); And then, where I could use call_user_func($a); (or something similar) and the function would do it's thing -- anything like that? Thanks tedd --- Rob's suggestion follows. Like the following? ?php function f_a() { echo 'a'; } function f_b() { echo 'b'; } function f_c() { echo 'c'; } $map = array ( 'a' = 'f_a', 'b' = 'f_b', 'c' = 'f_c', ); $map['a'](); $map['b'](); $map['c'](); ? -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax please....
At 8:13 PM +0200 4/9/06, Michael Felt wrote: And I thought Ajax was a Dutch Football (soccer) team. :P It isn't?? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax please....
And I thought Ajax was a Dutch Football (soccer) team. :P It isand a very good dish washing detergent too (and yes, I am a bachelor :-D ) Cheers, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for shopping cart
Lisa, -- shameless plug If you want a more traditional shopping cart, you might look into Shop Script (I'm a distributor). I've installed and set-up a few of those. They cost, but are set up for an easy admin for civilians. If interested, contact me privately. /shameless plug --- Another thing to consider is that commercial programs often tend to have better support too incase things go wrong or you want modifications/added features. Don't get me wrong, there are _many_ free programs that are supported very well but they are supported mostly by a community and if you want modifications you would either have to pay for it or wait a long time, if you dont know how to go in and do it yourself of course. The free system thinks more of how a modification would help the whole community of users rather than the single person who has a specific need (OSC as an example, not that I am bashing OSC...I installed it for more than one client myself.) HTH. Cheers, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: looking for shopping cart
Hey, -- OH NO ... I didn't forget. I had a whole swathe of abuse ready for this guy about his language /cultural skills and the dodgy design-by-template 1999-dreamweaver HTML crap (view source made me laugh anyway, especially when considered in the light of point 2 on this page: http://www.bsdinfotech.com/doit.htm)- Hehehe someone certainly was hitting the thesaurus for point two: 2. Eradicating Existing Flaws. --- but then I thought better of it, heck the sun is shining today :-)Lucky son of...oops, sorry, sometimes cant control the little green monster in me :-DJ/K of course. today I have someone trying to takeover my main webserver for use in a botnet, SPAM is the least of my worries ;-)--Sounds bad, best of luck m8.Cheers,Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stripping enclosed text from PHP code
Hi, I am writing on a script that parses a PHP script and finds all function calls to check, if these functions exist. To do this, I needed a function that would strip out all text, which is enclosed in apostrophes or quotation marks. This is somewhat tricky, as the script needs to be aware of what really is an enclosed text and what is PHP code. Apostrophes in quotation mark enclosed text should be ignored and quotation marks in apostrophe enclosed text should be ignored, as well. Similarly, escaped apostrophes in apostrophe enclosed text and escaped quotation marks in quotation mark enclosed text should be ignored. The following function uses preg_match to do this job. ? function stripstrings($text) { while (preg_match(/^(.*)(?!\\\)('|\)(.*)$/, $text, $matches)) { $front = $matches[1]; $lim = $matches[2]; $tail = $matches[3]; while (preg_match(/^(.*)(?!\\\)('|\)(.*)$/, $front, $matches)) { $front = $matches[1]; $tail = $matches[3] . $lim . $tail; $lim = $matches[2]; } if (!preg_match(/^(.*)(?!\\\)$lim(.*)$/, $tail, $matches)) break; $string = $matches[1]; $tail = $matches[2]; while (preg_match(/^(.*)(?!\\\)$lim(.*)$/, $string, $matches)) { $string = $matches[1]; $tail = $matches[2] . $lim . $tail; } $text = $front . $tail; } return($text); } ? I noticed that this function is very slow, in particular because preg_match(/^(.*)some_string(.*)$/, $text, $matches); always seems to find the *last* occurrence of some_string and not the *first* (I would need the first). There is certainly a way to write another version where one looks at every single character when going through $text, but this would make the code much more complex. I wonder, if there is a faster *and* simple way to do the same thing. Is there btw a script freely available, which can parse PHP code and check for errors ? Any help is highly appreciated. Winfried -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php with ajax - uploading pictures
Hi there, I am searching for a good upload framework that works with PHP and AJAX to provide an upload interface that uploads one picture instantly, shows the thumbnail and displays another upload formfield to select the next picture for upload. Is there something like this, or similar around? Thank you for any hint, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to run 'periodic'
Thank you Joe for your input. I will take a look at crond. /frank 7 apr 2006 kl. 20.06 skrev Joe Wollard: Frank, It sounds like you need to run this as a job through crond. I'm not sure what the OSX version is (maybe they have a port of crond?) but you could set that up to execute the specific code, as root, whenever you want. As far as I can think, and maybe Chris Shifflet can confirm/deny this, you shouldn't be running into any additional security issues by executing the script as root - As long as it's running through the CLI version of PHP. Just make sure it's only executable by root and then root should be the only one allowed to create that mammoth ;-) - Joe On 4/6/06, Frank Arensmeier [EMAIL PROTECTED] wrote: Hi. I have written a script which outputs a rather large ZIP file ( 200 MB ) by collecting a large amount of PDF files and html pages. When the script is done, the available amount of free memory has decreased by about 20 - 30%. Running 'periodic' on my machine ( Apple Xserve G5 with Mac OS 10.4 server) restores the available memory to a more proper size. The question is: how can I execute 'periodic daily|weekly|monthly' from my script? Is this possible at all? I know that 'periodic' needs root. And all PHP code is executed as www user which doesn't have root privileges. Would I compromise my servers security when granting root privileges to a script that executes 'periodic' (which could be called from the script that outputs the ZIP archive)? thanks /frank -- 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] stripping enclosed text from PHP code
http://www.phpcompiler.org/ Satyam - Original Message - From: Winfried Meining [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Sunday, April 09, 2006 10:20 PM Subject: [PHP] stripping enclosed text from PHP code Hi, I am writing on a script that parses a PHP script and finds all function calls to check, if these functions exist. To do this, I needed a function that would strip out all text, which is enclosed in apostrophes or quotation marks. This is somewhat tricky, as the script needs to be aware of what really is an enclosed text and what is PHP code. Apostrophes in quotation mark enclosed text should be ignored and quotation marks in apostrophe enclosed text should be ignored, as well. Similarly, escaped apostrophes in apostrophe enclosed text and escaped quotation marks in quotation mark enclosed text should be ignored. The following function uses preg_match to do this job. ? function stripstrings($text) { while (preg_match(/^(.*)(?!\\\)('|\)(.*)$/, $text, $matches)) { $front = $matches[1]; $lim = $matches[2]; $tail = $matches[3]; while (preg_match(/^(.*)(?!\\\)('|\)(.*)$/, $front, $matches)) { $front = $matches[1]; $tail = $matches[3] . $lim . $tail; $lim = $matches[2]; } if (!preg_match(/^(.*)(?!\\\)$lim(.*)$/, $tail, $matches)) break; $string = $matches[1]; $tail = $matches[2]; while (preg_match(/^(.*)(?!\\\)$lim(.*)$/, $string, $matches)) { $string = $matches[1]; $tail = $matches[2] . $lim . $tail; } $text = $front . $tail; } return($text); } ? I noticed that this function is very slow, in particular because preg_match(/^(.*)some_string(.*)$/, $text, $matches); always seems to find the *last* occurrence of some_string and not the *first* (I would need the first). There is certainly a way to write another version where one looks at every single character when going through $text, but this would make the code much more complex. I wonder, if there is a faster *and* simple way to do the same thing. Is there btw a script freely available, which can parse PHP code and check for errors ? Any help is highly appreciated. Winfried -- 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] DDE + PHP
Hello, I have an Excel spreadsheet that is automatically updated with quotes. I am doing a project for my BS and I need to grab the information from this spreadsheet and populate a MySQL database. Any ideas on how to accomplish that with PHP? The spreadsheet uses a DDE feed to fetch information from a third party service and needs to be opened. I understand that I can do that with Java as well but if there is a way with PHP I prefer. Thanks, C.F. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function by reference
On Sun, 2006-04-09 at 14:17, tedd wrote: Hi gang: Not that I have an immediate need for this, but in other languages one can access a function by reference (in other words, it's address -- such as call(function address) ). In php, one can pass a variable by reference by simply using the ampersand, such a $a. Is there a similar way to reference a function? Rob, was kind enough to post the following code, but I was looking for something where I could store the function's address in a variable. Something like: $a = f_a(); And then, where I could use call_user_func($a); (or something similar) and the function would do it's thing -- anything like that? It's the same thing for the most part... ?php $a = 'f_a'; call_user_func( $a, $p1, $p2, $p3 ) ? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DDE + PHP
At 4:59 PM -0600 4/9/06, C.F. Scheidecker Antunes wrote: Hello, I have an Excel spreadsheet that is automatically updated with quotes. I am doing a project for my BS and I need to grab the information from this spreadsheet and populate a MySQL database. Any ideas on how to accomplish that with PHP? The spreadsheet uses a DDE feed to fetch information from a third party service and needs to be opened. I understand that I can do that with Java as well but if there is a way with PHP I prefer. Thanks, C.F. Yep, you can upload an Excel spreadsheet and populate MySQL via php. These links might give you a start. http://www.weberdev.com/get_example-3591.html http://www.weberdev.com/get_example-1270.html As for DDE and third party service, I haven't a clue. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Implied permissions
Hey guys... implementing a permission system and just wanted some advice. If i have permission A which has implied permissions B and C How do the permissions relate to each other, for eg if I select permission A to true, that implies that permission B and C must be set to true, but then if I set B to false or C to false, or both does that affect permission A? Assuming that B, and C dont have implied rights you should be able to turn both of them off while leaving A on, but then that breaks the rule for A having implied permissions B and C. Any help appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Var within a var
Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. e.g i have this stored Dear $title $name we would like to.. I declare the vars $title and $name $title = 'Mr'; $name = 'Test'; //retrieve the stored template $query = select template from letters; $result = mysqli_query($dblink,$query); if($row = mysqli_fetch_array($result)){ print $row['template']; } i would expect that to print: Dear Mr Test we would like to.. but it doesnt it prints out Dear $title $name we would like to.. can someone point out where i am going wrong? Thanks for any help in advance! Cheers Bob - Yahoo! Photos NEW, now offering a quality print service from just 8p a photo.
[PHP] Variable within a Variable
Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. e.g i have this stored Dear $title $name we would like to.. I declare the vars $title and $name $title = 'Mr'; $name = 'Test'; //retrieve the stored template $query = select template from letters; $result = mysqli_query($dblink,$query); if($row = mysqli_fetch_array($result)){ print $row['template']; } i would expect that to print: Dear Mr Test we would like to.. but it doesnt it prints out Dear $title $name we would like to.. can someone point out where i am going wrong? Is this actually possible and if so im picking ive go the syntax wrong? Thanks for any help in advance! Cheers Bob - To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
Re: [PHP] Variable within a Variable
bob pilly wrote: Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. e.g i have this stored Dear $title $name we would like to.. I declare the vars $title and $name $title = 'Mr'; $name = 'Test'; //retrieve the stored template $query = select template from letters; $result = mysqli_query($dblink,$query); if($row = mysqli_fetch_array($result)){ print $row['template']; } i would expect that to print: Dear Mr Test we would like to.. but it doesnt it prints out Dear $title $name we would like to.. If you don't get an immediate response you don't need to repost your question. The data stored in the database is $title, $name, not the filled in variables. When php prints it out (in this case), it's printing it out exactly how it came out of the database. No variable substitutions etc take place unless you tell them to. I'd suggest using htmlentities / htmlspecialchars to help make sure your data won't cause issues like XSS. You could do: print str_replace(array('$title', '$name'), array($title, $name), htmlentities($row['template'])); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable within a Variable
At 06:54 PM 4/9/2006, bob pilly wrote: Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. At 04:05 PM 4/7/2006, Paul Novitski wrote: At 02:41 PM 4/7/2006, David Clough wrote: I have to parse the string 'Hello $foo' as it comes from the database: I don't get to construct it. I did hold out more hope for the eval function, but it seems to me that this is for PHP code in a database, not to evaluate variables. David, please try the eval() route: it will do what you want. You say, this is for PHP code in a database, not to evaluate variables, but evaluating variables is absolutely part of PHP code processing! Eval() will operate on $x = 4; just as easily as on Hello $foo. You should not use eval() frivolously because it presents a potential vulnerability in your code. You may wish to ensure that the database text it operates on is first cleansed of any other PHP syntax -- similarly to the way we should all ensure that any incoming data is clean before we process it and incorporate it into our scripts. Here's an example of variaible evaluation: ___ $bar = cat; $foo = Hello \$bar.; echo $foo; RESULT: Hello $bar. By escaping the $, I have made it a literal character in the text, the same as if I'd read Hello $bar from a database. ___ eval(echo \$foo\;); RESULT: Hello cat. This is equivalent to scripting: echo $foo; I'm using eval() to execute the echo command and interpret the PHP variable $foo. ___ eval(\$dog = \$bar;); echo dog = . $dog; RESULT: dog = cat Here I'm using eval() to set one PHP variable equal to another. ___ You can't simply write: eval(\$bar;); or $x = eval($foo); because everything inside the eval() parentheses needs to be a complete PHP statement. The eval() function itself doesn't return the value of an evaluated expression. To capture the value of an expression, you must evaluate a complete statement that sets a variable equal to the expression as above. ___ Clear as mud? Regards, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Var within a var
This one time, at band camp, bob pilly [EMAIL PROTECTED] wrote: Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. eval() Kevin -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to use check box in CakePHP?
Hi everybody! I want to use a checkbox in Add, Edit form with CakePHP. How to do? Please help me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use check box in CakePHP?
Pham Huu Le Quoc Phuc wrote: Hi everybody! I want to use a checkbox in Add, Edit form with CakePHP. How to do? Please help me! You know cake has documentation right? http://manual.cakephp.org/ -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use check box in CakePHP?
Could you give me a example? - Original Message - From: Chris [EMAIL PROTECTED] To: Pham Huu Le Quoc Phuc [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, April 10, 2006 10:39 AM Subject: Re: [PHP] How to use check box in CakePHP? Pham Huu Le Quoc Phuc wrote: Hi everybody! I want to use a checkbox in Add, Edit form with CakePHP. How to do? Please help me! You know cake has documentation right? http://manual.cakephp.org/ -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use check box in CakePHP?
Pham Huu Le Quoc Phuc wrote: Could you give me a example? Read the documentation or ask on their mailing list / forum. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use check box in CakePHP?
Pham Huu Le Quoc Phuc wrote: Could you give me a example? I found your question quite easily in the manual: http://manual.cakephp.org/pages/ch09s01#d0e1498 checkbox ($fieldName, $title=null, $htmlAttributes=null, $return=false) -- 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] PHP + DDE live feed
Hello, I have an Excel spreadsheet that is automatically updated with quotes. I am doing a project for my BS and I need to grab the information from this spreadsheet and populate a MySQL database. Any ideas on how to accomplish that with PHP? The spreadsheet uses a live DDE feed to fetch information from a third party service and needs to be opened. This is not a matter of reading a static XLS spreadsheet but what I need is a DDE way to talk to the open spreadsheet and update the database when the cells are changed or have a 1 minute loop to go over the cells. I understand that I can do that with Java with a commercial package called Java DDE as well but if there is a way with PHP I prefer. Thanks, C.F. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + DDE live feed
C.F. Scheidecker Antunes wrote: Hello, I have an Excel spreadsheet that is automatically updated with quotes. I am doing a project for my BS and I need to grab the information from this spreadsheet and populate a MySQL database. Any ideas on how to accomplish that with PHP? The spreadsheet uses a live DDE feed to fetch information from a third party service and needs to be opened. This is not a matter of reading a static XLS spreadsheet but what I need is a DDE way to talk to the open spreadsheet and update the database when the cells are changed or have a 1 minute loop to go over the cells. There are a few packages on phpclasses.org which may do what you want: http://www.phpclasses.org They all seem to use the COM object (http://www.php.net/com) which only works on windows. This package might help also: http://sourceforge.net/projects/phpexcelreader/ and should work anywhere. -- 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] mod_rewrite q's: syntax?
Hi all... sorry if this is OT for PHP list... Maybe a reply off-list? I just wanted to share my .htaccess file in the hopes that I can hone/fool-proof-a-tize it as much as possible via your feedback and suggestions. Here is what I got so far... I start by turning-on error reporting, then I am converting all non www traffic to www traffic, and I finish things up by removing index.php from the site url... [code] -- # Turn-on PHP error messaging: php_value display_errors 1 php_value error_reporting 2047 # Power-up the rewrite engine: RewriteEngine on # Redirect all non-www traffic: RewriteCond %{HTTP_HOST} ^mydomain\.com$ RewriteRule ^.*$ http://www.mydomain.com%{REQUEST_URI} [R=permanent,L] # Remove index.php from url: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+) index.php/$1 [L] -- [/code] What I want to do: I would like to use mod_rewrite to forward all requests for http://www.mydomain.com (or http://mydomain.com) to www.mydomain.com/folder/file.php Questions: 1. How is my code looking so far? Any potential pitfalls that you can see? 2. Can I combine the conditions and rules into one, more compact, script? 3. Any suggestions on how I would go about adding-in a rule/condition to redirect users to com/folder/file.php as stated above? Many TIA, Sorry if OT. Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_rewrite q's: syntax?
Micky Hulse wrote: Hi all... sorry if this is OT for PHP list... Maybe a reply off-list? I just wanted to share my .htaccess file in the hopes that I can hone/fool-proof-a-tize it as much as possible via your feedback and suggestions. Here is what I got so far... I start by turning-on error reporting, then I am converting all non www traffic to www traffic, and I finish things up by removing index.php from the site url... [code] -- # Turn-on PHP error messaging: php_value display_errors 1 php_value error_reporting 2047 # Power-up the rewrite engine: RewriteEngine on # Redirect all non-www traffic: RewriteCond %{HTTP_HOST} ^mydomain\.com$ RewriteRule ^.*$ http://www.mydomain.com%{REQUEST_URI} [R=permanent,L] # Remove index.php from url: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+) index.php/$1 [L] -- [/code] What I want to do: I would like to use mod_rewrite to forward all requests for http://www.mydomain.com (or http://mydomain.com) to www.mydomain.com/folder/file.php Questions: 1. How is my code looking so far? Any potential pitfalls that you can see? 2. Can I combine the conditions and rules into one, more compact, script? 3. Any suggestions on how I would go about adding-in a rule/condition to redirect users to com/folder/file.php as stated above? Do you need to do it with a mod_rewrite? if not, you can do it easily in php: header('location: folder/file.php'); exit(); in index.php. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mod_rewrite q's: syntax?
-Original Message- From: Chris [mailto:[EMAIL PROTECTED] Do you need to do it with a mod_rewrite? if not, you can do it easily in php: header('location: folder/file.php'); exit(); in index.php. Unfortunately, yes... I am using a CMS, and my current setup is forcing me into using the more complicated mod_rewrite. Well, not that it is a bad thing... seems like mod_rewrite is more search-engine/bot friendly. Thanks for the tip though, I really appreciate your time. Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php