Re: [PHP] Question about authenticating people...
On Nov 27, 2007, at 3:48 PM, Stut wrote: Jason Pruim wrote: The subject might be a little misleading... But I couldn't think of how better to describe it in a small sentence :) What I'm wondering is, I have a program that accesses a database and displays the info in that database... I know, nothing revolutionary about it... I plan on setting up a database per customer who uses my system, and what I would like to do is have everyone go to the same address to login... Such as: raoset.com/oldb/ they enter their username/password and get redirected to their site... Or at least pull up their database... Now that I'm typing this out, I may have thought of away to do this... Set the main page, so that when you login, it accesses a master database, which has the username, password, and database name stored in it. Write the database name to a session variable, which I could then use in my mysql connect file for the database Does that make sense? Thoughts? Problems? RTFM's? :) Assuming you mean raoset.com is not the domain of their site you would need to pass the database name to their site some way other than via a session since the session is tied to the domain name (no way around that I'm afraid). This clearly makes it a bit insecure so you might want to rethink how you're doing this. Maybe they select/enter their domain name on the login form, then you can use a bit of JS to have the form submit to a script on their site. This gives the best of both worlds... they all go to the same URL to log in, but you don't need to pass things like database names between sites via the browser (which is insecure). -Stut The database they are connecting to is on my site. That's what they would be logging into. I'm trying to avoid something like this: HTTP://www.raoset.com/oldb/customers/customer1 HTTP://www.raoset.com/oldb/customers/customer2 etc. etc. etc. What I would like is to have everyone go to: HTTP://www.raoset.com/oldb/login.php and then be able to pull up there database from their login credentials. Does that make it clear as mud? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about authenticating people...
adding a client name to the login process might make that easier and it forces a sort of 2 factor authentication making the database 'hopefully' harder to crack bastien From: [EMAIL PROTECTED] To: php-general@lists.php.net Date: Tue, 27 Nov 2007 15:30:32 -0500 Subject: [PHP] Question about authenticating people... The subject might be a little misleading... But I couldn't think of how better to describe it in a small sentence :) What I'm wondering is, I have a program that accesses a database and displays the info in that database... I know, nothing revolutionary about it... I plan on setting up a database per customer who uses my system, and what I would like to do is have everyone go to the same address to login... Such as: raoset.com/oldb/ they enter their username/password and get redirected to their site... Or at least pull up their database... Now that I'm typing this out, I may have thought of away to do this... Set the main page, so that when you login, it accesses a master database, which has the username, password, and database name stored in it. Write the database name to a session variable, which I could then use in my mysql connect file for the database Does that make sense? Thoughts? Problems? RTFM's? :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Express yourself with free Messenger emoticons. Get them today! http://www.freemessengeremoticons.ca/?icid=EMENCA122
Re: [PHP] Question about authenticating people...
Jason Pruim wrote: Just for my own curiosity, why do you think sessions are evil? I haven't found a better way to store my variables between different pages... Other then always posting them in either $_POST or $_GET each time... But that can add up quite a bit on a complicated site though... Sessions in the way that most PHP developers think about them are an enemy of horizontal scalability, but if slightly alter the way you think about how your app works you can effectively remove the need for this type of session. Think about how much info you need to store between page requests that isn't already available to you some other way, in a database for example. Now consider that if your app needs to scale then chances are you'll end up with your session storage in a database. What do you gain by extracting that data from it's natural home in the database and putting it into another location in the database for the duration of a users visit? The one thing you do need to transfer from request to request is something to identify the logged in user. This is done in the same way sessions pass their identifier, in a cookie or in the URL. The only difference is that you need to encrypt it to make it a bit harder to fake. I generally include a timestamp in the encrypted cookie so I can impose a hard limit on the lifetime of a session. Normal rules for good encryption apply here, but bear in mind that every single request will need to decrypt it, and potentially encrypt it too so don't go overboard. Of course it's possible that the app you're working on will never need to scale beyond one machine, but I have been involved in scaling too many sites that weren't designed to do it to not plan for the possibility in everything I do now. Anyway, that's why I avoid using 'sessions' wherever possible - IMHO there are better ways to achieve the same goal for most applications. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question regarding type hinting parameters of php functions
Hi, i have tried a current snapshot of PHP 5.3 and have a question regarding type hinting. For example when using the function array_slice(array $array, int $offset, int $length) with a non-integer length parameter, what is the desired behavior? When calling array_slice($array, 0, (float)2); the resulting array is EMPTY. When using the right type array_slice($array, 0, (int)2); it works as expected. Shouldn't there be a notice/warning than just a wrong return value? In my case there is neither a warning nor does it work as expected. (perhaps it do something wrong?) Of course i can use int's, but in my opinion either a warning should be given or the function should gracefully handle the wrong typed parameter. Thank you for any feedback, Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question regarding type hinting parameters of php functions
On Mon, 26 Nov 2007 10:29:40 +0100, Dirk Thomas / 4wd media [EMAIL PROTECTED] wrote: Hi, i have tried a current snapshot of PHP 5.3 and have a question regarding type hinting. For example when using the function array_slice(array $array, int $offset, int $length) with a non-integer length parameter, what is the desired behavior? When calling array_slice($array, 0, (float)2); the resulting array is EMPTY. When using the right type array_slice($array, 0, (int)2); it works as expected. Shouldn't there be a notice/warning than just a wrong return value? In my case there is neither a warning nor does it work as expected. (perhaps it do something wrong?) Of course i can use int's, but in my opinion either a warning should be given or the function should gracefully handle the wrong typed parameter. Thank you for any feedback, Dirk I think there should at least be a notice. It's propably better to ask this on the internals list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about urlencode....
Hi, OK this one is a little embarrasing. I've been doing this for years and I just wonder if I'm wrong Say you have an exit link on your site, e.g. /leave.php, which accepts a url get arg. You use this page to record stats/whatever and then issue a Location: header to take the user to the correct location. Fairly standard yeah? Well I've been doing something like: $url = 'http://colin.guthr.ie/'; echo 'a href=/leave.php?url='.urlencode($url).'Click/a'; The logic in /leave.php does not need to call urldecode as it's done automatically by PHP. This has worked well for me in the browsers I've used (IE, FF etc.) Recently, though, when using google webmaster tools I noticed that I was getting a lot of 404's and this ultimately stemmed from the double urlencoding of these url paramaters whereby the % signs used to encode characters like / as %2F were encoded themselves leading to %252F. PHP would automatically urldecode this to %2F but that still leaves me with an encoded variable. Ugg. So my question is, is the google bot just getting it wrong? Is it reading the link and seeing a % and encoding it? Or is it finding a page somewhere randomly on the interweb which has incorrectly double encoded it and going from there? It doesn't give you an referrer info which makes tracking down such errors pretty tricky :( I could just call urldecode manually, but I'm curious as to why I should need to. Anyone fought with this before? Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about urlencode....
Unless your URL is more complicated than your example, you shouldn't need to use urlencode() at all. You'd need to use it in a case where your string may contain characters that aren't valid in URLs like spaces and such: $baseurl = http://www.somesearchsite.com/search=;; $searchfor = Grace O'Mally; $searchurl = $baseurl . urlencode($searchfor); Since you set your URL explicitly and it's not something entered by a user, you shouldn't need it. Try that and see if it fixes your other problem with double encoding.. or at least gives a better clue as to where it's coming from. Slainte! -TG - Original Message - From: Colin Guthrie [EMAIL PROTECTED] To: php-general@lists.php.net Date: Thu, 22 Nov 2007 16:19:18 + Subject: [PHP] Question about urlencode Hi, OK this one is a little embarrasing. I've been doing this for years and I just wonder if I'm wrong Say you have an exit link on your site, e.g. /leave.php, which accepts a url get arg. You use this page to record stats/whatever and then issue a Location: header to take the user to the correct location. Fairly standard yeah? Well I've been doing something like: $url = 'http://colin.guthr.ie/'; echo 'a href=/leave.php?url='.urlencode($url).'Click/a'; The logic in /leave.php does not need to call urldecode as it's done automatically by PHP. This has worked well for me in the browsers I've used (IE, FF etc.) Recently, though, when using google webmaster tools I noticed that I was getting a lot of 404's and this ultimately stemmed from the double urlencoding of these url paramaters whereby the % signs used to encode characters like / as %2F were encoded themselves leading to %252F. PHP would automatically urldecode this to %2F but that still leaves me with an encoded variable. Ugg. So my question is, is the google bot just getting it wrong? Is it reading the link and seeing a % and encoding it? Or is it finding a page somewhere randomly on the interweb which has incorrectly double encoded it and going from there? It doesn't give you an referrer info which makes tracking down such errors pretty tricky :( I could just call urldecode manually, but I'm curious as to why I should need to. Anyone fought with this before? Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about arrays
On Nov 13, 2007, at 1:34 AM, Jim Lucas wrote: Jason Pruim wrote: Hi Everyone, I have a question, and to avoid getting flammed until the morning, I waited to ask until the end of my day :) Or near it at least. I have a small simple script I'm writing so that I can calculate how much a certain number of pieces weigh, The page can be seen here: HTTP://www.raoset.com/weight/ and here is the php code: Obviously I have some debugging stuff listed in there, so that's not the end result that it WILL be :) What I'm having issues with is, it only takes the value of the second text box, it won't process my array. Anyone care to take a quick look? Or tell me other then the php website where to look? I've already looked there and just couldn't come up with anything that makes sense to me... Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] What is your expected results? Jim Lucas The output I want would be to display something like this after hitting the second submit button: the weight of 100 pieces is: 9.4 | Route #| Pieces | Weight | | R001| 469| 44.086# | | R004| 540| 50.76#| and what I get is: | Route #| Pieces | Weight | | R004| 540| 50.76#| | R004| 540| 50.76#| Or more specifically what ever is in the bottom set of text boxes. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about arrays
Hi Everyone, I have a question, and to avoid getting flammed until the morning, I waited to ask until the end of my day :) Or near it at least. I have a small simple script I'm writing so that I can calculate how much a certain number of pieces weigh, The page can be seen here: HTTP://www.raoset.com/weight/ and here is the php code: ?PHP //include 'defaults.php'; include '../../media/debug.php'; $pieceWeight = $_POST['txtWeight']; $pieceWeight = $pieceWeight /100; $Pieces = $_POST['txtPieces']; $weightOfRoute = $Pieces * $pieceWeight; $Route =strtoupper($_POST['txtRoute']); $TextBoxes = 2;//$_GET['txtNumber']; //$Vweight = $pieceWeight * $VtxtPieces; //Begin debugging echo BR; var_dump($_POST); echo BR; var_dump($_GET); echo BR; //End Debugging $myArray = Array(Route = $Route, Pieces = $Pieces);//, Record =$Record); //echo BRmyArray: .$myArray[Route].BR; echo BR; print_arr($myArray); echo BR; //$VtxtRoute = strtoupper($_POST['txtRoute[]']); //$VtxtPieces1 = $_POST['txtPieces1']; //var_dump($Pieces, $weightOfRoute); //echo BRPieces[0]: $PiecesBR; $i = '0'; echo HTML form method='GET' action='index.php' P/Number of text boxes needed: input type='text' size='5' name='txtNumber' value='{$TextBoxes}' input type='submit'/P /form form method='POST' action='index.php' PWeight of 100 pieces: input type='text' size='5' name='txtWeight' value='{$pieceWeight}'/p table tr tdRoute #/td tdPieces per route/td tdWeight of route/td /tr HTML; while($i $TextBoxes) { //$arrRoute = array(txtRoute$i); //echo $arrRoute; echo HTML !--Begin display of text boxes -- tr td input type='text' size='5' name=txtRoute value={$myArray['Route']} /td td input type='text' size='5' name='txtPieces' value={$myArray['Pieces']} /td td {$weightOfRoute}# /td /tr HTML; $i++; } echo HTML /table input type='submit' /form HTML; /* tr td input type='text' size='5' name='txtRoute2' /td td input type='text' size='5' name='txtPieces2' /td td {$weightOfRoute} /td /tr tr td input type='text' size='5' name='txtRoute3' /td td input type='text' size='5' name='txtPieces3' /td td {$weightOfRoute} /td /tr */ ? Obviously I have some debugging stuff listed in there, so that's not the end result that it WILL be :) What I'm having issues with is, it only takes the value of the second text box, it won't process my array. Anyone care to take a quick look? Or tell me other then the php website where to look? I've already looked there and just couldn't come up with anything that makes sense to me... Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about arrays
On 11/12/07, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I have a question, and to avoid getting flammed until the morning, I waited to ask until the end of my day :) Or near it at least. I have a small simple script I'm writing so that I can calculate how much a certain number of pieces weigh, The page can be seen here: HTTP://www.raoset.com/weight/ and here is the php code: ?PHP //include 'defaults.php'; include '../../media/debug.php'; $pieceWeight = $_POST['txtWeight']; $pieceWeight = $pieceWeight /100; $Pieces = $_POST['txtPieces']; $weightOfRoute = $Pieces * $pieceWeight; $Route =strtoupper($_POST['txtRoute']); $TextBoxes = 2;//$_GET['txtNumber']; //$Vweight = $pieceWeight * $VtxtPieces; //Begin debugging echo BR; var_dump($_POST); echo BR; var_dump($_GET); echo BR; //End Debugging $myArray = Array(Route = $Route, Pieces = $Pieces);//, Record =$Record); //echo BRmyArray: .$myArray[Route].BR; echo BR; print_arr($myArray); echo BR; //$VtxtRoute = strtoupper($_POST['txtRoute[]']); //$VtxtPieces1 = $_POST['txtPieces1']; //var_dump($Pieces, $weightOfRoute); //echo BRPieces[0]: $PiecesBR; $i = '0'; echo HTML form method='GET' action='index.php' P/Number of text boxes needed: input type='text' size='5' name='txtNumber' value='{$TextBoxes}' input type='submit'/P /form form method='POST' action='index.php' PWeight of 100 pieces: input type='text' size='5' name='txtWeight' value='{$pieceWeight}'/p table tr tdRoute #/td tdPieces per route/td tdWeight of route/td /tr HTML; while($i $TextBoxes) { //$arrRoute = array(txtRoute$i); //echo $arrRoute; echo HTML !--Begin display of text boxes -- tr td input type='text' size='5' name=txtRoute value={$myArray['Route']} /td td input type='text' size='5' name='txtPieces' value={$myArray['Pieces']} /td td {$weightOfRoute}# /td /tr HTML; $i++; } echo HTML /table input type='submit' /form HTML; /* tr td input type='text' size='5' name='txtRoute2' /td td input type='text' size='5' name='txtPieces2' /td td {$weightOfRoute} /td /tr tr td input type='text' size='5' name='txtRoute3' /td td input type='text' size='5' name='txtPieces3' /td td {$weightOfRoute} /td /tr */ ? Obviously I have some debugging stuff listed in there, so that's not the end result that it WILL be :) What I'm having issues with is, it only takes the value of the second text box, it won't process my array. Anyone care to take a quick look? Or tell me other then the php website where to look? I've already looked there and just couldn't come up with anything that makes sense to me... Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jason, You've duplicated the names of your text boxes, so the second ones overwrite the first. I'd guess you want to create arrays using input type='text' size='5' name='txtPieces2[]' instead of input type='text' size='5' name='txtPieces2'. hth, -David.
Re: [PHP] Question about arrays
On Nov 12, 2007 3:59 PM, Jason Pruim [EMAIL PROTECTED] wrote: [snip] echo HTML form method='GET' action='index.php' P/Number of text boxes needed: input type='text' size='5' name='txtNumber' value='{$TextBoxes}' input type='submit'/P /form form method='POST' action='index.php' PWeight of 100 pieces: input type='text' size='5' name='txtWeight' value='{$pieceWeight}'/p table tr tdRoute #/td tdPieces per route/td tdWeight of route/td /tr HTML; Why do you have two FORM attributes doing the same thing, going to the same place here? It will only submit data from within the form you're hitting the button. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about arrays
On Nov 12, 2007, at 4:14 PM, Daniel Brown wrote: On Nov 12, 2007 3:59 PM, Jason Pruim [EMAIL PROTECTED] wrote: [snip] echo HTML form method='GET' action='index.php' P/Number of text boxes needed: input type='text' size='5' name='txtNumber' value='{$TextBoxes}' input type='submit'/P /form form method='POST' action='index.php' PWeight of 100 pieces: input type='text' size='5' name='txtWeight' value='{$pieceWeight}'/p table tr tdRoute #/td tdPieces per route/td tdWeight of route/td /tr HTML; Why do you have two FORM attributes doing the same thing, going to the same place here? It will only submit data from within the form you're hitting the button. The reason for the 2 form elements, was because they need to be able to tell it how many text boxes it needs. Sometimes, it could need 5 rows, sometimes 50... It depends on the particular job. If you know of a better way to do it, Possibly a if/else setup? I'm still at the early stages of thinking in this program. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about arrays
Jason Pruim wrote: Hi Everyone, I have a question, and to avoid getting flammed until the morning, I waited to ask until the end of my day :) Or near it at least. I have a small simple script I'm writing so that I can calculate how much a certain number of pieces weigh, The page can be seen here: HTTP://www.raoset.com/weight/ and here is the php code: Obviously I have some debugging stuff listed in there, so that's not the end result that it WILL be :) What I'm having issues with is, it only takes the value of the second text box, it won't process my array. Anyone care to take a quick look? Or tell me other then the php website where to look? I've already looked there and just couldn't come up with anything that makes sense to me... Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] What is your expected results? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about php.ini file
Hi all: I've learned, much to my pleasure, that I can place a php.ini file in the root directory of my shared domain to allow some customization of the php settings. However, when I do this, I keep getting weird results. Some of the values that I change appear as I've asked them to be. Some appear to not change at all. And some have been changing to what appears to be default values for php. I'm wondering a few things here. First, my computer is Windows-based, but the server is Linux-based. Do I need to somehow convert the Windows text file line termination characters to their Linux variants? If so, how? Is it possible that I'm trying to change values beyond some upper limit which is causing php to use the default value? The main values that I'm trying to change are: post_max_size upload_max_filesize memory_limit max_execution_time max_input_time If anyone knows of upper limits for these, I'd appreciate learning about them. As always, any help you can send my way will be greatly appreciated! Thanks, Jon
Re: [PHP] Question about php.ini file
You must take in count that before php even gets to receive something, it all passes through the HTTP server (apache or something). for most of these settings there are equivalents in the config file of the server that you need to change accordingly. this might be the cause of the weird results. for example, if your limit for uploaded files is 10M in php but the server is set to accept max 5M, 5M will be the limit Jon Westcot wrote: Hi all: I've learned, much to my pleasure, that I can place a php.ini file in the root directory of my shared domain to allow some customization of the php settings. However, when I do this, I keep getting weird results. Some of the values that I change appear as I've asked them to be. Some appear to not change at all. And some have been changing to what appears to be default values for php. I'm wondering a few things here. First, my computer is Windows-based, but the server is Linux-based. Do I need to somehow convert the Windows text file line termination characters to their Linux variants? If so, how? Is it possible that I'm trying to change values beyond some upper limit which is causing php to use the default value? The main values that I'm trying to change are: post_max_size upload_max_filesize memory_limit max_execution_time max_input_time If anyone knows of upper limits for these, I'd appreciate learning about them. As always, any help you can send my way will be greatly appreciated! Thanks, Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about php.ini file
Hi Cristian: Thanks for the replies. In this case, what I've been noticing is that most of the values have gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in place. For example, upload_max_filesize was 8M before I placed my file, but, afterwards, it was 2M! I'm trying to increase this size, not decrease it. Could it be the line-ending characters that are causing the problem? Could PHP be seeing the new file but not realizing how to process it, which would cause the values to flop over to their defaults? Thanks, Jon - Original Message - You must take in count that before php even gets to receive something, it all passes through the HTTP server (apache or something). for most of these settings there are equivalents in the config file of the server that you need to change accordingly. this might be the cause of the weird results. for example, if your limit for uploaded files is 10M in php but the server is set to accept max 5M, 5M will be the limit Jon Westcot wrote: Hi all: I've learned, much to my pleasure, that I can place a php.ini file in the root directory of my shared domain to allow some customization of the php settings. However, when I do this, I keep getting weird results. Some of the values that I change appear as I've asked them to be. Some appear to not change at all. And some have been changing to what appears to be default values for php. I'm wondering a few things here. First, my computer is Windows-based, but the server is Linux-based. Do I need to somehow convert the Windows text file line termination characters to their Linux variants? If so, how? Is it possible that I'm trying to change values beyond some upper limit which is causing php to use the default value? The main values that I'm trying to change are: post_max_size upload_max_filesize memory_limit max_execution_time max_input_time If anyone knows of upper limits for these, I'd appreciate learning about them. As always, any help you can send my way will be greatly appreciated! Thanks, Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about php.ini file
On 11/4/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Cristian: Thanks for the replies. In this case, what I've been noticing is that most of the values have gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in place. For example, upload_max_filesize was 8M before I placed my file, but, afterwards, it was 2M! I'm trying to increase this size, not decrease it. Could it be the line-ending characters that are causing the problem? Could PHP be seeing the new file but not realizing how to process it, which would cause the values to flop over to their defaults? do you have ssh access to the server? i recommend you start out by creating the simplest file you can by editing it directly on the linux server, via vim or w/e. then using a phpinfo() script, you should see your overridden value in the left column (those are for the locally overridden values). some other things to note are; 1. apache must be properly configured to allow the .htaccess overrides. 2. you cant override all the values in php.ini; see the documentation regarding which ones can be overriden and where here is an article regarding the process, http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess -nathan
Re: [PHP] Question about php.ini file
Hi Nathan: I'm not certain if I have all of the items you've mentioned, but I'll look into it. And thanks for the link; I'll check that out, too. Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Sunday, November 04, 2007 5:05 PM Subject: Re: [PHP] Question about php.ini file On 11/4/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Cristian: Thanks for the replies. In this case, what I've been noticing is that most of the values have gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in place. For example, upload_max_filesize was 8M before I placed my file, but, afterwards, it was 2M! I'm trying to increase this size, not decrease it. Could it be the line-ending characters that are causing the problem? Could PHP be seeing the new file but not realizing how to process it, which would cause the values to flop over to their defaults? do you have ssh access to the server? i recommend you start out by creating the simplest file you can by editing it directly on the linux server, via vim or w/e. then using a phpinfo() script, you should see your overridden value in the left column (those are for the locally overridden values). some other things to note are; 1.. apache must be properly configured to allow the .htaccess overrides. 2.. you cant override all the values in php.ini; see the documentation regarding which ones can be overriden and where here is an article regarding the process, http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess -nathan
Re: [PHP] Question about php.ini file
Hi Nathan: Another quick question regarding the use of the .htaccess file: If I'm trying to set something like post_max_size, which takes a shorthand value such as 16M in place of the full value, will using the php_value type of statement also accept the shorthand value, or do I need to place in the full value? Thanks again; this solution may be exactly what we need! Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Sunday, November 04, 2007 5:05 PM Subject: Re: [PHP] Question about php.ini file On 11/4/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Cristian: Thanks for the replies. In this case, what I've been noticing is that most of the values have gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in place. For example, upload_max_filesize was 8M before I placed my file, but, afterwards, it was 2M! I'm trying to increase this size, not decrease it. Could it be the line-ending characters that are causing the problem? Could PHP be seeing the new file but not realizing how to process it, which would cause the values to flop over to their defaults? do you have ssh access to the server? i recommend you start out by creating the simplest file you can by editing it directly on the linux server, via vim or w/e. then using a phpinfo() script, you should see your overridden value in the left column (those are for the locally overridden values). some other things to note are; 1.. apache must be properly configured to allow the .htaccess overrides. 2.. you cant override all the values in php.ini; see the documentation regarding which ones can be overriden and where here is an article regarding the process, http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess -nathan
Re: [PHP] Question about php.ini file
Jon Westcot wrote: Hi Nathan: Another quick question regarding the use of the .htaccess file: If I'm trying to set something like post_max_size, which takes a shorthand value such as 16M in place of the full value, will using the php_value type of statement also accept the shorthand value, or do I need to place in the full value? yes, valid values for ini settings are the same regardless of where you set them (.ini, apache conf, php script) Thanks again; this solution may be exactly what we need! Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Sunday, November 04, 2007 5:05 PM Subject: Re: [PHP] Question about php.ini file On 11/4/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Cristian: Thanks for the replies. In this case, what I've been noticing is that most of the values have gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in place. For example, upload_max_filesize was 8M before I placed my file, but, afterwards, it was 2M! I'm trying to increase this size, not decrease it. Could it be the line-ending characters that are causing the problem? Could PHP be seeing the new file but not realizing how to process it, which would cause the values to flop over to their defaults? do you have ssh access to the server? i recommend you start out by creating the simplest file you can by editing it directly on the linux server, via vim or w/e. then using a phpinfo() script, you should see your overridden value in the left column (those are for the locally overridden values). some other things to note are; 1.. apache must be properly configured to allow the .htaccess overrides. 2.. you cant override all the values in php.ini; see the documentation regarding which ones can be overriden and where here is an article regarding the process, http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
This is a PHP users mailing list. If you have a question, you can send it to php-general@lists.php.net and whoever can help you with it will reply. On 10/26/07, arash moosavi [EMAIL PROTECTED] wrote: I have Question In PHP Where Can I send it to Give my answer?
Re: [PHP] Question
2007. 10. 26, péntek keltezéssel 15.26-kor arash moosavi ezt írta: I have Question In PHP Where Can I send it to Give my answer? for example to this list ;) (it's not sure you will get the exact answer you want, but the chances are pretty good) greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question
I have Question In PHP Where Can I send it to Give my answer?
Re: [PHP] Question
On 10/26/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 10. 26, péntek keltezéssel 15.26-kor arash moosavi ezt írta: I have Question In PHP Where Can I send it to Give my answer? [snip!] http://web.ics.purdue.edu/~ssanty/cgi-bin/eightball.cgi -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
On Oct 24, 2007, at 6:10 PM, Instruct ICC wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? Well, I code all of my applications to receive RFID signals, and I had a RFID transmitter embedded into me that gets powered by the electricity that my body generates, so when it can no longer get that signal, the application is designed to shut down and put up a message that says Due to the death of my creator I quit, have a nice day! :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
On Oct 24, 2007, at 9:01 PM, tedd wrote: At 3:10 PM -0700 10/24/07, Instruct ICC wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? When you stop paying for hosting, the application get's the idea when it's bits go poof! If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use: $dates = getdate(); $month = $dates['mon']; $w = http://www.sperling.com/css/seasons/;; switch( $month ) { case 03: case 04: case 05: $var = $w . spring.jpg; break; case 06: case 07: case 08 : $var = $w . summer.jpg; break; case 09: case 10: case 11: $var = $w . fall.jpg; break; case 12: case 01: case 02: $var = $w . winter.jpg; $break; } echo($var); And this code is called from within my css file for a background image. Yes, I use variables in css. Cheers, tedd Hi tedd, That's actually where I got the idea, just couldn't remember who on what list said they did it :) using variables in css is it as easy as just putting in a quick ?PHP echo background: $date; ? in the css? or is it more complicated? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta: On Oct 24, 2007, at 9:01 PM, tedd wrote: At 3:10 PM -0700 10/24/07, Instruct ICC wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? When you stop paying for hosting, the application get's the idea when it's bits go poof! If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use: $dates = getdate(); $month = $dates['mon']; $w = http://www.sperling.com/css/seasons/;; switch( $month ) { case 03: case 04: case 05: $var = $w . spring.jpg; break; case 06: case 07: case 08 : $var = $w . summer.jpg; break; case 09: case 10: case 11: $var = $w . fall.jpg; break; case 12: case 01: case 02: $var = $w . winter.jpg; $break; } echo($var); And this code is called from within my css file for a background image. Yes, I use variables in css. Cheers, tedd Hi tedd, That's actually where I got the idea, just couldn't remember who on what list said they did it :) using variables in css is it as easy as just putting in a quick ?PHP echo background: $date; ? in the css? or is it more complicated? you have to configure apache to handle css files as php files. also you have to send headers including content-type set to text/css and then you can script your css greets Zoltán Németh -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
On 10/25/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta: On Oct 24, 2007, at 9:01 PM, tedd wrote: At 3:10 PM -0700 10/24/07, Instruct ICC wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? When you stop paying for hosting, the application get's the idea when it's bits go poof! If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use: $dates = getdate(); $month = $dates['mon']; $w = http://www.sperling.com/css/seasons/;; switch( $month ) { case 03: case 04: case 05: $var = $w . spring.jpg; break; case 06: case 07: case 08 : $var = $w . summer.jpg; break; case 09: case 10: case 11: $var = $w . fall.jpg; break; case 12: case 01: case 02: $var = $w . winter.jpg; $break; } echo($var); And this code is called from within my css file for a background image. Yes, I use variables in css. Cheers, tedd Hi tedd, That's actually where I got the idea, just couldn't remember who on what list said they did it :) using variables in css is it as easy as just putting in a quick ?PHP echo background: $date; ? in the css? or is it more complicated? you have to configure apache to handle css files as php files. also you have to send headers including content-type set to text/css and then you can script your css greets Zoltán Németh -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Or, in the event that you're unable to set MIME types and parsing, you can just add the appropriate style/style tags and then ? include('css/style.css'); ? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
At 3:13 PM +0200 10/25/07, Zoltán Németh wrote: 2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta: That's actually where I got the idea, just couldn't remember who on what list said they did it :) using variables in css is it as easy as just putting in a quick ?PHP echo background: $date; ? in the css? or is it more complicated? you have to configure apache to handle css files as php files. also you have to send headers including content-type set to text/css and then you can script your css greets Zoltán Németh That's one way. Here's another: http://sperling.com/examples/pcss/ As Zoltán suggested, but didn't elaborate, you can drop a .htaccess file into your root directory that contains: FilesMatch \.(css|style)$ SetHandler application/x-httpd-php /FilesMatch and then use ?php whatever you want ? inside the css file. This makes things easier when trying to change constants like colors, or dealing with the box-model problem, or rules that are dependant upon other rules; or really neat automatic image width/height determinations for images on the fly (think about that). :-) There are a lot of opportunities to add functionality to css that apparently has not been addressed in any documentation I've been able to find. I can't be the first down this street, but for certain it hasn't been traveled often. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about time...
I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? Well, I code all of my applications to receive RFID signals, and I had a RFID transmitter embedded into me that gets powered by the electricity that my body generates, so when it can no longer get that signal, the application is designed to shut down and put up a message that says Due to the death of my creator I quit, have a nice day! :) I'm not amused. http://zeitgeistmovie.com/ Way way way at the end. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
[PHP] Question about time...
Hi Everyone, I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED]
Re: [PHP] Question about time...
On 10/24/07, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] ? if(date(M) == 11) { // Display turkey } ? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
Errr... Never mind... Soon as I hit send I got a brain storm... I just do this: ?PHP $month = date('m'); if ($month == 11){ echo turkey; }else{ echo No turkey; } ? Or something similar, I'll try and feather it out and see how it works for multiple holidays :) (IE: Thanksgiving, Christmas, New Years, Halloween etc. etc.) On Oct 24, 2007, at 3:57 PM, Jason Pruim wrote: Hi Everyone, I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Well, I hope this makes sense: ?php if (date('m') == 11) { echo 'img src=turkey.png /'; } ? -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
On 10/24/07, Daniel Brown [EMAIL PROTECTED] wrote: On 10/24/07, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone, I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] ? if(date(M) == 11) { // Display turkey } ? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished Sorry, that should've been a lower-case M. ? if(date(m) == 11) { // Display turkey } ? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about time...
On Oct 24, 2007, at 4:09 PM, Richard Heyes wrote: I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Well, I hope this makes sense: ?php if (date('m') == 11) { echo 'img src=turkey.png /'; } ? Yeah... The joys of dealing with a cold that makes your head feel like it wants to explode and you just wish it would so it would feel better :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about time...
I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? _ Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now. http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
Re: [PHP] Question about time...
On 10/24/07, Instruct ICC [EMAIL PROTECTED] wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? _ Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now. http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033 ? echo /LIFE\n; die($jason); ? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about time...
what about if (date(m) == 11){ echo ; } bastien To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Wed, 24 Oct 2007 15:57:38 -0400 Subject: [PHP] Question about time... Hi Everyone, I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :) Thanks for looking! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] _ Have fun while connecting on Messenger! Click here to learn more. http://entertainment.sympatico.msn.ca/WindowsLiveMessenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about time...
At 3:10 PM -0700 10/24/07, Instruct ICC wrote: I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? When you stop paying for hosting, the application get's the idea when it's bits go poof! If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use: $dates = getdate(); $month = $dates['mon']; $w = http://www.sperling.com/css/seasons/;; switch( $month ) { case 03: case 04: case 05: $var = $w . spring.jpg; break; case 06: case 07: case 08 : $var = $w . summer.jpg; break; case 09: case 10: case 11: $var = $w . fall.jpg; break; case 12: case 01: case 02: $var = $w . winter.jpg; $break; } echo($var); And this code is called from within my css file for a background image. Yes, I use variables in css. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about time...
I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. And how will the application know when you are dead? When you stop paying for hosting, the application get's the idea when it's bits go poof! Yep, that will do it. I wonder if they can legally bill your estate? Or if the estate is liable. If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use: Nice. _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
[PHP] Question about ereg_replace and urlencode...
Hello! i am trying to make links clickable on a page. I would like to urlencode the URL so that it is well passed to a redirect.php file, which would do somethings and then also do a meta http refresh I am trying to use a function like the following, but it doesn't work. I would like to apply urlencode on the link that is there in $str, so that i have the link to redirect.php?url=urlencoded str With the following, 1 gets hardcoded in my link! How do i urlencode it please? Any thoughts would help Regards Venky ?php $str='blah blah http://www.someserver.com/indexn12.asp?main_variable=EDITSamp;file_name=edit3%2Etxtamp;counter_img=3 blah blah'; function b_make_clickable ($str) { $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?//=]+)', 'a href=http://www.myserver.com/redirect.php?url=' . urlencode(1) . ' target=_blank\1/a', $str); $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?//=]+)', '\1a href=http://www.myserver.com/redirect.php?url=http://' . urlencode(2) . ' target=_blank\2/a', $str); $str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','a href=mailto:\1;\1/a', $str); return $str; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about ereg_replace and urlencode...
Venkatesh M. S. wrote: Hello! i am trying to make links clickable on a page. I would like to urlencode the URL so that it is well passed to a redirect.php file, which would do somethings and then also do a meta http refresh I am trying to use a function like the following, but it doesn't work. I would like to apply urlencode on the link that is there in $str, so that i have the link to redirect.php?url=urlencoded str With the following, 1 gets hardcoded in my link! How do i urlencode it please? Any thoughts would help Regards Venky ?php $str='blah blah http://www.someserver.com/indexn12.asp?main_variable=EDITSamp;file_name=edit3%2Etxtamp;counter_img=3 blah blah'; function b_make_clickable ($str) { $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?//=]+)', 'a href=http://www.myserver.com/redirect.php?url=' . urlencode(1) . ' target=_blank\1/a', $str); $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?//=]+)', '\1a href=http://www.myserver.com/redirect.php?url=http://' . urlencode(2) . ' target=_blank\2/a', $str); $str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','a href=mailto:\1;\1/a', $str); return $str; } ? That would be the bit where you use urlencode(1) to put the URL into the URL. I think you want urlencode($str) instead. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about ereg_replace and urlencode...
Many thanks Stut The problem is that the rest of the $str is actually a big post from a blog, which will have many other text and info apart from the URL, and i don't want to urlencode everything in there! Venky On 02/10/2007, Stut [EMAIL PROTECTED] wrote: Venkatesh M. S. wrote: Hello! i am trying to make links clickable on a page. I would like to urlencode the URL so that it is well passed to a redirect.php file, which would do somethings and then also do a meta http refresh I am trying to use a function like the following, but it doesn't work. I would like to apply urlencode on the link that is there in $str, so that i have the link to redirect.php?url=urlencoded str With the following, 1 gets hardcoded in my link! How do i urlencode it please? Any thoughts would help Regards Venky ?php $str='blah blah http://www.someserver.com/indexn12.asp?main_variable=EDITSamp;file_name=edit3%2Etxtamp;counter_img=3 blah blah'; function b_make_clickable ($str) { $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?//=]+)', 'a href=http://www.myserver.com/redirect.php?url=' . urlencode(1) . ' target=_blank\1/a', $str); $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?//=]+)', '\1a href=http://www.myserver.com/redirect.php?url=http://' . urlencode(2) . ' target=_blank\2/a', $str); $str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','a href=mailto:\1;\1/a', $str); return $str; } ? That would be the bit where you use urlencode(1) to put the URL into the URL. I think you want urlencode($str) instead. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about making modules
Hey, i've been trying alot to make php modules (php based.. not real modules for php in c) but i can't get it working. Here is a sample file: ?php class moduletest { function text() { return moduletestbr /; } } class test_moduletest extends moduletest { function text() { return test_moduletestbr /; } } $test = new moduletest; $test2 = new test_moduletest; echo $test-text(); echo $test2-text(); ? Now what you get when running this file: moduletest test_moduletest That's logical and not the problem The issue is that i want the test_moduletest class to overwrite functions in moduletest but without the need for me to call the class again. So the result i want with $test-text(); == test_moduletest and $test must initialize the moduletest class!! not the test_moduletest class. I want to use this as a (obvious) module system so that others can extend the base class with more advanced features or improve existing features by overwriting them. i did found a place where this is being done: ADOdb Lite but i can't find out how that script is doing it.. Any help with this would be greatly appreciated Thanx, Mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about making modules
Maybe you should deal with some things like * Plugin-Architecture * Extension Points * States !? A look at wikipedia might give most information you need. Regards rob On Sa, Sep 01, 2007 at 11:23:31 +0200, Mark wrote: Hey, i've been trying alot to make php modules (php based.. not real modules for php in c) but i can't get it working. Here is a sample file: ?php class moduletest { function text() { return moduletestbr /; } } class test_moduletest extends moduletest { function text() { return test_moduletestbr /; } } $test = new moduletest; $test2 = new test_moduletest; echo $test-text(); echo $test2-text(); ? Now what you get when running this file: moduletest test_moduletest That's logical and not the problem The issue is that i want the test_moduletest class to overwrite functions in moduletest but without the need for me to call the class again. So the result i want with $test-text(); == test_moduletest and $test must initialize the moduletest class!! not the test_moduletest class. I want to use this as a (obvious) module system so that others can extend the base class with more advanced features or improve existing features by overwriting them. i did found a place where this is being done: ADOdb Lite but i can't find out how that script is doing it.. Any help with this would be greatly appreciated Thanx, Mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Und komm, Du brauchst nur einen Baum um 1000 Streichhölzer herzustellen. Aber Du brauchst nur einen Streichholz um 1000 Bäume abzubrennen. Meine Güte wer soll das denn jetzt verstehen? Ganz egal, komm wir bleiben noch etwas länger. Die Bedeutung zahlt ja immer der Empfänger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [WD]: PHP Question - any help is appreciated
Dylan Barber wrote: I am needing to provide back a fixed length file out of a shopping cart system - I can create the file but does anybody have a simple function to pad or truncate a string to a certain length? Use sprintf() to format your string. $len = 20 //the length you want $str = 'abcde'; The following says to pad the string with the character x to a final length of $len characters or to trim the string to $len characters. The % is simply there to show that the argument is a formatting instruction. The 'x says to use an x as the padding character (default is a space). The s informs that we're performing this on a string, as opposed to a number. echo sprintf(%'x${len}.${len}s, $str); xxxabcde This one will add the padding to the end (note the minus sign): echo sprintf(%-'x${len}.${len}s, $str); abcdexxx If you want the default space, use: echo sprintf(%${len}.${len}s, $str); abcde Truncate: $str = 'abcdefghijklmnopqrstuvwxyz'; echo sprintf(%'x${len}.${len}s, $str); abcdefghijklmnopqrst You probably want to assign this to a variable so, instead of using echo, do: $padded = sprintf(%'x${len}.${len}s, $str); HTH brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about note on php.net
On Sat, August 11, 2007 1:54 pm, Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! If I could remember/find the URL to login, I could delete that bogus note... It's about as wrong as it gets. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about note on php.net
brian wrote: Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! Because i'm already procrastinating ... google site:php.net equazcion http://www.php.net/session_set_save_handler wherein: equazcion 10-Mar-2007 02:44 I know this might be obvious, but session_set_save_handler() should only be called once per session, or else your saved data will keep getting reset. If your script doesn't have a predictable start page that will only be called only once per session, place the session_set_save_handler statement in an include file, and call it via require_once(). I doubt that this is correct. The save handler that is being set is not, in itself, a part of the session, but a function that is to be used to act upon the session. That is, there isn't anything inherent to the session in the function. Thus, it wouldn't be saved as *a part of* the session. It's just a handler. It's not as if the function, itself, were a container for the session vars. Looking at the source in head for that function[1] it would appear to fail if a session has already been started, in which case equizcion's comment would be wrong. If the OP is concerned about it I suggest they try it and see what happens. -Stut [1] http://lxr.php.net/source/php-src/ext/session/session.c#1473 -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about note on php.net
Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks!
Re: [PHP] question about note on php.net
Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! Erm, what note where on php.net? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about note on php.net
Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! Because i'm already procrastinating ... google site:php.net equazcion http://www.php.net/session_set_save_handler wherein: equazcion 10-Mar-2007 02:44 I know this might be obvious, but session_set_save_handler() should only be called once per session, or else your saved data will keep getting reset. If your script doesn't have a predictable start page that will only be called only once per session, place the session_set_save_handler statement in an include file, and call it via require_once(). I doubt that this is correct. The save handler that is being set is not, in itself, a part of the session, but a function that is to be used to act upon the session. That is, there isn't anything inherent to the session in the function. Thus, it wouldn't be saved as *a part of* the session. It's just a handler. It's not as if the function, itself, were a container for the session vars. My $.02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
On Wed, August 1, 2007 5:00 pm, Michael Preslar wrote: I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Are you trying to use perl's back tic operator in php here? Close. He's trying to use the shell's back tick operator in MySQL. I think. It would actually work if the `date +%Y%m%d` was outside of the quotes he is wrapping around his query, as then he'd be using PHP's backticks operator which is very much like a shell backticks operator. Though using PHP date() function, as already suggested, would be MUCH faster. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
Stut wrote: Michael Preslar wrote: I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Are you trying to use perl's back tic operator in php here? PHP also supports the that. However, I think the OP's problem is that it's inside other quotes and is therefore not being executed. But, as someone else pointed out, you should be using the PHP date function to get the date from within PHP. -Stut Not perl, bash! Well, what I was trying to do was covert my bash script to php, my sql statement makes the call to date so that it puts today date, that all it doing. I will look around and see if I can do that with php. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
Payne wrote: Stut wrote: Michael Preslar wrote: I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Are you trying to use perl's back tic operator in php here? PHP also supports the that. However, I think the OP's problem is that it's inside other quotes and is therefore not being executed. But, as someone else pointed out, you should be using the PHP date function to get the date from within PHP. -Stut Not perl, bash! Well, what I was trying to do was covert my bash script to php, my sql statement makes the call to date so that it puts today date, that all it doing. I will look around and see if I can do that with php. Thanks. Guys, thanks for the help got it, if I switch to current_date with is build into mysql that does what I was doing anyway. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about passing date in sql...
Guys, Got a quick question. I got a sql statement works when I pass it from the cli. but if I try in php I get nothing. This is the statement. Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date='`date +%Y%m%d`' order by country asc; I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Any clue as to why? Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
Payne wrote: Guys, Got a quick question. I got a sql statement works when I pass it from the cli. but if I try in php I get nothing. This is the statement. Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date='`date +%Y%m%d`' order by country asc; I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Any clue as to why? Payne why not use the PHP function to format the date? http://www.php.net/date -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Are you trying to use perl's back tic operator in php here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about passing date in sql...
Michael Preslar wrote: I know it has to do with date='`date +%Y%m%d`', because if I remove it works. Are you trying to use perl's back tic operator in php here? PHP also supports the that. However, I think the OP's problem is that it's inside other quotes and is therefore not being executed. But, as someone else pointed out, you should be using the PHP date function to get the date from within PHP. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question re virtual and scope of definitions
Hi, today I wanted to use virtual (an `include' wasn't an option) to get the output from another PHP script. I got errors about functions being already defined, which is true since in both scripts are functions of the same name. I always thought virtual makes an Apache subrequest which gives me a new PHP environment. But similar to include the definitions from script1 are also in the scope of script2. Is this the wanted behaviour? If so, how could I insert the output from another PHP script (I could fetch it with curl or wget but that's the last thing I would like to do)?. What if I inserted with virtual another .html file which in turn uses mod_include to insert with !--#include virtual ...-- the PHP script (sounds like loop the loop)? KP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question re virtual and scope of definitions
(Karl Pflästerer) wrote: Hi, today I wanted to use virtual (an `include' wasn't an option) to get the output from another PHP script. I got errors about functions being already defined, which is true since in both scripts are functions of the same name. I always thought virtual makes an Apache subrequest which gives me a new PHP environment. But similar to include the definitions from script1 are also in the scope of script2. Is this the wanted behaviour? If so, how could I insert the output from another PHP script (I could fetch it with curl or wget but that's the last thing I would like to do)?. What if I inserted with virtual another .html file which in turn uses mod_include to insert with !--#include virtual ...-- the PHP script (sounds like loop the loop)? More of an apache question really. The #include virtual stuff is all handled by apache, not php. Looks like SSI's support cmd and/or exec: http://httpd.apache.org/docs/2.2/mod/mod_include.html#element.exec Why is an include not an option? What are you trying to achieve? -- 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] Question on Connecting to Microsoft SQL Server from PHP
All: I can't seem to connect to a SQL Server database with PHP. I have read the php.net documentation and so many other forums on the Internet that my eyes were literally blood shot. Today I thought I would try this route. I have PHP and Apache installed on my local machine. They work fine as I created another application with them (and MySQL) that worked as expected/designed. I want to connect to MS SQL Server 2000 that rests on another machine here at work. I can reach the tables and do whatever I want with them from my machine through SQL Query Analyzer. (The other machine runs a Windows Server. So I am trying to connect from one Windows box to another Windows box.) So I know that I can connect to the tables (and the machine that they rest on) from my machine. It is just that I get the following error when I load my PHP page: Warning: mssql_connect() [[ http://localhost/development_files/ordertrackno/where_is_it.php/function.mssql-connect ]function.mssql-connect]: Unable to connect to server: . . . In my PHP page I have the following: $sql = mssql_connect (xx.xx.xx.xx:, xx, xx); $conn=mssql_select_db(xx, $sql); etc I have tried replacing the semicolon with a comma as some have said. I get the same error. I have tried replacing the quotation marks with an apostrophe and I get the same error. I have the Client tools installed on my machine. (I should mention that they are not installed on the Apache on my machine as I could not get them to install from the SQL Server disk to that location--only to the hardrive.). Again, they connect to the database. I can query the database from my machine. I have the latest ntwdblib.dllinstalled in the php, php\extension, apache\bin, and system 32 directories. What else . . . I have tried setting the msssql.secure_connection to both off and on and I still get the same error. I have ensured that TCP/IP and Named Pipes are enabled in the SQL Configuration tool. I have asked the network guy to help out but no luck there. Again, I am at a loss and need to get this up and running. Any suggestions would be appreciated. Thanks. Tommy
RE: [PHP] Question on Connecting to Microsoft SQL Server from PHP
All: I can't seem to connect to a SQL Server database with PHP. I have read the php.net documentation and so many other forums on the Internet that my eyes were literally blood shot. Today I thought I would try this route. I have PHP and Apache installed on my local machine. They work fine as I created another application with them (and MySQL) that worked as expected/designed. I want to connect to MS SQL Server 2000 that rests on another machine here at work. I can reach the tables and do whatever I want with them from my machine through SQL Query Analyzer. (The other machine runs a Windows Server. So I am trying to connect from one Windows box to another Windows box.) So I know that I can connect to the tables (and the machine that they rest on) from my machine. It is just that I get the following error when I load my PHP page: Warning: mssql_connect() [[ http://localhost/development_files/ordertrackno/where_is_it.php/fu nction.mssql-connect ]function.mssql-connect]: Unable to connect to server: . . . In my PHP page I have the following: $sql = mssql_connect (xx.xx.xx.xx:, xx, xx); $conn=mssql_select_db(xx, $sql); etc I have tried replacing the semicolon with a comma as some have said. I get the same error. I have tried replacing the quotation marks with an apostrophe and I get the same error. I have the Client tools installed on my machine. (I should mention that they are not installed on the Apache on my machine as I could not get them to install from the SQL Server disk to that location--only to the hardrive.). Again, they connect to the database. I can query the database from my machine. I have the latest ntwdblib.dllinstalled in the php, php\extension, apache\bin, and system 32 directories. What else . . . I have tried setting the msssql.secure_connection to both off and on and I still get the same error. I have ensured that TCP/IP and Named Pipes are enabled in the SQL Configuration tool. I have asked the network guy to help out but no luck there. Again, I am at a loss and need to get this up and running. Any suggestions would be appreciated. Thanks. Tommy Do you have any firewall software running on your local PC? (e.g. ZoneAlarm) This could be blocking the connection from Apache but allowing it for your other SQL client tools... Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Connecting to Microsoft SQL Server from PHP
In my PHP page I have the following: $sql = mssql_connect (xx.xx.xx.xx:, xx, xx); $conn=mssql_select_db(xx, $sql); Since both servers are within your local network, you should be able to connect as follows: $connection = mssql_connect('SERVERNAME','username','password') or die ('Cannot connect to server'); $database = mssql_select_db(my_database_name, $mssql_connection) or die ('DB selection failed'); Possible SQL Server issues: Unless your internal network does not trust your other servers, you should not have to use ip:port. Just use the servers actual name. I would also put in the or die statements so you know if you are failing connecting to the server or to the DB. Also, make sure the username/password you are using to connect is setup in MSSQL Server as a valid user for your database. Possible PHP issues: In your php.ini file make sure that extension=php_mssql.dll is uncommented You should only have mssql.secure_connection = Off set to On if you are trying to use NT Authentification. On 6/12/07, Edward Kay [EMAIL PROTECTED] wrote: All: I can't seem to connect to a SQL Server database with PHP. I have read the php.net documentation and so many other forums on the Internet that my eyes were literally blood shot. Today I thought I would try this route. I have PHP and Apache installed on my local machine. They work fine as I created another application with them (and MySQL) that worked as expected/designed. I want to connect to MS SQL Server 2000 that rests on another machine here at work. I can reach the tables and do whatever I want with them from my machine through SQL Query Analyzer. (The other machine runs a Windows Server. So I am trying to connect from one Windows box to another Windows box.) So I know that I can connect to the tables (and the machine that they rest on) from my machine. It is just that I get the following error when I load my PHP page: Warning: mssql_connect() [[ http://localhost/development_files/ordertrackno/where_is_it.php/fu nction.mssql-connect ]function.mssql-connect]: Unable to connect to server: . . . In my PHP page I have the following: $sql = mssql_connect (xx.xx.xx.xx:, xx, xx); $conn=mssql_select_db(xx, $sql); etc I have tried replacing the semicolon with a comma as some have said. I get the same error. I have tried replacing the quotation marks with an apostrophe and I get the same error. I have the Client tools installed on my machine. (I should mention that they are not installed on the Apache on my machine as I could not get them to install from the SQL Server disk to that location--only to the hardrive.). Again, they connect to the database. I can query the database from my machine. I have the latest ntwdblib.dllinstalled in the php, php\extension, apache\bin, and system 32 directories. What else . . . I have tried setting the msssql.secure_connection to both off and on and I still get the same error. I have ensured that TCP/IP and Named Pipes are enabled in the SQL Configuration tool. I have asked the network guy to help out but no luck there. Again, I am at a loss and need to get this up and running. Any suggestions would be appreciated. Thanks. Tommy Do you have any firewall software running on your local PC? (e.g. ZoneAlarm) This could be blocking the connection from Apache but allowing it for your other SQL client tools... Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Connecting to Microsoft SQL Server from PHP
You may want to try using the Sybase drivers. MS basically bought Sybase and re-named it MS SQL and then broke a lot of stuff :-) One of the things they haven't broken (yet) is the basic Sybase driver functionality to send queries. For sure, ' versus won't make any difference. You may want to take out he : port info -- unless you've worked hard to set up the server on some weird port or something, the default should just work. Also see if there are any error messages available: in Apache error log in MS SQL error logs (good luck!) in mssql_error() or whatever it is in $php_errormsg or whatever it is (turn it on in php.ini) You might also want to try running ethereal or netstat or whatever it is that will tell you what traffic is happening across your ethernet... On Tue, June 12, 2007 9:00 am, Tommy Peterson wrote: All: I can't seem to connect to a SQL Server database with PHP. I have read the php.net documentation and so many other forums on the Internet that my eyes were literally blood shot. Today I thought I would try this route. I have PHP and Apache installed on my local machine. They work fine as I created another application with them (and MySQL) that worked as expected/designed. I want to connect to MS SQL Server 2000 that rests on another machine here at work. I can reach the tables and do whatever I want with them from my machine through SQL Query Analyzer. (The other machine runs a Windows Server. So I am trying to connect from one Windows box to another Windows box.) So I know that I can connect to the tables (and the machine that they rest on) from my machine. It is just that I get the following error when I load my PHP page: Warning: mssql_connect() [[ http://localhost/development_files/ordertrackno/where_is_it.php/function.mssql-connect ]function.mssql-connect]: Unable to connect to server: . . . In my PHP page I have the following: $sql = mssql_connect (xx.xx.xx.xx:, xx, xx); $conn=mssql_select_db(xx, $sql); etc I have tried replacing the semicolon with a comma as some have said. I get the same error. I have tried replacing the quotation marks with an apostrophe and I get the same error. I have the Client tools installed on my machine. (I should mention that they are not installed on the Apache on my machine as I could not get them to install from the SQL Server disk to that location--only to the hardrive.). Again, they connect to the database. I can query the database from my machine. I have the latest ntwdblib.dllinstalled in the php, php\extension, apache\bin, and system 32 directories. What else . . . I have tried setting the msssql.secure_connection to both off and on and I still get the same error. I have ensured that TCP/IP and Named Pipes are enabled in the SQL Configuration tool. I have asked the network guy to help out but no luck there. Again, I am at a loss and need to get this up and running. Any suggestions would be appreciated. Thanks. Tommy -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Connecting to Microsoft SQL Server from PHP
Tommy, Since SQL Server may loom on my horizon, I've tried connecting to a SQL Server 2000 db on my network. I got it to work _without_ any port after the IP in mssql_connect(). I'm using PHP 5.2.0 from windows XP to a Windows 2000 box running SQL Server. I used SQL Server Authentication to create the login. Are you sure your login is working? David
[PHP] Question about using ftp_put() for copying files
Can anyone explain what's going on. If I assign $source= $source_dir . $file; $source_dir is the absolute path i.e., /home/x/public_html/EditPage/ And $dist= $dist_dir . $file; $dist_dir is simply relative to $_SERVER[document_root]; i.e., just plain /test To get ftp_put() to work, I must first chdir to the $dist_dir. ftp_chdir($dist_dir); ftp_put($conn_id, $dist, $source, flag]; Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about using ftp_put() for copying files
On Thu, May 24, 2007 2:37 pm, Al wrote: Can anyone explain what's going on. If I assign $source= $source_dir . $file; $source_dir is the absolute path i.e., /home/x/public_html/EditPage/ And $dist= $dist_dir . $file; $dist_dir is simply relative to $_SERVER[document_root]; i.e., just plain /test To get ftp_put() to work, I must first chdir to the $dist_dir. ftp_chdir($dist_dir); ftp_put($conn_id, $dist, $source, flag]; Similar to 'document_root', FTP has its own idea of where a root directory is for each login/user. In your case, it would appear by coincidence to match up with 'document_root' -- well, perhaps not coincidence since many webhosts restrict their users' FTP accounts to only be their own web directories, so they can't go poking around in other people's stuff quite as easily. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about using ftp_put() for copying files
What puzzles me is that one path must be absolute and the other relative to the root. And, I've got chdir to the destination dir. I know about ftp having its own root. In my code, I have a check to make certain the ftp root is the same as the $_SERVER[document_root]. Richard Lynch wrote: On Thu, May 24, 2007 2:37 pm, Al wrote: Can anyone explain what's going on. If I assign $source= $source_dir . $file; $source_dir is the absolute path i.e., /home/x/public_html/EditPage/ And $dist= $dist_dir . $file; $dist_dir is simply relative to $_SERVER[document_root]; i.e., just plain /test To get ftp_put() to work, I must first chdir to the $dist_dir. ftp_chdir($dist_dir); ftp_put($conn_id, $dist, $source, flag]; Similar to 'document_root', FTP has its own idea of where a root directory is for each login/user. In your case, it would appear by coincidence to match up with 'document_root' -- well, perhaps not coincidence since many webhosts restrict their users' FTP accounts to only be their own web directories, so they can't go poking around in other people's stuff quite as easily. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On 13/05/07, Robert Cummings [EMAIL PROTECTED] wrote: On Sat, 2007-05-12 at 23:03 -0500, Richard Lynch wrote: You may find this entertaining, and even useful: http://richardlynch.blogspoot.com I'm sure Richard meant http://richardlynch.blogspot.com Unless he's trying to promote bondage and SM :) Well, I found this entertaining. As for useful? I'll say no. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On Tue, 2007-05-15 at 16:57 +0100, Alister Bulman wrote: On 13/05/07, Robert Cummings [EMAIL PROTECTED] wrote: On Sat, 2007-05-12 at 23:03 -0500, Richard Lynch wrote: You may find this entertaining, and even useful: http://richardlynch.blogspoot.com I'm sure Richard meant http://richardlynch.blogspot.com Unless he's trying to promote bondage and SM :) Well, I found this entertaining. As for useful? I'll say no. Thanks for the feedback. We'll use the information you've provided that explains what you didn't find useful to help us improve our free services for future visitors. 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] Question
On Sun, 2007-05-13 at 00:33 -0500, Richard Lynch wrote: Here's your cookie: http://l-i-e.com/cookie.php :-) Bah, I was hoping for something a bit more tasty :/ ;) PS Does the one where I juke the URL to just be iwant.xyz work right at least?... Yep. 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] Question
Notice the 1st code example : http://www.php-code-search.com/?q=how%20to%20force%20the%20user%20to%20downl oad%20a%20file berber -Original Message- From: Dusan Novakovic [mailto:[EMAIL PROTECTED] Sent: Sunday, May 13, 2007 2:19 AM To: php-general@lists.php.net Subject: [PHP] Question Hi! I need a script which will run pop-up menu with the Save As button when I click on a link (e.g. a href=file.txtClick/a ) so that I could save that file on my computer. In the example I wrote file.txt file opens in browser, which I don`t want to happen. I would be very grateful if someone could send me a possible solution to this problem. Dušan -- made by Dusan -- 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] Question
Hi! I need a script which will run pop-up menu with the Save As button when I click on a link (e.g. a href=file.txtClick/a ) so that I could save that file on my computer. In the example I wrote file.txt file opens in browser, which I don`t want to happen. I would be very grateful if someone could send me a possible solution to this problem. Dušan -- made by Dusan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On Sat, May 12, 2007 7:19 pm, Dusan Novakovic wrote: Hi! I need a script which will run pop-up menu with the Save As button when I click on a link (e.g. a href=file.txtClick/a ) so that I could save that file on my computer. In the example I wrote file.txt file opens in browser, which I don`t want to happen. I would be very grateful if someone could send me a possible solution to this problem. You may find this entertaining, and even useful: http://richardlynch.blogspoot.com -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On Sat, 2007-05-12 at 23:03 -0500, Richard Lynch wrote: On Sat, May 12, 2007 7:19 pm, Dusan Novakovic wrote: Hi! I need a script which will run pop-up menu with the Save As button when I click on a link (e.g. a href=file.txtClick/a ) so that I could save that file on my computer. In the example I wrote file.txt file opens in browser, which I don`t want to happen. I would be very grateful if someone could send me a possible solution to this problem. You may find this entertaining, and even useful: http://richardlynch.blogspoot.com I'm sure Richard meant http://richardlynch.blogspot.com Unless he's trying to promote bondage and SM :) 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] Question
On Sun, 2007-05-13 at 00:24 -0400, Robert Cummings wrote: On Sat, 2007-05-12 at 23:03 -0500, Richard Lynch wrote: On Sat, May 12, 2007 7:19 pm, Dusan Novakovic wrote: Hi! I need a script which will run pop-up menu with the Save As button when I click on a link (e.g. a href=file.txtClick/a ) so that I could save that file on my computer. In the example I wrote file.txt file opens in browser, which I don`t want to happen. I would be very grateful if someone could send me a possible solution to this problem. You may find this entertaining, and even useful: http://richardlynch.blogspoot.com I'm sure Richard meant http://richardlynch.blogspot.com Unless he's trying to promote bondage and SM :) BTW Richard, my Opera browser (9.10 linux) opened up this link as a page containing text: http://l-i-e.com/blogger/download.php?filename=iwant.xyz No download dialog. I want my cookie :) 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] Question
On Sat, May 12, 2007 11:40 pm, Robert Cummings wrote: BTW Richard, my Opera browser (9.10 linux) opened up this link as a page containing text: http://l-i-e.com/blogger/download.php?filename=iwant.xyz If Opera IGNORES the RFC-mandated application/octet-stream as forcing a download, it's BROKEN. This has been in every RFC since HTTP 1.0... [EMAIL PROTECTED] junk]$ wget --server-response http://l-i-e.com/blogger/download.php? filename=iwant.xyz --00:01:53-- http://l-i-e.com/blogger/download.php?filename=iwant.xyz = `download.php?filename=iwant.xyz.1' Resolving l-i-e.com... done. Connecting to l-i-e.com[67.139.134.202]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Sun, 13 May 2007 05:08:47 GMT 3 Server: Apache/1.3.37 (Unix) DAV/1.0.3 PHP/4.4.1 mod_ssl/2.8.28 OpenSSL/0.9.8 b 4 X-Powered-By: PHP/4.4.1 5 Content-length: 50 6 Keep-Alive: timeout=15, max=100 7 Connection: Keep-Alive 8 Content-Type: application/octet-stream ^ any http client that does't do a download here is just plain broken... 100%[] 5048.83K/s ETA 00:00 00:01:53 (48.83 KB/s) - `download.php?filename=iwant.xyz.1' saved [50/50] No download dialog. I want my cookie :) Here's your cookie: http://l-i-e.com/cookie.php :-) PS Does the one where I juke the URL to just be iwant.xyz work right at least?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about OO design
# [EMAIL PROTECTED] / 2007-04-09 15:29:01 -0700: (I'm dealing with PHP4.) class User { var id; var name; var email; var balance; var accrual; var is_manager; function User($user_id) { $this-id = $user_id; $this-name = get_name(); // ... $this-accrual = get_accrual(); } function get_name() { // get name from db $sql = ...; $db = DB::singleton(); $db-execute($sql); } That static call on DB makes User tightly coupled to DB. This class won't work without the other. Aggravated by the multiple calls. Jochem cut the number down to 1 by doing the work in the constructor, but that doesn't remove the dependency, just makes it easier to remove eventually. The usual technique is to pass the database connection to the constructor: class User { function User($data_source, $user_id) { $this-ds = $data_source; $this-id = $user_id; $this-_fetch_data(); } var $ds, $id; function _fetch_data() { $this-ds-execute(...); } } Now, the User class is completely independent of the DB class. You can use User with any other class that has the same interface as DB. Of course, the more abstraction you provide, the more versatility you get, so you definitely don't want to have any SQL embedded in the business logic or classes as generic as User. I'll leave the issue of abstracting away data acquisition as an exercise for the reader. What about the places where you instantiate the User class? You would now need to change every new User($id) to at least new User($dbconn, $id) You can (and should) solve that by encapsulating the User instantiation. The tight coupling problem applies to all classes, including User. The industry standard technique to solve this is to use a creation or factory method: class UserFactory { function UserFactory($dbconn) { $this-dbconn = $dbconn; } var $dbconn; function create($id) { return new User($this-dbconn, $id); } } $uf = new UserFactory($dbconn); ... $user = $uf-create($id); And to prevent creating multiple instances of a single user (but you're screwed in PHP anyway): # NOTE: not bothering with references at all class Users { function Users($factory) { $this-factory = $factory; } var $factory; var $users = array(); function get($id) { if (!isset($this-users[$id])) { $this-users[$id] = $this-factory-create($id); } return $this-users[$id]; } } $users = new Users($factory); ... $user = $users-get($id); The classes follow two simple principles: Don't Repeat Yourself and Single Responsibility Principle (DRY, SRP). Sticking to them yields tremendous benefits in my experience, as does No Hardwiring, Please. Recommended reading: Design Patterns, Gamma et al.; Test-Driven Development by Example, Beck; Patterns of Enterprise Application Architecture, Fowler, C++ User's Journal archives. Also, did I mention that Singleton has turned a bit sour since its publication in Design Patterns, and is now considered an antipattern? Quoting one of the authors of the book: : It is a bad sign that the only pattern you mentioned was Singleton. : This shows you don't understand how to construct GUIs very well. : Singleton is a weak pattern, and whenever people start with : Singleton, it is a sign of a bad design. : : -Ralph Johnson -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Portfoilo's
Larry Garfield wrote: This is why one should work on an open source project. Much easier to show off legally. :-) unfortunately we aren't all fortunate enough to work for an open source project and earn a living, except Paul of course. Regards, Clive. {No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about OO design
On Monday, April 09, 2007 4:24 PM Jochem Maas mailto:[EMAIL PROTECTED] said: Ok. I see what you're saying. If I populate all that data during the constructor why would I ever call the function again right? you could refresh the data if needed - but basically the idea is to cut down the user data grab into a single sql call. [snip useful bits] Thanks for the help Jochem! I appreciated it. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Novice PHP Question - Listing Folder Contents
I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) 2 - List/ display the contents on the same Web-page Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
revDAVE wrote: I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) 2 - List/ display the contents on the same Web-page Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] Hello, A good place to start learning: http://us.php.net/dir -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
On 4/10/07, revDAVE [EMAIL PROTECTED] wrote: I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) http://www.php.net/manual/en/function.scandir.php 2 - List/ display the contents on the same Web-page http://www.php.net/manual/en/function.file-get-contents.php Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
On 4/10/2007 1:13 PM, Tijnema ! [EMAIL PROTECTED] wrote: http://www.php.net/manual/en/function.scandir.php 2 - List/ display the contents on the same Web-page http://www.php.net/manual/en/function.file-get-contents.php WOW COOL - That was quick - thanks Tijnema Brad! From here: http://us.php.net/manual/en/function.scandir.php I created a folder on a site called 'test' - inside that I created a folder called 'tmp' and put a few small files in there - test1.php and test1.pdf - inside the 'test' folder - I put a page with this code in it: ---START-- !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleUntitled Document/title /head body ?php $dir= '/tmp'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2); ? /body /html --- END I believe I'm using php 5.xx and other simple php code tests works ok... What did I do wrong? * It returned this: Array ( [0] = . [1] = .. [2] = 20070319-203422-202.180.53.58-request_body-cIifAH [3] = 20070331-205545-210.151.155.75-request_body-ndb6cr [4] = 20070407-120415-74.120.199.72-request_body-e04f0i [5] = cpbandwidth [6] = horde_32001.log [7] = impatt8G6tEI [8] = impattnZ83wN [9] = mysql.sock [10] = sess_081964a8e938ed5ce96599ca69c3735f [11] = sess_0a68937c12c590e4e888729a6f3b3909 [12] = sess_196a3d41dcf968745b769fd0cc109027 [13] = sess_1d76fbb6d9a20281764dd704d7b3b42b [14] = sess_1df95e42d90db2a3b56b01b13418436f [15] = sess_251f03b20e722badf7f50b79bdf2d658 [16] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [17] = sess_372c43405de9f29c9f7da7e2f744b76b [18] = sess_3ec91e33b50ba9907a5c5a1708536e72 [19] = sess_3f53f2e40741897d8bf2221e1654ffe4 [20] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [21] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [22] = sess_60d24ab7ad329193f4c0a86b8523d620 [23] = sess_62b717b4d1cb02a212d069bbda572537 [24] = sess_643b41e3f4cbcddff8691733ec5ced73 [25] = sess_73954a8cdafc3ec27e100334f41f4687 [26] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [27] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [28] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [29] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [30] = sess_b509845b62cd47325f7e87da19950c8f [31] = sess_ce336da97e49a065da7a1e17f67905fe [32] = sess_cee73725b4740fd4a71007acc415e315 [33] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [34] = sess_db0673c8f47533b927ebd220b158b9a6 [35] = sess_db6015a1a82369de458bea63790dd2a7 [36] = sess_ea54cce4bee772eca9d051b9665ad767 [37] = sess_fc8499d1de617bfd49f3ed6a64a55dfe ) Array ( [0] = sess_fc8499d1de617bfd49f3ed6a64a55dfe [1] = sess_ea54cce4bee772eca9d051b9665ad767 [2] = sess_db6015a1a82369de458bea63790dd2a7 [3] = sess_db0673c8f47533b927ebd220b158b9a6 [4] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [5] = sess_cee73725b4740fd4a71007acc415e315 [6] = sess_ce336da97e49a065da7a1e17f67905fe [7] = sess_b509845b62cd47325f7e87da19950c8f [8] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [9] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [10] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [11] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [12] = sess_73954a8cdafc3ec27e100334f41f4687 [13] = sess_643b41e3f4cbcddff8691733ec5ced73 [14] = sess_62b717b4d1cb02a212d069bbda572537 [15] = sess_60d24ab7ad329193f4c0a86b8523d620 [16] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [17] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [18] = sess_3f53f2e40741897d8bf2221e1654ffe4 [19] = sess_3ec91e33b50ba9907a5c5a1708536e72 [20] = sess_372c43405de9f29c9f7da7e2f744b76b [21] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [22] = sess_251f03b20e722badf7f50b79bdf2d658 [23] = sess_1df95e42d90db2a3b56b01b13418436f [24] = sess_1d76fbb6d9a20281764dd704d7b3b42b [25] = sess_196a3d41dcf968745b769fd0cc109027 [26] = sess_0a68937c12c590e4e888729a6f3b3909 [27] = sess_081964a8e938ed5ce96599ca69c3735f [28] = mysql.sock [29] = impattnZ83wN [30] = impatt8G6tEI [31] = horde_32001.log [32] = cpbandwidth [33] = 20070407-120415-74.120.199.72-request_body-e04f0i [34] = 20070331-205545-210.151.155.75-request_body-ndb6cr [35] = 20070319-203422-202.180.53.58-request_body-cIifAH [36] = .. [37] = . ) -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
On 4/10/07, revDAVE [EMAIL PROTECTED] wrote: On 4/10/2007 1:13 PM, Tijnema ! [EMAIL PROTECTED] wrote: http://www.php.net/manual/en/function.scandir.php 2 - List/ display the contents on the same Web-page http://www.php.net/manual/en/function.file-get-contents.php WOW COOL - That was quick - thanks Tijnema Brad! From here: http://us.php.net/manual/en/function.scandir.php I created a folder on a site called 'test' - inside that I created a folder called 'tmp' and put a few small files in there - test1.php and test1.pdf - inside the 'test' folder - I put a page with this code in it: ---START-- !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleUntitled Document/title /head body ?php $dir= '/tmp'; This links to /tmp, and that's probably not what you want, you want it relative to your page try: ?php $dir = './tmp'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2); ? /body /html --- END I believe I'm using php 5.xx and other simple php code tests works ok... What did I do wrong? * It returned this: Array ( [0] = . [1] = .. [2] = 20070319-203422-202.180.53.58-request_body-cIifAH [3] = 20070331-205545-210.151.155.75-request_body-ndb6cr [4] = 20070407-120415-74.120.199.72-request_body-e04f0i [5] = cpbandwidth [6] = horde_32001.log [7] = impatt8G6tEI [8] = impattnZ83wN [9] = mysql.sock [10] = sess_081964a8e938ed5ce96599ca69c3735f [11] = sess_0a68937c12c590e4e888729a6f3b3909 [12] = sess_196a3d41dcf968745b769fd0cc109027 [13] = sess_1d76fbb6d9a20281764dd704d7b3b42b [14] = sess_1df95e42d90db2a3b56b01b13418436f [15] = sess_251f03b20e722badf7f50b79bdf2d658 [16] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [17] = sess_372c43405de9f29c9f7da7e2f744b76b [18] = sess_3ec91e33b50ba9907a5c5a1708536e72 [19] = sess_3f53f2e40741897d8bf2221e1654ffe4 [20] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [21] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [22] = sess_60d24ab7ad329193f4c0a86b8523d620 [23] = sess_62b717b4d1cb02a212d069bbda572537 [24] = sess_643b41e3f4cbcddff8691733ec5ced73 [25] = sess_73954a8cdafc3ec27e100334f41f4687 [26] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [27] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [28] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [29] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [30] = sess_b509845b62cd47325f7e87da19950c8f [31] = sess_ce336da97e49a065da7a1e17f67905fe [32] = sess_cee73725b4740fd4a71007acc415e315 [33] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [34] = sess_db0673c8f47533b927ebd220b158b9a6 [35] = sess_db6015a1a82369de458bea63790dd2a7 [36] = sess_ea54cce4bee772eca9d051b9665ad767 [37] = sess_fc8499d1de617bfd49f3ed6a64a55dfe ) Array ( [0] = sess_fc8499d1de617bfd49f3ed6a64a55dfe [1] = sess_ea54cce4bee772eca9d051b9665ad767 [2] = sess_db6015a1a82369de458bea63790dd2a7 [3] = sess_db0673c8f47533b927ebd220b158b9a6 [4] = sess_d93ffa5f105f1f1be98c8d25d507d4d2 [5] = sess_cee73725b4740fd4a71007acc415e315 [6] = sess_ce336da97e49a065da7a1e17f67905fe [7] = sess_b509845b62cd47325f7e87da19950c8f [8] = sess_b10ba9bb132e6b7e595e5dd6534456c7 [9] = sess_ab4f0779de0d62ffdb663e2e5fa0e545 [10] = sess_a4924e20ddf793e3b105f8e571fcb8f9 [11] = sess_96b7e378fbe36ef9dd0d6971f055f1f4 [12] = sess_73954a8cdafc3ec27e100334f41f4687 [13] = sess_643b41e3f4cbcddff8691733ec5ced73 [14] = sess_62b717b4d1cb02a212d069bbda572537 [15] = sess_60d24ab7ad329193f4c0a86b8523d620 [16] = sess_57fff08ce0f8e04aa5bdf951beac4a09 [17] = sess_57cb8a894f1ffb0e401b4f056aef72e1 [18] = sess_3f53f2e40741897d8bf2221e1654ffe4 [19] = sess_3ec91e33b50ba9907a5c5a1708536e72 [20] = sess_372c43405de9f29c9f7da7e2f744b76b [21] = sess_2c6ca7e9f66fdec29eec68eb82b1af74 [22] = sess_251f03b20e722badf7f50b79bdf2d658 [23] = sess_1df95e42d90db2a3b56b01b13418436f [24] = sess_1d76fbb6d9a20281764dd704d7b3b42b [25] = sess_196a3d41dcf968745b769fd0cc109027 [26] = sess_0a68937c12c590e4e888729a6f3b3909 [27] = sess_081964a8e938ed5ce96599ca69c3735f [28] = mysql.sock [29] = impattnZ83wN [30] = impatt8G6tEI [31] = horde_32001.log [32] = cpbandwidth [33] = 20070407-120415-74.120.199.72-request_body-e04f0i [34] = 20070331-205545-210.151.155.75-request_body-ndb6cr [35] = 20070319-203422-202.180.53.58-request_body-cIifAH [36] = .. [37] = . ) -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- 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] Novice PHP Question - Listing Folder Contents
In addition to the suggestions made, check out opendir() too. It may be a little simpler for what you're doing. Not sure. Remember, the beauty of PHP is that there's almost always a fuction or two already made that do what you want. Even some semi-obscure stuff. So always scan through the function list before assuming you gotta do things the hard way. http://us.php.net/opendir -TG = = = Original message = = = I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) 2 - List/ display the contents on the same Web-page Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice PHP Question - Listing Folder Contents
http://www.php.net/readdir ?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != . $file != ..) { echo $file\n; } } closedir($handle); } ? cheers jmg - Original Message - From: revDAVE [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, April 10, 2007 10:11 PM Subject: [PHP] Novice PHP Question - Listing Folder Contents I apologize in advance, however I know almost nothing about PHP - ( but I am trying to learn now)... I am wondering if it is possible to create a PHP page that can: 1 - Get the contents of everything in its own folder at the same level ( just list sub folders filenames - not their contents) 2 - List/ display the contents on the same Web-page Q: I'm sure this is most likely doable - but I sure could use some help - any ideas how to do this? Example list: file1.php file2.php file22.txt file1.pdf - that sort of thing -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- 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] Novice PHP Question - Listing Folder Contents
Thanks to ALL ... Brad - Tijnema - TG - Richard and JMG! With a little fooling around - I actually got exactly what I wanted!!! Boy that was fun! And thanks for the incredibly quick responses! -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about OO design
Hello, I'm working on a project now and I'd like to get some feedback on how to implement a proper class (or two). This is an application that records an employee's used vacation time. There are two tables: (1) events, (2) users. Users: id (int) name (varchar) email (varchar) balance (mediumint, stored in seconds) // this is the balance for // the user after all events // have been accounted for. accrual (smallint, stored in seconds) is_manager (bool) Events: id (int) uid (int, users.id) date (date) duration (smallint, stored in seconds) balance (smallint, stored in seconds) // this is the balance for // the user at the time the // event was added. created (datetime) Currently I have just one class called User that looks like this: (I'm dealing with PHP4.) class User { var id; var name; var email; var balance; var accrual; var is_manager; function User($user_id) { $this-id = $user_id; $this-name = get_name(); // ... $this-accrual = get_accrual(); } function get_name() { // get name from db $sql = ...; $db = DB::singleton(); $db-execute($sql); } function get_email() function get_accrual() function is_manager() { // same as above more or less } function get_events() { // this function gets all the events for // the current users and returns them // as an array. } function add_event() { // this function adds a single event for // the current user. it also recalculates // the 'balance' for each event because // of data display requirements. } function del_event($event_id) { // delete an event from the current user's // events list based on $event_id. } } As I started to write this and use it I get the feeling that there should also be an Event class that is extended by the User class. Reason being that each User object is a reference to the currently logged in user, not anyone else. But if you're a manager you have the responsibility to approve/deny and/or add/delete events for your employees. But with that in mind I've gone from a class that handles the currently logged in user to one that handles the currently logged in user plus any number of other users. I guess I'm thinking of this in the same terms as db normalization. Ex: I could add an extra price_level column to my products table each time I need a new pricing level but it's probably better to create a separate table called products_prices. It's slightly more complicated but it would allow me to have as many pricing levels as I want without modifying my databse or code. I'd appreciate any kind of feedback on this. If I haven't been clear with something please let me know. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about OO design
Chris W. Parker wrote: Hello, I'm working on a project now and I'd like to get some feedback on how to implement a proper class (or two). This is an application that records an employee's used vacation time. There are two tables: (1) events, (2) users. Users: id (int) name (varchar) email (varchar) balance (mediumint, stored in seconds) // this is the balance for // the user after all events // have been accounted for. accrual (smallint, stored in seconds) is_manager (bool) Events: id (int) uid (int, users.id) date (date) duration (smallint, stored in seconds) balance (smallint, stored in seconds) // this is the balance for // the user at the time the // event was added. created (datetime) Currently I have just one class called User that looks like this: (I'm dealing with PHP4.) class User { var id; var name; var email; var balance; var accrual; var is_manager; function User($user_id) { $this-id = $user_id; $this-name = get_name(); // ... $this-accrual = get_accrual(); } function get_name() { // get name from db $sql = ...; $db = DB::singleton(); $db-execute($sql); you probably only want one DB call to populate the User object with all the relevant user data at the point where the object is created. function User($user_id) { // check the user id properly? // see the getEmployee() example below for the // reason for the array usage if (is_array($user_id)) { $this-id = $user_id['id']; $this-load($user_id); } else { $this-id = $user_id; $this-load(); } } function load($data = null) { if (!is_array($data) || empty($data)) { // get user data from db $sql = SELECT * FROM users WHERE id={$this-id}; // error checking? $db = DB::singleton(); $db-execute($sql); $data = $db-getRow(); } $this-name = $data['name']; $this-accrual = $data['accrual']; $this-email= $data['email']; /// etc } function get_email() function get_accrual() function is_manager() { // same as above more or less } function get_events() { // this function gets all the events for // the current users and returns them // as an array. } function add_event() { // this function adds a single event for // the current user. it also recalculates // the 'balance' for each event because // of data display requirements. } function del_event($event_id) { // delete an event from the current user's // events list based on $event_id. } } As I started to write this and use it I get the feeling that there should also be an Event class that is extended by the User class. Reason if you use an Event class then it should just represent an Event (and a User object would [probably] contain an array of Event objects). AFAICT there is no good reason to have Event extend User. being that each User object is a reference to the currently logged in user, not anyone else. the User class is merely a representation of *a* user - you can use an instance for the currently logged in user, but that doesn't stop you from using the same class to model the collection of users that fall under a given manager. But if you're a manager you have the responsibility to approve/deny and/or add/delete events for your employees. // you might need to f around with returning references here, // (I can never quite get that right without a bit of trial and error in php4) function getEmployees() { // consider caching the result? $emps = array(); if ($this-is_manager) { // get user data from db $sql = SELECT * FROM users WHERE manager_id={$this-id}; // error checking? $db = DB::singleton(); $db-execute($sql); while ($data = $db-getRow()) $emps[] = new User($data); } return $emps; } But with that in mind I've gone from a class that handles the currently logged in user to one that handles the currently logged in user plus any number of other users. I guess I'm thinking of this in the same terms as db normalization. Ex: I could add an extra price_level column to my products table each
RE: [PHP] Question about OO design
On Monday, April 09, 2007 3:51 PM Jochem Maas mailto:[EMAIL PROTECTED] said: Thanks for the response Jochem. Chris W. Parker wrote: [snip] you probably only want one DB call to populate the User object with all the relevant user data at the point where the object is created. [snip] Ok. I see what you're saying. If I populate all that data during the constructor why would I ever call the function again right? [snip] As I started to write this and use it I get the feeling that there should also be an Event class that is extended by the User class. Reason if you use an Event class then it should just represent an Event (and a User object would [probably] contain an array of Event objects). AFAICT there is no good reason to have Event extend User. I see. being that each User object is a reference to the currently logged in user, not anyone else. the User class is merely a representation of *a* user - you can use an instance for the currently logged in user, but that doesn't stop you from using the same class to model the collection of users that fall under a given manager. I see. // you might need to f around with returning references here, // (I can never quite get that right without a bit of trial and error in php4) function getEmployees() { // consider caching the result? $emps = array(); if ($this-is_manager) { // get user data from db $sql = SELECT * FROM users WHERE manager_id={$this-id}; // error checking? $db = DB::singleton(); $db-execute($sql); while ($data = $db-getRow()) $emps[] = new User($data); } return $emps; } How do I reference a User object within the $emps array? Is it like $emps[0]-accrual ? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about OO design
Chris W. Parker wrote: On Monday, April 09, 2007 3:51 PM Jochem Maas mailto:[EMAIL PROTECTED] said: Thanks for the response Jochem. Chris W. Parker wrote: [snip] you probably only want one DB call to populate the User object with all the relevant user data at the point where the object is created. [snip] Ok. I see what you're saying. If I populate all that data during the constructor why would I ever call the function again right? you could refresh the data if needed - but basically the idea is to cut down the user data grab into a single sql call. [snip] As I started to write this and use it I get the feeling that there should also be an Event class that is extended by the User class. Reason if you use an Event class then it should just represent an Event (and a User object would [probably] contain an array of Event objects). AFAICT there is no good reason to have Event extend User. I see. being that each User object is a reference to the currently logged in user, not anyone else. the User class is merely a representation of *a* user - you can use an instance for the currently logged in user, but that doesn't stop you from using the same class to model the collection of users that fall under a given manager. I see. // you might need to f around with returning references here, // (I can never quite get that right without a bit of trial and error in php4) function getEmployees() { // consider caching the result? $emps = array(); if ($this-is_manager) { // get user data from db $sql = SELECT * FROM users WHERE manager_id={$this-id}; // error checking? $db = DB::singleton(); $db-execute($sql); while ($data = $db-getRow()) $emps[] = new User($data); $emps[$data['id']] = new User($data); } return $emps; } How do I reference a User object within the $emps array? Is it like $emps[0]-accrual ? that's one way, you might consider keying the emps array on the user id for easier retrieval (see above), which would allow you to quickly reference the correct employee User object when a manager performs an action on a given emp. or when a manager edits multiple employees: $manager = new User($_SESSION['userid']); $emps= $manager-getEmployees(); // think about using references here? foreach ($emps as $id = $emp) { if (isset($_POST['emps'][$id])) { // just some vague 'update' concept/action thingummy $emp-doSomeUpdateStuff($_POST['emps'][$id]); $emp-saveUpdateStuffToDB(); } } or a different tack foreach ($_POST['emps'] as $id = $stuff)) { $manager-updateEmpStuff($id, $stuff); } // where updateEmpStuff does something like User { function updateEmpStuff($id, $stuff) { if ($this-is_manager) { // don't forget to cache the emps array?? // don't forget the use of references?? $emps = $this0getEmployees(); if (isset($emps[$id])) { // again a vague thingummy representing something // a manager might [need to be able to] do. $emps[$id]-managerUpdatesStuff($stuff); } } } } Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question on Portfoilo's
So i've been meaning to start a portfolio of some code, so that when I apply for a job, and they want code samples, I have something to show them. Unfortunately, at this time, most of my work is inside of a much larger application, or in code that belongs to my current employer (not a php job, just misc. things i've made). What kind of things do you guys have in your portfolio's/code samples that your provide to a potential employer? What things do you feel I should avoid when putting this kinda of thing together? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Portfoilo's
This is why one should work on an open source project. Much easier to show off legally. :-) On Monday 09 April 2007 8:23 pm, Matt Carlson wrote: So i've been meaning to start a portfolio of some code, so that when I apply for a job, and they want code samples, I have something to show them. Unfortunately, at this time, most of my work is inside of a much larger application, or in code that belongs to my current employer (not a php job, just misc. things i've made). What kind of things do you guys have in your portfolio's/code samples that your provide to a potential employer? What things do you feel I should avoid when putting this kinda of thing together? -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Portfoilo's
Em Segunda 09 Abril 2007 22:36, Larry Garfield escreveu: This is why one should work on an open source project. Much easier to show off legally. :-) You can't live for and from only open source projects... _I_ develop web sites and show them to my clients... Well... I'm an empoyler... =p What about you develop your personal web log? Later, you can develop your own personal calendar, to schelude that importante meeting... And going to make your own portfoilo... =] -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Al, there are plenty of good people in this newsgroup, and I would go so far as to count myself among them. Take a moment to really ponder why they don't come to your defence ... No, I meant REALLY ponder ... From: Sylvain Robitaille -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on Portfoilo's
On Mon, 2007-04-09 at 22:45 -0300, Davi wrote: Em Segunda 09 Abril 2007 22:36, Larry Garfield escreveu: You can't live for and from only open source projects... Why not? I do... --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about form submitting
Hi, Sorry for the lame question, but i didn't find a satisfactory answer in the web. I have this subscribe form (subscribe.php) and on submit i have to check for errors: a) password and password confirmation mismatch; b) missing filled fields c) check e-mail validity d) etc. My question is how do i make all these possibilities show a different error message without leaving subscribe.php ? I know that the for action must be subscribe.php, from there i'm blind as a bat. Any help would be appreciated. Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about form submitting
On 4/3/07, Mário Gamito [EMAIL PROTECTED] wrote: Hi, Sorry for the lame question, but i didn't find a satisfactory answer in the web. I have this subscribe form (subscribe.php) and on submit i have to check for errors: a) password and password confirmation mismatch; b) missing filled fields c) check e-mail validity d) etc. My question is how do i make all these possibilities show a different error message without leaving subscribe.php ? I know that the for action must be subscribe.php, from there i'm blind as a bat. Any help would be appreciated. Warm Regards -- :wq! Mário Gamito This can only be done with Javascript if you don't want to leave the page. And so, you're on the wrong list, search for a javascript list :) Tijnema -- 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 form submitting
Not true. You can submit the form back to itself as many times as required by making the form action $_SERVER['PHP_SELF'] and checking for various sequences and outputting different html in each case.