php-general Digest 16 Jun 2005 10:30:35 -0000 Issue 3515
php-general Digest 16 Jun 2005 10:30:35 - Issue 3515 Topics (messages 217033 through 217059): Re: Anyone ever upgraded PHP at GoDaddy? 217033 by: Greg Donald 217034 by: Brian Dunning 217037 by: Laurent Duchesne 217038 by: Greg Donald Re: Apache fails to start (oracle path problem?) 217035 by: Shane Presley COM integration problems 217036 by: Jonathan Kart Re: Converting [and] to XML format- help/advise requested 217039 by: Dotan Cohen 217040 by: Dotan Cohen 217056 by: Sebastian Mendel ftruncate() and stream wrappers 217041 by: Justin Hannus passthru() passing variables 217042 by: Chris Herold 217048 by: Richard Lynch Re: incrementing a register global 217043 by: Richard Lynch 217057 by: Sebastian Mendel Re: Sessions 217044 by: Richard Lynch How to print variable name and contents 217045 by: nntp.charter.net 217046 by: Richard Davey Re: Retrievable weather service info? 217047 by: xfedex Re: php/osx and firebird 217049 by: Richard Lynch Re: Compiling problem (apxs) 217050 by: Richard Lynch OT Major Release Versions 217051 by: Richard Lynch Re: unable to load php_gd2.dll 217052 by: Nadim Attari Re: Image upload form 217053 by: Nadim Attari Re: htmlArea - a 'client editor' 217054 by: Kim Madsen 217058 by: Kim Madsen Re: autocomplete a field 217055 by: Kim Madsen Freing memory resources? 217059 by: Gustav Wiberg Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On 6/15/05, Brian Dunning [EMAIL PROTECTED] wrote: GoDaddy's Virtual Dedicated Servers come with PHP 4.2 - anyone ever upgraded this to 4.3 or later? I've never done any command line stuff or anything like that - is there an easier way? Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. -- Greg Donald Zend Certified Engineer http://destiney.com/ ---End Message--- ---BeginMessage--- On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? ---End Message--- ---BeginMessage--- Hi, you need to get the appropriate php tarball from http://www.php.net/downloads.php and check out this page: http://www.geocities.com/tipsforlinux/articles/27.html It will tell you how to: - extract the sources - run configure (this is where you use the configure line from phpinfo) - install compiled binaries Laurent 2005/6/15, Brian Dunning [EMAIL PROTECTED]: On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- On 6/15/05, Brian Dunning [EMAIL PROTECTED] wrote: On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? You use it to configure your PHP for compilation. See http://www.php.net/manual/en/install.php -- Greg Donald Zend Certified Engineer http://destiney.com/ ---End Message--- ---BeginMessage--- Thank you! That fixed it. I just had to define the Oracle env variables on the httpd startup script. So that was a huge help :) Shane On 6/15/05, Kristen G. Thorson [EMAIL PROTECTED] wrote: I ran into a similar problem trying to get ODBC working with a Progress database. I managed to solve it by setting the environment variables in the httpd startup script. Not much help, I know, but a suggestion. ;) good luck kgt Shane Presley wrote: Hello, I'm having trouble compiling and running PHP with oracle support. I was able to compile with the appropriate configure script, but only after I set my Oracle environment variables in my shell. That was no problem. The problem is, when Apache goes to load the php module, it fails, because it can't find the oracle library. Interactively I had to do this... export
RE: [PHP] htmlArea - a 'client editor'
-Original Message- From: M Saleh EG [mailto:[EMAIL PROTECTED] Sent: Saturday, June 04, 2005 2:57 PM To: Rory Browne Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] htmlArea - a 'client editor' www.FCKEditor.net http://www.FCKEditor.net FCKEditor is the best i've ever seen. Check it out. Yeah, looks cool, but Im having a *lot* of trouble getting the listing of current images and upload functionality to work. How and where do You set this up? The documentation is very simple and yet confusing. The filemanager image browser shows that Im looking in /, cant seem to find a setting for this anywhere The upload doesnt return an error, the JS upload in progress just hangs... /Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] autocomplete a field
-Original Message- From: xfedex [mailto:[EMAIL PROTECTED] Sent: Saturday, June 04, 2005 4:57 AM To: php-general@lists.php.net Subject: Re: [PHP] autocomplete a field Hi, Anyone know if theres a way to disable this feature for user using old browsers or not suporting JS/XML? It seems there was no replies to this post? Try autocomplete=off in the input tag: input type=text name=whatever autocomplete=off /Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Converting [and] to XML format- help/advise requested
Dotan Cohen wrote: On 6/15/05, Sebastian Mendel [EMAIL PROTECTED] wrote: Dotan Cohen wrote: Hi gurus. I'm having fun replacing the text within [ and ] to XML format on 4000+ files on a windows XP machine. I installed php (and an apache server) on the machine because it is the only language the I am remotely familiar with. I want and text that is with [ and ] to be enclosed with note and /note. Going through the archives I found this nice regex (I changed it a bit- I hope that I didn't break anything important) that fits into str_replace: str_replace(/[([a-zA-Z]+?)]/, note.$what was_inside_the_parethesis./note, $string); str_replace doesnt support regular expressions http://www.php.net/str_replace what you need is preg_replace() http://www.php.net/preg_replace But how on sweet mother Earth do I get the $what was_inside_the_parethesis variable to stick into the note tags? I tried functions that would remove the [ and ], then do $new_str=note.$what was_inside_the_parethesis./note; and then replace the whole [$what was_inside_the_parethesis] with $new_str. I did get that far. preg_replace( '/\[([^\]]+)\]/', 'note\1/note', $string); Now the catch! If $what_was_inside_the_parethesis contains the word 'algebra' then I want nothing returned- in other words [$what was_inside_the_parethesis] should be cut out and nothing put in it's place. I added an if function in there that checked the presence of the word algebra, but it ALWAYS returned blank. preg_replace( '/\[(algebra|([^\]]+))\]/', 'note\2/note', $string); just to mention, you need only the second example, the first ist just to explain the step toward the final ocde. The code works great for [] tags that do not contain the word algebra. If the word algebra is alone between the tags then it returns note/note, which I can easily remove with one more line of code. But if the word algebra appears with another word, then it is converted to a note just as if it did not contain the word. $search = array( '/\[[^\]*algebra[^\]*\]/', '/\[([^\]]+)\]/', ); $replace = array( '', 'note\1/note', ); preg_replace( $search, $replace, $string); Thank you Sebastian. Know that I not only appreciate your assistance, but that I also make a genuine effort to learn from your example. I think that it's about time that I learned to brew regexes. On my to google now... there are just two things you need to learn regular expressions: the PHP-manual: http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php http://www.php.net/manual/en/reference.pcre.pattern.syntax.php http://www.php.net/manual/en/ref.pcre.php http://www.php.net/manual/en/ref.regex.php and the regex coach: http://www.weitz.de/regex-coach/ -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: incrementing a register global
Aaron Todd wrote: I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } did you tried foreach() with $_GET ( or $_REQUEST ) ? foreach ( $_GET as $key = $var ) { echo $key . ' = ' . $var; } but this is not incrementing a register global but 'accessing a superglobale array' -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] htmlArea - a 'client editor'
-Original Message- From: Kim Madsen [mailto:[EMAIL PROTECTED] Sent: Thursday, June 16, 2005 9:14 AM To: php-general@lists.php.net Subject: RE: [PHP] htmlArea - a 'client editor' Yeah, looks cool, but Im having a *lot* of trouble getting the listing of current images and upload functionality to work. How and where do You set this up? The documentation is very simple and yet confusing. I should have mentioned that Ive looked at the config file in /FCKeditor/editor/filemanager/browser/default/connectors/php/config.php :-) /Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Freing memory resources?
Hi there! I have a script that runs about 10 minutes... Localy on my computer (Windows XP 2.6Ghz, Apache) the computer hangs a little now and then when the script is running. Is there any good way of releasing more memory while the script is running? The script could take 20 minutes, it's not a big matter how long the script takes. (As long as the server can do other things at the same time) (In production environment, the php-script is on Apache and Linux (if it matters)) Best regards Gustav Wiberg @varupiraten.se Here is my script: ?php //This script was updated 2005-06-16 //by Gustav Wiberg / [EMAIL PROTECTED] //Please visit www.varupiraten.se // require(phpfunctions/dbsafety.php); //Parameters that sets the rules for importing // static $fileName = import/GNTprisfil.txt; static $logFileName = logfiles/gnt.txt; static $limitSteps = 25; static $saldoColumn = 6; static $artNrColumn = 2; static $priceColumn = 5; static $row = 1; static $updateActions = 0; static $deleteActions = 0; static $checkLev = gn-; //Function for creating a logfile //and writing to screen // function writeNow($str, $logFileName) { //Create a handle for writing (appending) // $logHandle = fopen($logFileName,a); fwrite($logHandle, $str\r\n); echo $str . br; //Close file for writing to logfile // fclose($logHandle); } //Set limitstart for first time // if (!isset($limitStart)) {$limitStart = 0;} if (isset($_REQUEST[updateActions])) {$updateActions = $_REQUEST[updateActions];} if (isset($_REQUEST[deleteActions])) {$deleteActions = $_REQUEST[deleteActions];} if (isset($_REQUEST[startTime])) {$startTime = $_REQUEST[startTime];} if ($_REQUEST[limitstart]) { $limitStart = $_REQUEST[limitstart]; } require (phpfunctions/opendb.php); $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // if ($limitStart == 0) { $dbArray = mysql_fetch_array($querys); $nrOfProducts = $dbArray[cn]; echo Antal produkter: $nrOfProducts; //Create logfile or delete all content from current logfile // $logHandle = fopen($logFileName,wb); fclose($logHandle); //Get starttime of script // $startTime = time(); } else { $nrOfProducts = $_REQUEST[nrofproducts]; } if ($limitStart $nrOfProducts) { $nrSeconds = time() - $startTime; $nrMinutes = $nrSeconds / 60; ? bKlar/b med uppdatering av saldo och ev. borttagningar fr bGNT/b.brbr bTid fr uppdatering:/b ?php echo $nrSeconds;? sekunder eller ?php echo $nrMinutes;? minuterbrbr bAntal uppdateringar:/b ?php echo $updateActions;?br bAntal produkter som ej visas efter uppdatering: /b ?php echo $deleteActions;?br a href=captech_checksaldo_step2.php?deleteActions=0updateActions=0Kolla captech produkter/a ?php exit; } //Check if the filename exists first! //If not, then exit script if (!file_exists($fileName)) { echo Filen $fileName finns inte!brAvslutar scriptet nu!; exit; } //Go through database with products from GNT // $sql = SELECT tbvara.IDVara, tbvara.Saldo, tbvara.startPris, tbvara.Varunamn, tbvara.synligVara, tbvara.lastPris, tbunderkategori.marginalProcent, tbunderkategori.Underkategori FROM tbvara; $sql .= LEFT JOIN tbunderkategorivara ON (tbvara.IDVara = tbunderkategorivara.ForIDVara); $sql .= LEFT JOIN tbunderkategori ON (tbunderkategori.IDUnderKategori = tbunderkategorivara.ForIDUnderKategori); $sql .= WHERE Varunamn LIKE '$checkLev%' AND tbunderkategori.marginalProcent-1 AND tbunderkategori.Underkategori'Ej tilldelade' ORDER BY IDVara LIMIT $limitStart,$limitSteps; //echo $sql; //exit; $querys = mysql_query($sql); while ($toarray = mysql_fetch_array($querys)) { //Get current row from db // $idproduct = $toarray[IDVara]; $dbSaldo = $toarray[Saldo]; $dbArtNr = $toarray[Varunamn]; $dbPris = $toarray[startPris]; $dbSynligVara = $toarray[synligVara]; $dbLastPris = $toarray[lastPris]; $dbMarginalProcent = $toarray[marginalProcent]; $dbUnderKategori = $toarray[Underkategori]; //Taken from table tbunderkategori // $marginalProcent = intval($dbMarginalProcent); //Delete $checkLev from string $dbArtNr for the sake of comparing //(take away the three first characters) // $dbArtNr = substr($dbArtNr, 3); //Go through whole textfile and compare with current row in db // $handle = fopen($fileName, r); $foundProduct= false; ob_start(); while (($data = fgetcsv($handle, 1000, ;)) !== FALSE) { $textSaldo = $data[$saldoColumn]; $textArtNr = $data[$artNrColumn]; $textPris = $data[$priceColumn]; //Default marginal is 15 when marginal isn't set for undercategory
[PHP] Re: Freing memory resources?
Gustav Wiberg wrote: Hi there! I have a script that runs about 10 minutes... Localy on my computer (Windows XP 2.6Ghz, Apache) the computer hangs a little now and then when the script is running. Is there any good way of releasing more memory while the script is running? The script could take 20 minutes, it's not a big matter how long the script takes. (As long as the server can do other things at the same time) why do you expect this comes from memory-consumption? did you check your Querys? try 'EXPLAIN SELECT ...' and check your indices how large are your tables? -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returned mail: Data format error
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] `?t|K?oG??1\Q ?INq#k)B-y;8?%?~b?w)fj??A?,XbO[?8jl2WeFx\A??,|?_abO R.B?i(,?}nj ??XnU?sp?Z? eG/?H?K/N?Wg?I~ytDFkL?e?fOb'?'/[L??!?[uB\?VL?jD'g?\5,fI?A0??N y??R]G?R?sIE??F? ?2:|??\wg?0v?3y?x;?gV?_?Q9S'?]?f9( bb?7yL?N6[k$5?C1 hg?AMYQHQ?cpYO?N?AC?y?{.? 6;UXVLQ?'L?!h?v9x b?7q?VY?5VP 3OuE??$5[ !C??Ix?u?Dlby|`{?:? %Zr^3r^??0?-C?a7sJ ?Z_~H?Q?f?4?c?9{Jkl /KQT \4}?z[9Ag?UTi ku R(?,x$bz]j6???]}?m?Gn 6?r?:q??1p Y?? Hg??y4y?d`?b]z(F?r?I?!t_?#m?)'#?BP9I?H`mCBQ0?R\?yp??B _?}NKa??Zwc;OqPo2rIwg?/K`l a7d1???}m?yKNaox H3{?5tiX ??g?Reh??quSZ?(|??!?{hA%w?X{S_,?.bh0{xbV\HKY9^{?g?zeP$??.ld??zn$xRhD?){g?I?K??8e*.?^]??1?V`.Op7m?Kq??qW9Ol?/I?sY?Z?? /!o9e~?ZIXvX?{.br3}a`!??4??.`?`?^Eb/8%%gb??!?(qY~?R^#ZzFS ?`OzC??u?CQ??0?Q! Q '6?. !?hY?^??^6Fa?[T??fdwh8|??Xc?7M2?]?P\9(WZ512?gVeGQ ?c'-?%?Wf?w?i`!?; TPJ?#J?7?!1B??*I!Bv)?5? 79iQ8QL pS|B#Ov?? UHT M?Jm??/'[ RV? ?07t??Z(Ryu ~G$m?A02avWof?l?BDqx???4?VgJ GM? [jZ:w?$\[?^]q?.5KkHd???: G%AAZL?nX? 1C[?xQ?R??B!HG)?-rN~RD:N3mlS?%S%dFsyS.??`*nHA{~(?/??);Scf?x?Mix??x9M2`?gWlpDYE49uG^Wt?zJ!?cEU?*r;HG_?sv_h? ??KBg2fz^?\su]v??{?tKoN)?N_$???a5Kl-7l6`Zs?mM(.2jL??M4U?7 mDy???#;Gqg?7e5g.hL4(?T.?J?j?j^?*??i9?\C?u N?%?-%rS(goOCy?o8sg|h?3lYgHZDU? (??C!?-RUr!f7wSF1??5???gDac?DhGD}0??8?zn[?~?:{:~ T?EA}p .uG 1r,}/?oXL?6\/#? (l(?6N:cqA?Ejo?g#wH?[?n?K'?w3:DW?zOY$sbMxO?7?*M??D??Q??R,???fZ-?{(^`2]Y?a?I?y$(V^),OtN]e`$?UD4?}Rq^~9{n?Rh[Dw?^\??]6}yY?UPyrm?gGN/{l9?'K??{H:?,K?[%?bojqQJ9%EJD???DqN1E[50#mL HEIc??u??YUE??x:Etgehrk,R?M` file attachment: message.zip This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Freing memory resources?
Gustav Wiberg wrote: Hi there! I have a script that runs about 10 minutes... Localy on my computer (Windows XP 2.6Ghz, Apache) the computer hangs a little now and then when the script is running. Is there any good way of releasing more memory while the script is running? The script could take 20 minutes, it's not a big matter how long the script takes. (As long as the server can do other things at the same time) (In production environment, the php-script is on Apache and Linux (if it matters)) maybe use nice to stop your script hogging resources. $ nice --adjustment=19 php yourscript.php check the manpage for more info: $ man nice Best regards Gustav Wiberg @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Freing memory resources?
Sebastian Mendel wrote: Gustav Wiberg wrote: Hi there! I have a script that runs about 10 minutes... Localy on my computer (Windows XP 2.6Ghz, Apache) the computer hangs a little now and then when the script is running. Is there any good way of releasing more memory while the script is running? The script could take 20 minutes, it's not a big matter how long the script takes. (As long as the server can do other things at the same time) why do you expect this comes from memory-consumption? did you check your Querys? try 'EXPLAIN SELECT ...' and check your indices how large are your tables? Hi Sebastian! The table are about 600-700 rows, but i only select 25 rows at a time, so I guess that isn't the issue. For each row, a comparison is done with a textfile that has almost 30.000 rows. I guess this is the problem is... It takes time to load same textfile for each row, but an array for 30.000 rows should not be done either or should it? Is there a better way of solving this? The script loads after 25 rows, because of I don't want to get any timeout... We don't have any own webserver, so we have to rely on our Webhotel-supplier. And our webhotel doesn't wan't to change certain thing for security reasons. why not move the text-file into the DB? of course not as a whole. or why not elsewise take 25 lines from the textfile against the 700 rows in the DB? or not load the whole file in the array, check line by line - http://www.php.net/fgets -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fshockopen error while opening a https stream urgent help needed
Hello All I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian Php Configure command './configure' '--with-apxs=/www/bin/apxs' '--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d/' '--enable-trans-sid' '--disable-libxml' Registered PHP Streams : php, file, http, ftp Registered Stream Socket Transports : tcp, udp, unix, udg allow_url_fopen : On On Now when i try to open a https url via it gives me this error [Wed Jun 15 19:03:36 2005] [error] PHP Warning: fsockopen() [a href='function.fsockopen'function.fsockopen/a]: unable to connect to ssl:// 192.168.0.10:443http://www.google.com/url?sa=Dq=http://www.testcall.com:443(Unable to find the socket transport quot;sslquot; - did you forget to enable it when you configured PHP?) in /www/htdocs/testcon.php on line 2 I am trying to fix this from last few days but not successful can some please help me its very urgent. Do I need to register ssl and https as registered php streams? and if so how do i register them. Thankyou Regards Dhaval Choksi
[PHP] Re: How to print variable name and contents
You can use $$var constuction, what display name of $var function my_trace($var){ echo $$var.'='.$var.'br'; } nntp.charter.net [EMAIL PROTECTED] / : news:[EMAIL PROTECTED] I want to write a trace procedure and call it with variable names, and I am having trouble with the syntax. My goal is to have a procedure that will echo lines such as: Trace: $myvar=the contents of $myvar My attempt that didn't work is to write a function: function my_trace($m){ echo (\nbrTRACE: $m = ); eval(\$t=\$m\;); echo($t.br\n); } and call it with statements like: my_trace(\$my_var); my_trace(\$_ENV[\COMPUTERNAME\]); What am I doing wrong, and how should this be done? Also, should I post to a different group? Thanks, Gil Grodsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] incrementing a register global
You try to increment value of a var! to change it name u have to add $i to it's name like this foreach($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } foreach ($_GET as $var_name=$var_value) { $i++; echo $var_mane.$i; } if I correctly understand u Jay Blanchard [EMAIL PROTECTED] ???/ ? ?: news:[EMAIL PROTECTED] [snip] I dont know it this is possible, but here it goes. Hopefully I cac explain it well enough for someone to understand. I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } This is where my problem is. And I dont know if this is even possible, but if you look at the echo line in the loop I am trying to add the number of $i to the register global. I dont get an error in doing this, but when I run the script I get the number of $i instead of the value of $_GET['name1'] Like I said, I hope I explained this good enough for someone to know what I am trying to do. If anyone has any suggestions or comments about doing something like this please let me know. [/snip] Your terminology is a little mixed-up, you are not dealing with a 'register global' you are dealing with a variable and an array. If you will do this... print_r($_GET); You will see am array. then you can do something like this..(without the substring manipulation above) for($i = 0; $i count($_GET); $i++){ echo $_GET[$i] . \n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Complinging 4.2.0 on FC4 Test 3
Hi All I am trying to compile php 4.2 on Fedora Core 4 Test 3 The compilation throws this: make[1]: Entering directory `/home/kdedev/php-4.2.0' /bin/sh /home/kdedev/php-4.2.0/libtool --silent --mode=link gcc -I. -I/home/kdedev/php-4.2.0/ -I/home/kdedev/php-4.2.0/main -I/home/kdedev/php-4.2.0 -I/usr/local/apache/include -I/home/kdedev/php-4.2.0/Zend -I/home/kdedev/php-4.2.0/ext/mysql/libmysql -I/home/kdedev/php-4.2.0/ext/xml/expat -DLINUX=22 -DHAVE_SET_DUMPABLE -DUSE_HSREGEX -I/home/kdedev/php-4.2.0/TSRM -g -O2 -prefer-pic -o libphp4.la -rpath /home/kdedev/php-4.2.0/libs -avoid-version stub.lo Zend/libZend.la sapi/apache/libsapi.la main/libmain.la regex/libregex.la /home/kdedev/php-4.2.0/ext/ctype/libctype.la /home/kdedev/php-4.2.0/ext/mysql/libmysql.la /home/kdedev/php-4.2.0/ext/pcre/libpcre.la /home/kdedev/php-4.2.0/ext/posix/libposix.la /home/kdedev/php-4.2.0/ext/session/libsession.la /home/kdedev/php-4.2.0/ext/standard/libstandard.la /home/kdedev/php-4.2.0/ext/xml/libxml.la TSRM/libtsrm.la -lpam -lcrypt -lresolv -lm -ldl -lnsl -lresolv -lcrypt -ldl /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in /home/kdedev/php-4.2.0/ext/mysql/.libs/libmysql.al(my_error.lo) /lib/libc.so.6: could not read symbols: Bad value collect2: ld returned 1 exit status distcc[17817] ERROR: compile (null) on localhost failed make[1]: *** [libphp4.la] Error 1 make[1]: Leaving directory `/home/kdedev/php-4.2.0' make: *** [all-recursive] Error 1 Anybody know how to fix this? Ps: I know that PHP 5 is out, but I need this to port my program to 4.2+ 5.0 With kind regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- pgp17UiKbgt8g.pgp Description: PGP signature
[PHP] Using Exec Function
I'm Windows XP Professional SP1, Apache 2.0.50 and PHP 5.0.4 I'm trying to run a Win32 application using Exec() or Shell_Exec() but it doesn't work. In PHP.INI safe_mode is Off Apache is running under SYSTEM user I also tryed to use backtick operator as shown in http://php.net/manual/en/language.operators.execution.php but with no success, in the browser I get something like this: C:\Programmi\Apache Group\Apache2\htdocs\proveC:\HELLO.EXE php code ?php $test = `c:\mybat.bat`; echo pre$test/pre; ? mybat.bat C:\HELLO.EXE I'm still learning to use PHP, so this obviously beyond me. Davide -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OT Major Release Versions
Richard Lynch wrote: This is Computer Software philosophical musing, not specifically related to just PHP, but applicable to PHP and, well, all other OpenSource software... As I sit here surrounded by machines (physically and virtually) and realizing that while I've got most of them on auto-update as much as I can, or I've foisted off the updating on somebody else (for $$$) because I just don't *WANT* to be a SysAdmin... I'm still left with a lot of hours I'd have to invest to really be as current as I'd like to be. Let's take RedHat and other OSes, for example, only because I don't want this to devolve into the what version of PHP should I use thread that would be a hot button here. [Not that RedHat and or its versions aren't almost as hot, but...] No kidding! The way that they switched their codebase was, erm, interesting to say the least? I looked at Red Hat about 1.5 years ago and it took me a while to realize that Fedora Core was the free / development branch of their OS. And the prospect of using a box that never makes it out of development is, um, a reason to invest in Rolaids :) I've got RedHat 8, RedHat 9, FC2, and FC3 on different machines here and at client's sites. Oh, and Win XP Home, just for fun, for testing stupid IE bugs. I'd love to just move them all to FC3 (4 now?) but it would really be painful, and a lot more hours than I have available. Now, the thing is, it's finally gotten to the point where I'm willing to let the OS authors/maintainers (RedHat) update my box for me, because, with the current arms race in viruses and whatnot, that's got to be better than my inability to stay on top of things, even if occasionally it breaks something that actually worked before. Yes it's an unfortunate trade off, but not so bad if you Keep It Simple Stupid (tm). Most of the patches that get released to the wild (i.e. the stuff that you get if you don't closely watch any internals@ lists) have been tested for the OBVIOUS problems. It's the edge cases that cause the most bugs... My philosophical question is: Why can't the damn things just have an easy one-click button to go from major version to major version, or if I'm willing to turn over control of the OS versioning to RedHat (or whomever) just do it automatically? Okay, I can accept that for Microsoft and other proprietary software, that's a non-option, because they WANT to force you to BUY the new version, though with their new subscription model... Well, let's not get into THAT argument either. Forget the Windows box. But that's hard to do with my W2K workstation... with that pompous sound that blares out of the speakers every time I reboot! ;) In the past, I've been told that the various pieces of software version control and tracking means that you need the clean break of a major release to keep sanity in versions. I think that was true then, but is it really true now? I would tend to say: yes. Take PHP for example. There are a lot of Extensions floating out there (mostly in PECL) which rely heavily on internal function calls / behaviors. So if the maintainers of the PHP project decide to do something so fundamentally different that it's likely to break, like, everything... well then every extension out there needs to be recoded (and tested) or else it's going to break. There are currently two issues on the PHP internal list that directly affect this question of yours: Unicode and Module Dependencies. As we all know (or should know) PHP lacks proper Unicode support. Perl, Java, and a whole slew of others already have this support, but PHP (the language of the web?) doesn't. So there is work underway to fix this in the default distribution (I've heard maybe around PHP 5.5), but let's face it: this is going to break almost everything. Strings are the lifeblood of web applications and the addition of Unicode strings is going to require a lot of extensions to be upgraded. An excellent summary of this situation can be found here: http://www.gravitonic.com/downloads/talks/intlphpcon2005/php_unicode.pdf So clearly our extension authors need to get the word and upgrade their packages. A lot of them probably will make the changes for PHP 5.5 (or whatever version Unicode comes out in), but some might not. So if Redhat comes in and upgrades your version of PHP (even if they're good enough that they upgrade all of the extensions too!) then you're going to have an application that doesn't work because your extensions don't support Unicode. Now we move on to another discussion on the internals@ list. Someone (Jani?) mentioned they had started work on a patch for module dependencies. The proposal is still being worked on, e.g. where do we do the checking so that PHP startup doesn't slow down too dramatically? However, if the module lists dependencies properly... and the parent modules (e.g. PHP core) correctly indicate BC breaks... then we might have something
[PHP] [RE-PHRASE] PHP ZIP Class
I am in need of a PHP class or script or something that will allow me to designate a group of files to be zipped up, including PDF files, automagically. It must be compatible with WinZip as that is what the user will have access to. I have tried several things, a couple of classes, and some other tricks to no avail. There seems to be an issue with PDF's that I cannot figure out. The files are usually 1 byte too short when you try to open them after unzipping them, and are therefore corrupt. If anyone is aware of something would you please let me know? I am even willing at this point to add a couple of layers of abstraction to make this work as long as the process is relatively invisible to the end user. My desire is that it works like this; User clicks link [start automagic stuff] *whirring* //determine which files should go into archive *clicking* //put files in archive [/end automagic stuff] User presented with dialog box to save archive Any and all clues are appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using Exec Function
Exec is the way to go... it gives you output as well as any error status. Here's an example script that works for a Win32 program I have and you should be able to adapt to your own usage: ?php /** Notice that the command has extra quotes around it for the Windows command line as well as double-backslashes for each directory in the path */ $win_cmd = \C:\\Program Files\\The Regex Coach\\The Regex Coach.exe\; exec($win_cmd, $stdout, $stderr); print Standard output:\n; print_r($stdout); print Standard error:\n; print_r($stderr); ? -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Those checkboxes again
hi, I'm severely frustrated and perhaps you can help with what I have done wrong. The checkboxes I use to populate an intersection table work to add the records, and now I am trying to update them. It's almost there but producing some unexpected results when the form is submitted: the idea is that it displays the checkboxes as pre-selected if they're associated with the art_id in the intersection table. They're now appearing as all unselected. Any help is appreciated. ?php $query = ''; $result = 0; $art_id = $_POST['art_id']; print_r($_POST); if (isset($_POST['editrecordMedia'])){ if (!empty($_POST['media_types'])) { foreach($_POST['media_types'] as $type) { $query = UPDATE media_art SET media_id='$type', art_id='$art_id'; var_dump($query); mysql_query($query) or die(mysql_error()); } } else {echo mediatypes is empty;} //Closes if (!empty($media_types)) }//closes if (isset($_POST['editrecordMedia']) //If editrecord hasn't been set, but selectcartoon has, get the cartoon's recordset //This is just to get the title for display purposes $query = SELECT art_title FROM art WHERE art_id='$art_id'; //end $media_query = SELECT media.media_id, media.media_name, media_art.art_id FROM media LEFT JOIN media_art ON media_art.media_id=media.media_id AND media_art.art_id='$art_id'; //These $art results are just to get the title for display purposes $art_result = mysql_query($query); $art_rows = mysql_fetch_assoc($art_result); //end $media_result = mysql_query($media_query); $checkbox_media = array (); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' ; if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= checked ; } $checkbox_media[] .= /{$media_rows['media_name']} ; } ? table align=center trth colspan=4Main Menu/th/tr tr tda href=addrecord.phpAdd A Record/a/td tda href=chooserecord.phpEdit A Record/a/td tda href=deleterecord.phpDelete A Record/a/td /tr /table form action=?php echo $_SERVER['PHP_SELF']; ? method=post name=editrecordMedia input type=hidden name=art_id value=?php echo $art_id ;? Choose media related to strong?php echo $art_rows['art_title'];?/strongbr /br / Media: ?php echo join($checkbox_media); ? input type=submit name=editrecordMedia value=Update /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image upload form
Nadim Attari wrote: http://www.php-help.net/sources-php/image.upload.function.353.html Thanks, Nadim, I'm sure that is a great script. I am really trying to learn how it's working, so I'm trying to stay away from pre-rolled stuff as much as I can and beg for the mercy of the list in building these simple scripts. Believe it or not I'm actually improving pretty fast (despite scriptorial evidence to the contrary on this list)! Thanks again, JJ Regards, Nadim Attari Alienworkers.com Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; // print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [RE-PHRASE] PHP ZIP Class
I have no clue why your PDF's are reading one byte short. However, I did find a class over at SourceForge which claims to do exactly what you want: http://sourceforge.net/projects/few/ noteI have never used this package and have no idea if it's going to explode when you use it./note -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT ??: Form posting without leaving form
Thanks. This worked out to be the best solution of the suggestions I had received. I've implemented it and it works as advertised. Bruce John Browne wrote: Check out the xmlhttp object in Javascript: http://jibbering.com/2002/4/httprequest.html On 6/13/05, Kall, Bruce A. [EMAIL PROTECTED] wrote: This is perhaps a javascript question Is there a way to post a form to a url without having a user submit from the form? I have a php web page that is a detailed form with a lot of fields. If the user does some work on this form and let's it sit, their session can time out (I had this happen to the user after it sat for 2 hours). Is there some way to have a timer in the page and have partial form results sent back to the server, but still leave the form on the screen as-is? In other words, I want to have the client periodically post the form data back to the server, but leave the same web page displayed. Thanks, Bruce -- 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-PHRASE] PHP ZIP Class
I am in need of a PHP class or script or something that will allow me to designate a group of files to be zipped up, including PDF files, automagically. It must be compatible with WinZip as that is what the user will have access to. I have tried several things, a couple of classes, and some other tricks to no avail. There seems to be an issue with PDF's that I cannot figure out. The files are usually 1 byte too short when you try to open them after unzipping them, and are therefore corrupt. If anyone is aware of something would you please let me know? I am even willing at this point to add a couple of layers of abstraction to make this work as long as the process is relatively invisible to the end user. My desire is that it works like this; Why can't you just install zip and wrap it up in a system() call? That's always worked for me... Info-ZIP's Zip http://www.info-zip.org/Zip.html User clicks link [start automagic stuff] *whirring* //determine which files should go into archive *clicking* //put files in archive [/end automagic stuff] User presented with dialog box to save archive Any and all clues are appreciated. -- 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: [RE-PHRASE] PHP ZIP Class
Hello, on 06/16/2005 11:05 AM Jay Blanchard said the following: I am in need of a PHP class or script or something that will allow me to designate a group of files to be zipped up, including PDF files, automagically. It must be compatible with WinZip as that is what the user will have access to. I have tried several things, a couple of classes, and some other tricks to no avail. There seems to be an issue with PDF's that I cannot figure out. The files are usually 1 byte too short when you try to open them after unzipping them, and are therefore corrupt. If anyone is aware of something would you please let me know? I am even willing at this point to add a couple of layers of abstraction to make this work as long as the process is relatively invisible to the end user. My desire is that it works like this; User clicks link [start automagic stuff] *whirring* //determine which files should go into archive *clicking* //put files in archive [/end automagic stuff] User presented with dialog box to save archive Any and all clues are appreciated. Here you may find a few Zip classes, in case you have not checked yet: http://www.phpclasses.org/browse/class/42.html -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Fshockopen error while opening a https stream urgent help needed
Hello, on 06/16/2005 09:08 AM choksi said the following: Hello All I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian Php Configure command './configure' '--with-apxs=/www/bin/apxs' '--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d/' '--enable-trans-sid' '--disable-libxml' Registered PHP Streams : php, file, http, ftp Registered Stream Socket Transports : tcp, udp, unix, udg allow_url_fopen : On On Now when i try to open a https url via it gives me this error [Wed Jun 15 19:03:36 2005] [error] PHP Warning: fsockopen() [a href='function.fsockopen'function.fsockopen/a]: unable to connect to ssl:// 192.168.0.10:443http://www.google.com/url?sa=Dq=http://www.testcall.com:443(Unable to find the socket transport quot;sslquot; - did you forget to enable it when you configured PHP?) in /www/htdocs/testcon.php on line 2 I am trying to fix this from last few days but not successful can some please help me its very urgent. Do I need to register ssl and https as registered php streams? and if so how do i register them. You need to compile PHP with OpenSSL. Alternatively, you can use the curl library. You may also want to take a look at this HTTP client class that uses fsockopen or curl depending on which is available: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A more sane problem description
Sorry, The last post I made was fairly incomprehensible. I'm trying to a) edit information which is already in an intersection table, while b) allowing the user to add new information to the intersection table The information in it is pulled from the table media_art and I grab the media_art_id, media_id and art_id. If a media_id is associated with an art_id in the table, I grab all three and make the checkbox for that media_id checked. I need to understand how I can make it so that a) if the user UNchecks the box, then the row containing that media_id will be deleted. AND b) if the user checks a new box, a new row will be inserted into the media_art table containing the media_id and the art_id. This is so far beyond my comprehension it's not even funny. This is what I have so far - thank you in advance for the help.: ?php $query = ''; $result = 0; $art_id = $_POST['art_id']; $media_art_id = $_POST['media_art_id']; //print_r($_POST); if (isset($_POST['editrecordMedia'])){ if (!empty($_POST['media_types'])) { foreach($_POST['media_types'] as $type) { $query = UPDATE media_art SET media_id='$type', art_id='$art_id' WHERE media_art_id='$media_art_id' LIMIT 1; print_r($query); mysql_query($query) or die(mysql_error()); } } else {echo mediatypes is empty;} //Closes if (!empty($media_types)) }//closes if (isset($_POST['editrecordMedia']) //If editrecord hasn't been set, but selectcartoon has, get the cartoon's recordset //This is just to get the title for display purposes $query = SELECT art_title FROM art WHERE art_id='$art_id'; //end $media_query = SELECT media.media_id, media.media_name, media_art.art_id, media_art.media_art_id FROM media LEFT JOIN media_art ON media_art.media_id=media.media_id AND media_art.art_id='$art_id'; //These $art results are just to get the title for display purposes $art_result = mysql_query($query); $art_rows = mysql_fetch_assoc($art_result); //end $media_result = mysql_query($media_query); $checkbox_media = array (); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' ; if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= checked media_art_id='{$media_rows['media_art_id']}'; } $checkbox_media[] .= /{$media_rows['media_name']} ; } ? table align=center trth colspan=4Main Menu/th/tr tr tda href=addrecord.phpAdd A Record/a/td tda href=chooserecord.phpEdit A Record/a/td tda href=deleterecord.phpDelete A Record/a/td /tr /table form action=?php echo $_SERVER['PHP_SELF']; ? method=post name=editrecordMedia input type=hidden name=art_id value=?php echo $art_id ;? Choose media related to strong?php echo $art_rows['art_title'];?/strongbr /br / Media: ?php echo join($checkbox_media); ? input type=submit name=editrecordMedia value=Update /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include and extending classes
I'm trying to consolidate code in a new project. My dirs are: / /inc core.class.php /mods /mods/system system.class.php //extends core.class.php user.class.php //extends system.class.php In core.class.php I have my generic special html methods and my db connection. I'm having trouble accessing $this-db (initialized in core.class.php) from user.class.php. Am I wrong in thinking user.class.php should be able to access methods/attributes of core.class.php? I'm running PHP 5.0.4 on Windows //core.class.php class core { var $db; function core(){ //initialize db connection (works from here) } //Other methods } //system.class.php include ../../inc/core.class.php; class system extends core { function system(){ } } //user.class.php include system.class.php; class user extends system{ function user(){ //$this-db cannot be used here } } TIA, Mike There are no stupid questions. --my professors until I came into class. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SSL ldap bind
Hello list I am trying to do an ssl ldap bind to novell's edir 8.7. I have followed the examples from http://us4.php.net/manual/en/function.ldap-connect.php I know these examples are for AD, but they should be close to the same. I have exported the server cert and made the changes to ldap.conf. and restarted the ldap service from the command line on a linux box this works: ldapsearch -H ldaps://ldapserver -x but this does not ldapsearch -H ldaps://ldapserver and returns the error: ldap_ssl_interactive_bind_s: Unknown authentication method (86) additional info: SASL(-4): no mechanism available: No worthy mechs found if i run the above command with the debug option -d 16 it says something about supportedSASLMechanisms1...NMAS_LOGIN notice that on the one that does not work i am not using the -x option. This option allows you todo simple authentication. In php i can do a bind on the normal port of 389, but anything on 636 fails. $ldapserver=ldapserver; //this works $ldapserver=ldaps://ldapserver; //this fails $ldapserver=ldapserver:636; //this fails if (!($ldap = ldap_connect($ldapserver))) { die (Could not connect to LDAP Server: $server\n); } else { print Connected\n; } if (!(ldap_bind($ldap, $bindUser,$bindPass))) { die (Unable to Bind); } else { print Bound\n; } I am assuming the reason that it is failing is that i am getting that same SASL error. Is there anyway to make ldap_bind() use simple authentication?? I looked at ldap_set_option() and could not find anything about simple authentication. http://us4.php.net/manual/en/function.ldap-set-option.php This page has a link to: http://www.openldap.org/devel/cvsweb.cgi/~checkout~/doc/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt This page says something about a constant value LDAP_SASL_SIMPLE. Is there anyway to configure this? I am using: PHP 4.3.3 --with-openssl --with-ldap=yes Apache 2.0 Openldap OpenSSL 0.9.7b 10 Apr 2003 I have googled all over for this, any help would be appreciated. Thanks, Jason Motes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include and extending classes
Mike Smith wrote: I'm trying to consolidate code in a new project. My dirs are: / /inc core.class.php /mods /mods/system system.class.php //extends core.class.php user.class.php //extends system.class.php In core.class.php I have my generic special html methods and my db connection. I'm having trouble accessing $this-db (initialized in core.class.php) from user.class.php. Am I wrong in thinking user.class.php should be able to access methods/attributes of core.class.php? http://php.net/manual/en/function.include.php So if user.class.php include()'s core.class.php then you should have the class definition (for methods) as well as any objects that were created. in core.class.php. In other words all variables get imported into the current scope in the calling file. I'm running PHP 5.0.4 on Windows //core.class.php class core { var $db; Is this actually var? Did you possibly call this private / protected? Var == Public, so the db property of any core class should be available. function core(){ //initialize db connection (works from here) } //Other methods } //system.class.php include ../../inc/core.class.php; Note that relative paths can cause problems when you switch the current working directory. This likely isn't a problem for this particular issue you're having, but it's a gotcha for future work. What I do for relative includes is something like: include dirname(__FILE__) . ../../inc/core.class.php; class system extends core { function system(){ /** See note below */ $this-core(); } } //user.class.php include system.class.php; class user extends system{ function user(){ //$this-db cannot be used here What exactly do you mean by cannot be used... do you mean that you don't have access to db? Or perhaps you expect cascading __constructor calls which PHP does not do by default. Instead you need to call the parent constructor *explicitly*. $this-system(); } } TIA, Mike There are no stupid questions. --my professors until I came into class. -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL ldap bind
$ldapserver=ldapserver; //this works $ldapserver=ldaps://ldapserver; //this fails $ldapserver=ldapserver:636; //this fails if (!($ldap = ldap_connect($ldapserver))) { die (Could not connect to LDAP Server: $server\n); } else { print Connected\n; } if (!(ldap_bind($ldap, $bindUser,$bindPass))) { die (Unable to Bind); } else { print Bound\n; } Oh yeah, My connects don't fail. It fails on the bind, even if it is anomynous. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] If I have 2 arrays...
Array ( [0] = ORIGTN [1] = PSP_BILL1 [2] = PSP_BILL2 [3] = PSP_BILL3 [4] = PSP_CITY [5] = PSP_STATE [6] = PSP_ZIP [7] = PSP_CONNECT [8] = STATUS [9] = _0404 [10] = _0405 [11] = _0406 [12] = Total [13] = Rate [14] = Total Comp ) Array ( [0] = PSP_BILL1 [1] = PSP_BILL3 [2] = PSP_CITY [3] = PSP_STATE [4] = PSP_ZIP [5] = TOTAL COMP ) ...shouldn't array_intersect($arr1, $arr2) return an array? Array ( [0] = PSP_BILL1 [1] = PSP_BILL3 [2] = PSP_CITY [3] = PSP_STATE [4] = PSP_ZIP ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: If I have 2 arrays...
Close... I think array keys are preserved from the (original) first array, but other than that those appear to be the values that should intersect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: If I have 2 arrays...
[snip] Close... I think array keys are preserved from the (original) first array, but other than that those appear to be the values that should intersect. [/snip] After a var_dump I am seeing that there is an extra space in each element of one array, so no intersection occurs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: If I have 2 arrays...
[snip] Close... I think array keys are preserved from the (original) first array, but other than that those appear to be the values that should intersect. [/snip] You are correct, I was more worried about the values -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If I have 2 arrays...
Hello Jay, Thursday, June 16, 2005, 5:54:40 PM, you wrote: JB ...shouldn't array_intersect($arr1, $arr2) return an array? Works perfectly for me (code below) PHP 4.3.11 ?php $array1 = array('ORIGTN', 'PSP_BILL1', 'PSP_BILL2', 'PSP_BILL3', 'PSP_CITY', 'PSP_STATE', 'PSP_ZIP', 'PSP_CONNECT', 'STATUS', '_0404', '_0405', '_0406', 'Total', 'Rate', 'Total Comp'); $array2 = array('PSP_BILL1', 'PSP_BILL3', 'PSP_CITY', 'PSP_STATE', 'PSP_ZIP', 'TOTAL COMP'); $array3 = array_intersect($array1, $array2); print_r($array1); print_r($array2); print_r($array3); ? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: If I have 2 arrays...
Jay Blanchard wrote: [snip] Close... I think array keys are preserved from the (original) first array, but other than that those appear to be the values that should intersect. [/snip] After a var_dump I am seeing that there is an extra space in each element of one array, so no intersection occurs. Well then there you have it... having an extra space means that the strings in the first array won't match the strings in the second array. Perhaps you can array_intersect(array_walk($array1, 'trim'), $array2) -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Setup...
Hi there! I have been stumbling my way through PHP for a while now and I have finally decided that I need to set up my development machine with a local testing / debugging setup so that I can stop uploading all of my blunders to my public site to test... I am running XP Pro SP2 with IIS installed and running... Where do I need to go from here? I have downloaded the latest PHP Windows Binary but I don't know if I should install it first, or if I should try to find MySQL to install first... Any help on setting up this monster would be helpful!!! TIA! Chase -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] report
The original message was included as attachment -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Setup...
On 6/16/05, Chase [EMAIL PROTECTED] wrote: Hi there! I have been stumbling my way through PHP for a while now and I have finally decided that I need to set up my development machine with a local testing / debugging setup so that I can stop uploading all of my blunders to my public site to test... I am running XP Pro SP2 with IIS installed and running... Where do I need to go from here? I have downloaded the latest PHP Windows Binary but I don't know if I should install it first, or if I should try to find MySQL to install first... Any help on setting up this monster would be helpful!!! It doesn't matter if you install MySQL or PHP first since you would most likely be installing both precompiled, not from source. Enabling MySQL support in PHP on Windows consists of properly defining your extensions directory in your php.ini, placing your php_mysql.dll in that defined extensions directory, and finally you would uncomment the MySQL extension line. extension_dir = c:\php\ext extension=php_mysql.dll I would use the regular PHP installer, then add the files from the non-installer download to the initial install in c:\php. That will get you a ton of extra extensions you may or may not want. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru() passing variables
On Thu, June 16, 2005 11:44 am, Chris Herold said: Thanks for the tips; however, I think I am still missing something. My perl script is running when called by passthru() because within the body of the simple test code I have set it up to: code print Content-type: text/html\n\n; print Source ID: $source_id; /code and when I run the php with the full address to my file (abbreviated here and before for brevity): $source_id = test; passthru(/home/.../cgi-bin/passthru_test.cgi $source_id); it prints out Content-type: text/html Source ID: Which is what I expect although missing the printout for the source_id value. Is Perl set with that Tainted mode thing where it won't *LET* you use arguments from the outside world unless you at least pretend to scrub them? To test, what happens when you run text.cgi test from the command line without PHP in the picture? Re:Exec() I have tried exec and it does not seem to be working for me in terms of producing an error output. I set it up for: exec(/home/httpd/vhosts/omniomix.com/cgi-bin/passthru_test.cgi $source_id,$out,$err); and I get no printout at all. Is there something obvious that I am doing wrong? exec won't print anything at all. You have to take further action to print out $out and/or $err. Also, move the quote at the end of $err to be after $source_id As it is now, you are passing 2 more arguments with commas to your Perl/cgi script, not providing 2 more arguments to exec. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL ldap bind
snip I am trying to do an ssl ldap bind to novell's edir 8.7. I have followed the examples from http://us4.php.net/manual/en/function.ldap-connect.php I know these examples are for AD, but they should be close to the same. I have exported the server cert and made the changes to ldap.conf. and restarted the ldap service /snip I guess it helps if you restart apache after you make the above changes. Everthing is working now! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] undefined index
I have a bit of code that splices up a cookie into 4 bits so the information can be displayedin a neat way in a table if ($quantity == 0){ } else { $pieces = explode( , $quantity); $formatted_price = sprintf('%0.2f', $pricecode); echo table width=\240\ border=\0\ cellpadding=\2\ cellspacing=\5\trtd valign=\top\ align=\right\ width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd align=\left\ width=\200\$pieces[1] $pieces[2] $pieces[3] $pieces[4]/tdtd valign=\top\ align=\left\ width=\80\$formatted_price/td/tr/table; } } The trouble is I get a NOTICE that tells me the indexes 1 to 4 have not been defined. how do I do this. What is the output of: print_r($pieces) if placed right after the explode() line? Maybe $quantity isn't what you think it is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question to example from manual
Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? System WinXP Apache 2.0.50 php 5.0.3 thx janbro Example 7-6. Static variables with recursive functions ?php function Test() { static $count = 0; $count++; echo $count; if ($count 10) { Test (); } $count--; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to example from manual
janbro wrote: Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? System WinXP Apache 2.0.50 php 5.0.3 Because you've defined the function, but you've never called it. thx janbro Example 7-6. Static variables with recursive functions ?php function Test() { static $count = 0; $count++; echo $count; if ($count 10) { Test (); } $count--; } Test(); ? -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to example from manual
autsch, that's true, sorry for disturbing thx Jason janbro Jason Barnett schrieb: janbro wrote: Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? System WinXP Apache 2.0.50 php 5.0.3 Because you've defined the function, but you've never called it. thx janbro Example 7-6. Static variables with recursive functions ?php function Test() { static $count = 0; $count++; echo $count; if ($count 10) { Test (); } $count--; } Test(); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to example from manual
autsch, that's true, sorry for disturbing thx Jason janbro Jason Barnett schrieb: janbro wrote: Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? System WinXP Apache 2.0.50 php 5.0.3 Because you've defined the function, but you've never called it. thx janbro Example 7-6. Static variables with recursive functions ?php function Test() { static $count = 0; $count++; echo $count; if ($count 10) { Test (); } $count--; } Test(); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question to example from manual
On Thu, June 16, 2005 1:31 pm, janbro said: Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? System WinXP Apache 2.0.50 php 5.0.3 thx janbro Example 7-6. Static variables with recursive functions ?php function Test() { static $count = 0; $count++; echo $count; if ($count 10) { Test (); } $count--; } ? You defined the function, but never called it. Add a line that does: Test(); at the end. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL ldap bind
On Thu, June 16, 2005 9:45 am, Jason Motes said: WILD GUESS ALERT! and returns the error: ldap_ssl_interactive_bind_s: Unknown authentication method (86) additional info: SASL(-4): no mechanism available: No worthy mechs found if i run the above command with the debug option -d 16 it says something about supportedSASLMechanisms1...NMAS_LOGIN It sounds to me like something is not quite right in the SSL authentication setup... Can PHP read the directories and files where your keys are? Can it *FIND* those diretories? How is it supposed to know to use those directories? http://www.openldap.org/devel/cvsweb.cgi/~checkout~/doc/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt This page says something about a constant value LDAP_SASL_SIMPLE. Is there anyway to configure this? Got me there. Unless there's some kind of generic PHP function like ldap_set_option() or something like that... I am using: PHP 4.3.3 --with-openssl --with-ldap=yes Apache 2.0 Openldap OpenSSL 0.9.7b 10 Apr 2003 Have you confirmed with ?php phpinfo();? that OpenSSL actually got compiled in? A lot of time ./configure will continue to build PHP even if one of the Modules you asked for couldn't be found. You'll have error messages buried in the logs from configure, but it will be painfully *NOT* obvious that it didn't work ?php phpinfo();? makes it painfully obvious. Either you've got a whole section there about OpenSSL and its version and whatnot, or it didn't get compiled in. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [RE-PHRASE] PHP ZIP Class
On Thu, June 16, 2005 7:05 am, Jay Blanchard said: I am in need of a PHP class or script or something that will allow me to designate a group of files to be zipped up, including PDF files, automagically. It must be compatible with WinZip as that is what the user will have access to. I have tried several things, a couple of classes, and some other tricks to no avail. There seems to be an issue with PDF's that I cannot figure out. The files are usually 1 byte too short when you try to open them after unzipping them, and are therefore corrupt. If anyone is aware of something would you please let me know? I am even willing at this point to add a couple of layers of abstraction to make this work as long as the process is relatively invisible to the end user. My desire is that it works like this; User clicks link [start automagic stuff] *whirring* //determine which files should go into archive *clicking* //put files in archive [/end automagic stuff] User presented with dialog box to save archive Any and all clues are appreciated. +1 on the http://php.net/exec plus using zip on the command line. Hopefully the users don't have direct control over what gets passed in as an argument... ; rm -rf / would be bad, for example... http://php.net/escapeshellarg for that. Performance might be an issue, but probably not if you are zipping up PDFs and delivering them in a download... The extra overhead of a shell isn't *THAT* much. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: OT Major Release Versions
[the responses in the latter parts of this are more relevant to PHP-general than the first half... Sorry... Skim down for PHP-GENERAL STUFF] On Thu, June 16, 2005 7:28 am, Jason Barnett said: Richard Lynch wrote: Let's take RedHat and other OSes, for example, only because I don't want this to devolve into the what version of PHP should I use thread that would be a hot button here. [Not that RedHat and or its versions aren't almost as hot, but...] No kidding! The way that they switched their codebase was, erm, interesting to say the least? I looked at Red Hat about 1.5 years ago and it took me a while to realize that Fedora Core was the free / development branch of their OS. And the prospect of using a box that never makes it out of development is, um, a reason to invest in Rolaids :) It's not that bad, in Truth, only in Marketing. See, they want to SELL the RedHat name to Enterprise for big money. But they quickly found (after a disastrous attempt to only have Enterprise) that they *need* the OpenSource community to develop and, more importantly QA the new versions. In Truth, an FCx box is really just the same as the old RedHat (Mandrake, whatever) boxes. You can, if you want, be risky and add in non-recommended bleeding edge packages... But it doesn't do that unless you push it. But that's hard to do with my W2K workstation... with that pompous sound that blares out of the speakers every time I reboot! ;) Errrm. Just turn off all the Sounds in the Control Panel? I haven't heard that annoying sound in AGES. PHP-GENERAL STUFF If you're talking about literally breaking the bank... well, for subscription-based companies I bet that an auto-updating OS would be A Good Thing. Because you're already sold on the new product (it got updated to your machine for you!) and it's an easier sell to convince you to keep your support contract for the new product. I meant the intellectual/open-source bank of Developers and their time. I don't really care about the subscription-based OS companies, frankly. I wouldn't expect them to change on this, as it's revenue they can't pass up to *also* charge extra fees every time a major upgrade happens... Or they'll just be forced to make incompatible hardware changes, and make up the money there. Most likely both, if history is any indicator. :-^ From a technical perspective though... I just think there are too many dependency nightmares for Redhat to deal with. :-/ Maybe I'm just not aware of how the whole RPM thingy works, but I'm guessing that whoever writes it doesn't check external libraries that PHP might depend on (or libraries that are built on top of PHP for that matter). I don't know, for sure, but I think there's a *LOT* of dependency checking in RPMs... At least, I've failed to install RPMs I needed, because of dependency failures. Over-riding those safeties generally led to glitches, at best, or downright un-usable systems. Especially that glibc thing. Man, that really sucked. [Yes, I know why they did what they did. It *still* sucked from the user perspective.] And I believe the reason the PHP RPMs tend to lag so much is specifically so the RPM-makers can hammer out everything to make the various Modules of PHP they feel they need to have in the RPM still work and they even QA them a fair amount. Maybe the RPM-makers don't dig down into the guts of PHP Modules as much as they should in an automated way. Or maybe they do. They *must* be doing something somewhere along the line, even if it's making a whole new source RPM and throwing out any Modules (by hand) that don't work, and if you need PHP Module X, and had PHP Module X before, you either lose out, or you don't get the new RPM because it knows it won't work. Either way, though, it seems to me that whatever it is all these systems/people/processes are doing in that regard, it isn't going to be any WORSE off to just jump from PHP 4.x to PHP 5.0 for *most* people, or at least to give them that option in a one-click, ez-rollback way. And to do the same for the OS, which is where, for me at least, I really need this change-over to just work Ideally, all the big PHP packages out there (even the ones I won't use due to their security history) that everybody uses is already working on having a PHP 5 version to roll out -- even if that means they just slapped an ini-setting line at the top of their code to be PHP4 BC until they really fix it. I know a lot of you guys actually ENJOY that kind of stuff, and playing with the new distro is your idea of a Good Time. But is that what Joe Sixpack and Betsy Buick really want? Not *this* Joe Sixpack. I gladly welcome auto-updating programs that don't break BC. And often times I'll bite the bullet and break BC if there's new functionality that proves worth the time and effort. [thinks... perhaps I need to look into better version control for my own code...] I've only been intending to set up my own
Re: [PHP] Using Exec Function
On Thu, June 16, 2005 6:23 am, Davide Pasqualini said: I'm Windows XP Professional SP1, Apache 2.0.50 and PHP 5.0.4 I'm trying to run a Win32 application using Exec() or Shell_Exec() but it doesn't work. In PHP.INI safe_mode is Off Apache is running under SYSTEM user I also tryed to use backtick operator as shown in http://php.net/manual/en/language.operators.execution.php but with no success, in the browser I get something like this: C:\Programmi\Apache Group\Apache2\htdocs\proveC:\HELLO.EXE php code ?php $test = `c:\mybat.bat`; echo pre$test/pre; ? mybat.bat C:\HELLO.EXE I'm still learning to use PHP, so this obviously beyond me. What do you expect hello.exe to do?... Cuz it looks like it's printing out *something* even if it's not what you want it to print out. C:\Programmi\Apache Group\Apache2\htdocs\prove is the output of hello.exe far as I can see. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about system function call
Hello, I'm trying to do the following in php. system(/usr/bin/smbutil -v view //[EMAIL PROTECTED]) to be able to view some shares folders on a server. Unfortunately, if I use this command in console, I get prompted for a password. Is there a way in php to wait for a password and enter it automatically? Please let me know. Thanks! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fshockopen error while opening a https stream urgent help needed
On Thu, June 16, 2005 5:08 am, choksi said: I'm not 100% sure, but... I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian Php Configure command './configure' '--with-apxs=/www/bin/apxs' '--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d/' This didn't work You know it didn't work because 'ssl' didn't show up in the list of stream and sockets below. You may be able to find out more about why it didn't work in the config.log file in your PHP source directory. Most likely, you're using the OpenSSL source directory instead of where SSL got installed, which is probably /usr/ or /usr/local In other worlds, go back to OpenSSL and do: make install and watch all the stuff fly by VERY carefully. See where it (probably) says stuff about where it's copying the .so and .h files. Whatever directories those are, take the common ancestor directories, and use that for --with-openssl-dir You may also need to do ldconfig for the new system libraries to get registered, after you do the make install of OpenSSL. But ldconfig is only for some distributions. Others do the same thing other ways. Some do it automatically. YMMV. '--enable-trans-sid' '--disable-libxml' Registered PHP Streams : php, file, http, ftp Registered Stream Socket Transports : tcp, udp, unix, udg allow_url_fopen : On On -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Freing memory resources?
Is they any way you could combine the UPDATE queries? I suspect not, but those are the ones that are probably what will get worse and worse over time as the file/db grows. All the left outer joins are not gonna help either, but that's only a few hundred rows, right?... But will it grow? Finally, if nice -19 isn't supported on Windows (I suspect not) a simple sleep call (see below) could give the rest of the system a chance to do useful work. On Thu, June 16, 2005 3:28 am, Gustav Wiberg said: ?php //This script was updated 2005-06-16 //by Gustav Wiberg / [EMAIL PROTECTED] //Please visit www.varupiraten.se // require(phpfunctions/dbsafety.php); //Parameters that sets the rules for importing // static $fileName = import/GNTprisfil.txt; static $logFileName = logfiles/gnt.txt; static $limitSteps = 25; static $saldoColumn = 6; static $artNrColumn = 2; static $priceColumn = 5; static $row = 1; static $updateActions = 0; static $deleteActions = 0; static $checkLev = gn-; //Function for creating a logfile //and writing to screen // function writeNow($str, $logFileName) { //Create a handle for writing (appending) // $logHandle = fopen($logFileName,a); fwrite($logHandle, $str\r\n); echo $str . br; //Close file for writing to logfile // fclose($logHandle); } //Set limitstart for first time // if (!isset($limitStart)) {$limitStart = 0;} if (isset($_REQUEST[updateActions])) {$updateActions = $_REQUEST[updateActions];} if (isset($_REQUEST[deleteActions])) {$deleteActions = $_REQUEST[deleteActions];} if (isset($_REQUEST[startTime])) {$startTime = $_REQUEST[startTime];} if ($_REQUEST[limitstart]) { $limitStart = $_REQUEST[limitstart]; } require (phpfunctions/opendb.php); $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // if ($limitStart == 0) { $dbArray = mysql_fetch_array($querys); $nrOfProducts = $dbArray[cn]; echo Antal produkter: $nrOfProducts; //Create logfile or delete all content from current logfile // $logHandle = fopen($logFileName,wb); fclose($logHandle); //Get starttime of script // $startTime = time(); } else { $nrOfProducts = $_REQUEST[nrofproducts]; } if ($limitStart $nrOfProducts) { $nrSeconds = time() - $startTime; $nrMinutes = $nrSeconds / 60; ? bKlar/b med uppdatering av saldo och ev. borttagningar fr bGNT/b.brbr bTid fr uppdatering:/b ?php echo $nrSeconds;? sekunder eller ?php echo $nrMinutes;? minuterbrbr bAntal uppdateringar:/b ?php echo $updateActions;?br bAntal produkter som ej visas efter uppdatering: /b ?php echo $deleteActions;?br a href=captech_checksaldo_step2.php?deleteActions=0updateActions=0Kolla captech produkter/a ?php exit; } //Check if the filename exists first! //If not, then exit script if (!file_exists($fileName)) { echo Filen $fileName finns inte!brAvslutar scriptet nu!; exit; } //Go through database with products from GNT // $sql = SELECT tbvara.IDVara, tbvara.Saldo, tbvara.startPris, tbvara.Varunamn, tbvara.synligVara, tbvara.lastPris, tbunderkategori.marginalProcent, tbunderkategori.Underkategori FROM tbvara; $sql .= LEFT JOIN tbunderkategorivara ON (tbvara.IDVara = tbunderkategorivara.ForIDVara); $sql .= LEFT JOIN tbunderkategori ON (tbunderkategori.IDUnderKategori = tbunderkategorivara.ForIDUnderKategori); $sql .= WHERE Varunamn LIKE '$checkLev%' AND tbunderkategori.marginalProcent-1 AND tbunderkategori.Underkategori'Ej tilldelade' ORDER BY IDVara LIMIT $limitStart,$limitSteps; //echo $sql; //exit; $querys = mysql_query($sql); while ($toarray = mysql_fetch_array($querys)) { //Get current row from db // $idproduct = $toarray[IDVara]; $dbSaldo = $toarray[Saldo]; $dbArtNr = $toarray[Varunamn]; $dbPris = $toarray[startPris]; $dbSynligVara = $toarray[synligVara]; $dbLastPris = $toarray[lastPris]; $dbMarginalProcent = $toarray[marginalProcent]; $dbUnderKategori = $toarray[Underkategori]; //Taken from table tbunderkategori // $marginalProcent = intval($dbMarginalProcent); //Delete $checkLev from string $dbArtNr for the sake of comparing //(take away the three first characters) // $dbArtNr = substr($dbArtNr, 3); //Go through whole textfile and compare with current row in db // $handle = fopen($fileName, r); $foundProduct= false; ob_start(); while (($data = fgetcsv($handle, 1000, ;)) !== FALSE) { $textSaldo = $data[$saldoColumn]; $textArtNr = $data[$artNrColumn];
Re: [PHP] passthru() passing variables
I dunno what 127 actually means, but the last time we saw it on this list, it boiled down to: You can't even run your 'sh' shell, much less Perl in that shell. Check what's in /bin/sh and what its permissions are. Make sure it's actually a valid shell binary, and not something bogus. If that's not it, keep digging. Somewhere, somehow, you've got something in permissions that is not allowing you to run a process/binary you need. If it's not /bin/sh, look at Perl. If it's not Perl, check your permissions on test.cgi again. Remember that PHP does not run as you with all your permissions - If you can 'su' to the user PHP runs as, this could get a lot easier to test... Check httpd.conf User directive to be certain you know what user PHP runs as, or check ?php phpinfo()? output. On Thu, June 16, 2005 11:55 am, Chris Herold said: I'm sorry, when I do the exec() */properly/ *I get OS Error: 127 Content-type: text/html Source ID: Richard Lynch wrote: On Wed, June 15, 2005 5:36 pm, Chris Herold said: I have been told that in order to pass variables via passthru() to another script (in my case, a perl script) one can do the following ... passthru(home/test.cgi $var) and that $var will then be passed through to the cgi. I have tried this and failed. Is this the proper format or is there something that I am missing. You may want to use exec first, so you can more easily capture the error output and error codes. exec(home/test.cgi $var, $output, $error); if ($error){ //You should probably use error_log here in your real code... //ASSUME this is going to break some day, for whatever reason. //You'll need it logged unless you like dealing with error reports like: //Hey, the website broke yesterday. echo OS Error: $errorbr /\n; echo implode(br /, $output); exit; } echo $output; Meanwhile, odds are *REALLY* good that you're not even calling the test.cgi script because you haven't provide a path that PHP can use. home/test.cgi would be assuming that home was in the same directory as your PHP script, and even that is kinda iffy depending on where you do this from the webserver or CLI... I would recommend using FULL PATH to *everything* in exec (and passthru) /full/path/to/home/test.cgi /full/path/to/any/args.txt Also be sure to use the escapeshellargs function to make your $var data kosher if it comes from the outside world. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about system function call
On Thu, June 16, 2005 2:43 pm, Tom Cruickshank said: I'm trying to do the following in php. system(/usr/bin/smbutil -v view //[EMAIL PROTECTED]) to be able to view some shares folders on a server. Unfortunately, if I use this command in console, I get prompted for a password. Is there a way in php to wait for a password and enter it automatically? Please let me know. Thanks! smbutil may or may not accept a password as an argument. Something like: smbutil --password=SECRET -v view //[EMAIL PROTECTED] If not, you MIGHT be able to do: system(echo SECRET\n | /usr/bin/smbutil -v view //[EMAIL PROTECTED]); You may need to dink around with the \n part to get it into the shell rather than in the PHP string... system(echo -e \SECRET\\n\ | /usr/bin/smbutil -v view //[EMAIL PROTECTED]); You should use exec instead during experimentation at least, so you can get error messages... Actually, exec is probably better all around, unless you really need passthru for performance reasons... smbutil *might* require a TTY (a REAL logged in person) the way some programs do. If its documenation says so, I think you're out of luck on the password bit. There might be other options, like SSH key-pair authentication or Kereberos or, for all I know, somebody wrote a PHP Samba Module while I wasn't looking... I'd probably never use it, so wouldn't have noticed. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Those checkboxes again
Thanks, Joe! I see what you weer going after. I had several problems including the fact that I really didn't understand what I was trying to do until after I did it. And I had some log errors a friend helped with. What I needed to do was delete the media types from the intersection table and then insert them anew; that way I don't have to do all sorts of looping through finding the status of checked and unchecked boxes etc. Eventually I came to: if (isset($_POST['editrecordMedia'])){ if (!empty($_POST['media_types'])) { //TO make sure art_id isn't empty if (!empty($art_id)) { //delete media_art entries for this art_id $query=DELETE FROM media_art WHERE art_id='$art_id'; mysql_query($query); $query = INSERT INTO `media_art` (`media_id`,`art_id`) VALUES ; $sep = ; foreach($_POST['media_types'] as $type) { $query .= $sep ('$type','$art_id'); $sep = , ; Anyway, thanks so much for your help!! JJ Joe Harman wrote: if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= checked ; } $checkbox_media[] .= /{$media_rows['media_name']} ; if think you only need 2 '=' signs... i do this alot with arrays of check boxes .. now don't quote me on this... but i do something like this.. using arrays for the check box values if($permissions_data NULL) { if(in_array($row_rsPermissions['permission_short_name'], $permissions_data)) { $checked_per = checked; } else { $checked_per = ; } } hope that helps you out Joe On 6/16/05, Jack Jackson [EMAIL PROTECTED] wrote: hi, I'm severely frustrated and perhaps you can help with what I have done wrong. The checkboxes I use to populate an intersection table work to add the records, and now I am trying to update them. It's almost there but producing some unexpected results when the form is submitted: the idea is that it displays the checkboxes as pre-selected if they're associated with the art_id in the intersection table. They're now appearing as all unselected. Any help is appreciated. ?php $query = ''; $result = 0; $art_id = $_POST['art_id']; print_r($_POST); if (isset($_POST['editrecordMedia'])){ if (!empty($_POST['media_types'])) { foreach($_POST['media_types'] as $type) { $query = UPDATE media_art SET media_id='$type', art_id='$art_id'; var_dump($query); mysql_query($query) or die(mysql_error()); } } else {echo mediatypes is empty;} //Closes if (!empty($media_types)) }//closes if (isset($_POST['editrecordMedia']) //If editrecord hasn't been set, but selectcartoon has, get the cartoon's recordset //This is just to get the title for display purposes $query = SELECT art_title FROM art WHERE art_id='$art_id'; //end $media_query = SELECT media.media_id, media.media_name, media_art.art_id FROM media LEFT JOIN media_art ON media_art.media_id=media.media_id AND media_art.art_id='$art_id'; //These $art results are just to get the title for display purposes $art_result = mysql_query($query); $art_rows = mysql_fetch_assoc($art_result); //end $media_result = mysql_query($media_query); $checkbox_media = array (); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' ; if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= checked ; } $checkbox_media[] .= /{$media_rows['media_name']} ; } ? table align=center trth colspan=4Main Menu/th/tr tr tda href=addrecord.phpAdd A Record/a/td tda href=chooserecord.phpEdit A Record/a/td tda href=deleterecord.phpDelete A Record/a/td /tr /table form action=?php echo $_SERVER['PHP_SELF']; ? method=post name=editrecordMedia input type=hidden name=art_id value=?php echo $art_id ;? Choose media related to strong?php echo $art_rows['art_title'];?/strongbr /br / Media: ?php echo join($checkbox_media); ? input type=submit name=editrecordMedia value=Update /form -- 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] Retrievable weather service info?
Quoting Murray @ PlanetThoughtful [EMAIL PROTECTED]: Hi All, Just wondering if anyone knows of a free weather service that can be interrogated by PHP for information such as current temperature for a range of cities around the world? Regards, Murray I *highly* recommend the PEAR Services_Weather package: http://pear.php.net/package/Services_Weather Services_Weather searches for given locations and retrieves current weather data and, dependent on the used service, also forecasts. Up to now, GlobalWeather from CapeScience, Weather XML from EJSE (US only), a XOAP service from Weather.com and METAR/TAF from NOAA are supported. Further services will get included, if they become available, have a usable API and are properly documented. hth, Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delivery reports about your e-mail
Yes, it would be nice if the list didn't relay this obvious cruft. I'm s*bscribed to quite a few discussion lists, and php-general seems to be the ONLY one relaying these malware messages and the claims of virus filters. It looks rather like php-general is operating as an open list, seeing as some of the addresses these messages are coming from clearly shouldn't already be s*bscribed to the list, and the malware responsible for most of it wouldn't actually perform a s*bscription. At a minimum, I'd block the handful of known forgery addresses, plus block postmaster@ and mailer-daemon@ messages from reaching the list. Yea, bummer for the handful of people who use postmaster for their s*bscription address (which is contrary to the purpose of the postmaster address, so no loss there). I'd be quite happy if the list didn't accept attachments either, but that would probably be a bit much to ask. The appropriate solution would be to configure lists.php.net and any other php.net mail hosts to use SMTP AUTH, and set them up with TLS certificates and trusted relationships among one another using TLS (this is easy to do, at least in sendmail - but php.net is running qmail...). After that is done, set php.net hosts up to REJECT messages claiming to be from php.net (proper AUTH or TLS will circumvent this rejection). End result: no more forgeries through the php.net servers. --- Please DO NOT carbon me on list replies. I'll get my copy from the list. Founding member of the campaign against email bloat. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php