Re: [PHP] Another problem with conditional statements
On Friday 20 December 2002 08:28, Sean Malloy wrote: > Its all wrong. You shouldn't be using a switch statement anyway. A switch > is for evaluating a single variable. You can use the switch construct in the context that the OP was using it. In fact I prefer use that instead of a whole bunch of if-then-else statements. For one thing it looks (IMO) a lot neater. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with static call of method - class::method
Hi everybody, I've problem deciding whether is method call static or dynamic. How can I find it? mirek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL path problems
Thx for your help, butis there any instructions that let me follow? I'm not familiar with those settings, thx a lot "Peter Houchin" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D :[EMAIL PROTECTED] > if ur using apache using .htaccess in the directory .. and you can also set > it in the httpd.conf > > > -Original Message- > > From: ªüYam [mailto:[EMAIL PROTECTED]] > > Sent: Friday, 20 December 2002 4:41 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] URL path problems > > > > > > Suppose my web domain is http://abc.com > > There is a administration directory in my wwwroot which is used > > to store the > > administrative control pages. > > > > However, from now on, everyone can access the administrative pages through > > the addictive path to the domain such as: > > http://abc.com/administration/xxx.php > > > > Is there any solution to block or prevent the addictive path through my > > server? > > Just like only http://abc.com is allowed to browse. > > thx a lot > > > > > > > > -- > > 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] Problem with static call of method - class::method
[re-sending] Hi everybody, I've problem deciding whether is method call static or dynamic. How can I find it? mirek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with static call of method - class::method
[re-sending] Hi everybody, I've problem deciding whether is method call static or dynamic. How can I find it? mirek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error installing
On Thursday 19 December 2002 23:48, Mako Shark wrote: > Anybody have any bright ideas? > > Trying to install my own PHP on my own server. I'm > getting the error "Redirection limit for this URL > exceeded. Unable to load the requested page." Not sure whether this is your problem, but one thing which can cause this is when your browser is set to reject cookies and the page tries to set a cookie and redirects to itself to read the cookie which it tried to set, it doesn't find it so it sets it again and redirects ... until you get the error message. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Good day for overcoming obstacles. Try a steeplechase. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working in html
You can also change the apache config to use php for .html pages. example in apache 2.0.x: ... normal stuff like documentroot, servername, .. SetOutputFilter PHP SetInputFilter PHP Or globally in the /etc/httpd/conf.d/php.conf, add a: SetOutputFilter PHP SetInputFilter PHP Example in apache 1.3.x: Between the and tags, add the following: AddType application/x-httpd-php .html Kind regards, Dries Verachtert On Thu, 2002-11-07 at 22:27, 1LT John W. Holmes wrote: > > PHP isn't working in my html docs - what changes do I need to make to get > it > > to do so? Does it need to be recompiled? Can I do it without > re-compiling? > > Give your file a .php extension, maybe? > > ---John Holmes... > > > -- > 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] Another problem with conditional statements
> -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 00:19 > > This should be as simple as breathing, but not today. I have > two variables > $a and $b which I need to compare in a switch statement in > several different > ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and > $b is equal to > 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stuff; > break; > > endswitch; Well, I've just cut-and-pasted this code and added a few echo statements (and some other twiddles to get suitable values in), and it works perfectly -- so I'd say your $a and $b aren't getting the values you think they are. As a firtst step, I suggest you echo them out immediately before the switch statement and see what you've got. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mkdir() makes dir, but with wrong owner
Hi, i had a few problems with mkdir() ane uploading files using php. i have a simple script, which is making a dir. but everytime, it makes a dir with totally wrong user. chown wont work. any expirience with this?? i have found some older posts considering this, but no real answers. i think, the problem is probably in httpd.conf (apche config file), but i am not sure. any ideas? thanx. Mirza -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Some discoveries I've made. Anyone care to confirm/deny
> -Original Message- > From: Sean Malloy [mailto:[EMAIL PROTECTED]] > Sent: 19 December 2002 23:30 > > Firstly, something regarding accessing form/query string variables, on > diffferent versions of PHP. Starts to become a nightmare, but > you also want > to make sure you _aren't_ requiring register_globals to be on... > > so what I do; > > function Form($var = null) > { > if (function_exists('version_compare')) // added in 4.1.0 > { > return @$_POST[$var]; > } > global $HTTP_POST_VARS; > return @$HTTP_POST_VARS[$var]; > } This seems unnecessarily complex -- $HTTP_*_VARS did not go away when the new $_* superglobals were introduced, and are not likely to anytime soon, so the simple way to do this is just to continue referring to $HTTP_POST_VARS[$var]. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 00:34 > > switch() does not work that way. Switch uses the value in > the parentheses and selects a > CASE based upon that value. Read the manual. > > You will have to use a series of if()-elseif()-else() Not true. Absolutely nothing wrong with using switch in this way -- it's a very neat and useful device. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache2 & PHP4
OK, so I've spent the last 2 or 3 hours looking on the net for this. Can anyone tell me the proper way (with Apache 2.0.40) to instruct apache to process .htm and .html files? I've tried: In /etc/httpd/conf/httpd.conf :: AddType application/x-httpd-php .php AddType application/x-httpd-php .html And also in /etc/httpd/conf.d/php.conf :: AddType application/x-httpd-php .php AddType application/x-httpd-php .html Neither appears to work or affect anything at all. I have also tried: SetOutputFilter PHP SetInputFilter PHP ... in the php.conf file, but my guess is that this wouldn't work unless something like the AddType points to PHP to begin with. Can anyone give me some ideas? I'm just fine with Apache 1.3, but RH8 ships with Apache2 and I thought I'd try it ... Chase -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Sean Malloy [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 02:36 > To: PHP General > Subject: RE: [PHP] Another problem with conditional statements > > > Nowhere in the documentation does it specify switch should be > used in the > context you are attempting. The docs say: "In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for." TRUE is an expression, and so can be the subject of a switch statement. > The docs show a single variable and checking the case of that > variable. Admittedly all the examples in the manual use a single variable, but from the first sentence of the switch description: "The switch statement is similar to a series of IF statements on the same expression." ... I think it's reasonable to deduce that the parentheses after switch can contain any legitimate expression. Admittedly, all the examples in the manual use a single variable -- perhaps you might want to submit a Documentation Problem bug report suggesting some more complex examples. Actually, looking at the online manual again, I see several user notes with potential candidates for moving to the manual proper, including one which demonstrates the exact usage that the OP was having problems with. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 03:15 > > > Using switch would be more efficiant as it would stop once a > match is made > (if you use break), but with eleif statements each one is evaluated in > order. Not sure that's true -- a sequence of elseifs will also stop evaluating once one of the conditions has evaluated to true. The essential difference is that a switch/case structure is a repeated test against a single value (possibly derived from an expression), whereas an if ... elseif sequence can test multiple completely disjoint conditions. > $chr = substr($a,$i,1); > switch (TRUE) { > > case $chr == "á" || $chr == "à" || $chr == "ã" || $chr == "â": > $a = str_replace(substr($a,$i,1),"a",$a); > break; > > case $chr == "é" || $chr == "è" || $chr == "ê": > $a = str_replace(substr($a,$i,1),"e",$a); > break; > > } Actually, I'm not sure that's a good example, either! I'd have thought it was better written as: switch (substr($a,$i,1)) { case "á": case "à": case "ã": case "â": $a = str_replace(substr($a,$i,1),"a",$a); break; case "é": case "è": case "ê": $a = str_replace(substr($a,$i,1),"e",$a); break; } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upload_max_filesize + ini_set
is there a way to get this setting to work without hard setting in htaccess ? i'd like to be able to dynamically set the max filesize via a defines setting and ini_set rather than statically in htaccess -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is there any method to filter the single quote from a string?
as title that I'm getting a trouble on filtering the single quote ' , since there would be error when storing those string into MySQL, thus, i have to find the appropriate method to solve it, anybody can help please? thx a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote from astring?
don't filter the quotes... escape them with add_slashes() justin on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > as title that I'm getting a trouble on filtering the single quote ' , since > there would be error when storing those string into MySQL, thus, i have to > find the appropriate method to solve it, anybody can help please? > thx a lot > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] upload_max_filesize + ini_set
> -Original Message- > From: electroteque [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 11:35 > To: [EMAIL PROTECTED] > Subject: [PHP] upload_max_filesize + ini_set > > > is there a way to get this setting to work without hard > setting in htaccess > ? i'd like to be able to dynamically set the max filesize via > a defines > setting and ini_set rather than statically in htaccess No can do -- as all file upload activity takes place before your script even starts executing, you can't use ini_set on this. In fact, upload_max_filesize is listed in http://www.php.net/manual/en/function.ini-set.php as being a PHP_INI_SYSTEM level directive, which means it can be set only in php.ini or httpd.conf (if using Apache) -- it's not even settable in .htaccess files. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to upload a file
post_max_size 8M upload_tmp_dir It fails immediately after clicking the submit button. [thanx for ur concern] On Wed, 18 Dec 2002, Rich Gray wrote: > What are these settings in your php.ini? > > post_max_size > upload_tmp_dir > > Does the upload_tmp_dir have enough space? Are the permissions on the > directory correct? When you start the upload - how long does it take to fail > immeditaely you click submit or after a delay. If the latter then is there > anything created in the upload directory after teh submit is clicked and > before it fails...? > > -Original Message- > From: Somesh [mailto:[EMAIL PROTECTED]] > Sent: 18 December 2002 15:52 > To: Rich Gray > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] How to upload a file > > > > No difference > > > On Wed, 18 Dec 2002, Rich Gray wrote: > > > As others have suggested does it make any difference if you up the script > > timeout limit with set_time_limit() or via the max_execution_time in > > php.ini? > > > > > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] PHP not working in html]
You can also change the apache config to use php for .html pages. example in apache 2.0.x: ... normal stuff like documentroot, servername, .. SetOutputFilter PHP SetInputFilter PHP Or globally in the /etc/httpd/conf.d/php.conf, add a: SetOutputFilter PHP SetInputFilter PHP Example in apache 1.3.x: Between the and tags, add the following: AddType application/x-httpd-php .html Kind regards, Dries Verachtert On Thu, 2002-11-07 at 22:27, 1LT John W. Holmes wrote: > > PHP isn't working in my html docs - what changes do I need to make to get > it > > to do so? Does it need to be recompiled? Can I do it without > re-compiling? > > Give your file a .php extension, maybe? > > ---John Holmes... > > > -- > 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] Apache2 & PHP4
Hello, I use the following in my VirtualHost example: DocumentRoot /a/b/c/d/ ServerName a.be SetOutputFilter PHP SetInputFilter PHP I don't have AddType's for .html. I also still got the following: AllowOverride All This was needed to make the AddType in .htaccess files work in apache 1.3 if i remember correctly. It's possible you only need a 'AllowOverride FileInfo' to make it work. This works without problems for me on RH8 with the apache/php from RH8. Kind regards, Dries Verachtert On Fri, 2002-12-20 at 10:32, Chase Urich wrote: > OK, so I've spent the last 2 or 3 hours looking on the net for this. > Can anyone tell me the proper way (with Apache 2.0.40) to instruct > apache to process .htm and .html files? > > I've tried: > In /etc/httpd/conf/httpd.conf :: > AddType application/x-httpd-php .php > AddType application/x-httpd-php .html > And also in /etc/httpd/conf.d/php.conf :: > AddType application/x-httpd-php .php > AddType application/x-httpd-php .html > > Neither appears to work or affect anything at all. I have also tried: > > SetOutputFilter PHP > SetInputFilter PHP > > ... in the php.conf file, but my guess is that this wouldn't work unless > something like the AddType points to PHP to begin with. > > Can anyone give me some ideas? I'm just fine with Apache 1.3, but RH8 > ships with Apache2 and I thought I'd try it ... > > Chase > > > -- > 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] XML fopen($url)
Reading Remote Files With FOPEN: This appears to be quite a common problem for installations that run a really tight ship. I am trying to do some XML and have a slight problem: My hosting company does not allow for file sockets. I assume that this means that allow_url_fopen will not work. Example if (!($fp = fopen($url, "r"))) { die("could not open XML input"); } ?> NOTE: This works fine if the file is local. The following is supposed to work by overriding the default php.ini but sadly, does not work on my installation. Sample Newsfeed in XML format Or setting the ini file: $feed = 'http://slashdot.org/slashdot.rdf'; ini_set('allow_url_fopen', true); $fp = fopen($feed, 'r'); $xml = ''; while (!feof($fp)) { $xml .= fread($fp, 128); } fclose($fp); The result is either getting a message stating that the file could not be opened or that the file does not exist in the directory. The file pointer does not seem to recognize the scheme (http) versus file protocol sometimes? My question is, has anybody got a reasonable work around for reading remote files from an http server (must be port 80 not ftp port 21) that does not require using any commands from the file sockets set (fopen, fsock...) OR... What am I missing here to get the fopen to work when fsockets are NOT ALLOWED. NOTE: Yahoo Web Hosting is my provider. They have not yet responded to my query regarding file sockets and their policies. I cannot change the PHP installation so I may be not be able to do XML at all. Any thoughts or comments would be greatly appreciated. Thanks, Bill http://www.zappersoftware.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir() makes dir, but with wrong owner
>i had a few problems with mkdir() ane uploading files using php. > >i have a simple script, which is making a dir. but everytime, it >makes a dir with totally wrong user. chown wont work. > >any expirience with this?? i have found some older posts >considering this, but no real answers. i think, the problem is >probably in httpd.conf (apche config file), but i am not sure. That's normal. PHP runs as the Apache user, so anything it creates will be owned by that user. Workaround is to use CGI mode or make the dir 777 so you can still access it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote from astring?
thx "Justin French" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D :[EMAIL PROTECTED] don't filter the quotes... escape them with add_slashes() justin on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > as title that I'm getting a trouble on filtering the single quote ' , since > there would be error when storing those string into MySQL, thus, i have to > find the appropriate method to solve it, anybody can help please? > thx a lot > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good program to indent large quantity of files?
Leif K-Brooks wrote: I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? phpedit.com (I believe) has a 'code beautifier' program which will take existing files and make them 'pretty' (indented, etc) Not sure if it can do things in batches or not, but still faster than doing things manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 20 Dec 2002 13:47:40 -0000 Issue 1774
php-general Digest 20 Dec 2002 13:47:40 - Issue 1774 Topics (messages 128931 through 128983): Re: Another problem with conditional statements 128931 by: Beauford.2002 128934 by: Sean Malloy 128936 by: Beauford.2002 128958 by: Jason Wong 128959 by: Jason Wong 128966 by: Ford, Mike [LSS] 128969 by: Ford, Mike [LSS] 128971 by: Ford, Mike [LSS] 128972 by: Ford, Mike [LSS] Re: Training Courses in PHP & MySQL 128932 by: Andrew Wilson 128939 by: michael kimsal 128940 by: Mike Hillyer 128941 by: michael kimsal Re: Problem with sessions. 128933 by: Philip Olson 128957 by: Jason Wong Re: Fatal error: Call to undefined function: allerrors() in 128935 by: Beauford.2002 128938 by: John W. Holmes Code still showing up :( 128937 by: Lic. Rodolfo Gonzalez Gonzalez syntax to reference $_POST within function 128942 by: Jamie 128945 by: Philip Olson Good program to indent large quantity of files? 128943 by: Leif K-Brooks 128944 by: Leif K-Brooks 128949 by: Justin French 128954 by: Leif K-Brooks 128983 by: michael kimsal URL path problems 128946 by: ªüYam 128947 by: Peter Houchin 128948 by: Wee Keat 128961 by: ªüYam Alternating Links 128950 by: conbud 128951 by: Philip Olson 128952 by: Justin French 128953 by: conbud Re: offline application 128955 by: Philippe Saladin PopUp Recall 128956 by: beno Problem with static call of method - class::method 128960 by: Mirek Novak 128962 by: Mirek Novak 128963 by: Mirek Novak Re: Error installing 128964 by: Jason Wong Re: PHP not working in html 128965 by: Dries Verachtert mkdir() makes dir, but with wrong owner 128967 by: Mirza Muharemagic 128981 by: John W. Holmes Re: Some discoveries I've made. Anyone care to confirm/deny 128968 by: Ford, Mike [LSS] Apache2 & PHP4 128970 by: Chase Urich 128979 by: Dries Verachtert upload_max_filesize + ini_set 128973 by: electroteque 128976 by: Ford, Mike [LSS] Is there any method to filter the single quote from a string? 128974 by: ªüYam 128975 by: Justin French 128982 by: ªüYam Re: How to upload a file 128977 by: Somesh Re: PHP not working in html] 128978 by: Dries Verachtert XML fopen($url) 128980 by: William Bradshaw Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- I believe you are incorrect. Switch will look for the first case statement that is true and execute that statement. The following works - case one is incorrect so it doesn't get executed but the second case does. Paste this into a test.php file and you will see it works.. Read the manual. $a=2; $b=4; switch (true) { case ($a < $b) and ($b > 5): echo "Incorrect"; case ($a == 2): echo "Correct"; } So my original question is still stands. The switch statement is correct, but there is a problem with my conditional statements. - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 7:33 PM Subject: Re: [PHP] Another problem with conditional statements > switch() does not work that way. Switch uses the value in the parentheses and selects a > CASE based upon that value. Read the manual. > > You will have to use a series of if()-elseif()-else() > - Original Message - > From: "Beauford.2002" <[EMAIL PROTECTED]> > To: "PHP General" <[EMAIL PROTECTED]> > Sent: Thursday, December 19, 2002 6:19 PM > Subject: [PHP] Another problem with conditional statements > > > Hi, > > This should be as simple as breathing, but not today. I have two variables > $a and $b which I need to compare in a switch statement in several different > ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and $b is equal to > 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stu
RE: [PHP] Re: mail()
I changed this and it works fine but I now lose my formating. It doesn't seem to recognize the \n breaks. Am I asking for to much? -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 8:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: mail() You need to set the correct header type: Content-type: text/html otherwise it defaults to: Content-type: text/plain Mike "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > I am using the following code but when I view the sent e-mail (in my yahoo > account) the link info is all plain text. I see the How do I create it as a link? I know I can send them because I have done it > before in my yahoo e-mail, just never through php and mail(). > > Thanks, > Eddie > > $mailcontent="Thank you for registering with AirCharterUnited \n" > ."Your Username is $uname and your password is $pword > \n" > ."Please click the following link to activate your > account \n" >." href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u > name'>Activate Account"; >mail($email,'Thanks',$mailcontent,"From: > aircharterunited.com"); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] login
Ok, Newbie Question. I know have a login and registration page on my website. What is the best way to check to see if the users have logged in before they access the other pages? SHould I add to each of the other url's ?clientid='' and if it is an empty string I know they haven't logged in? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] login
Do you mean loggged-in in the current browser session? If that, then cookies are good. If you mean EVER ogged in, then you'll want to look at a database, perhaps, mySQL. - Original Message - From: "Edward Peloke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:20 AM Subject: [PHP] login Ok, Newbie Question. I know have a login and registration page on my website. What is the best way to check to see if the users have logged in before they access the other pages? SHould I add to each of the other url's ?clientid='' and if it is an empty string I know they haven't logged in? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mail()
Actually, you don't need to send this as an html hyperlink. Simply using: http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$uname Should work; it does for me. - Original Message - From: "Edward Peloke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:18 AM Subject: RE: [PHP] Re: mail() I changed this and it works fine but I now lose my formating. It doesn't seem to recognize the \n breaks. Am I asking for to much? -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 8:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: mail() You need to set the correct header type: Content-type: text/html otherwise it defaults to: Content-type: text/plain Mike "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > I am using the following code but when I view the sent e-mail (in my yahoo > account) the link info is all plain text. I see the How do I create it as a link? I know I can send them because I have done it > before in my yahoo e-mail, just never through php and mail(). > > Thanks, > Eddie > > $mailcontent="Thank you for registering with AirCharterUnited \n" > ."Your Username is $uname and your password is $pword > \n" > ."Please click the following link to activate your > account \n" >." href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u > name'>Activate Account"; >mail($email,'Thanks',$mailcontent,"From: > aircharterunited.com"); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mail()
that should be: http://www.aircharterunited.com\pages\activate_account.php?clientid=$uname (Grrr...that's what I get for using copy/paste from original email) - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: "Edward Peloke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:04 AM Subject: Re: [PHP] Re: mail() Actually, you don't need to send this as an html hyperlink. Simply using: http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$uname Should work; it does for me. - Original Message - From: "Edward Peloke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:18 AM Subject: RE: [PHP] Re: mail() I changed this and it works fine but I now lose my formating. It doesn't seem to recognize the \n breaks. Am I asking for to much? -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 8:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: mail() You need to set the correct header type: Content-type: text/html otherwise it defaults to: Content-type: text/plain Mike "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > I am using the following code but when I view the sent e-mail (in my yahoo > account) the link info is all plain text. I see the How do I create it as a link? I know I can send them because I have done it > before in my yahoo e-mail, just never through php and mail(). > > Thanks, > Eddie > > $mailcontent="Thank you for registering with AirCharterUnited \n" > ."Your Username is $uname and your password is $pword > \n" > ."Please click the following link to activate your > account \n" >." href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u > name'>Activate Account"; >mail($email,'Thanks',$mailcontent,"From: > aircharterunited.com"); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] login
no, I mean logged into the current browser session. I have never used cookies so I will look into that in the php docs. Thanks, Eddie -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 9:00 AM To: Edward Peloke; [EMAIL PROTECTED] Subject: Re: [PHP] login Do you mean loggged-in in the current browser session? If that, then cookies are good. If you mean EVER ogged in, then you'll want to look at a database, perhaps, mySQL. - Original Message - From: "Edward Peloke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:20 AM Subject: [PHP] login Ok, Newbie Question. I know have a login and registration page on my website. What is the best way to check to see if the users have logged in before they access the other pages? SHould I add to each of the other url's ?clientid='' and if it is an empty string I know they haven't logged in? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: mail()
Can I still keep the formatting? When I added the Content-type: text/html to the header last night, the link worked but my formatting did not. Everything was just a long string. Thanks, Eddie -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 9:07 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: mail() that should be: http://www.aircharterunited.com\pages\activate_account.php?clientid=$uname (Grrr...that's what I get for using copy/paste from original email) - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: "Edward Peloke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:04 AM Subject: Re: [PHP] Re: mail() Actually, you don't need to send this as an html hyperlink. Simply using: http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$uname Should work; it does for me. - Original Message - From: "Edward Peloke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 8:18 AM Subject: RE: [PHP] Re: mail() I changed this and it works fine but I now lose my formating. It doesn't seem to recognize the \n breaks. Am I asking for to much? -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 8:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: mail() You need to set the correct header type: Content-type: text/html otherwise it defaults to: Content-type: text/plain Mike "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > I am using the following code but when I view the sent e-mail (in my yahoo > account) the link info is all plain text. I see the How do I create it as a link? I know I can send them because I have done it > before in my yahoo e-mail, just never through php and mail(). > > Thanks, > Eddie > > $mailcontent="Thank you for registering with AirCharterUnited \n" > ."Your Username is $uname and your password is $pword > \n" > ."Please click the following link to activate your > account \n" >." href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u > name'>Activate Account"; >mail($email,'Thanks',$mailcontent,"From: > aircharterunited.com"); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] libcrypt.a and solaris 8
hello, i'm trying to compile php with openssl and ldap. i can't i keep getting an error. i surfed the web and found a reference that the library libcrypt.a in openssl is not compatable with that in solaris 8. is this true? --dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mail()
Hi, if you use plain text use "\n", elseif you use text/html use "" (and all the other html-tags) HTH, Bastian Edward Peloke schrieb: > Can I still keep the formatting? When I added the Content-type: text/html > to the header last night, the link worked but my formatting did not. > Everything was just a long string. > > Thanks, > Eddie > > -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 9:07 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Re: mail() > > that should be: > http://www.aircharterunited.com\pages\activate_account.php?clientid=$uname > > (Grrr...that's what I get for using copy/paste from original email) > > - Original Message - > From: "Rick Emery" <[EMAIL PROTECTED]> > To: "Edward Peloke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, December 20, 2002 8:04 AM > Subject: Re: [PHP] Re: mail() > > Actually, you don't need to send this as an html hyperlink. Simply > using: > http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$uname > > Should work; it does for me. > > - Original Message - > From: "Edward Peloke" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, December 20, 2002 8:18 AM > Subject: RE: [PHP] Re: mail() > > I changed this and it works fine but I now lose my formating. It doesn't > seem to recognize the \n breaks. Am I asking for to much? > > -Original Message- > From: Mike Mannakee [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 19, 2002 8:51 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: mail() > > You need to set the correct header type: > > Content-type: text/html > > otherwise it defaults to: > > Content-type: text/plain > > Mike > > "Edward Peloke" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello all, > > > > I am using the following code but when I view the sent e-mail (in my yahoo > > account) the link info is all plain text. I see the everything. > > How do I create it as a link? I know I can send them because I have done > it > > before in my yahoo e-mail, just never through php and mail(). > > > > Thanks, > > Eddie > > > > $mailcontent="Thank you for registering with AirCharterUnited \n" > > ."Your Username is $uname and your password is $pword > > \n" > > ."Please click the following link to activate your > > account \n" > >." > > href='http:\\www.aircharterunited.com\pages\activate_account.php?clientid=$u > > name'>Activate Account"; > >mail($email,'Thanks',$mailcontent,"From: > > aircharterunited.com"); > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER["PATH_TRANSLATED"] returns empty string
On Wed, 18 Dec 2002, Chris Hewitt wrote: > Robert Nedbal wrote: > >So should I try to use apache 1.x instead of apache2? > > > Pass on that, I have no experience of Apache 2, but I do not think it is > intended for production yet. Looking at phpinfo() on my computer here > (GNU/Linux RedHat 7.3 PHP 4.1.2 and Apache 1.3.23) in the "PHP > Variables" at the bottom shows "_SERVER["PATH_TRANSLATED"} as having the > value "/var/www/html/phpinfo.php", which is correct. If you do not get a > value by looking at phpinfo() then I suggest there must be some sort of > bug. You could try searching the bug list, otherwise maybe going back to > Apache 1.3.x is a good idea. > I tried Apache 1.3.x and it works. I tested phpinfo() on both systems and there are results: _SERVER["PATH_TRANSLATED"] Apache 1.3.27 + php-4.2.3: correct value Apache 2.0.40 + php-4.2.2: empty string (not even shown by phpinfo()) I think that there is not big difference between php-4.2.2 and php-4.2.3, at least in release notes for php-4.2.3 was nothing about _SERVER variables. Should I add record about this to http://bugs.php.net/ ? > Hope this helps. Yes, thank you very much. Best regards, Robert > > Chris > > -- Robert Nedbal - Czech Technical University in Prague, Czech Republic email: [EMAIL PROTECTED] http://www.sh.cvut.cz/~robik/ /* Debuggers are evil. Never ever trust them. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to upload a file
And if you select a small file it works fine right? -Original Message- From: Somesh [mailto:[EMAIL PROTECTED]] Sent: 20 December 2002 12:29 To: Rich Gray Cc: [EMAIL PROTECTED] Subject: RE: [PHP] How to upload a file post_max_size 8M upload_tmp_dir It fails immediately after clicking the submit button. [thanx for ur concern] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] login
On Friday 20 December 2002 22:20, Edward Peloke wrote: > Ok, > Newbie Question. > I know have a login and registration page on my website. What is the best > way to check to see if the users have logged in before they access the > other pages? SHould I add to each of the other url's ?clientid='' and if > it is an empty string I know they haven't logged in? Use sessions. After you've validated their username and password, set a session variable to show that they're logged in. Storing the login status in the URL is an extremely bad idea. What's to stop people who haven't logged in from adding/setting their own clientid? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I got vision, and the rest of the world wears bifocals. -- Butch Cassidy */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with static call of method - class::method
From what I know about OOP, $this should be undefined if the method call is static. Mirek Novak wrote: Hi everybody, I've problem deciding whether is method call static or dynamic. How can I find it? mirek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER["PATH_TRANSLATED"] returns empty string
Is $_SERVER["SCRIPT_FILENAME"] the information you need? (on apache 2.0, php 4.2.2) Kind regards, Dries Verachtert On Fri, 2002-12-20 at 15:40, Robert Nedbal wrote: > On Wed, 18 Dec 2002, Chris Hewitt wrote: > > Robert Nedbal wrote: > > >So should I try to use apache 1.x instead of apache2? > > > > > Pass on that, I have no experience of Apache 2, but I do not think it is > > intended for production yet. Looking at phpinfo() on my computer here > > (GNU/Linux RedHat 7.3 PHP 4.1.2 and Apache 1.3.23) in the "PHP > > Variables" at the bottom shows "_SERVER["PATH_TRANSLATED"} as having the > > value "/var/www/html/phpinfo.php", which is correct. If you do not get a > > value by looking at phpinfo() then I suggest there must be some sort of > > bug. You could try searching the bug list, otherwise maybe going back to > > Apache 1.3.x is a good idea. > > > > I tried Apache 1.3.x and it works. I tested phpinfo() on both systems and > there are results: > _SERVER["PATH_TRANSLATED"] > Apache 1.3.27 + php-4.2.3: correct value > Apache 2.0.40 + php-4.2.2: empty string (not even shown by phpinfo()) > > I think that there is not big difference between php-4.2.2 and php-4.2.3, > at least in release notes for php-4.2.3 was nothing about _SERVER > variables. > > Should I add record about this to http://bugs.php.net/ ? > > > Hope this helps. > > Yes, thank you very much. > > Best regards, > Robert > > > > > Chris > > > > > > -- > > Robert Nedbal - Czech Technical University in Prague, Czech Republic > email: [EMAIL PROTECTED] http://www.sh.cvut.cz/~robik/ > /* Debuggers are evil. Never ever trust them. */ > > > > -- > 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] Re: Creating reports in database systems implemented over Web interface
Make use of fpdf - a good dpf creation lib.. type it into google for the site. "Enediel" <[EMAIL PROTECTED]> wrote in message 076a01c2a51c$9c47be50$8a24a8c0@nsoft">news:076a01c2a51c$9c47be50$8a24a8c0@nsoft... > Hi everybody: > > Over linux, I'm using PostgreSQL , Apache server, and PHP pages to create a > database systems with web interface. > > I need to know how programmers have solved the problem about printing high > quality reports using the databases information. > > Thanks in advance > Enediel > > Happy who can penetrate the secret causes of the things > ¡Use Linux! > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.427 / Virus Database: 240 - Release Date: 07/12/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax to reference $_POST within function
Thanks for the vote of confidence. I ended up getting it working with this: import_request_variables('p', 'p_'); function check_banlist($banlist, $p_email) { This is what I had been trying to accomplish but was writing it this way: function check_banlist($banlist, $_POST['email']) { Maybe you could also point me to the lesson that needs to be learned here. Is it that it is an array? or syntax? Thanks for the assistance! Jamie Sullivan Philip Olson wrote: First, read this: http://www.php.net/variables.external Second, assuming you have a PHP version equal to or greater than 4.1.0 and the method of the form is POST, you'd do something like this: $banlist = array('[EMAIL PROTECTED]'); echo check_banlist($banlist, $_POST['email']); Your question sounds like you're wondering if the function definition should change, it doesn't. You leave it as $email and use $email within the function. This is just how functions work, you pass in values. So: function foo ($email) { print $email; } foo($_POST['email']); // Or as you used to do with register_globals foo($email); Or you could always just do: function bar () { print $_POST['email']; } bar(); This is why they are SUPERglobals, because this is what you would have done in the past (old school): function baz () { global $email, $HTTP_POST_VARS; print $email; print $HTTP_POST_VARS['email']; } Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP 3, so just in case that might be important to you too. It is not super. Now if you don't care if 'email' comes from GET, POST, or COOKIE ... you could use $_REQUEST['email']. Or, import_request_variables() is another option. For example: import_request_variables('p', 'p_'); print $p_email; See the manual for details, and have fun! It really isn't that complicated and you'll be yelling out Eureka! pretty soon now. Regards, Philip Olson P.s. Superglobals work with register_globals on or off. On Thu, 19 Dec 2002, Jamie wrote: I am attempting to modify an old script to support the superglobal $_POST with register_globals=Off. These register globals are definately challenging when you are new to php and every example shown anywhere uses the old method but I guess what doesn't kill you only makes you stronger. I am trying to convert this line, $email is coming from an html form so I would typically call it with $_POST['email'] but this doesn't work in this case and I thus far haven't been able to find anything that explains what I should be doing. function check_banlist($banlist, $email) { Any assistance is appreciated! Thanks, Jamie -- 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] Problem with functions
Hi, I keep getting errors in my script that says 'x' function is undefined or 'y' function is undefined. I defined it as 'function test ($a, $b)' and call it using 'test($a, $b)' From my knowledge this is correct, but it just simply doesn't work. Anyone have any ideas on this? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions
Please show a bit more of the actual code - Original Message - From: "Beauford.2002" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 9:55 AM Subject: [PHP] Problem with functions Hi, I keep getting errors in my script that says 'x' function is undefined or 'y' function is undefined. I defined it as 'function test ($a, $b)' and call it using 'test($a, $b)' From my knowledge this is correct, but it just simply doesn't work. Anyone have any ideas on this? TIA -- 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] Problem with functions
Hi, > I keep getting errors in my script that says 'x' function > is undefined or 'y' function is undefined. I defined it as > 'function test ($a, $b)' and call it using 'test($a, $b)' You need to post code :-) Try this: "; echo "a is $a"; echo "b is $b"; } test(1, 2); ?> Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir() makes dir, but with wrong owner
Another option is to use ftp functions. John W. Holmes wrote: i had a few problems with mkdir() ane uploading files using php. i have a simple script, which is making a dir. but everytime, it makes a dir with totally wrong user. chown wont work. any expirience with this?? i have found some older posts considering this, but no real answers. i think, the problem is probably in httpd.conf (apche config file), but i am not sure. That's normal. PHP runs as the Apache user, so anything it creates will be owned by that user. Workaround is to use CGI mode or make the dir 777 so you can still access it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pb installaling gd extension on a win32 server
Hello, I have migrate my site from a linux to a win32 server :-{ I need to use the php_gd.dll library but my pb is that I've downloaded the php installer from php.net with no external extensions included. So, I have downloaded the php_gd.dll, put it into a directory (d:\php\extension) I have created, I have modified the extention_dir param in php.ini, but I always have a windows message box: "Unable to load dynamic library" Please help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax to reference $_POST within function
You don't need to import the request variables for that to work. The variable names in the function definition have no relationship to variables outside of it. Most likely, you're calling with something like: check_banlist($banlist,$p_email); but you could also call it with: check_banlist($variable_with_a_totally_different_name,$another_oddly_named_variable); or call it with check_banlist('some string','another string'); or even call it with check_banlist($banlist,$_POST['email']); so importing the request variables is pointless. What you call the variables inside the function doesn't have anything to do with whether there is a global variable with the same name! Jamie wrote: Thanks for the vote of confidence. I ended up getting it working with this: import_request_variables('p', 'p_'); function check_banlist($banlist, $p_email) { This is what I had been trying to accomplish but was writing it this way: function check_banlist($banlist, $_POST['email']) { Maybe you could also point me to the lesson that needs to be learned here. Is it that it is an array? or syntax? Thanks for the assistance! Jamie Sullivan Philip Olson wrote: First, read this: http://www.php.net/variables.external Second, assuming you have a PHP version equal to or greater than 4.1.0 and the method of the form is POST, you'd do something like this: $banlist = array('[EMAIL PROTECTED]'); echo check_banlist($banlist, $_POST['email']); Your question sounds like you're wondering if the function definition should change, it doesn't. You leave it as $email and use $email within the function. This is just how functions work, you pass in values. So: function foo ($email) { print $email; } foo($_POST['email']); // Or as you used to do with register_globals foo($email); Or you could always just do: function bar () { print $_POST['email']; } bar(); This is why they are SUPERglobals, because this is what you would have done in the past (old school): function baz () { global $email, $HTTP_POST_VARS; print $email; print $HTTP_POST_VARS['email']; } Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP 3, so just in case that might be important to you too. It is not super. Now if you don't care if 'email' comes from GET, POST, or COOKIE ... you could use $_REQUEST['email']. Or, import_request_variables() is another option. For example: import_request_variables('p', 'p_'); print $p_email; See the manual for details, and have fun! It really isn't that complicated and you'll be yelling out Eureka! pretty soon now. Regards, Philip Olson P.s. Superglobals work with register_globals on or off. On Thu, 19 Dec 2002, Jamie wrote: I am attempting to modify an old script to support the superglobal $_POST with register_globals=Off. These register globals are definately challenging when you are new to php and every example shown anywhere uses the old method but I guess what doesn't kill you only makes you stronger. I am trying to convert this line, $email is coming from an html form so I would typically call it with $_POST['email'] but this doesn't work in this case and I thus far haven't been able to find anything that explains what I should be doing. function check_banlist($banlist, $email) { Any assistance is appreciated! Thanks, Jamie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax to reference $_POST within function
This is a very important point to understand, I tried (and failed) to explain it. I think Leif made it pretty clear though, here's another :) // $a can be anything when you call the function function bar ($a) { print $a; } bar ('Hello World'); bar ($_POST['something']); Regards, Philip Olson On Fri, 20 Dec 2002, Leif K-Brooks wrote: > You don't need to import the request variables for that to work. The > variable names in the function definition have no relationship to > variables outside of it. Most likely, you're calling with something like: > check_banlist($banlist,$p_email); > but you could also call it with: > check_banlist($variable_with_a_totally_different_name,$another_oddly_named_variable); > or call it with > check_banlist('some string','another string'); > or even call it with > check_banlist($banlist,$_POST['email']); > so importing the request variables is pointless. What you call the > variables inside the function doesn't have anything to do with whether > there is a global variable with the same name! > > Jamie wrote: > > > Thanks for the vote of confidence. I ended up getting it working with > > this: > > > > import_request_variables('p', 'p_'); > > function check_banlist($banlist, $p_email) { > > > > This is what I had been trying to accomplish but was writing it this way: > > > > function check_banlist($banlist, $_POST['email']) { > > > > Maybe you could also point me to the lesson that needs to be learned > > here. Is it that it is an array? or syntax? > > > > Thanks for the assistance! > > > > Jamie Sullivan > > > > Philip Olson wrote: > > > >> First, read this: > >> > >> http://www.php.net/variables.external > >> > >> Second, assuming you have a PHP version equal to > >> or greater than 4.1.0 and the method of the form > >> is POST, you'd do something like this: > >> > >> $banlist = array('[EMAIL PROTECTED]'); > >> echo check_banlist($banlist, $_POST['email']); > >> > >> Your question sounds like you're wondering if the > >> function definition should change, it doesn't. You > >> leave it as $email and use $email within the function. > >> This is just how functions work, you pass in values. > >> So: > >> > >> function foo ($email) { > >> print $email; > >> } > >> > >> foo($_POST['email']); > >> > >> // Or as you used to do with register_globals > >> foo($email); > >> > >> Or you could always just do: > >> > >> function bar () { > >> print $_POST['email']; > >> } > >> > >> bar(); > >> > >> This is why they are SUPERglobals, because this is > >> what you would have done in the past (old school): > >> > >> function baz () { > >> global $email, $HTTP_POST_VARS; > >> > >> print $email; > >> > >> print $HTTP_POST_VARS['email']; > >> } > >> > >> Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP > >> 3, so just in case that might be important to you too. It is not super. > >> > >> Now if you don't care if 'email' comes from GET, POST, > >> or COOKIE ... you could use $_REQUEST['email']. Or, > >> import_request_variables() is another option. For > >> example: > >> > >> import_request_variables('p', 'p_'); > >> > >> print $p_email; > >> > >> See the manual for details, and have fun! It really > >> isn't that complicated and you'll be yelling out > >> Eureka! pretty soon now. > >> > >> Regards, > >> Philip Olson > >> > >> P.s. Superglobals work with register_globals on or off. > >> > >> > >> On Thu, 19 Dec 2002, Jamie wrote: > >> > >> > >>> I am attempting to modify an old script to support the superglobal > >>> $_POST with register_globals=Off. These register globals are > >>> definately challenging when you are new to php and every example > >>> shown anywhere uses the old method but I guess what doesn't kill you > >>> only makes you stronger. > >>> > >>> I am trying to convert this line, $email is coming from an html form > >>> so I would typically call it with $_POST['email'] but this doesn't > >>> work in this case and I thus far haven't been able to find anything > >>> that explains what I should be doing. > >>> > >>> function check_banlist($banlist, $email) { > >>> > >>> Any assistance is appreciated! Thanks, > >>> > >>> Jamie > >>> > >>> > >>> -- > >>> PHP General Mailing List (http://www.php.net/) > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >> > >> > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt >to decrypt it will be prosecuted to the full extent of the law. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Good program to indent large quantity of files?
Thanks, but it inserts two line breaks where there should be one, and puts spaces in my html tags so they don't work. Any other ideas? :( michael kimsal wrote: Leif K-Brooks wrote: I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? phpedit.com (I believe) has a 'code beautifier' program which will take existing files and make them 'pretty' (indented, etc) Not sure if it can do things in batches or not, but still faster than doing things manually. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Equivalent to mysqldump in PHP
Is there a function that can be implemented with PHP to do the equivalent of a mysqldump? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strings and default values...
Dear List, This is a simple problem, but I can't really find a good solution. and I have a general question also. 1) I have a webform that is save to a variable $html using heredoc. $html = <<< WEBFORM . . the problem is that when you enter an apostrophe, and then repost the page with the stored values, the apostrophe appears escaped in the edit form. how can I solve this? 2) is it possible to put additional ('nested') php inside a heredoc, or will that text simply print out? Thank you, Steven Kallstrom
Re: [PHP] Strings and default values...
1) You most likely have magic_quotes_gpc set to on. Either set it to off or stripslashes() the input. 2) No, it won't print. Think of a heredoc as a quotes string without the quotes. You can, however, do something like: $variable = <<< WHATEVER whatever text goes here WHATEVER; $variable.= executesomephp(); $variable = <<< WHATEVER whatever other text goes here WHATEVER; Steven Kallstrom wrote: Dear List, This is a simple problem, but I can't really find a good solution. and I have a general question also. 1) I have a webform that is save to a variable $html using heredoc. $html = <<< WEBFORM . . the problem is that when you enter an apostrophe, and then repost the page with the stored values, the apostrophe appears escaped in the edit form. how can I solve this? 2) is it possible to put additional ('nested') php inside a heredoc, or will that text simply print out? Thank you, Steven Kallstrom -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions
Jon, You may have answered my question, but I'm still confused. I see from your example that the actual function comes before the function is called in the script, and when I changed mine to that format it worked. Now the confusion. I have another script which is the opposite of your example, and works fine. So why would one work one way but not the other. I have included the exact format I have for the one that doesn't work, and below that the actual code of the one that does work. In most languages I have used, this is the correct format - it makes for easier reading. - Original Message - From: "Jon Haworth" <[EMAIL PROTECTED]> To: "'Beauford.2002'" <[EMAIL PROTECTED]>; "PHP General" <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 11:05 AM Subject: RE: [PHP] Problem with functions > Hi, > > > I keep getting errors in my script that says 'x' function > > is undefined or 'y' function is undefined. I defined it as > > 'function test ($a, $b)' and call it using 'test($a, $b)' > > You need to post code :-) > > Try this: > > > function test ($a, $b) > { > echo "I am the test function"; > echo "a is $a"; > echo "b is $b"; > } > > test(1, 2); > > ?> > > Cheers > Jon > > -- > 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] upload_max_filesize + ini_set
here is a sample htaccess file with ini rules php_value register_globals Off php_value track_vars On php_value arg_separator.output "&" php_value arg_separator.input "&" php_value upload_max_filesize "3M" i get 3M returned as the upload_max_filesize so it does work "Mike Ford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > -Original Message- > > From: electroteque [mailto:[EMAIL PROTECTED]] > > Sent: 20 December 2002 11:35 > > To: [EMAIL PROTECTED] > > Subject: [PHP] upload_max_filesize + ini_set > > > > > > is there a way to get this setting to work without hard > > setting in htaccess > > ? i'd like to be able to dynamically set the max filesize via > > a defines > > setting and ini_set rather than statically in htaccess > > No can do -- as all file upload activity takes place before your script even > starts executing, you can't use ini_set on this. > > In fact, upload_max_filesize is listed in > http://www.php.net/manual/en/function.ini-set.php as being a PHP_INI_SYSTEM > level directive, which means it can be set only in php.ini or httpd.conf (if > using Apache) -- it's not even settable in .htaccess files. > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload_max_filesize + ini_set
and i just tested the script and it let me upload a 2.5M file. so there must be a way to put it in the page aswell "Mike Ford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > -Original Message- > > From: electroteque [mailto:[EMAIL PROTECTED]] > > Sent: 20 December 2002 11:35 > > To: [EMAIL PROTECTED] > > Subject: [PHP] upload_max_filesize + ini_set > > > > > > is there a way to get this setting to work without hard > > setting in htaccess > > ? i'd like to be able to dynamically set the max filesize via > > a defines > > setting and ini_set rather than statically in htaccess > > No can do -- as all file upload activity takes place before your script even > starts executing, you can't use ini_set on this. > > In fact, upload_max_filesize is listed in > http://www.php.net/manual/en/function.ini-set.php as being a PHP_INI_SYSTEM > level directive, which means it can be set only in php.ini or httpd.conf (if > using Apache) -- it's not even settable in .htaccess files. > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Win32 php : MS Access support (odbc support)
Why not connect to MDB via ODBC? "Robert Mena" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I will have to retrieve data stored in a MDB (MS > Access) "database". > > Since this MDB file be hosted in a Windows machine I'd > like to have a CGI version of PHP with ODBC support so > I can retrieve the data locally and send to a remote > mysql database automatically. > > Since I've never used the CGI version to MDB any > tips/caveats will be appreciated. > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Resource limit/performance questions
I'm working on a php/mysql ap, which looks as though it will be dealing with an average of 160,000 rows of short text entries = 32 megs of drives space Anybody have ideas about what if any limits I might hit? And how I might be able to determine any limits at this point when we have only 2 weeks (.6 megs and 2600 rows) of what will be 2 years of data? I have full access to my linux server. I notice that when executing one set of statements for one page, it is now using in the 80 to 90% range of CPU states, and works for maybe 3 or 4 seconds to return the querys. I am at present doing this testing on a 550 mhz processor, but will be running the ap on a dual 500s. Am I getting totally out of hand in thinking I can do this? TIA -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
IMHO it depends on the amount of operations you have to perform on your rows. If manipulating 2,600 rows takes several seconds, then either you're performing some really complicated data manipulation or your db could use some optimization. I have an application that manipulates ~150,000 rows on a Pentium II 350 MHz and that takes at most half a second (although I'm doing really simple statistical stuff). Cheers, Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! --- Begin Message --- I'm working on a php/mysql ap, which looks as though it will be dealing with an average of 160,000 rows of short text entries = 32 megs of drives space Anybody have ideas about what if any limits I might hit? And how I might be able to determine any limits at this point when we have only 2 weeks (.6 megs and 2600 rows) of what will be 2 years of data? I have full access to my linux server. I notice that when executing one set of statements for one page, it is now using in the 80 to 90% range of CPU states, and works for maybe 3 or 4 seconds to return the querys. I am at present doing this testing on a 550 mhz processor, but will be running the ap on a dual 500s. Am I getting totally out of hand in thinking I can do this? TIA -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
In one main instance, I'm doing 10 querys on an array of 26 unique objects extracted from the database. So, I suppose it is running 260 queries on 2600 lines of code. Marco Tabini wrote: > > IMHO it depends on the amount of operations you have to perform on your > rows. If manipulating 2,600 rows takes several seconds, then either > you're performing some really complicated data manipulation or your db > could use some optimization. I have an application that manipulates > ~150,000 rows on a Pentium II 350 MHz and that takes at most half a > second (although I'm doing really simple statistical stuff). > > Cheers, > > Marco > -- > > php|architect - The Magazine for PHP Professionals > The monthly magazine dedicated to the world of PHP programming > > Check us out on the web at http://www.phparch.com! > > > > Subject: [PHP] Resource limit/performance questions > Date: Fri, 20 Dec 2002 15:31:58 -0500 > From: John Hinton <[EMAIL PROTECTED]> > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > I'm working on a php/mysql ap, which looks as though it will be dealing > with an average of > > 160,000 rows of short text entries = > 32 megs of drives space > > Anybody have ideas about what if any limits I might hit? And how I might > be able to determine any limits at this point when we have only 2 weeks > (.6 megs and 2600 rows) of what will be 2 years of data? I have full > access to my linux server. I notice that when executing one set of > statements for one page, it is now using in the 80 to 90% range of CPU > states, and works for maybe 3 or 4 seconds to return the querys. I am at > present doing this testing on a 550 mhz processor, but will be running > the ap on a dual 500s. > > Am I getting totally out of hand in thinking I can do this? > > TIA > -- > John Hinton - Goshen, VA. > http://www.ew3d.com > > Those who dance are considered insane > by those who can't hear the music > > -- > 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 -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['DOCUMENT_ROOT'] on localhost
On Wed, 18 Dec 2002 15:47:44 -0600, Joseph W. Goff <[EMAIL PROTECTED]> wrote: Is there a difference between PHP versions on your machine and your site? Have you looked at phpinfo() to see what variables have been set on your system? - Original Message - From: "rolf vreijdenberger" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 18, 2002 3:38 PM Subject: [PHP] $_SERVER['DOCUMENT_ROOT'] on localhost hey there, I include files outside the document root in my site. include $_SERVER['DOCUMENT_ROOT']."../inc.php" ; when I use this on the localhost it doesn't find this variable: $_SERVER['DOCUMENT_ROOT'] which makes testing more annoying since I have to upload to my site all the time. any ideas on the how and why??? thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I run a fairly recent PHP version (4.2+) on my personal machine (IIS on Win2k pro), and it doesn't return a fair number of $_SERVER variables. I just figured it was an IIS issue and worked around it. -- sasha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD 2.0 Souce tar ball ?
Hi guys, does any one have latest GD 2.0 source tarball and care to share ? seems like the url http://www.boutell.com/gd is down Regards -R'twick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with sessions.
On Thu, 19 Dec 2002 16:43:10 -0700, Mike Hillyer <[EMAIL PROTECTED]> wrote: Hello All; Please forgive me if I am repeating an often asked question, but I am having a problem with sessions. I simply cannot get them to work. The sample code I provide works on another server perfectly, this is the first page: session_start(); session_register("name","pass"); $name = "hilde"; $pass = "mypassword"; echo "Session variables set!"; echo "go to next page"; ?> When called, the following file arrives in /tmp: sess_f9c5e87b35ae66eac64a9a346321b269 name|s:5:"hilde";pass|s:10:"mypassword"; So obviously the session file is being created. However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269 Which has this code: session_start(); echo "The password of $name is $pass "; ?> I get "The Password of is " As a response. Both pages work perfectly on another server, so I am having trouble finding the problem, especially since the session file is actually created in /tmp My PHP.ini file is standard to a RedHat RPM install, but I will include it as an attachment. Any help would be greatly appreciated! Mike Hillyer Sounds like one server has registered globals on, and the other doesn't. Try changing your print statement like this: print 'The password of ' . $_SESSION['name'] is ' . $_SESSION['pass'] . ''; If you were displaying all errors and *warnings* (error_reporting (E_ALL)), it would have caught something like this. -- sasha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
Well, then, assuming your complexity grows linearly, I guess you'll have to wait a few minutes with 160,000 rows on which you can expect to perform 16,000 queries... You mention that you perform the queries on objects--can you elaborate on this point? Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! --- Begin Message --- In one main instance, I'm doing 10 querys on an array of 26 unique objects extracted from the database. So, I suppose it is running 260 queries on 2600 lines of code. Marco Tabini wrote: > > IMHO it depends on the amount of operations you have to perform on your > rows. If manipulating 2,600 rows takes several seconds, then either > you're performing some really complicated data manipulation or your db > could use some optimization. I have an application that manipulates > ~150,000 rows on a Pentium II 350 MHz and that takes at most half a > second (although I'm doing really simple statistical stuff). > > Cheers, > > Marco > -- > > php|architect - The Magazine for PHP Professionals > The monthly magazine dedicated to the world of PHP programming > > Check us out on the web at http://www.phparch.com! > > > > Subject: [PHP] Resource limit/performance questions > Date: Fri, 20 Dec 2002 15:31:58 -0500 > From: John Hinton <[EMAIL PROTECTED]> > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > I'm working on a php/mysql ap, which looks as though it will be dealing > with an average of > > 160,000 rows of short text entries = > 32 megs of drives space > > Anybody have ideas about what if any limits I might hit? And how I might > be able to determine any limits at this point when we have only 2 weeks > (.6 megs and 2600 rows) of what will be 2 years of data? I have full > access to my linux server. I notice that when executing one set of > statements for one page, it is now using in the 80 to 90% range of CPU > states, and works for maybe 3 or 4 seconds to return the querys. I am at > present doing this testing on a 550 mhz processor, but will be running > the ap on a dual 500s. > > Am I getting totally out of hand in thinking I can do this? > > TIA > -- > John Hinton - Goshen, VA. > http://www.ew3d.com > > Those who dance are considered insane > by those who can't hear the music > > -- > 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 -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions
On Saturday 21 December 2002 03:27, Beauford.2002 wrote: > Jon, > > You may have answered my question, but I'm still confused. I see from your > example that the actual function comes before the function is called in the > script, and when I changed mine to that format it worked. > > Now the confusion. I have another script which is the opposite of your > example, and works fine. So why would one work one way but not the other. I > have included the exact format I have for the one that doesn't work, and > below that the actual code of the one that does work. In most languages I > have used, this is the correct format - it makes for easier reading. PHP looks at the whole file before doing anything. So it doesn't matter where in the code you define your function. I usually put all my functions at the end so they don't get in the way of the main loop. You must have some other problem. Crank up the error reporting and look at the error log. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It's clever, but is it art? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Web-page audio recorder/player combination
Hi All, I posted a preliminary PHP example of how to use a Web-page audio recorder/player combination I developed. User's recordings are saved on, and played from, your server. http://www.freedomaudio.com/examples/recorder102/index.html Naturally, I would appreciate good feedback. Happy Holidays from Canada! Kendal http://www.freedomaudio.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cookies
I am setting a cookie with this code: 0){ $myrow2 = mysql_fetch_array($result2); $clientid=$myrow2["id"]; $fname=$myrow2["fname"]; $cookievalue=md5($uname.$password); setcookie("aircharteruser",$cookievalue,time()+1800,"/"); } } ?> and then checking in my other pages to see if it is set here.. The only problem is once the cookie is set, it never seems to go away. This one should have expired in 30 minutes right? I can still go in and get to the other pages without it telling me to log in. What did I do wrong? Thanks! Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
I was wondering if this would grow linearly... as the data collects? So, if it takes 3 seconds to do 2600 rows, will it take 30 seconds to do 26000 rows? I am using a simple for statement to send the 26 records through the 10 querys. A typical select is: SELECT DISTINCT DATE_FORMAT(date, '%Y%m%d'), field2 FROM $table WHERE field2 NOT LIKE '$anoption' AND field3 LIKE '$field2[$i]' AND TO_DAYS(NOW()) - TO_DAYS(date) <= 30"; This select is run over with five different date <= numbers... then done without the DISTINCT again over the same five time periods. The array of records being sent through the 10 querys should not grow too very large (26 in fact is a fairly high representation of what would be average), whereas the number of records will grow at a fairly predictable rate, with the same basic number of records added each day. I should have said records, instead of objects. (too many sessions with crAccess, too little time talking to real people about databases) Now... would you spell that querys or queries? Marco Tabini wrote: > > Well, then, assuming your complexity grows linearly, I guess you'll have > to wait a few minutes with 160,000 rows on which you can expect to > perform 16,000 queries... > > You mention that you perform the queries on objects--can you elaborate > on this point? > > Marco > -- > > php|architect - The Magazine for PHP Professionals > The monthly magazine dedicated to the world of PHP programming > > Check us out on the web at http://www.phparch.com! > > > > Subject: Re: [PHP] Resource limit/performance questions > Date: Fri, 20 Dec 2002 15:47:07 -0500 > From: John Hinton <[EMAIL PROTECTED]> > To: Marco Tabini <[EMAIL PROTECTED]> > CC: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > References: <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> > > In one main instance, I'm doing 10 querys on an array of 26 unique > objects extracted from the database. So, I suppose it is running 260 > queries on 2600 lines of code. > > Marco Tabini wrote: > > > > IMHO it depends on the amount of operations you have to perform on your > > rows. If manipulating 2,600 rows takes several seconds, then either > > you're performing some really complicated data manipulation or your db > > could use some optimization. I have an application that manipulates > > ~150,000 rows on a Pentium II 350 MHz and that takes at most half a > > second (although I'm doing really simple statistical stuff). > > > > Cheers, > > > > Marco > > -- > > > > php|architect - The Magazine for PHP Professionals > > The monthly magazine dedicated to the world of PHP programming > > > > Check us out on the web at http://www.phparch.com! > > > > > > > > Subject: [PHP] Resource limit/performance questions > > Date: Fri, 20 Dec 2002 15:31:58 -0500 > > From: John Hinton <[EMAIL PROTECTED]> > > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > I'm working on a php/mysql ap, which looks as though it will be dealing > > with an average of > > > > 160,000 rows of short text entries = > > 32 megs of drives space > > > > Anybody have ideas about what if any limits I might hit? And how I might > > be able to determine any limits at this point when we have only 2 weeks > > (.6 megs and 2600 rows) of what will be 2 years of data? I have full > > access to my linux server. I notice that when executing one set of > > statements for one page, it is now using in the 80 to 90% range of CPU > > states, and works for maybe 3 or 4 seconds to return the querys. I am at > > present doing this testing on a 550 mhz processor, but will be running > > the ap on a dual 500s. > > > > Am I getting totally out of hand in thinking I can do this? > > > > TIA > > -- > > John Hinton - Goshen, VA. > > http://www.ew3d.com > > > > Those who dance are considered insane > > by those who can't hear the music > > > > -- > > 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 > > -- > John Hinton - Goshen, VA. > http://www.ew3d.com > > Those who dance are considered insane > by those who can't hear the music > > -- > 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 -- John Hinton - Goshen, VA. http://www.ew3d.com Those who dance are considered insane by those who can't hear the music -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error installing
If you are trying to load a PHP-Nuke site, your problem is that the page can't access your mysql server. Either the server is not running, or the hostname/username/password is not correct so the program is unable to successfully connect to the mysql server. ..michael.. On Fri, 2002-12-20 at 01:08, Jason Wong wrote: > On Thursday 19 December 2002 23:48, Mako Shark wrote: > > Anybody have any bright ideas? > > > > Trying to install my own PHP on my own server. I'm > > getting the error "Redirection limit for this URL > > exceeded. Unable to load the requested page." > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Resource limit/performance questions
Well, the execution time depends on a number of factors. If your tables are indexed properly and you take advantage of the indexes, then the growth in execution time is not linear (I'm guessing the indexes are maintained through balanced or semi-balanced trees or a similar method). However, in your case, it's not the execution time but the number of executions. Even under the best of circumstances, if the number of queries increases in relation to the number of records, then you will notice a proportional slowdown. If the queries do not use your indexes, then the slowdown will probably be geometric, since the SQL engine will have to spend more time sorting through the records for each query. I usually say queries... it's worked so far :-) Marco -- php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com! --- Begin Message --- I was wondering if this would grow linearly... as the data collects? So, if it takes 3 seconds to do 2600 rows, will it take 30 seconds to do 26000 rows? I am using a simple for statement to send the 26 records through the 10 querys. A typical select is: SELECT DISTINCT DATE_FORMAT(date, '%Y%m%d'), field2 FROM $table WHERE field2 NOT LIKE '$anoption' AND field3 LIKE '$field2[$i]' AND TO_DAYS(NOW()) - TO_DAYS(date) <= 30"; This select is run over with five different date <= numbers... then done without the DISTINCT again over the same five time periods. The array of records being sent through the 10 querys should not grow too very large (26 in fact is a fairly high representation of what would be average), whereas the number of records will grow at a fairly predictable rate, with the same basic number of records added each day. I should have said records, instead of objects. (too many sessions with crAccess, too little time talking to real people about databases) Now... would you spell that querys or queries? Marco Tabini wrote: > > Well, then, assuming your complexity grows linearly, I guess you'll have > to wait a few minutes with 160,000 rows on which you can expect to > perform 16,000 queries... > > You mention that you perform the queries on objects--can you elaborate > on this point? > > Marco > -- > > php|architect - The Magazine for PHP Professionals > The monthly magazine dedicated to the world of PHP programming > > Check us out on the web at http://www.phparch.com! > > > > Subject: Re: [PHP] Resource limit/performance questions > Date: Fri, 20 Dec 2002 15:47:07 -0500 > From: John Hinton <[EMAIL PROTECTED]> > To: Marco Tabini <[EMAIL PROTECTED]> > CC: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > References: <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> > > In one main instance, I'm doing 10 querys on an array of 26 unique > objects extracted from the database. So, I suppose it is running 260 > queries on 2600 lines of code. > > Marco Tabini wrote: > > > > IMHO it depends on the amount of operations you have to perform on your > > rows. If manipulating 2,600 rows takes several seconds, then either > > you're performing some really complicated data manipulation or your db > > could use some optimization. I have an application that manipulates > > ~150,000 rows on a Pentium II 350 MHz and that takes at most half a > > second (although I'm doing really simple statistical stuff). > > > > Cheers, > > > > Marco > > -- > > > > php|architect - The Magazine for PHP Professionals > > The monthly magazine dedicated to the world of PHP programming > > > > Check us out on the web at http://www.phparch.com! > > > > > > > > Subject: [PHP] Resource limit/performance questions > > Date: Fri, 20 Dec 2002 15:31:58 -0500 > > From: John Hinton <[EMAIL PROTECTED]> > > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > I'm working on a php/mysql ap, which looks as though it will be dealing > > with an average of > > > > 160,000 rows of short text entries = > > 32 megs of drives space > > > > Anybody have ideas about what if any limits I might hit? And how I might > > be able to determine any limits at this point when we have only 2 weeks > > (.6 megs and 2600 rows) of what will be 2 years of data? I have full > > access to my linux server. I notice that when executing one set of > > statements for one page, it is now using in the 80 to 90% range of CPU > > states, and works for maybe 3 or 4 seconds to return the querys. I am at > > present doing this testing on a 550 mhz processor, but will be running > > the ap on a dual 500s. > > > > Am I getting totally out of hand in thinking I can do this? > > > > TIA > > -- > > John Hinton - Goshen, VA. > > http://www.ew3d.com > > > > Those who dance are considered insane > > by those who can't hear the music > > > > -- > > PHP General Mailing L
Re: [PHP] libcrypt.a and solaris 8
I've recently compiled PHP (4.2.3) with openssl support on a Solaris 8 system. openssl does not have a libcrypt.a library - it does have libcrypto.a. How did you install openssl and what is your configuration line for PHP? I've found it to be best to configure openssl so that it installs somewhere like /usr/local/ssl and to configure php to look at that directory for the openssl linking. It might also help if you told us what error message you're getting. ..michael.. On Fri, 2002-12-20 at 06:21, dweise wrote: > hello, >i'm trying to compile php with openssl and ldap. i can't i keep getting > an error. i surfed the web and found a reference that the library > libcrypt.a in openssl is not compatable with that in solaris 8. is this true? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disable session cookies
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there any way to disable using cookies in sessions? I haven't found a good reason to do this, only my boss's predisposition against cookies ;). Thanks in advance, Evan - -- A leader is the wave pushed ahead by the ship. - -Leo Nikolaevich Tolstoy -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+A5nH/rncFku1MdIRAsc2AKCW7GNJo/h36g/sDuUf4RBgcd3uLQCeP1ET OEoMuKLLQ42w2urky0wtGhU= =kFkN -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] login
You really need to check out sessions. 1. user logs in by a form 2. php validates the login, checks for a valid uid/pwd 3. if valid, sets a session variable like $_SESSION['uid'] 4. you put session_start() at the top of each page, and php will know that they are logged in as "justin" or whatever. Rather than passing around thier userid in the URL, you pass around a session id (long unique number) in the URL, and associate MANY session variables to it via either the URL or cookies (userid, first name, fav colour, preference for font size, preference for date format, whatever) on the server-side. The guts of it is a lot more complex than that of course, with many different options, but you get the drift :) What you would actually be testing for on each page would be $_SESSION['uid'], not $clientid or $_GET['clientid']. There are some simple examples on: http://www.php.net/manual/en/ref.session.php Cheers Justin on 21/12/02 1:20 AM, Edward Peloke ([EMAIL PROTECTED]) wrote: > Ok, > Newbie Question. > I know have a login and registration page on my website. What is the best > way to check to see if the users have logged in before they access the other > pages? SHould I add to each of the other url's ?clientid='' and if it is an > empty string I know they haven't logged in? > > Thanks, > Eddie > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/dreamweaver mx/mysql server question...
I'm trying to get dreamweaver mx working with php/mysql and a remote server. My remote server is named localhost. How can I change it's name? Is it as simple as change the host value for the user's login? I've tried several things to no avail. TIA, Kelly
Re: [PHP] Disable session cookies
Sorry about the double post- I got an error message (which i now realize was from a mirror), so i tried again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] text parser
Hi! I wan't to know if there is any goor text parser around here written in php. I'm asking before i create my own. I would like extract some text msgs to words and i would also like take care of stop words, special characters etc... So to know if some word is regular word, or if is number, html tag, html entry. -- tia, Uros -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Disable session cookies
> Is there any way to disable using cookies in sessions? I haven't found a > good > reason to do this, only my boss's predisposition against cookies ;). Yep, session.use_cookies setting in php.ini. Set it to zero to not use cookies. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: mail()
> I changed this and it works fine but I now lose my formating. It doesn't > seem to recognize the \n breaks. Am I asking for to much? Well, you'll be required to learn HTML if you're going to send HTML emails. Use . ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compile with GD TTF FREETYPE
Hello, I am trying compile my php-4.2.3 with FreeType Support enabled FreeType Linkage with TTF library ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --with-mysql =/usr/local/mysql --with-gd --enable-gd-native-ttf --with-ttf --disable-mbs tr-enc-trans --with-freetype-dir=/usr But, with the directives that I put I only have getting: FreeType Support enabled FreeType Linkage with freetype I need the FreeType with support TTFLibrary What did I make wrong in the compilation? Breno Cardoso perucchi [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: mail()
Yeah, is the best alternative. On Fri, 20 Dec 2002, John W. Holmes wrote: > > I changed this and it works fine but I now lose my formating. It > doesn't > > seem to recognize the \n breaks. Am I asking for to much? > > Well, you'll be required to learn HTML if you're going to send HTML > emails. Use . > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] the numeric key of an array???
How can i do for printing the value of an array given the numeric key for example i have this code: $array = array ( 'VAL1' => "VALUE1", 'VAL2' => "VALUE2", 'VAL3' => "VALUE3" ) So the only way i have found to print the value is like this : echo $array['VAL1']; and it prints = VALUE1 but i want to know if its possible to do it something like this: echo $array[0]; i mean give the numeric key for printing VALUE1 so instead the string key (VAL1) use the numerc (0) Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] the numeric key of an array???
> How can i do for printing the value of an array given the numeric key for > example i have this code: > > $array = array ( > 'VAL1' => "VALUE1", > 'VAL2' => "VALUE2", > 'VAL3' => "VALUE3" > ) > > So the only way i have found to print the value is like this : > echo $array['VAL1']; > > and it prints = VALUE1 but i want to know if its possible to do it > something > like this: > echo $array[0]; > i mean give the numeric key for printing VALUE1 so instead the string key > (VAL1) use the numerc (0) You can't, because there is no key of zero in that array. All arrays are associative, so the only way to use $array[0] is to define $array[0]. If you're looking to loop through your array, there are other methods. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the numeric key of an array???
No, but you can do this: $arr2 = array_values($array); print $arr2[0]; // VALUE1 Regards, Philip Olson On Fri, 20 Dec 2002, Alexander Guevara wrote: > How can i do for printing the value of an array given the numeric key for > example i have this code: > > $array = array ( > 'VAL1' => "VALUE1", > 'VAL2' => "VALUE2", > 'VAL3' => "VALUE3" > ) > > So the only way i have found to print the value is like this : > echo $array['VAL1']; > > and it prints = VALUE1 but i want to know if its possible to do it something > like this: > echo $array[0]; > i mean give the numeric key for printing VALUE1 so instead the string key > (VAL1) use the numerc (0) > > Thanks in advance! > > > > -- > 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] the numeric key of an array???
Well which kind of methods are you talking about?? could you tell me some for do it?? Thanks! "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 01c2a890$d1539cf0$7c02a8c0@coconut">news:01c2a890$d1539cf0$7c02a8c0@coconut... > > How can i do for printing the value of an array given the numeric key > for > > example i have this code: > > > > $array = array ( > > 'VAL1' => "VALUE1", > > 'VAL2' => "VALUE2", > > 'VAL3' => "VALUE3" > > ) > > > > So the only way i have found to print the value is like this : > > echo $array['VAL1']; > > > > and it prints = VALUE1 but i want to know if its possible to do it > > something > > like this: > > echo $array[0]; > > i mean give the numeric key for printing VALUE1 so instead the string > key > > (VAL1) use the numerc (0) > > You can't, because there is no key of zero in that array. All arrays are > associative, so the only way to use $array[0] is to define $array[0]. > > If you're looking to loop through your array, there are other methods. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the numeric key of an array???
Yeah this workes fine.. thanks!! "Philip Olson" <[EMAIL PROTECTED]> wrote in message Pine.BSF.4.10.10212210135051.36987-10@localhost">news:Pine.BSF.4.10.10212210135051.36987-10@localhost... > > No, but you can do this: > > $arr2 = array_values($array); > > print $arr2[0]; // VALUE1 > > Regards, > Philip Olson > > > On Fri, 20 Dec 2002, Alexander Guevara wrote: > > > How can i do for printing the value of an array given the numeric key for > > example i have this code: > > > > $array = array ( > > 'VAL1' => "VALUE1", > > 'VAL2' => "VALUE2", > > 'VAL3' => "VALUE3" > > ) > > > > So the only way i have found to print the value is like this : > > echo $array['VAL1']; > > > > and it prints = VALUE1 but i want to know if its possible to do it something > > like this: > > echo $array[0]; > > i mean give the numeric key for printing VALUE1 so instead the string key > > (VAL1) use the numerc (0) > > > > Thanks in advance! > > > > > > > > -- > > 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] the numeric key of an array???
> > If you're looking to loop through your array, there are other methods. > Well which kind of methods are you talking about?? could you tell me some > for do it?? foreach($array as $key=>$value) www.php.net/foreach while(list($key,$value) = each($array) www.php.net/each www.php.net/list $cnt = count($array); for($x=0;$x<$cnt;$x++) www.php.net/count ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the numeric key of an array???
Thanks. it worked fine.. and the reply at the botton too.. Thank you so much! "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000101c2a896$70aad5c0$7c02a8c0@coconut">news:000101c2a896$70aad5c0$7c02a8c0@coconut... > > > If you're looking to loop through your array, there are other > methods. > > > Well which kind of methods are you talking about?? could you tell me > some > > for do it?? > > foreach($array as $key=>$value) > > www.php.net/foreach > > while(list($key,$value) = each($array) > > www.php.net/each > www.php.net/list > > $cnt = count($array); > for($x=0;$x<$cnt;$x++) > > www.php.net/count > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote from astring?
It works.. but when you retrieve the data from the database to a text box it doesnt appear if it has the single quote ('), o tought it was cause i have the stripslashes but i delete stripslashes and it still doesnt appear in the text box! "Justin French" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... don't filter the quotes... escape them with add_slashes() justin on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > as title that I'm getting a trouble on filtering the single quote ' , since > there would be error when storing those string into MySQL, thus, i have to > find the appropriate method to solve it, anybody can help please? > thx a lot > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running perl script via su
I am getting a lot of information about running the web server as root and the associated problems and so on as I've been looking for a quick solution. I have a perl script that is run by cron that executes sequence of events via sftp. The sftp client has no option that I know of to denote a different user than the one executing the command using rsa so I set up a user with the same name as the user needed to log into the remote server and run it under cron for that user. I want to place a simple button on my web site that executes that script but it has to be run by that user. Since there will be no interface on the site for which commands can be sent using this page I'm not too worried about any kind of exploit. I also don't want to have to go through the process of installing and learning the methods of use for apache suExec. I also don't want the entire web server running as this user. Does anyone know of a quick and dirty solution for this Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] table trouble
Hello everyone, I was looking for some help, its late and I'm trying to help a friend finish up a project. here is an example and the jpg of what the page is supposed to look like. http://www.heathermccullough.com/bocajava/bocabucks/bocabucks.html http://www.heathermccullough.com/bocajava/bocabucks/sample.html The middle where the text and the photo images are a problem. When I push the text table it pushes that whole side out further, and as you can see by the sample image it supposed to be closer together. Any help would be appreaciated. thanks _ MSN 8: advanced junk mail protection and 3 months FREE*. http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote fromastring?
on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > It works.. but when you retrieve the data from the database to a text box it > doesnt appear if it has the single quote ('), o tought it was cause i have > the stripslashes but i delete stripslashes and it still doesnt appear in the > text box! Huh? I can't really understand what you're saying. If you're adding stuff to a database, and getting an error, use addslashes(), then on the way out of the database, you need to stripslashes(). Easy. If you don't get any errors, then magic quotes is probably enabled in your php.ini file. Justin > "Justin French" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > don't filter the quotes... escape them with add_slashes() > > justin > > on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > >> as title that I'm getting a trouble on filtering the single quote ' , > since >> there would be error when storing those string into MySQL, thus, i have to >> find the appropriate method to solve it, anybody can help please? >> thx a lot >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote from astring?
He is referring to a question that is answered here: http://www.php.net/manual/en/faq.html.php#faq.html.encoding Spoiler: htmlspecialchars() -> http://www.php.net/htmlspecialchars Regards, Philip Olson On Sat, 21 Dec 2002, Justin French wrote: > on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > > > It works.. but when you retrieve the data from the database to a text box it > > doesnt appear if it has the single quote ('), o tought it was cause i have > > the stripslashes but i delete stripslashes and it still doesnt appear in the > > text box! > > Huh? I can't really understand what you're saying. > > If you're adding stuff to a database, and getting an error, use > addslashes(), then on the way out of the database, you need to > stripslashes(). Easy. > > If you don't get any errors, then magic quotes is probably enabled in your > php.ini file. > > > Justin > > > > > > "Justin French" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > don't filter the quotes... escape them with add_slashes() > > > > justin > > > > on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > > > >> as title that I'm getting a trouble on filtering the single quote ' , > > since > >> there would be error when storing those string into MySQL, thus, i have to > >> find the appropriate method to solve it, anybody can help please? > >> thx a lot > >> > >> > > > > > > > -- > 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