Re: [PHP] Is there a way to...
GH wrote: Is there a way to make sure that a page is only loaded via a require or include statement? or other type of SSI? I would like to make sure that a 'parent document' (namely admin_template.php) only calls the php file? Thanks leave if outside htdocs -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod-rewrite
I have just started using mod-rewrite, and have two questions... I see everywhere on the net that I can change file names to lower case - at present they are an ex-Windows based mess of upper and lower. But I can't see anywhere how to actually do it, just that it is possible. Also, I use RewriteRule ^comm/(.*).php /comm.php?C=$1 to change comm.php?C=abc to a more search engine friendly comm/abc.php. But this leaves gives the effect of being in a different folder, and relative URLS within that page no longer work correctly. Is there a Clever Fix? Or do I have to change to absolute URLS? And if absolute is absolutely necessary, should I include the domain name? -- Pete Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod-rewrite
Wow - this is *really* spooky! When I wrote that, with RewriteRule relative URLS within that page no longer work correctly, I had not realised that those within PHP worked ok, whereas those in raw HTML didn't... -- Pete Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 and Multi Inheritance?
Is direct multi inhertance supported in PHP5? I'm on PHP4, didnt find this on the docs nor at zend's. It might be the reason of migrating to PHP5 for me. Any Idea? anyone who tested it? by this I dont mean the chaining method of inheriting. I mean direct multi inheritance! Thanx in advance. -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to...
secure it with apache .ht* files for directory and file settings or the main config file. On Sun, 17 Oct 2004 15:35:58 +0600, raditha dissanayake [EMAIL PROTECTED] wrote: GH wrote: Is there a way to make sure that a page is only loaded via a require or include statement? or other type of SSI? I would like to make sure that a 'parent document' (namely admin_template.php) only calls the php file? Thanks leave if outside htdocs -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod-rewrite
Pete wrote: I have just started using mod-rewrite, and have two questions... snip And neither one of them have anything to do with PHP. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php installation
hello all, i need to install php, postgresql and apache. i had redhat 7.3 running. i like to know, the comaptible versions of the above three. i couldn't install the current version of the above three as it is asking for GLIBC-2.3. but i had GLIBC-2.2.5 running. it is not possible to update GLIBC. thanks in advance - Do you Yahoo!? vote.yahoo.com - Register online to vote today!
[PHP] Re: PHP5 and Multi Inheritance?
* M Saleh Eg [EMAIL PROTECTED]: Is direct multi inhertance supported in PHP5? I believe so -- this was one of the new features of the object model introduced in PHP5. My understanding is that you have to create interface classes that a class can then implement. Unfortunately, interface classes are abstract -- no code allowed other than declarations. I'm on PHP4, didnt find this on the docs nor at zend's. It might be the reason of migrating to PHP5 for me. Any Idea? anyone who tested it? by this I dont mean the chaining method of inheriting. I mean direct multi inheritance! I saw a number of mentions of it when PHP5 was first released, but the only reference I can dig up now is at: http://www.zend.com/php5/andi-book-excerpt.php#Heading3 and, unfortunately, when it talks about interfaces being how multiple inheritance is achieved, fails to give an example. Surely somebody has a more definitive answer, but I thought I'd give it a shot. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to...
On Sat, 16 Oct 2004 22:04:33 -0400, Gh [EMAIL PROTECTED] wrote: Your right, this is not what I was expecting, I was thinking there was another way... Sounds good.. but any other suggestions? On Sat, 16 Oct 2004 21:40:56 -0400, Minuk Choi [EMAIL PROTECTED] wrote: well, this is probably not what you were expecting... but you can try this admin_template.php -- $parent = true; include('important.php'); -- important.php -- if (!isset($parent) || !$parent) exit(); //important stuff here. -- Of course, this only works assuming that the would-be hacker doesn't know HOW you are authenticating the file. If you are going to try this method, mix it up, use a rather unique variable name and or use a value that is hard to guess. -Minuk - Original Message - From: GH [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Saturday, October 16, 2004 9:15 PM Subject: [PHP] Is there a way to... Is there a way to make sure that a page is only loaded via a require or include statement? or other type of SSI? I would like to make sure that a 'parent document' (namely admin_template.php) only calls the php file? Thanks I often do it this way: main.php: ? define('MyScript', '1.0'); include('file.php'); ? file.php: ? if (!defined('MyScript')) die(Access denite); ? To hack this, the attacker needs filesystem access to your script - an if this happens, that should be your smallest problem... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP5 and Multi Inheritance?
Thanx Mathew I guess I found it, it's disapointing though. Here was the answer: http://www.zend.com/php5/andi-book-excerpt.php#Heading3 Copied from the link above 4. Interfaces Gives the ability for a class to fulfill more than one is-a relationships. A class can inherit from one class only but may implement as many interfaces as it wants. Copied from the link above On 17 Oct 2004 13:30:36 -, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: * M Saleh Eg [EMAIL PROTECTED]: Is direct multi inhertance supported in PHP5? I believe so -- this was one of the new features of the object model introduced in PHP5. My understanding is that you have to create interface classes that a class can then implement. Unfortunately, interface classes are abstract -- no code allowed other than declarations. I'm on PHP4, didnt find this on the docs nor at zend's. It might be the reason of migrating to PHP5 for me. Any Idea? anyone who tested it? by this I dont mean the chaining method of inheriting. I mean direct multi inheritance! I saw a number of mentions of it when PHP5 was first released, but the only reference I can dig up now is at: http://www.zend.com/php5/andi-book-excerpt.php#Heading3 and, unfortunately, when it talks about interfaces being how multiple inheritance is achieved, fails to give an example. Surely somebody has a more definitive answer, but I thought I'd give it a shot. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod-rewrite
Yes it does! It aint off topic. Pate is trying to figure out how to integrate mod_rewrite functionality with his PHP scripts. If you're new to mod_rewrite then you can use this alternative PHP script that does the work for u. Here you go: http://www.zend.com/codex.php?id=674single=1 On Sun, 17 Oct 2004 09:16:37 -0400, John Nichel [EMAIL PROTECTED] wrote: Pete wrote: I have just started using mod-rewrite, and have two questions... snip And neither one of them have anything to do with PHP. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod-rewrite
M Saleh EG wrote: Yes it does! It aint off topic. Pate is trying to figure out how to integrate mod_rewrite functionality with his PHP scripts. Ah well, I should just ask a question or two about how to integrate mod_perl functionality then, eh? It's as offtopic as MySQL, JavaScript, etc questions are on this list. There _are_ places out there were mod_rewrite would be on topic, but this isn't one of them. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tempnam not working??
Hi Everybody, I'm running php 4.3.2 When I run the following $fname = tempnam('mytmp/', 'PREFIX_'); and then echo $fname, it returns /tmp/FILENAME rather than mytmp/FILENAME I'm running under RHEL 3 U3 Anybody know what's going on? thanks, Brent
Re: [PHP] Tempnam not working??
- Original Message - From: Brent Clements [EMAIL PROTECTED] When I run the following $fname = tempnam('mytmp/', 'PREFIX_'); and then echo $fname, it returns /tmp/FILENAME rather than mytmp/FILENAME -- From the manual: Creates a file with a unique filename in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that The chances are that mytmp in the directory the script is runjning in either doesn't exist or is not writable by the process running on the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP5 and Multi Inheritance?
I'm not sure, but I think the only way you are going to get MI in PHP, is if you implement if yourself. By this I mean, implementing the correct __get(), __set(), and __call() functions. On Sun, 17 Oct 2004 18:32:34 +0400, M Saleh EG [EMAIL PROTECTED] wrote: Thanx Mathew I guess I found it, it's disapointing though. Here was the answer: http://www.zend.com/php5/andi-book-excerpt.php#Heading3 Copied from the link above 4. Interfaces Gives the ability for a class to fulfill more than one is-a relationships. A class can inherit from one class only but may implement as many interfaces as it wants. Copied from the link above On 17 Oct 2004 13:30:36 -, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: * M Saleh Eg [EMAIL PROTECTED]: Is direct multi inhertance supported in PHP5? I believe so -- this was one of the new features of the object model introduced in PHP5. My understanding is that you have to create interface classes that a class can then implement. Unfortunately, interface classes are abstract -- no code allowed other than declarations. I'm on PHP4, didnt find this on the docs nor at zend's. It might be the reason of migrating to PHP5 for me. Any Idea? anyone who tested it? by this I dont mean the chaining method of inheriting. I mean direct multi inheritance! I saw a number of mentions of it when PHP5 was first released, but the only reference I can dig up now is at: http://www.zend.com/php5/andi-book-excerpt.php#Heading3 and, unfortunately, when it talks about interfaces being how multiple inheritance is achieved, fails to give an example. Surely somebody has a more definitive answer, but I thought I'd give it a shot. -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- 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] Tempnam not working??
Brent Clements wrote: Hi Everybody, I'm running php 4.3.2 When I run the following $fname = tempnam('mytmp/', 'PREFIX_'); and then echo $fname, it returns /tmp/FILENAME rather than mytmp/FILENAME I'm running under RHEL 3 U3 Anybody know what's going on? If 'mytmp' does not exist (relative to your script), then PHP will default to the system directory. Or, if PHP cannot write to 'mytmp', it'll default back to the system temporary directory. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend PHP Certification test
I've been looking all over the Zend Cert site, trying to find the passing rate, ie how many questions I have to get right in order to pass. Is this information secret, or have I just not looked in the right place. If it's the latter, please enlighten me. Thanks Rory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IIS6 - CGI vs ISAPI
I am running a Windows 2003 web server with IIS 6. I currently have PHP 4.3.8 installed as CGI and it is almost working perfectly. Occasionally, I get the following error: No input file specified. I will be upgrading to 4.3.9 soon and am considering switching to ISAPI. I have heard good and bad things from people who I feel are not quite informed. I would like to know your opinion on the matter. Which is a better option for IIS6? What are the upsides and downsides to each? -- Thank You, Jason Williard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein wrote: I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach ( $_SESSION['foo'] as $x ) { sql .= INSERT INTO TABLE (... VALUES ($x) Just can't seem to figure out how with three arrays. help appreciated. Stuart Can you provide a print_r() output of your $_SESSION['foo'] ? I can help you more after that. -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 / signature.asc Description: This is a digitally signed message part
Re: [PHP] Nested foreach ?
Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each. Thank you Stuart --- Robby Russell [EMAIL PROTECTED] wrote: On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein wrote: I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach ( $_SESSION['foo'] as $x ) { sql .= INSERT INTO TABLE (... VALUES ($x) Just can't seem to figure out how with three arrays. help appreciated. Stuart Can you provide a print_r() output of your $_SESSION['foo'] ? I can help you more after that. -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 / ATTACHMENT part 2 application/pgp-signature name=signature.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein wrote: Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each. Thank you Stuart Are these 3 arrays related somehow? are all the [0]'s related and all the [1]'s related in each array? If so, you might consider having an array of arrays -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 / signature.asc Description: This is a digitally signed message part
Re: [PHP] Nested foreach ?
They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean by are the [0] related. Thank you, Stuart --- Robby Russell [EMAIL PROTECTED] wrote: On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein wrote: Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each. Thank you Stuart Are these 3 arrays related somehow? are all the [0]'s related and all the [1]'s related in each array? If so, you might consider having an array of arrays -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 / ATTACHMENT part 2 application/pgp-signature name=signature.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
On Sun, 2004-10-17 at 13:08 -0700, Stuart Felenstein wrote: They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean by are the [0] related. Thank you, Stuart I guess that I am just trying to figure out what your issue is. Can you explain what the issue is a bit more, in plain english and perhaps I can help you from there. All I can see right now is that you are having an issue with a nested foreach, but didn't really explain what the issue was. -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 / signature.asc Description: This is a digitally signed message part
Re: [PHP] Nested foreach ?
Okay, I will try - I have these three fields in a form for user input. There are 10 sets of these, i.e. Users can enter three sets of skills, with the yearsused and when last used. I have set them up as arrays, since it's probably not wise to manage 30 seperate variables. I'm using session variables: $_SESSION['skills'] = $_POST['skill']; $_SESSION['skys'] = $_POST['sky']; $_SESSION['slus'] = $_POST['slu']; My problem is I do not know how to get these into the database with one query. Hope this is clearer. Thank you , Stuart --- Robby Russell [EMAIL PROTECTED] wrote: On Sun, 2004-10-17 at 13:08 -0700, Stuart Felenstein wrote: They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean by are the [0] related. Thank you, Stuart I guess that I am just trying to figure out what your issue is. Can you explain what the issue is a bit more, in plain english and perhaps I can help you from there. All I can see right now is that you are having an issue with a nested foreach, but didn't really explain what the issue was. -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 / ATTACHMENT part 2 application/pgp-signature name=signature.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
Stuart Felenstein wrote: Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each. Since we're just guessing at what you want, I'll guess something like this: foreach($skills as $key = $skill) { echo $skill - {$skys[$key]} - {$slus[$key]}\n; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
John, Sorry, I'm not trying to be unclear. There are 3 columns in the table. In the user form. there are 30 fields, 10 text and 20 dropdown. The 10 text are: $_SESSION['skills'] = $_POST['skill']; The first dropdown is : $_SESSION['skys'] = $_POST['sky']; The second dropdown is: $_SESSION['slus'] = $_POST['slu']; So I need to grab the input and enter into database where each set of skill, sky , slu is a new record. I hope this is clearer. Stuart --- John Holmes [EMAIL PROTECTED] wrote: Stuart Felenstein wrote: Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4] = ) Array ( [0] = [1] = [2] = [3] = [4] = ) 1 FYI - The skills is a string, skys and slus ints. Also I had only filled in 3 of the 5 for each. Since we're just guessing at what you want, I'll guess something like this: foreach($skills as $key = $skill) { echo $skill - {$skys[$key]} - {$slus[$key]}\n; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.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] Nested foreach ?
Stuart, Having read what you've written so far, you may want to try something like this. In your HTML (I've left the selects empty, but you can see what I mean): input type=text name=skills[0][name] /select name=skills[0][years] /select name=skills[0][used] / input type=text name=skills[1][name] /select name=skills[1][years] /select name=skills[1][used] / input type=text name=skills[2][name] /select name=skills[2][years] /select name=skills[2][used] / ... input type=text name=skills[9][name] /select name=skills[9][years] /select name=skills[9][used] / Then in PHP ?php foreach ($_POST['skills'] as $skill) { $skillname = $skill['name']; $yearsused = $skill['years']; $lastused = $skill['used']; ... } ? Hope this helps Cheers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested foreach ?
Stuart Felenstein wrote: John, Sorry, I'm not trying to be unclear. There are 3 columns in the table. In the user form. there are 30 fields, 10 text and 20 dropdown. The 10 text are: $_SESSION['skills'] = $_POST['skill']; The first dropdown is : $_SESSION['skys'] = $_POST['sky']; The second dropdown is: $_SESSION['slus'] = $_POST['slu']; So I need to grab the input and enter into database where each set of skill, sky , slu is a new record. I hope this is clearer. Did you read the answer I gave? foreach($skills as $key = $skill) { echo $skill - {$skys[$key]} - {$slus[$key]}\n; } Now adapt that to your session variables and query: foreach($_SESSION['skills'] as $key = $skill) { $query = INSERT INTO table (skill, sky, sku) VALUES ('$skill', {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]}); //run query } or, if you can use extended inserts: $insert = array(); foreach($_SESSION['skills'] as $key = $skill) { $insert[] = ('$skill',{$_SESSION['skys'][$key]},{$_SESSION['skus'][$key]}); } $query = 'INSERT INTO table (skill,sky,sku) VALUES ' . implode(',',$insert); //run query -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cacheing problem
Hi, Heres my problem: I am offering a form for the client to upload his picture, then his pic is shown and he can pick some text to write on the image, then I am using GD to write the text. If the client does not like the position of the text he can press the back button and change the position, but this seems to be working only in Operain IE it is displaying this horrorable text: Warning: Page has Expired The page you requested was created using information blah balh blah blah What headers or whatever do I have to set so that it shows the cached page? please show me where and how to set the headers or whatever :-) Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] probs generating multiple drop down select lists within a single form
hi... i have a prob/issue that i can't see.. i'm trying to geneate a page with multiple lists so that the user has to select an item from all 3 lists in order to access the next page... the 1st select/list allows the user to select either one or more items. the 2nd/3rd select lists require the user to select only a single item from the lists. ie: list1 list2list3 submitBTN the user would select the items from all three lists, and hit the selectBTN, to go to the next page... the prob that i'm having is that if i simply select item(s) from the 1st list, then the code allows the user to continue...in other words, the app looks as though the user has selected an item from the 2nd/3rd even though they haven't been selected... in examining the code, it appears that the last item in the 2nd/3rd lists is being somehow read/inserted into the items, and are somehow included in the querystring... my code is: /* generate the state list */ echo div style='position:absolute; top:320px; left:50px; width:400px;' form name='test' method='get' action='$foo.php' div style='position:relative; top:10px; left:10px;' select multiple size=10 name='state[]' ; $state_query = select * from stateTBL; $res = mysqli_query($link, $state_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu echo option value ='*'All States/option\n; while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['val'].'.$row['name']./option\n; } echo /select /div ; /* generate the year list */ echo div style='position:absolute; top:10px; left:240px; width:100px;' select multiple size=1 name= 'year' ; $year_query = select * from yearTBL; $res = mysqli_query($link, $year_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['year'].'.$row['year']./option\n; } echo /select /div ; /* generate the terms list */ echo div style='position:absolute; top:10px; left:325px; width:100px;' select name= 'term' ; $term_query = select * from termTBL; $res = mysqli_query($link, $term_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['ID'].'.$row['term']./option\n; } echo /select /div ; $blah = $userdata['session_id']; echo div style='position:relative; top:-150px; left:475px;' input type='submit' name='sub1' value='submit' /div input type ='hidden' name='sid' value='$blah' input type='hidden' name='display' value='state' /form /div ; in foo.php, i simply display the $_GET['state'], $_GET['year'],$_GET['term'] vars to see what they are... if i make all the select vars for the query terms arrays, it works as it should, in that if all three lists aren't selected, then the user can't proceed. however, if i use the select select name = 'foo' for the 2nd/3rd lists, then the logic screws up... any idea why this is occuring is there a better way/example of using multiple drop down lists within a single form. any thoughts/comments/pointers would be helpful.. i'm pretty sure that the issue/prob is rather straight forward/simple, but i can't see it right now thanks... -bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cacheing problem
On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag [EMAIL PROTECTED] wrote: Warning: Page has Expired You can use the GET method instead of POST in your form if that's appropriate. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] probs generating multiple drop down select lists within a single form
On Sun, 17 Oct 2004 17:23:14 -0700, bruce [EMAIL PROTECTED] wrote: i have a prob/issue that i can't see.. i'm trying to geneate a page with multiple lists so that the user has to select an item from all 3 lists in order to access the next page... the 1st select/list allows the user to select either one or more items. the 2nd/3rd select lists require the user to select only a single item from the lists. ie: list1 list2list3 submitBTN the user would select the items from all three lists, and hit the selectBTN, to go to the next page... the prob that i'm having is that if i simply select item(s) from the 1st list, then the code allows the user to continue...in other words, the app looks as though the user has selected an item from the 2nd/3rd even though they haven't been selected... in examining the code, it appears that the last item in the 2nd/3rd lists is being somehow read/inserted into the items, and are somehow included in the querystring... my code is: /* generate the state list */ echo div style='position:absolute; top:320px; left:50px; width:400px;' form name='test' method='get' action='$foo.php' Why $foo here? Maybe not enough context for me to understand the reason, I dunno. div style='position:relative; top:10px; left:10px;' select multiple size=10 name='state[]' ; $state_query = select * from stateTBL; $res = mysqli_query($link, $state_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu echo option value ='*'All States/option\n; while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['val'].'.$row['name']./option\n; } echo /select /div ; /* generate the year list */ echo div style='position:absolute; top:10px; left:240px; width:100px;' select multiple size=1 name= 'year' ; Did you mean year[] here? Otherwise why multiple? $year_query = select * from yearTBL; $res = mysqli_query($link, $year_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['year'].'.$row['year']./option\n; } echo /select /div ; /* generate the terms list */ echo div style='position:absolute; top:10px; left:325px; width:100px;' select name= 'term' ; $term_query = select * from termTBL; $res = mysqli_query($link, $term_query); //$res = mysql_query($query); //go ahead and process/populate the drop down //menu while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) { echo option value ='.$row['ID'].'.$row['term']./option\n; } echo /select /div ; $blah = $userdata['session_id']; echo div style='position:relative; top:-150px; left:475px;' input type='submit' name='sub1' value='submit' /div input type ='hidden' name='sid' value='$blah' input type='hidden' name='display' value='state' /form /div ; in foo.php, i simply display the $_GET['state'], $_GET['year'],$_GET['term'] vars to see what they are... if i make all the select vars for the query terms arrays, it works as it should, in that if all three lists aren't selected, then the user can't proceed. however, if i use the select select name = 'foo' for the 2nd/3rd lists, then the logic screws up... any idea why this is occuring is there a better way/example of using multiple drop down lists within a single form. Possibly. I'd recommend using print_r($_GET) to see your form submissions. To make sure your actually getting what you want to be getting. any thoughts/comments/pointers would be helpful.. i'm pretty sure that the issue/prob is rather straight forward/simple, but i can't see it right now Not sure exactly what is broken, is that your entire script as posted? -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help With Error
Hello Everyone, I keep getting the following errors in my class and I don't know why. Maybe something has changed in PHP 5.x that I don't know about? Here are the errors and the methods of that class: --- Notice: Undefined index: 0 in L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line 77 Notice: Undefined index: 0 in L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line 77 Fatal error: Cannot use object of type DB_Error as array in L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line 46 --- Line 77 is the 5th line of the following function: --- function get_ancestors($child) { // get child's lft rgt values $data = $this-get_cat_coord($child); // get ancestors of child based on child's lft and rgt values $tree = $this-fetch('SELECT * FROM tree WHERE lft '.$data['0']['lft'].' AND rgt '.$data['0']['rgt'].' ORDER BY lft ASC'); return $tree; } --- Line 46 is the 3rd line of the following function --- function get_parent($child) { $parent = $this-get_ancestors($child); $parent = $parent[count($parent)-1]; if (count($parent) 0) { return $parent; } else { return 0; } } --- I am calling the following function which calls the other two child functions above: --- function add_cat($cat, $addAfterCat_name='', $addAfterCat_lft='') { if (!$this-exists_in_category($cat, $addAfterCat_name)) { $db = $this-dbconnect(); if ($cat != '' $addAfterCat_lft != '') { $db-query(UPDATE tree SET rgt=rgt+2 WHERE rgt.$addAfterCat_lft); $db-query(UPDATE tree SET lft=lft+2 WHERE lft.$addAfterCat_lft); $add_query = INSERT INTO tree SET lft='; $add_query .= $addAfterCat_lft+1; $add_query .= ', rgt='; $add_query .= $addAfterCat_lft+2; $add_query .= ', category='$cat'; echo $add_query; $db-query($add_query); $message = 'Category Added To Tree'; } elseif ($cat != '' $addAfterCat_lft == '') { $message = 'Please Input A Category To Add'; } elseif ($cat == '' $addAfterCat_lft != '') { $message = 'Please Choose A Category To Add This Category To'; } } else { $message = 'Category Already Exists In The Parent Category'; } return $message; } --- What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help With Error
[snip] Notice: Undefined index: 0 in L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line 77 [/snip] It's telling you that $data['0'], which is used twice in your query, is not a valid index (ie. it doesn't exist) for the $data array. Why don't you dump the $data array after it is set to see where the problem is: $data = $this-get_cat_coord($child); print_r($data); die(); Take a look at what comprises the $data array and you should find your problem. HTH, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cacheing problem
Hi, I dont really have a problem in converting from POST to GET but the html FILE box does not post its variables if it is not in POST eg: input type=file name=upload if you do a submit with $_GET the $_FILES array will be or not existant How to pass that? Thanks, Mag --- Greg Donald [EMAIL PROTECTED] wrote: On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag [EMAIL PROTECTED] wrote: Warning: Page has Expired You can use the GET method instead of POST in your form if that's appropriate. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend PHP Certification test
--- Rory Browne [EMAIL PROTECTED] wrote: I've been looking all over the Zend Cert site, trying to find the passing rate, ie how many questions I have to get right in order to pass. Is this information secret, or have I just not looked in the right place. It's not public information. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming December 2004http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend PHP Certification test
Hi Rory, The passing score is not revealed. There is only a pass/fail on the test. Best, Daniel Kushner On Sun, 17 Oct 2004 19:08:32 +0100, Rory Browne [EMAIL PROTECTED] wrote: I've been looking all over the Zend Cert site, trying to find the passing rate, ie how many questions I have to get right in order to pass. Is this information secret, or have I just not looked in the right place. If it's the latter, please enlighten me. Thanks Rory -- 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] Shell commands on Windows not working
We have a client using a Windows system: PHP 4.3.4 Windows NT WEBSERVER 5.2 build 3790 I'm attempting to use exec() to run a system command. I don't seem to be able to call any command, or at least I don't see any output. Indeed, the following produces nothing: echo `dir`; //i.e. backticks It works happily on my laptop. They have safe mode off. The PHP manual talks about shell_exec needing to be enabled, but doesn't give any clue how. Any clues? Tim Owens Dataview Design Ltd - innovative quality web automation - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorials for Maintenance of State
--- GH [EMAIL PROTECTED] wrote: I know about sessions... but I am even more concerened now about the use of cookies but I am not 100% sure on how to accomplish this When you say you are concerned about cookies, what do you mean exactly? When used properly, cookies can afford a heightened level of security to users whose preferences allow them. Because they were created with the specific purpose of adding state to HTTP, they tend to address this problem the best. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming December 2004http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cacheing problem
You have some restriction on the size of the data u send through GET method.. like i remember it as 256Kb or so. So if u r sending data larger than this limit ...u need to use the post method /sagar - Original Message - From: Mag [EMAIL PROTECTED] To: Greg Donald [EMAIL PROTECTED]; php php [EMAIL PROTECTED] Sent: Monday, October 18, 2004 7:59 AM Subject: Re: [PHP] cacheing problem Hi, I dont really have a problem in converting from POST to GET but the html FILE box does not post its variables if it is not in POST eg: input type=file name=upload if you do a submit with $_GET the $_FILES array will be or not existant How to pass that? Thanks, Mag --- Greg Donald [EMAIL PROTECTED] wrote: On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag [EMAIL PROTECTED] wrote: Warning: Page has Expired You can use the GET method instead of POST in your form if that's appropriate. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.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] guessing timezone based on country/state/city
On 17/10/2004, at 3:03 PM, Curt Zirzow wrote: * Thus wrote Justin French: I have an event CMS where really, I should know the TZ of the events, which can happen world wide. However the user base is not computer heads, so I can't just ask them. So, I'm faced with the prospect of making an educated guess based on the Country, State and Capital City information provided by the user... possibly I could interface with the files in /usr/share/zoneinfo/, or perhaps there's a database I can download to hook into. It could be possible to figure out what zone one is in via the zone.tab file. It probably will be a lot of work just to figure that out, not to mention you need to be able to find the coordinates of the persons Country/State. Curt, Can't find a zone.tab file on my system (Darwin, OS X), but I felt it's worth pointing out that I don't need to know the timezone of the user, I need to know the timezone of the event they're entering into the CMS... I was hoping to do this with an educated guess based on user input like country, state and town, rather than by asking the user (who isn't too technically minded) to decide. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache segmentation faults
Hello, every now and then I notice in apache logs there were few segmentation faults (on a daily basis) and all I am stuck with is PID of that process (which is of course dead by then) and nothing about what it was doing. Is there any way to figure out what request that apache process was serving when SIGSEGV occured? Is there any reading about this? I believe the request is not logged at all because (I think) every child writes to log files himself and not through parent. (+ log files usually provide outgoing bytes value, which is not available in such a situation - if it was logging through parent) Again, does anybody know how could I trace out what is causing this? Thank you, Bostjan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] guessing timezone based on country/state/city
Hello, On 10/18/2004 02:23 AM, Justin French wrote: I was hoping to do this with an educated guess based on user input like country, state and town, rather than by asking the user (who isn't too technically minded) to decide. One easy way to do what you want is to use the Javascript Date object getTimeZoneOffset() function to fill in some form hidden field to pass the timezone offset to the server. It relies on Javascript but it does exactly what you want. -- 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] RE: [PHP-DB] Question: Putting separate form elements into an array
Stuart, now I'm confused. You seem to be posting slightly different versions of problems relating to the same script(s) on 2 lists. What is the current situation? Iterating through the 3 arrays or inserting into MySQL? Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 17 October 2004 16:14 To: Stuart Felenstein; Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Question: Putting separate form elements into an array Changed my direction somewhat but keep getting a parse error and although I know where it is , I can't seem to figure out what I need to do to make it syntax correct: [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Question: Putting separate form elements into an array
Sorry about the two lists. The echo's are fine. The problem was iterating through the 3 arrays. Stuart --- Graham Cossey [EMAIL PROTECTED] wrote: Stuart, now I'm confused. You seem to be posting slightly different versions of problems relating to the same script(s) on 2 lists. What is the current situation? Iterating through the 3 arrays or inserting into MySQL? Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 17 October 2004 16:14 To: Stuart Felenstein; Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Question: Putting separate form elements into an array Changed my direction somewhat but keep getting a parse error and although I know where it is , I can't seem to figure out what I need to do to make it syntax correct: [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nested foreach ?
I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach ( $_SESSION['foo'] as $x ) { sql .= INSERT INTO TABLE (... VALUES ($x) Just can't seem to figure out how with three arrays. help appreciated. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php