Re: [PHP] Looking for optimal coding
for($i=1;$i<=50;$i++) { if ((!empty($content) && $row[$content] == $states[$i]) || ($dstate == $states[$i])) $selected="SELECTED"; else $selected=""; printf("%s", $states[$i], $selected, $nstates[$i]); } I always prefer to use printf to mix content and data. And why not use the || your reaching a single solution Jerry Verhoef >-Original Message- >From: Joffrey van Wageningen [mailto:[EMAIL PROTECTED]] >Sent: Friday, February 15, 2002 10:00 AM >To: PHP Email List >Subject: Re: [PHP] Looking for optimal coding > > > > > This is not a big thing. > > But I am looking at this thinking there is a way to make the code take >up > > even less lines. > > > for($i=01;$i<=50;$i++) { > > if (!empty($content)) { > > if ($row[$content]==$states[$i]) > > echo " > selected>$nstates[$i]\n"; > > else > > echo "value=\"$states[$i]\">$nstates[$i]\n"; > > } > > else{ > > if ($dstate == $states[$i]) > > echo " > selected>$nstates[$i]\n"; > > else > > echo "value=\"$states[$i]\">$nstates[$i]\n"; > > } > > } > >i would try: > >for($i=01;$i<=50;$i++) { > if(!empty($content) && $row[$content] == $states[$i]) > $selected = " selected"; > elseif($dstate == $states[$i]) > $selected = " selected"; > else > $selected = ""; > echo "value=\"".$states[$i]."\"".$selected.">".$nstates[$i].""; >} > >trading four echo's for a one echo and a extra var and nest the ifs > > > Basically I want to check for two possible conditions to make an item >selected. > > If the first one is valid then do not check for the other. > > > > Get what I mean? > > Any expert programmers out there with the way to chop this even further? > >test it :) > >mvgr, >Joffrey van Wageningen > >-- >.-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-- >| Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue >| PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 >| * We demand guaranteed rigidly defined areas of doubt and uncertainty. >| -- Douglas Adams > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > _ Chat on line met vrienden en probeer MSN Messenger uit: http://messenger.msn.nl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keeping the dot
Try thinking :? :? Just add a dot. $filename = ereg_replace("[^a-zA-Z0-9.]", "",$filename); = I have a file that is being uploaded, but I need to remove all the characters in the filename except letters, numbers, and the '.' (dot). Example would be 'where_i_go.mp3' removing the '_' to get 'whereigo.mp3'. Below is what I have to remove the none letters and numbers, but it also takes away the '.' (dot). How can I make the code below keep the dot? $filename = ereg_replace("[^a-zA-Z0-9]", "",$filename); Regards, Joseph A. Bannon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN Foto's is de eenvoudigste manier om je foto's te delen en af te drukken: http://photos.msn.nl/Support/WorldWide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multiple browser instances - is it possible to determine which browser
Create a frame set. if your page opens without frameset the did something wrong, at least not allowed. (like open in a new window) If the main page, containing the frameset is loaded, the page is opened in a new window or they pressed f5(reload). === We've considered using javascript but cannot think of a way that would work. Take a simple example, 2 browsers - opened separately, pointing at different pages. We thought that we could set some property of each instance of the browser to a unique value (i.e. the window name). We would only need to do it once, when entering the site. But, when a new page is loaded there is no way from PHP to grab this unique value, unless it has been sent to the loaded page as a GET or POST variable. This would mean that we would have to pass this value to every page as a GET or POST variable. GETs are problematic, leaving us with POSTs only. But POSTING to every page is a pain. Is there any other way? >-Original Message- >From: Dennis Moore [mailto:[EMAIL PROTECTED]] >Sent: 04 March 2002 15:28 >To: Neil Kimber; [EMAIL PROTECTED] >Subject: Re: [PHP] Multiple browser instances - is it possible to >determine which browser? > > >You may consider the use of Javascript to control the parent and child >windows and frames of your application. > >/dkm > > > >- Original Message - >From: "Neil Kimber" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Monday, March 04, 2002 9:51 AM >Subject: [PHP] Multiple browser instances - is it possible to determine >which browser? > > > > We have an application framework that tidies up application session > > variables as you traverse from page to page. It works really nicely - >until > > a user opens up 2 instances of a browser. Our code cannot distinguish > > between different browser instances, so browser instance 2 causes our > > application session vars for browser instance 1 to be cleared out. > > > > We've toyed with many ideas and short of forcing a unique >hidden value to >be > > 'POST'ed to every page from every page we don't have an elegant >solution. >Is > > there any other way that we could do this? > > > > Neil > > > > > > -- > > 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 _ Meld je aan bij de grootste e-mailservice wereldwijd met MSN Hotmail: http://www.hotmail.com/nl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie seeks urgent help
Good afternoon list, My first post here and i'm having trouble with a form: it doesn't send the input to the given e-mail address: i get a blank mail without any of the fields. Here's how it should arrive in the mailbox: Empresa: field input Contato: field input Fone: field input Fax: field input Email: field input Produto: field input Origem: field input Destino: field input Quantidade: field input Peso: field input Comprimento: field input Altura: field input Largura: field input I really appreciate the help Here's the code and the form: // Your email address $youremail = 'email adress'; // Your web site title $websitetitle = 'newbie.com'; // Path to "thanks for the message" page $thankyoupage = 'http://wwwContact_success1.php'; // Send notification to sender (use false if not required) $sendnotification = true; # // Do not edit below this # $contact_form_action = $_SERVER['PHP_SELF']; if ((isset($_POST["sendcontact"])) && ($_POST["sendcontact"] == "contactsent")) { $contacter_form_error = array(); if (empty($_POST['empresa_name'])){ $contacter_form_error[] = 'favor preencher nome da empresa'; } if (empty($_POST['contato_name'])){ $contacter_form_error[] = 'favor preencher nome do contato'; } if (empty($_POST['fone'])){ $contacter_form_error[] = 'favor preencher número do telefone'; } if (empty($_POST['contato_email'])){ $contacter_form_error[] = 'favor preencher seu e-mail'; } if (empty($_POST['produto'])){ $contacter_form_error[] = 'favor preencher o produto'; } if (empty($_POST['origem'])){ $contacter_form_error[] = 'favor preencher origem'; } if (empty($_POST['destino'])){ $contacter_form_error[] = 'favor preencher destino'; } if (empty($_POST['quantidade'])){ $contacter_form_error[] = 'favor preencher quantidade'; } if (empty($_POST['peso'])){ $contacter_form_error[] = 'favor preencher peso'; } if (empty($_POST['comprimento'])){ $contacter_form_error[] = 'favor preencher comprimento'; } if (empty($_POST['altura'])){ $contacter_form_error[] = 'favor preencher altura'; } if (empty($_POST['largura'])){ $contacter_form_error[] = 'favor preencher largura'; } else { $empresa_name = stripslashes($_POST['empresa_name']); $contato_email = stripslashes($_POST['contato_email']); $subjectline = "$websitetitle | Mensagem de $empresa_name"; mail($youremail, $subjectline, "Orçamento de empresa"); if($sendnotification == true) { $notification_message = "Obrigado por nos contatar, $contato_name. Recebemos sua mensagem e entraremos em contato em breve"; $notification_subject = "Obrigado por sua mensagem para $websitetitle."; mail($contato_email, $notification_subject, $notification_message, "From: $youremail"); } header("Location:$thankyoupage"); } } ?> 0){ print 'Algo está errado:'."\n"; print ''."\n"; foreach($contacter_form_error as $form_err) { print "$form_err\n"; } print ''."\n"; } ?> Todos os campos obrigatórios são marcados com asteriscos (*). Seus Dados Empresa * Contato * Número do telefone * Fax E-mail * Produto * Origem * Destino * Quantidade * Peso * Comprimento * Altura * Largura * -- Best regards, Luc Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "Doctor to patient: I have good news and bad news - the good news is that you are not a hypochondriac." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Newbie seeks urgent help
Hello Daniel, Friday, July 13, 2007, 5:50:53 PM, you wrote: > In your code, all you have is this: Unfortunately it doesn't work, probably because of my lack of php skills :-) I copied and paste your solution as follows: which gives the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in / on line 14 -- Best regards, Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[4]: [PHP] Newbie seeks urgent help
Hello Tijnema, Friday, July 13, 2007, 10:09:05 PM, you wrote: > You're using a ' here, which ends the string. Use one of these: > $websitetitle = "John Doe's Site"; > OR > $websitetitle = 'John Doe\'s Site'; > Just a matter of preference ;) Thanks Tijnema But still get: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in / on line 14 So i still don't have a clue what i could have snipped and if i have everything in the correct order. -- Best regards, Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[6]: [PHP] Newbie seeks urgent help
Hello Tijnema, Friday, July 13, 2007, 10:45:48 PM, you wrote: > You must have some unclosed single quote ( ' ) somewhere, on one of > these lines probably: > $youremail = > $websitetitle = > $thankyoupage = Found the problem :-) in the block: $body =<
Re[8]: [PHP] Newbie seeks urgent help
Hello DJ, Saturday, July 14, 2007, 1:34:36 AM, you wrote: > Isn't the sender's Email $contacto_email ? > if($sendnotification == true) { >$notification_message = "Obrigado por nos contatar, > $contato_name. Recebemos sua mensagem e entraremos em contato em breve"; >$notification_subject = "Obrigado por sua mensagem > para $websitetitle."; >mail($contato_email, $notification_subject, > $notification_message, "From: $youremail"); I have that piece of code but still no go :-) G -- Best regards, Luc mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable problem?
Good afternoon list, Probably a no-brainer for the most of you but i'm in a pickle: i've set up a variable to receive in the body of the notification mail upon sending a form. The body of the mail should read like this: Obrigado por nos contatar, $contato_name. Recebemos sua mensagem e entraremos em contato em breve. (in english: tnx for contacting us, $contato_name. We received your message and will contact you shortly.) Where $contato_name is the name of the contact, as used in the form. The problem is that the message arrives without the $contato_name, so i get: Obrigado por nos contatar, . Recebemos sua mensagem e entraremos em contato em breve. Here's the script: // Print form field errors if present if (count($contacter_form_error)>0){ print 'Algo está errado:'."\n"; print ''."\n"; foreach($contacter_form_error as $form_err) { print "$form_err\n"; } print ''."\n"; } ?> Todos os campos obrigatórios são marcados com asteriscos (*). Seus Dados Empresa * Contato * Número do telefone * Fax E-mail * Produto * Origem * Destino * Quantidade * Peso * Comprimento * Altura * Largura * -- Best regards, Luc Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "If you feel Dog tired at night, it may be because you growled all day!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable problem?
Good evening Daniel, It was foretold that on 24/7/2007 @ 17:47:46 GMT-0400 (which was 18:47:46 where I live) Daniel Brown would write: > You're not defining $contato_name. > Do this: > $contato_name = $_POST['contato_name']; Yes!! Oh so simple for a non-newbie lol. It works like a charm Daniel. I'm really, really grateful!!! -- Best regards, Luc _ Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "The pleasure of love is in loving. We are happier in the passion we feel than in that we inspire." - François, duc de La Rochefoucauld (1613–1680) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Variable problem?
Hello Richard, Wednesday, July 25, 2007, 12:05:22 AM, you wrote: > I think you're just missing $contato_name = $_POST['contato_name'] in > here somewhere... That was what was missing indeed :-) > That said, if you are using striplashes, you have magic_quotes_gpc on, > and that's something you may want to turn off in the first place. > Or consider checking if it's on in your code rather than assuming it's > on. magic_quotes_gpc is indeed on by default on my hosting server as i checked their php modules. -- Best regards, Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions?
Good morning list, I have my form up and running but something is missing: if you omit required fields, the form returns an error like: please fill in ... please fill in... the error message is displayed above the form on the same page. The problem is that upon showing the error message, the fields already filled out, return blank so that the user has to fill everything in again. What i would like to have is that the data already filled out, is being saved when the error message kicks in so that the user doesn't have to start al over again. Am i right in assuming this is done with a session, and if so how would i do that? here's my script: $contact_form_action = $_SERVER['PHP_SELF']; if ((isset($_POST["sendcontact"])) && ($_POST["sendcontact"] == "contactsent")) { $contacter_form_error = array(); if (empty($_POST['empresa_name'])){ $contacter_form_error[] = 'favor preencher nome da empresa'; } if (empty($_POST['contato_name'])){ $contacter_form_error[] = 'favor preencher nome do contato'; } if (empty($_POST['fone'])){ $contacter_form_error[] = 'favor preencher número do telefone'; } if (empty($_POST['contato_email'])){ $contacter_form_error[] = 'favor preencher seu e-mail'; } if (empty($_POST['produto'])){ $contacter_form_error[] = 'favor preencher o produto'; } if (empty($_POST['origem'])){ $contacter_form_error[] = 'favor preencher origem'; } if (empty($_POST['destino'])){ $contacter_form_error[] = 'favor preencher destino'; } if (empty($_POST['quantidade'])){ $contacter_form_error[] = 'favor preencher quantidade'; } if (empty($_POST['peso'])){ $contacter_form_error[] = 'favor preencher peso'; } if (empty($_POST['comprimento'])){ $contacter_form_error[] = 'favor preencher comprimento'; } if (empty($_POST['altura'])){ $contacter_form_error[] = 'favor preencher altura'; } if (empty($_POST['largura'])){ $contacter_form_error[] = 'favor preencher largura'; } else { $empresa_name = stripslashes($_POST['empresa_name']); $contato_email = stripslashes($_POST['contato_email']); $body =<< // Print form field errors if present if (count($contacter_form_error)>0){ print 'Algo está errado:'."\n"; print ''."\n"; foreach($contacter_form_error as $form_err) { print "$form_err\n"; } print ''."\n"; } ?> Todos os campos obrigatórios são marcados com asteriscos (*). Seus Dados Empresa * Contato * Número do telefone * Fax E-mail * Produto * Origem * Destino * Quantidade * Peso * Comprimento * Altura * Largura * -- Best regards, Luc Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "Experience - the name men give to their mistakes." - Oscar Wilde. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Sessions?
Hello brian, Thursday, July 26, 2007, 2:47:55 PM, you wrote: > The way that i generally handle this is to use a class. I instantiate an > object when the page loads, whether the form has been submitted or not. Tnx for the response Brian. Being a newbie i'll read your post carefully, trying to understand it all and plunge into it :-) -- Best regards, Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail problem - deadline!!!!! - SOLVED
Good evening list, Solved the problem myself :-) i changed the mail function instead of $youremail = '[EMAIL PROTECTED]', i used $to = "" and changed the mail fuction from: @mail($contato_email,$subjectline,$body, "From: $contato_email"); into @mail($to,$subjectline,$body, "From: $contato_email"); -- Best regards, Luc Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "From St Paul's second letter to the Corithians: 'Dear Corinthians, you could have at least replied to the first ...'" - Giobbe Covatta - Italian writer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Job database
This is a free service for the PHP Community. Job seekers can search the latest PHP related positions. Companies can post their Jobs with EASE for FREE! http://www.phpcareer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Can't recover data in php posted with a form tag.
I have 2 files runQuery.php and doSQL.php, where the first one is posting data entered by the user to the second page and displaying it but the data never arrives. Any idea why this would not work, maybe some configuration issue?? Any help is really appreciated... i.e. select * from scpsft Résultat de la requète: -->
[PHP] Using odbc_pconnect function
Hi, Trying to use persistant connections to reduce general access times on my tables, I have the following problem. When creating my connection with: $connectionstring = odbc_pconnect("prov","username","pass"); I'm able to use it on the current page but how do I resuse the variable $connectionstring on other pages since I make calls like: $queryexe = odbc_do($connectionstring, $query); Hope this is not confusing. Also, can I make the persistant connection expire after there have been no calls to the DB for a certain time? Many Thanks, -Luc
[PHP] Page display of query resuts using ODBC
Hi, Just wondering if anybody knows a script to display a resultset over several pages using page numers & previous, next links. So far I've only found such scripts for mysql using the the following sql syntax which is not odbc compliant: SELECT * from table LIMIT 0, 4 I've looked at many sites to find such a script without luck so far... Thanks in advance for your help, -Luc
[PHP] IIS4 problem
hi, I 've got problems executing .exe through Php script. On my machine ( NT4, Omnihttpd), i can do whatever I want, but when I transfer my scripts to my server NT4 with IIS4, something goes wrong, (with a "dir" nothing happens, with a "help" it slows down my server to a point I need to reboot it) To summarize I need to execute an exe for a connection with a bank and as it did not work I tried with some DOS commands. (I gave the proper rights to the directory containing my exe and my scripts) Below is my script \n"); print("Output : \n"); print $allOutput; for ($index = 0; $index < count($AllOutput); $index++) { print("$AllOutput[$index] \n"); } print ("\n"); print("return value : $ReturnValue\n"); ?> Thanks in advance if someone had a similar problem Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!
Hello! My first message: I've just updated PHP from 5.1.4 to 5.2.5 (to solve an Apache problem when double-clicking on links). This was successful, as the problem is now solved, but I now, sometimes, get a message stating that the memory is exhausted. I modififed php.ini and set memory_limit to 16M (instead of 8M with PHP5.1.4), then 32M, then 64M, with the same message. With 128M, it works. Can this change in memory required be considered as normal? I don't think so... Is there any explanation? Details: - Platform: Windows. - I used Windows binaries (no C compiler available). The part causing the error uses jpgraph (for generating .png files) and the png files are used when generating a PDF file (by the tcpdf library) (the gd extension is used). A second issue with this release: When I made the tests decribed above, I used 'restart' to restart the Apache server, with no error message. When I tried to stop Apache and start it again, I got an error message stating that the zend_unmangle_property_name_ex entry cannot be found in php5ts.dll, and I now get this message each time I restart Apache (Apache2.2),. But it seems that Apache works normally nonetheless. I made sure that the php5ts.dll used is the right version for 5.2.5. Any idea? Thanks for any suggestion!
[PHP] RE : [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!
Thanks for this clue (ini_set). But I normally don't need this amount of memory anywhere, as 8M were OK in PHP5.1.4... I just want to understand what happens. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE : RE : [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!
Thank you. You must be right about the memory_limit not enabled in 5.1.4 Windows binaries. It would be nice, for the Windows binary download, to provide details on parameters uised to compile it (and on extensions included: actually, using the "installer" package is supposed to be simpler, but it is more complex, because it does not include all extensions included in the zip download...) Memory limit wasn't force enabled before 5.2.1. Maybe that was it? http://www.php.net/ChangeLog-5.php#5.2.1 Version 5.2.1 08-Feb-2007 Added CURLOPT_TCP_NODELAY constant to Curl extension. (Sara) Added support for hex numbers of any size. (Matt) Added function stream_socket_shutdown(). It is a wrapper for system shutdown() function, that shut downs part of a full-duplex connection. (Dmitry) Added internal heap protection (Dmitry) memory-limit is always enabled (--enable-memory-limit removed) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Downstream
Hi php-general-team, An large XML Downstream over asp should be saved into a xml-file. If I open the asp website directly (IE6.0). It shows after 15 min a big part of the xml-stream (like if I would open an xml-file with the browser) and a failure at the end. I don't know how to save it into Harddisk, before a failure-window popup, wich says "Not enough virtual memory, because stylesheet is activated". And I wouldn't know how to continue from the rest of the stream on. I thought there's an easy way to develope a documentpipe with php. Can you show me some example, how to get a datastreama into files? Thank you very much for help Pascal Luc --- Pascal Luc Client/System Support (Applicationdeveloping) SSZ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with make test
Hi, I just configured and make'd PHP with no problem, but when I run make test, I get the following output: - = CWD : /home/programs/php/php-4.3.0 PHP : /home/programs/php/php-4.3.0/sapi/cli/php PHP_SAPI: cli PHP_VERSION : 4.3.0 ZEND_VERSION: 1.3.0 PHP_OS : Linux INI actual : /usr/local/Zend/etc/php.ini More .INIs : Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0 Extra dirs : = TIME START 2003-01-06 13:27:47 = FAIL EXPECT [tests/run-test/test001.phpt] FAIL EXPECTF [tests/run-test/test002.phpt] FAIL EXPECTREGEX [tests/run-test/test003.phpt] FAIL INI section allows '=' [tests/run-test/test004.phpt] FAIL Error message handling [tests/run-test/test005.phpt] PASS Error messages are shown [tests/run-test/test006.phpt] FAIL dirname test [tests/run-test/test007.phpt] FAIL Trivial "Hello World" test [tests/basic/001.phpt] SKIP Simple POST Method test [tests/basic/002.phpt] (reason: Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0) SKIP GET and POST Method combined [tests/basic/003.phpt] (reason: Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0) SKIP Two variables in POST data [tests/basic/004.phpt] (reason: Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0) SKIP Three variables in POST data [tests/basic/005.phpt] (reason: Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0) FAIL Add 3 variables together and print result [tests/basic/006.phpt] FAIL Multiply 3 variables and print result [tests/basic/007.phpt] FAIL Divide 3 variables and print result [tests/basic/008.phpt] FAIL Subtract 3 variables and print result [tests/basic/009.phpt] FAIL Testing | and & operators [tests/basic/010.phpt] SKIP Testing $argc and $argv handling (GET) [tests/basic/011.phpt] (reason: Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 0) FAIL Testing $argc and $argv handling (cli) [tests/basic/012.phpt] FAIL Bug #20539 (PHP CLI Segmentation Fault) [tests/basic/bug20539.phpt] FAIL Methods via variable name, bug #20120 [tests/classes/bug20120.phpt] FAIL Classes general test [tests/classes/class_example.phpt] FAIL Classes inheritance test [tests/classes/inheritance.phpt] FAIL Strlen() function test [tests/func/001.phpt] FAIL Static variables in functions [tests/func/002.phpt] FAIL General function test [tests/func/003.phpt] FAIL General function test [tests/func/004.phpt] FAIL Testing register_shutdown_function() [tests/func/005.phpt] FAIL Output buffering tests [tests/func/006.phpt] FAIL INI functions test [tests/func/007.phpt] FAIL Test for buffering in core functions with implicit flush off [tests/func/008.phpt] FAIL Test for buffering in core functions with implicit flush on [tests/func/009.phpt] FAIL Simple If condition test [tests/lang/001.phpt] FAIL Simple While Loop Test [tests/lang/002.phpt] FAIL Simple Switch Test [tests/lang/003.phpt] FAIL Simple If/Else Test [tests/lang/004.phpt] FAIL Simple If/ElseIf/Else Test [tests/lang/005.phpt] FAIL Nested If/ElseIf/Else Test [tests/lang/006.phpt] FAIL Function call with global and static variables [tests/lang/007.phpt] FAIL Testing recursive function [tests/lang/008.phpt] FAIL Testing function parameter passing [tests/lang/009.phpt] FAIL Testing function parameter passing with a return value [tests/lang/010.phpt] FAIL Testing nested functions [tests/lang/011.phpt] FAIL Testing stack after early function return [tests/lang/012.phpt] FAIL Testing eval function [tests/lang/013.phpt] FAIL Testing eval function inside user-defined function [tests/lang/014.phpt] FAIL Testing include [tests/lang/015.phpt] FAIL Testing user-defined function in included file [tests/lang/016.phpt] FAIL Testing user-defined function falling out of an If into another [tests/lang/017.phpt] FAIL eval() test [tests/lang/018.phpt] FAIL eval() test [tests/lang/019.phpt] FAIL Switch test 1 [tests/lang/020.phpt] FAIL Switch test 2 [tests/lang/021.phpt] FAIL Switch test 3 [tests/lang/022.phpt] FAIL Regression test [tests/lang/023.phpt] FAIL Looped regression test (may take a while) [tests/lang/024.phpt] - What does that mean? What do I need to do to fix that? Thanks, Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Editors
Do you know any good equivalent with similar features for Linux? Thanks, Pierre-Luc Soucy > PHPEdit i use it personally www.phpedit.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stream does not support seeking
Hi, We have recently upgraded to PHP 4.30 and since then, some people on our server started getting the following error message on their sites: Warning: main() [function.main]: stream does not support seeking in http://www.domain.com/path/to/file.inc on line 0 We have found that it happens when people use URLs in the include function, but have no idea why, espcially since allow_url_fopen is on. Any suggestions? Thanks, Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP OpenSSL question
Hi, I have loaded the appropriate keys: //load keys $ca_file = openssl_x509_read('file://'.$ca_file); $public_key = openssl_pkey_get_public('file://'.$public_key_file); $private_key = openssl_pkey_get_private('file://'.$private_key_file); and can successfully encrypt data: $to_send = ' http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"> '; openssl_public_encrypt($to_send, $message, $public_key); I then write the encrypted data to the socket using socket_write (when communicating with a server) but the server disconnects me when I attempt to read its output with socket_read: Warning: socket_read() unable to read from socket [54]: Connection reset by peer Any idea why? To what I understand, I might need to do a SSL handshake first? How can that be done with PHP? Thanks a lot! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Decrypting data with GnuPG
Hi, I would like to decrypt data encoded with GnuPG without including the private key passphrase in the command to prevent people from viewing it with "ps". Here is the code I wrote: $command = "/usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning --always-trust --yes --output /path/to/output.txt --decrypt /path/to/testtext.asc"; $passphrase = '***'; $fp = popen($command, 'w+'); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; == I assumed that the fputs() function would write the passphrase at the prompt, but that doesn't seem to be the case - the command does not create the output.txt file when ran by the PHP program (which is running as a CGI under my user BTW) while it works when ran from the shell. Any idea why? Thanks! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decrypting data with GnuPG
Hi, Does that mean that there is no way to achieve this with PHP and that I should rather use the --passphrase-fd argument? Thanks, Pierre-Luc Evan Nemerson wrote: GnuPG doesn't use stdin to read the password, which is where you're sending it. It uses a more low-level interface (check out the below link if you're interested) where they interact directly with the virtual console. Try piping to your command- that won't work either echo $PASSPHRASE | \ /usr/bin/gpg \ --homedir=/path/to/.gnupg \ --no-secmem-warning \ --always-trust \ --yes \ --output /path/to/output.txt \ --decrypt /path/to/testtext.asc GnuPG source code for TTY I/O: http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/*checkout*/gnupg/util/ttyio.c?rev=1.28&content-type=text/plain On Wed, 2003-05-28 at 16:14, Pierre-Luc Soucy wrote: Hi, I would like to decrypt data encoded with GnuPG without including the private key passphrase in the command to prevent people from viewing it with "ps". Here is the code I wrote: $command = "/usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning --always-trust --yes --output /path/to/output.txt --decrypt /path/to/testtext.asc"; $passphrase = '***'; $fp = popen($command, 'w+'); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; == I assumed that the fputs() function would write the passphrase at the prompt, but that doesn't seem to be the case - the command does not create the output.txt file when ran by the PHP program (which is running as a CGI under my user BTW) while it works when ran from the shell. Any idea why? Thanks! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decrypting data with GnuPG
From the GnuPG docs: --passphrase-fd n Read the passphrase from file descriptor n. If you use 0 for n, the passphrase will be read from stdin. This can only be used if only one passphrase is supplied. Don't use this option if you can avoid it. I added --passphrase-fd 0 to my command so the passphrase should normally be read from stdin (according to the docs), but it still does not work. Any idea? I am unfortunately not familiar with C code, so I can difficultly find solutions to my problems by reading the GnuPG source. Thanks! Pierre-Luc Evan Nemerson wrote: GnuPG doesn't use stdin to read the password, which is where you're sending it. It uses a more low-level interface (check out the below link if you're interested) where they interact directly with the virtual console. Try piping to your command- that won't work either echo $PASSPHRASE | \ /usr/bin/gpg \ --homedir=/path/to/.gnupg \ --no-secmem-warning \ --always-trust \ --yes \ --output /path/to/output.txt \ --decrypt /path/to/testtext.asc GnuPG source code for TTY I/O: http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/*checkout*/gnupg/util/ttyio.c?rev=1.28&content-type=text/plain On Wed, 2003-05-28 at 16:14, Pierre-Luc Soucy wrote: Hi, I would like to decrypt data encoded with GnuPG without including the private key passphrase in the command to prevent people from viewing it with "ps". Here is the code I wrote: $command = "/usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning --always-trust --yes --output /path/to/output.txt --decrypt /path/to/testtext.asc"; $passphrase = '***'; $fp = popen($command, 'w+'); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; == I assumed that the fputs() function would write the passphrase at the prompt, but that doesn't seem to be the case - the command does not create the output.txt file when ran by the PHP program (which is running as a CGI under my user BTW) while it works when ran from the shell. Any idea why? Thanks! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decrypting data with GnuPG
I just tried, but that didn't correct the problem - the output.txt file is still not generated: $command = "/usr/bin/gpg --homedir=/path/to/homedir/.gnupg --no-secmem-warning --passphrase-fd 0 --always-trust --yes --output /path/to/homedir/.gpgkeys/temp/output.txt --decrypt /path/to/homedir/.gpgkeys/temp/testtext.asc"; $passphrase = 'MY_PASSPHRASE'."\n"; $fp = popen($command, 'w+'); fputs($fp, $passphrase); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; ?> Regards, Pierre-Luc Evan Nemerson wrote: Are you appending a newline to your passphrase? $passphrase = "my gnupg passphrase\n"; On Thursday 29 May 2003 06:56 am, you wrote: From the GnuPG docs: --passphrase-fd n Read the passphrase from file descriptor n. If you use 0 for n, the passphrase will be read from stdin. This can only be used if only one passphrase is supplied. Don't use this option if you can avoid it. I added --passphrase-fd 0 to my command so the passphrase should normally be read from stdin (according to the docs), but it still does not work. Any idea? I am unfortunately not familiar with C code, so I can difficultly find solutions to my problems by reading the GnuPG source. Thanks! Pierre-Luc Evan Nemerson wrote: GnuPG doesn't use stdin to read the password, which is where you're sending it. It uses a more low-level interface (check out the below link if you're interested) where they interact directly with the virtual console. Try piping to your command- that won't work either echo $PASSPHRASE | \ /usr/bin/gpg \ --homedir=/path/to/.gnupg \ --no-secmem-warning \ --always-trust \ --yes \ --output /path/to/output.txt \ --decrypt /path/to/testtext.asc GnuPG source code for TTY I/O: http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/*checkout*/gnupg/util/ttyio.c?re v=1.28&content-type=text/plain On Wed, 2003-05-28 at 16:14, Pierre-Luc Soucy wrote: Hi, I would like to decrypt data encoded with GnuPG without including the private key passphrase in the command to prevent people from viewing it with "ps". Here is the code I wrote: $command = "/usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning --always-trust --yes --output /path/to/output.txt --decrypt /path/to/testtext.asc"; $passphrase = '***'; $fp = popen($command, 'w+'); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; == I assumed that the fputs() function would write the passphrase at the prompt, but that doesn't seem to be the case - the command does not create the output.txt file when ran by the PHP program (which is running as a CGI under my user BTW) while it works when ran from the shell. Any idea why? Thanks! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Decrypting data with GnuPG
Just for the record, adding the --batch argument to the GnuPG command solved the problem. Regards, Pierre-Luc Pierre-Luc Soucy wrote: Hi, I would like to decrypt data encoded with GnuPG without including the private key passphrase in the command to prevent people from viewing it with "ps". Here is the code I wrote: $command = "/usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning --always-trust --yes --output /path/to/output.txt --decrypt /path/to/testtext.asc"; $passphrase = '***'; $fp = popen($command, 'w+'); fputs($fp, $passphrase); pclose($fp); print "Done"; exit; == I assumed that the fputs() function would write the passphrase at the prompt, but that doesn't seem to be the case - the command does not create the output.txt file when ran by the PHP program (which is running as a CGI under my user BTW) while it works when ran from the shell. Any idea why? Thanks! Pierre-Luc Soucy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get Specific Data from an CSV format file to PHP
Jack You may want to have a look at : http://cvs.php.net/cvs.php/pear/File Hope this helps Luc At 20:41 18/04/02 +0800, Jack wrote: >Dear all >I had tried to fetch the data from CSV file by using PHP, what i did is >fetch the whole file content! >But now i only want specific data from that CSV file, is there anyway in php >that can point the pointer to specific data i want? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get ip of visitors
At 11:04 23/04/2002 +0300, Cosmin Vlasiu wrote: >Hello, >How can I take the IP of the visitator of my php page? >not gethostbyname... >I need the ip of any visitator not for the specified visitator. > >Thank you > >Cosmin Hello, function http_data() { $user_data = array (); // IP Number if (getenv(HTTP_X_FORWARDED_FOR)){ $user_data['ip']=getenv(HTTP_X_FORWARDED_FOR); } else { $user_data['ip'] =getenv(REMOTE_ADDR); } // HOSTNAME if ((getenv("REMOTE_HOST ")== "")){ $r_hostname = @gethostbyaddr($REMOTE_ADDR); if ($r_hostname ==""){ $user_data['machine'] = 'unknown'; }else { $user_data['machine'] = $r_hostname; } } else { $user_data['machine'] = getenv("REMOTE_HOST "); } // Browser $user_data['navigateur']= getenv("HTTP_USER_AGENT"); // HTTP Refer $user_data['comefrom'] = getenv("HTTP_REFERER"); return $user_data; } Hope this helps Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
At 11:07 04/05/2002 -0500, Paras Mukadam wrote: >Thanks for that ! >But my question still remains the same ... does PHP alone (without ZEND) >compile code into some .compiled_PHP file so that the user loading same page >for 2nd time gets better response than the 1st time? Hello, Both have nothing reallyr elated (as strange as it sounds) Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about fsockopen
Hello I use a class to parse a RSS feed, my problem is that when the distant site is down my own site is stuck (because my class waits for an answer that doesn't come..) The logical answer is to use a fsockopen before to control the connection. Reading the doc I see : int fsockopen ( string hostname, int port [, int errno [, string errstr [, float timeout]]]) fsockopen allows to control if the hostname is up and running My problem is that hostname returns the home page that is in HTML, the page that I want is a php page. HTML page are not often down (only when all the server is down) php pages are often down (because mySQL problem or PHP problems) So I'd like to be able to control if a specific url is OK and not only the hostname. How can I do that ? Thanks in advance Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] register_globals in php4
Mike, Both of your bit of code are not equal. On my ISP in 4.0.6 isset returned false if the variable was not existing OR empty in 4.2 isset returns true if the variable exists but is empty, so you may want to check with empty instead of isset Luc At 12:16 10/05/2002 +0100, Ford, Mike [LSS] wrote: > > -Original Message- > if (isset($password)): // register_globals on > $super_user = $password==$super_password; > endif; > > if ($super_user): > // sensitive admin stuff > endif; > >is more secure than: > > if (isset($_GET['password'])): // register_globals off > $super_user = $_GET['password']==$super_password; > endif; > > if ($super_user): > // sensitive admin stuff > endif; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help with undefined variables, please
At 12:49 14/05/2002 -0600, Matthew Walker wrote: >I prefer to use isset(), not empty(). It's more accurate, in that it >knows the difference between a variable that just isn't set, and one >that has an empty value (which may be valid). hello, You may want to do some tests. last time i did that : > 4.1 => isset() returns false if the variable is not set OR if the variable is empty So for example For php > 4.1 foo is ALWAYS set (it can be empty if no value is typed, but it exists so it is set) If you want to know is the user typed something you must use empty() Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help with undefined variables, please
At 21:57 14/05/2002 +0200, Luc Saint-Elie wrote: > > 4.1 => isset() returns false if the variable is not set OR if the > variable is empty typo.. wanted to say : > 4.1 isset() returns true if the variable is set ORT if the variable is empty Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php