[PHP] GD2 Fonts
Fonts, I am trying to use imageloadfont($PATH_TO_FONT . '/arial.ttf'); on a windowze machine. It fails without any error message. Now, the font I use is the one from the windows Fonts/ dir. I have also installed the freetype extension. Can anyone tell me how they do it with fonts on windowze. Please don't tell me to use Linux (i know that ;)). Thank you, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .htaccess authentification problem
Hi, When using .htaccess files the request does not reach your scripts untill Apache has done his authentication. So, I suggest you take out the .htaccess part for authentication and deal with it only from PHP; for instance with sessions: 1. Ask for user/pass on first page and authnticate against DB 2. If ok, put it in the $_SESSION 3. When in the user dir, check his session and if he/she is not authenticated make authentication with PHP (your code below) Hope this helps, Catalin Michael HüBner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hallo, Hope somebody can help me. I'm working on Linux, Apache. On my start-site the user can log in via inserting Username and Password into normal formfields, which are compared with a DB. After this login, he can change to his own user-directory which is .htpasswd and .htaccess protected. Thats the reson he has to insert his Username and Password again ;( My Question: Is there a way, so the user has to insert his data only once? I've also tried it by doing a authentification like this first: ?php if (!isset($_SERVER['PHP_AUTH_USER'])) { Header(WWW-Authenticate: Basic realm=\My Realm\); Header(HTTP/1.0 401 Unauthorized); echo Text to send if user hits Cancel button\n; exit; } else { echo Hello {$_SERVER['PHP_AUTH_USER']}; echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p; } ? but it doesn't work for me, because when switching to the userdirs, the .htaccess authentification window pops up again (it is the same pwd and uid in the DB and the .htpasswd) ;( Thank you in advance, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 (simple?) php related questions
Hi, Whats the advantage of the above and whats the idea? isnt it much easier (and logical) to keep track of pages if you give them a logical name? The idea behind this approach is using MVC (MVC2) architecture which gives much more flexibility to the programmer. Usually index.php (or whatever name) is called the controller and it uses some configuration files so that it knows which script(s) are responsible fo processing certain actions. This approach allows to separate between business logic and presentation. An MVC intro is beyond the scope of this list, so google for it Take a look at phrame.sourceforge.net for some ideas Cheers, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array problems
$city = Ipswitch; $city_found = 0; $contentfile = fopen(content.txt, r); while (!feof($contentfile) $city_found == 0); { $my_line = fgets($contentfile, 16384); $content_array = explode(\t,$my_line); if ($content_array[0] == $city) { $city_found = 1; print(Matched on $content_aray[0]br\n); } } print($content_array[0]\n); I think what you got is a scope problem. You are creating $content_array in your while loop so its scope is limited to the while loop. To test this simply do a var_dump or print_r on $content_array outside your loop and see if it actually is an array, which I guess it won't it will either be null or an empty string. To solve simply do an initialisation of the variable before the while loop like $content_array = ''. Regards Stefan
Re: [PHP] array problems
On Friday 28 November 2003 16:03, [EMAIL PROTECTED] wrote: I think what you got is a scope problem. You are creating $content_array in your while loop so its scope is limited to the while loop. To test this simply do a var_dump or print_r on $content_array outside your loop and see if it actually is an array, which I guess it won't it will either be null or an empty string. To solve simply do an initialisation of the variable before the while loop like $content_array = ''. So that people don't get misled, the above is completely wrong. WHILE loops do not have their own scope. The correct answer (or the most plausible) was given in an earlier response by Marek, which pointed out that the last line(s) of the file may have just contained a CR and/or LF. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Marriage is the waste-paper basket of the emotions. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD2 Fonts
On Friday 28 November 2003 15:33, Catalin Trifu wrote: Fonts, I am trying to use imageloadfont($PATH_TO_FONT . '/arial.ttf'); on a windowze machine. It fails without any error message. Now, the font I use is the one from the windows Fonts/ dir. I have also installed the freetype extension. Can anyone tell me how they do it with fonts on windowze. Please don't tell me to use Linux (i know that ;)). In all cases that I have come across when I had problems loading fonts, PHP spat out an error. I suggest that you turn on FULL error reporting and look for the error. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Once harm has been done, even a fool understands it. -- Homer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The clock issue in this forum!
Why are you sorting your email on the sender's timestamp and not the arrival timestamp in your mailbox? Or is this really another thing Outlook can't figure out? -Rasmus On Thu, 27 Nov 2003, Kim Steinhaug wrote: Im using Outlook Express reading theese messages and I think the newsreader works just fine. But what do I do when theese people post with wrong dates. Is there any way in Outlook Express I can remove theese posts, or do I have to see them topping the list every time I check the lists? Ive tried several ways now, but I cant seem to fix them. Any help would be appritiated? Maby I should change newsreader? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- 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] Does anyone have Upload meter php codes?
Hi, I though megaupload at http://www.raditha.com/php/ was pretty much near the top for many search phrases that had php, progess and upload in it. Astron of BrOnX wrote: Hi everyone, i am looking for upload meter progress bar codes. I have looked up arround and the most of them needs for patching PHP to get upload variables. And also they are for Linux. I have need a solution for windows. It can be a extra DLL file for PHP but i dont know how i can find? If anyone has an idea for php4.3.2 version please inform me. Thanks -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array problems
Curtis Maurand wrote: OK. That worked, thanks. Is it me, or is that rather odd behavior? It is you ;) Shouldn't array elements set within a loop be available to me outside the loop if the loop exits normally? A loop is not a function (well it is, sort of.) Should I declare the variable as global? You are in a loop, so the variable is overwriten by new value in each iteration. global $content_array; $city_found = 1; while(!feof ... When I was taking programming courses in college, I was taught that breaking out of a loop like that was bad practice; that it was better to leave a loop normally. Depends. You could write $continue=true; while($continue .. other conditions .. ) { if(... another condition ...) { $continue = false; } } I don't think this is any better then breaking out, and is certainly slower. break and continue constructs are here for a reason and the use is right here. I've never programmed in C other than to write a crude little dos2unix (actually mac2dos) utility. Mosty i've written Perl, PHP Pascal and Basic. Pascal, Perl and Basic don't exhibit this behavior. All have this behavior. I never worked with arrays in C. Am I wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] openssl_sign and openssl_verify
Hi, is there a way to create the same signature with openssl from the command line? Also I need to verify a php gererated signature at the command line. Background: Two servers, one php is compiled with --with-openssl and the other not :/ thanks Dietrich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Receiving a warning... no clue how to resolve it and need help badly :(
| \./ . Aaron Wolski wrote: *** Sorry if this is a duplicate for some on another list** Hi Guys, I need help with this code I am about to paste. It works on a testing server running PHP 4.2.2 but not 4.3.2 Here is the error: Warning: array_merge_recursive(): recursion detected in /services2/webpages/r/i/rinkrake.com/public/test.php on line 26 Here is the code: ?php echo Generating results, this could take a minutebr; // Allow the script enough time to finish (lots of data, lots of loops) set_time_limit(999); // db connection $link = mysql_connect(xxx, xxx, xxx); mysql_select_db(xxx); // We need these queries to do our job $we_ordered_1 = mysql_query(select OrderTable.cart_id, CartTable.cart_id, CartTable.product_index from OrderTable, CartTable where CartTable.product_index = 1 and OrderTable.cart_id = CartTable.cart_id); $we_ordered_14 = mysql_query(select OrderTable.cart_id, CartTable.cart_id, CartTable.product_index from OrderTable, CartTable where CartTable.product_index = 14 and OrderTable.cart_id = CartTable.cart_id); $customers = mysql_query(select cart_id, first, last, email from OrderTable); // Compare cart_id's between customers who ordered product #1 and #14. If the customer // ordered #1 and not #14, put their cart_id in the $good_customers array and move on // to the next. while ($row1 = mysql_fetch_row($we_ordered_1)) { while ($row2 = mysql_fetch_row($we_ordered_14)) { if ($row1[0] != $row2[0]) { $temp[cust_id] = $row1[1]; $good_customers = array_merge_recursive($good_customers,$temp); } } mysql_data_seek($we_ordered_14,0); } // Free up some memory, reset things back to square one (just to be on the safe side) // and get rid of any duplicate items in our newly created array. mysql_free_result($we_ordered_1); mysql_free_result($we_ordered_14); unset ($temp); reset ($good_customers); $good_customers = array_unique($good_customers[cust_id]); // Fetch a customer, step through the $good_customers array and // compare the cart_id stored in $good_customers, if they match, // kick out a 'record' with the necessary data. while ($row3 = mysql_fetch_row($customers)) { foreach ($good_customers as $value) { if ($row3[0] == $value) { echo $row3[0]. | .$row3[1]. | .$row3[2]. | .$row3[3].br\n; } } } mysql_close($link); echo script language=JavaScriptalert(\Done!\);/script; CAN anyone help me resolve the problem? I know it has to do with a bug being fixed for array_merge_recursive but I don't know how to resolve the problem and get the results I need :-( Please help? Thanks so much!!! Aaron Am not sure about the bug in yout script, but what are you trying to do? For what I understand you are trying to find all customers who ordered Product ID #1 and not Product ID #14? If that's right, simply fire: ?php $Orders = mysql_query('SELECT * FROM OrderTable LEFT JOIN CartTable on OrderTable.cart_id = CartTable.cart_id WHERE CartTable.product_index IN (1,14) ORDER BY product_index ASC'); $Ones = Array(); while($Order = mysql_fetch_assoc($Orders)) { if ($Order['product_index'] == 1) { $Ones['cart_id'] = Array($Order); } elseif { ($Order['product_index'] == 14) unset($Ones['cart_id']; } } ? This will leave you with an array $Ones with all returned rows where the cusomer ordered #1 and not #14. The trick is that I ordered on product_index, so that I am sure that I'm processing all 1's first, and then all 14's. With some more advanced order by tricks (this one's pretty simple) you can probably leave out the enire where clause, and getting entire orders matching the criteria you set. Hope it helped you ;) Wouter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .htaccess authentification problem
Michael Hübner wrote: Hallo, Hope somebody can help me. I'm working on Linux, Apache. On my start-site the user can log in via inserting Username and Password into normal formfields, which are compared with a DB. After this login, he can change to his own user-directory which is .htpasswd and .htaccess protected. Thats the reson he has to insert his Username and Password again ;( My Question: Is there a way, so the user has to insert his data only once? I've also tried it by doing a authentification like this first: ?php if (!isset($_SERVER['PHP_AUTH_USER'])) { Header(WWW-Authenticate: Basic realm=\My Realm\); Header(HTTP/1.0 401 Unauthorized); echo Text to send if user hits Cancel button\n;exit; } else { echo Hello {$_SERVER['PHP_AUTH_USER']}; echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p; } but it doesn't work for me, because when switching to the userdirs, the .htaccess authentification window pops up again (it is the same pwd and uid in the DB and the .htpasswd) ;( Thank you in advance, Michael Please, please .. somebody come up with a solution to this and this kind of problems that as been bugging (I think) every php developer/scripter/programmer (however you call yourself) that has to deal with security. Eventually I found myself doing the entire security procedure in auto_prepend'ed files. But this only blocks access to php files. Isn't there like some apache module mod_auth_php, just like there is mod_auth_mysql and others? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does anyone have Upload meter php codes?
On Thursday 27 November 2003 18:21, Ryan A wrote: http://pear.php.net/package/HTML_Progress Very nice, But seems to have a problem with Netscape Communicator 4.75 Quote: Your browser should accept DHTML feature. Last I checked, Netscape 4.x weren't very good at that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Blessing an object
Greg Beaver wrote: Wouter, you could try this adding this method to each object you need blessings from: function bless($classname) { if ($classname == get_class($this)) { return $this; } $vars = get_object_vars($this); $ret = new $classname; return $ret-loadValues($vars); } function loadValues($vals) { foreach ($vals as $name = $val) { $this-$name = $val; } return $this; } In the Load() method, you should determine what class you need, and call $ret = $this-bless('classname'), and then return $ret. Then, instead of doing $Thing-Load(); do $Thing = $Thing-Load(); and have Load() return an object instance (either $this or the newly blessed object). This will maintain encapsulation and achieve the results you're looking for. Regards, Greg Thanks Greg .. this comes pretty close to what I had done myself as a workaround. Only thing that's different is that in my bless implementation I don't return the blessed value, but overwrite the $this var. Which works. What advantage do you think I would get from your appraoch? [snip The Way I Bless {example from own memory, cannot reach the actual code at this time} ] function Bless($ClassName) { // return false if class doesn't exist if (!class_exists($ClassName)) return false; $New = new $ClassName(); foreach($this as $Key = $Value) $New[$Key] = $Value; $this = $New; unset $New); } [/snip The Way I Bless] Hmm .. maybe I'm thinking 'out of te box' here, but can I manually add this functionality to stdClass, so that they are available in each and ever object I create? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array problems
On Thu, Nov 27, 2003 at 08:19:02PM -0500, Curtis Maurand wrote: : On Wednesday 26 November 2003 21:53, Marek Kilimajer mumble: : Curtis Maurand wrote: : Sorry, its a typo. it should be: : : $city = Ipswitch; : $city_found = 0; : $contentfile = fopen(content.txt, r); : while (!feof($contentfile) $city_found == 0); : { : $my_line = fgets($contentfile, 16384); : $content_array = explode(\t,$my_line); : if ($content_array[0] == $city) :{ : $city_found = 1; : print(Matched on $content_aray[0]br\n); : : /* Break out of the while loop */ :break; : :} : } : print($content_array[0]\n); : : //end : : Is it me, or is that rather odd behavior? Shouldn't array elements : set within a loop be available to me outside the loop if the loop : exits normally? It should. However, you must be sure to take the right action if the loop exists unnormally. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Optimizing PHP Relevancy Ranking Algorithm
I've developed some search result ranking code and it works extremely well in terms of relevancy but needs use some help with performance. I'm already using zend optimizer and I've done some basic things to clean up the code. This helps performance quite a bit by itself, but that's not enough, because I need to deal with ranking 20,000 search results. From my limited benchmarking, it looks like the biggest problem is when I work with $_SESSION. $_SESSION[search][results][$key1][relevancy] = ($result_score * -1) / $num_fields_matched; and usort($_SESSION[search][results], cmp); which use up about equal amounts of time each and account for 80% of the loop time, but I don't know how to fix it. For the first piece of code, replacing $_SESSION with a blank array nets a huge performance increase (virtually eliminates time spent on that line of code). The second line of code, when commented out, causes an almost identical performance improvement as the first. I wonder, is there some slowness when dealing $_SESSION as compared to a regular array? Or is the slowness related to handling large arrays? One of these two things probably explains the first line. I think the second troublesome line of code may be due to the same problem as the first or it may be related to using usort instead of another sorting option, but I'm not sure how I could use another sorting option to meet my sorting needs for this complex situation. Anybody got a few ideas on how to speed up these two sluggish lines of code? I'm pretty much out of ideas. And if you have any other suggestions to speed things up, I would really appreciate them too. Thanks, -Galen P. Zink The code: function cmp($a, $b) { if($a[relevancy] $b[relevancy]) { return 1; } elseif($a[relevancy] $b[relevancy]) { return -1; } else { return 0; } } foreach($_SESSION[search][results] as $key1 = $value1) { $num_fields_matched = 0; $result_score = 0; $metaphone_ratio = 0; foreach($_SESSION[search][statements] as $key = $value) { if ($value != ) { $value = strtolower(trim($value)); $value1[$key] = strtolower(trim(($value1[$key]))); $num_fields_matched++; $levenshtein = levenshtein($value, $value1[$key], 0.5, 1, 1); $value_metaphone = metaphone($value1[$key]); $search_metaphone = metaphone($value); $search_position = strpos($value1[$key], $value); $string_count = substr_count($value1[$key], $value); if ($search_metaphone == $value_metaphone AND $value_metaphone != ) { $metaphone_ratio = 1; } elseif ($search_metaphone != 0) { $metaphone_ratio = 0.6 * (1 / levenshtein($search_metaphone, $value_metaphone)); } $result_score = 1; //basic math involving all above variables set in this foreach loop goes here - I'm not able to show it due to IP issues } } if ($num_fields_matched == 0) { $num_fields_matched = 1; } $_SESSION[search][results][$key1][relevancy] = ($result_score * -1) / $num_fields_matched; } usort($_SESSION[search][results], cmp); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageMagick + PHP on Win32
Hi, I have downloaded and installed ImageMagick (5.5.7 Q8) in c:\imagemagick added it to %PATH% I have downloaded the latest php_imagick.dll extension from kromann.info and installed it. PHP says imagick is installed properly. However, when i am trying to run any of the examples that come with it I get only errors. If anyone knows how to install imagemagick on win32, please do advise me. I have googled fot it, but i did not manage to fins anything usefull (perhaps my mistake) Thank you, Catalin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mysql backup
Hi all ! I know this is more of mysql issue than PHP but then i always get my problem solved here.. and hope the same this time also ... I have two systems. one with mysql-version: 3.23.37 other with mysql-version: 3.23.58 now i want to take the backup of 3.23.37 data and copy to 3.23.58 ... i know i can take backup using mysqldump command ... and then copy using mysql commands but as mysql create folder for each database . is it possible to copy the particular folder(database) to 3.23.58 and then running it smoothly ... Any body got any idea ??? Please help me out.. Thanks in advance Binay
Re: [PHP] Regular Expression Help: genreate alphanumeric, 8 chars
Adam -- ...and then Adam i Agnieszka Gasiorowski FNORD said... % ... % How about, % % $password = strtolower(substr(md5(uniqid(time())), 0, 7)); Hey, that's pretty slick. Good one! Gonna have to remember that; it's an excellent trick. Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] Telling GD2 Where Fonts Are
Tom, when I switch code to: putenv('GDFONTPATH=/Macintosh HD/Fonts/'); $font = Macintosh HD/Fonts./'arial.ttf'; per your saying: Give the full path to the font file, I do like this $font = $path_to_font.'/font.ttf'; I get: Parse error: parse error, unexpected T_STRING in /Users/stephent/Sites/php_mysql_web_dev/chapter_19/make_button.php on line 16 Whattaya make of that? mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Capturing $_POST variables
Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capturing $_POST variables
foreach ($_POST as $k = $v) { //everything you want to do } Shaun wrote: Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capturing $_POST variables
Thanks for your reply, I don't really need to do anything with them, just make sure they all retain their original values... Sophie Mattoug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] foreach ($_POST as $k = $v) { //everything you want to do } Shaun wrote: Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Capturing $_POST variables
Shaun wrote: Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. might wanna try (before any output, including spaces): ?php session_start(); foreach($_POST as $Key = $Value) $_SESSION[$Key] = $Value; But consider some checks to test if no values from $_SESSOIN are accidently overwritten (a user can post ANY value to ANY page he/she wants, this is NOT restricted to the form fields you have defined). ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Capturing $_POST variables
The only way you can send POST variables as POST variables in the next page is by using a form. That's obvious, you can't control the browser. So either use Wouter's suggestion to send them via sessions (if you don't HAVE to have them sent over via POST), or use Sophie's suggestion to build a list of hidden inputs in a form. Bogdan Shaun wrote: Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Telling GD2 Where Fonts Are
[EMAIL PROTECTED] wrote: Tom, when I switch code to: putenv('GDFONTPATH=/Macintosh HD/Fonts/'); $font = Macintosh HD/Fonts./'arial.ttf'; ... Parse error: parse error, unexpected T_STRING in /Users/stephent/Sites/php_mysql_web_dev/chapter_19/make_button.php on line 16 Whattaya make of that? Because Macintosh HD/Fonts should be part of string, i.e.: $font = '/Macintosh HD/Fonts/arial.ttf'; This will eliminate parse error, but does it solve Your actual problem, i don't know. Maybe You should set $font like Chris suggested (...Macintosh HD is actually / to the UNIX layer of the OS...): $font = '/Fonts/arial.ttf'; Hope that helps. -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capturing $_POST variables
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Shaun Am Freitag, 28. November 2003 14:41 schrieb Shaun: Thanks for your reply, I don't really need to do anything with them, just make sure they all retain their original values... If you are using a form to sent the data again to third page you can do this foreach ($_POST as $key = $value) { echo input type=\hidden\ name=\.$key.\ value=. $value.\; } Another way is the following: $postData = $_POST; echo input type=\hidden\ name=\postData\ value=. $postData.\; CU Thorsten - -- Thorsten Körner | http://www.123tkShop.org openSource e-Commerce | http://www.123tk.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/x1ORs5R35vLkl/cRAgqyAJwP/rfZugqf1pDotQm7pnFB2dmaHACfUEDv xsZScbosfp8E2omTFzjxDCo= =TPiS -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .htaccess authentification problem
Hi Catalin, Thanks for your response. I don't wont to do it this way, because I use the apache-module providing automatic directory indexing. It is very fast and I don't have to program a directory indexing by my own. Actually my server is only a Pentium 100 and generating an index via php slows my machine down. But maybe I don't understand the hole thing: Is there a way to use apache's automatic directory indexing and authentication with PHP at the same time? Michael Catalin Trifu [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, When using .htaccess files the request does not reach your scripts untill Apache has done his authentication. So, I suggest you take out the .htaccess part for authentication and deal with it only from PHP; for instance with sessions: 1. Ask for user/pass on first page and authnticate against DB 2. If ok, put it in the $_SESSION 3. When in the user dir, check his session and if he/she is not authenticated make authentication with PHP (your code below) Hope this helps, Catalin Michael HüBner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hallo, Hope somebody can help me. I'm working on Linux, Apache. On my start-site the user can log in via inserting Username and Password into normal formfields, which are compared with a DB. After this login, he can change to his own user-directory which is .htpasswd and .htaccess protected. Thats the reson he has to insert his Username and Password again ;( My Question: Is there a way, so the user has to insert his data only once? I've also tried it by doing a authentification like this first: ?php if (!isset($_SERVER['PHP_AUTH_USER'])) { Header(WWW-Authenticate: Basic realm=\My Realm\); Header(HTTP/1.0 401 Unauthorized); echo Text to send if user hits Cancel button\n; exit; } else { echo Hello {$_SERVER['PHP_AUTH_USER']}; echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p; } ? but it doesn't work for me, because when switching to the userdirs, the .htaccess authentification window pops up again (it is the same pwd and uid in the DB and the .htpasswd) ;( Thank you in advance, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql backup
Binay If the tables for both versions are MYISAM the steps are as follows: 1. Stop mysql on both systems. 2. Copy the contents of the 3.23.37 data folder to the 3.23.58 data folder using your OS tools (cp, file management tools, Windows explorer etc) 3. Start mysql on both systems. HTH Rory On 28 Nov 2003 at 17:17, Binay wrote: Hi all ! I know this is more of mysql issue than PHP but then i always get my problem solved here.. and hope the same this time also ... I have two systems. one with mysql-version: 3.23.37 other with mysql-version: 3.23.58 now i want to take the backup of 3.23.37 data and copy to 3.23.58 ... i know i can take backup using mysqldump command ... and then copy using mysql commands but as mysql create folder for each database . is it possible to copy the particular folder(database) to 3.23.58 and then running it smoothly ... Any body got any idea ??? Please help me out.. Thanks in advance Binay Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing PHP Relevancy Ranking Algorithm
On Fri, 28 Nov 2003 03:26:08 -0800, you wrote: Anybody got a few ideas on how to speed up these two sluggish lines of code? I'm pretty much out of ideas. And if you have any other suggestions to speed things up, I would really appreciate them too. I know nothing about your application, and I haven't looked too hard at your code. Having said that, you're not actually displaying 20,000 results on the page at one time, are you? And even if you did, what user is going to go check what hit no. 14,879 was? Most of your sort-processing is wasted. Pass over the array once, throwing away everything with a low relevancy. Then do your sort. If the user does decide to delve further into the results, then you can shuffle more of the abandoned stuff back in. But 99% of your users won't go past the first three pages, and you've saved yourself a vast amount of processor time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Capturing $_POST variables
Thanks you for your replies, is there a reason why i couldn't use the following? $_POST = $_POST; Bogdan Stancescu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The only way you can send POST variables as POST variables in the next page is by using a form. That's obvious, you can't control the browser. So either use Wouter's suggestion to send them via sessions (if you don't HAVE to have them sent over via POST), or use Sophie's suggestion to build a list of hidden inputs in a form. Bogdan Shaun wrote: Hi, is it possible to capture $_POST variables sent from a previous page so i can send them on to the next page? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Capturing $_POST variables
Shaun wrote: Thanks you for your replies, is there a reason why i couldn't use the following? $_POST = $_POST; You want to assign to the $_POST array of the third page the value of the $_POST of the seconde one ? You cannot do the way you wrote because it's not on the same page ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms and Arrays
Hi List, I have a dynamically generated form with inputs with names that create arrays i.e.: input name=fname[] input name=flab[] input name=fplc[] The extra bits for the inputs are omitted deliberately for this question but exists in the form i.e.: size, value, type. And these are repeated as many time as required. Thus they are generating arrays called: Fname0 Flab0 Fplc0 Fname1 Flab1 Fplc1 Fname2 Flab2 Fplc2 And so on as per the num of dynamically generated input lines for the form. My question is how can I treat each array separately and then move on to the next until end ? SO the output would be : fname0 = value flab0 = value fplc0 = value fname1 = value flab1 = value fplc1 = value fname2 = value flab2 = value fplc2 = value All keys / values are from $_POST via form button. I really hope I have been as clear as I can, but if you need more info them please email me. Thank you in advance for any help Dave C EPH Group Ltd. Professional UK Based Web Hosting http://www.ephgroup.com In the UK? Call FREE: 0800 031 9190 Unlimited WebSpace, Unlimited Email Accounts, FREE Telephone Support, FREE co.uk domain name, FAST FRIENDLY SERVICE, UNIX Windows accounts --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Capturing $_POST variables
On 28 November 2003 14:21, Shaun wrote: Thanks you for your replies, is there a reason why i couldn't use the following? $_POST = $_POST; None whatsoever -- but it's an expensive way of effectively doing nothing! (Which, I suspect, is not what you want to do.) The fact that you are even asking this suggests that you have a fundamental misunderstanding of the way things work. You have received several good answers to your original question -- pick the one you prefer. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms and Arrays
On 28 November 2003 14:36, Dave Carrera wrote: Hi List, I have a dynamically generated form with inputs with names that create arrays i.e.: input name=fname[] input name=flab[] input name=fplc[] The extra bits for the inputs are omitted deliberately for this question but exists in the form i.e.: size, value, type. And these are repeated as many time as required. Thus they are generating arrays called: Fname0 Flab0 Fplc0 Fname1 Flab1 Fplc1 Fname2 Flab2 Fplc2 Sorry to be pedantic, but, no, they are generating arrays called fname, flab, and fplc. The elements of these arrays are fname[0], fname[1], fname[2]..., flab[0], flab[1]... etc. And so on as per the num of dynamically generated input lines for the form. My question is This describes one way of handling the arrays: how can I treat each array separately and then move on to the next until end ? SO the output would be : ... but this illustrates exactly the opposite way of treating them: fname0 = value flab0 = value fplc0 = value fname1 = value flab1 = value fplc1 = value fname2 = value flab2 = value fplc2 = value So which is it you want? Presumably, your example output is correct and the description is wrong, and what you really want to do is address the first element of each array, then the second element of each array, and so on. In which case, you've pretty much described how to do it in your example output, and your only remaining problem is how to find out how long the arrays are -- for which I recommend you take a look at http://www.php.net/count. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/java/mysql programmer needed
Hi If any one on this list has good experience in php/java/mysql programming integrated with Adobe GoLive for both Mac Window, please contact me directly as we have a couple of projects that need that expertise. -- Kind regards, Paul. Gondwana [EMAIL PROTECTED] http://www.gondwanastudio.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question on sending PhP variable results to an HTML page to be displayed.
Hello, I know this may seem like the opposite approach but please let me explain the important reason I am trying to discover how to do this. Let us say you have a website www.example.com and you want to track and display information when a search engine scanned and stored the result into its database. Now you cannot change the home page name to whatever.php because this will alter the seach engines ranking of your site and you cannot display the date using JavaScript because the date will change even in the cache because the code is on the page. If you use the date function in PhP you can get the date and it will not change in the cache since the actual code is not on the page that generated it. My question is how do I get the answer that I have in a PHP variable back to an HTML page and give it lets say to JavaScript to display. Thanks for any help on this. Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql backup
Hi Rory, - Original Message - From: Rory McKinley [EMAIL PROTECTED] To: Binay [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, November 28, 2003 7:30 PM Subject: Re: [PHP] Mysql backup Binay If the tables for both versions are MYISAM the steps are as follows: 1. Stop mysql on both systems. 2. Copy the contents of the 3.23.37 data folder to the 3.23.58 data folder using your 1) Does the format in which 3.23.37 stores data in data folder differ with format that 3.23.58 uses?? I mean is it compatible with 3.23.58 2) What will happen to the index file ... will it automatically be activated once u copy the folder and start the mysql service?? 3) And most important have you tried it before ?? I mean are you sure its gonna work.. cuz i have to do in my production server ... so lil cautious... -- OS tools (cp, file management tools, Windows explorer etc) 3. Start mysql on both systems. HTH Rory On 28 Nov 2003 at 17:17, Binay wrote: Hi all ! I know this is more of mysql issue than PHP but then i always get my problem solved here.. and hope the same this time also ... I have two systems. one with mysql-version: 3.23.37 other with mysql-version: 3.23.58 now i want to take the backup of 3.23.37 data and copy to 3.23.58 ... i know i can take backup using mysqldump command ... and then copy using mysql commands but as mysql create folder for each database . is it possible to copy the particular folder(database) to 3.23.58 and then running it smoothly ... Any body got any idea ??? Please help me out.. Thanks in advance Binay Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- 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] Capturing $_POST variables
Thorsten Körner wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Shaun Am Freitag, 28. November 2003 14:41 schrieb Shaun: Thanks for your reply, I don't really need to do anything with them, just make sure they all retain their original values... If you are using a form to sent the data again to third page you can do this foreach ($_POST as $key = $value) { echo input type=\hidden\ name=\.$key.\ value=. $value.\; } Another way is the following: $postData = $_POST; echo input type=\hidden\ name=\postData\ value=. $postData.\; CU Thorsten This won't work. $_POST is always an array. If you want to go all the way of re-posting the postdata, this is an appraoch that would WORK. I'm not saying it's a GOOD appraoch (as others have said, it isn't :D): echo input type='hidden' name='PreviousPostData' value='.htmlentities(addslashes(serialize($_POST))).'; and on the other one $PreviousPostData = unserialize(stripslashes($_POST['PreviousPostData'])); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/java/mysql programmer needed
Hi If any one on this list has good experience in php/java/mysql programming integrated with Adobe GoLive for both Mac Window, please contact me directly as we have a couple of projects that need that expertise. -- Kind regards, Paul. Gondwana [EMAIL PROTECTED] http://www.gondwanastudio.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Buy beer and smoke at ANY age
Need a fake license to get into the tit bar and see some pussy? Visit www.photoidcards.com Too young to get your girl drunk and stick your long dong in her? Buy beer and smoke! Drive again if you got a DUI? Award winning site! www.souvenirids.com Read more here www.souvenirid.us This is not Spam. You signed up with partner site asking for fake license info.
[PHP] PEAR::SOAP_Client, Google API
I'm trying to get ANYTHING out of google API (for now), but it doesn't let me. I use the SOAP_Client from PEAR project and the WDSL file you get from Google when you register your key for using with their API. When I give an action wrong parameters, everything works great, it complaints that I gave it wrong data. I provide RIGHT data then and...I get a blank screen. No errors in logs, no nothing. What can be wrong? All I did to downloaded from PEAR files was to change include paths so I could place all the required files in one directory (SOAP). The short test code follows (as you can see I tried the doGoogleSearch action, defined in the WDSL, too). It looks like it bombs even before the first echo...: Help me, I'm really depressed and frustrated now :8[. I hate it when it doesn't give any kind of feedback like this... ? require_once('SOAP/Client.php'); $key = 'my google key goes here'; $queryterms = 'marichuana'; /* $query = array( 'key' = $key, 'q' = $queryterms, 'start' = 0, 'maxResults' = 10, 'filter' = true, 'restrict' = '', 'safeSearch' = false, 'lr' = '', 'ie' = '', 'oe' = '' ); */ $query = array( 'key' = $key, 'phrase' = $queryterms ); $soapclient = new SOAP_Client('GoogleSearch.wsdl', true); $result = $soapclient - call('doSpellingSuggestion', $query); echo 'pre' . print_r($result, TRUE) . '/pre'; $i = 1; print(Top 10 results for strong$queryterms/strongbr /br /); foreach ($result as $key = $value) { if($key == 'resultElements') { foreach ($value as $key2 = $value2) { foreach($value2 as $key3 = $value3) { if($key3 == 'URL') { $snippet = substr(strip_tags($value2[snippet]), 0, 70); $summary = substr($value2[snippet], 0, 70); $title = substr(strip_tags($value2[title]), 0, 70); $cachedSize = $value2[cachedSize]; print(#$i: stronga href=\$value3\$title/a/strongbr /Summary: $summarybr /$value3 - $cachedSizehr /); $i++; } print($key3 $value3br); } } } print(Key: $key; Value: $valuebr\n); } ? -- Seks, seksi, seksolatki... news:pl.soc.seks.moderowana http://hyperreal.info { iWanToDie } WiNoNa) ( http://szatanowskie-ladacznice.0-700.pl foReVeR( * ) Poznaj jej zwiewne ksztaty... http://www.opera.com 007 smime.p7s Description: S/MIME Cryptographic Signature
RE: [PHP] The clock issue in this forum!
Rasmus Lerdorf mailto:[EMAIL PROTECTED] on Friday, November 28, 2003 12:37 AM said: Why are you sorting your email on the sender's timestamp and not the arrival timestamp in your mailbox? Or is this really another thing Outlook can't figure out? Please take note, Outlook and Outlook Express are very different. Outlook can sort by arrival timestamp just fine (at least my version does). Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms and Arrays
Thank you for clearing up my rather lame explanation. So how can I process $_POST[dynamic-name][user-entered-value] arrays to give me my desired output: fname0 = value flab0 = value fplc0 = value fname1 = value flab1 = value fplc1 = value fname2 = value flab2 = value fplc2 = value Any help our example will be most appreciated. Dave C -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: 28 November 2003 14:50 To: 'Dave Carrera'; [EMAIL PROTECTED] Subject: RE: [PHP] Forms and Arrays On 28 November 2003 14:36, Dave Carrera wrote: Hi List, I have a dynamically generated form with inputs with names that create arrays i.e.: input name=fname[] input name=flab[] input name=fplc[] The extra bits for the inputs are omitted deliberately for this question but exists in the form i.e.: size, value, type. And these are repeated as many time as required. Thus they are generating arrays called: Fname0 Flab0 Fplc0 Fname1 Flab1 Fplc1 Fname2 Flab2 Fplc2 Sorry to be pedantic, but, no, they are generating arrays called fname, flab, and fplc. The elements of these arrays are fname[0], fname[1], fname[2]..., flab[0], flab[1]... etc. And so on as per the num of dynamically generated input lines for the form. My question is This describes one way of handling the arrays: how can I treat each array separately and then move on to the next until end ? SO the output would be : ... but this illustrates exactly the opposite way of treating them: fname0 = value flab0 = value fplc0 = value fname1 = value flab1 = value fplc1 = value fname2 = value flab2 = value fplc2 = value So which is it you want? Presumably, your example output is correct and the description is wrong, and what you really want to do is address the first element of each array, then the second element of each array, and so on. In which case, you've pretty much described how to do it in your example output, and your only remaining problem is how to find out how long the arrays are -- for which I recommend you take a look at http://www.php.net/count. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Important notice
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Wednesday, November 26, 2003 9:30 PM said: If you feel this transaction was made by our mistake, please press No. I keep clicking No but nothing is happening. PLEASE HELP! Maybe it's a bug with PHP?? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capturing $_POST variables
Shaun -- ...and then Shaun said... % % I don't really need to do anything with them, just make sure they all retain % their original values... If you're going to get the original values from the submitted page anyway then you have no trust in that original value. If you need to make sure that something doesn't change from post to post, you must store it in a session so that you can check it later. The good news is that once it's in a session you don't have to post it every time :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] Buy beer and smoke at ANY age
Rasmus -- ...and then [EMAIL PROTECTED] said... % ... % This is not Spam. You signed up with partner site asking for fake license info. You need to put a curfew on your lists; look what they've been out and doing! Some kids just can't be trusted, I guess. ;-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
RE: [PHP] Forms and Arrays
On 28 November 2003 17:22, Dave Carrera wrote: Thank you for clearing up my rather lame explanation. So how can I process $_POST[dynamic-name][user-entered-value] arrays to give me my desired output: fname0 = value flab0 = value fplc0 = value fname1 = value flab1 = value fplc1 = value fname2 = value flab2 = value fplc2 = value Any help our example will be most appreciated. Well, like I say, you've pretty much written it there. You need a loop which outputs one line on each iteration -- the body of the loop will look something like: echo fname$i = {$_POST['fname'][$i]} . flab$i = {$_POST['flab'][$i]} . fplc$i = {$_POST['fplc'][$i]} There's any number of ways you could write the loop so that $i has the approriate value on each iteration, but a for() loop would probably be the conventional one. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php as cgi script
Hello all! I have this problem: I need to run a php (http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains that line #!/usr/local/bin/php -q I get it an error from my apache log: malformed header from script. Bad header= php [options] -r cod e: /www/cgi-bin/pruebacgi.php I hope someone can help me! I don't know what can I do. In fact if I run any php that have this line #!/usr/local/bin/php I get an error like that Premature end of script headers: /www/cgi-bin/pruebacgi.php I have installed the php4.3.3 and apache 1.3.28. I configured the php with this line ./configure --with-mysql --with-apache=../apache_1.3.28 --enable-track-vars Do I need to configure some else in my apache or php configuration file. Whan can I do to solve this problem? Thanks in advance KISSES Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] BUG: require_once() or die(); = fatal error
Hmm... Well Rasmus, I do see your point, however it still seems to me it 'should' at least compile and work as I expect it to. My way, the logic is that the file *is* 'required' (whereas I view 'include' files as optional), and I want to exit the program with a graceful message instead of the fatal error (which doesn't really doesn't tell me what the problem is -- Failed opening required '1' doesn't mean anything to me or the user) that is shown. My intent was to put a @require_once() so that I could do just that. Especially since I'm running my script on the command line, and your stock fatal error message uses HTML tags. Not a critical bug or a show stopper, but I do still feel it is a bug. -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 8:55 PM To: Daevid Vincent Cc: [EMAIL PROTECTED] Subject: Re: [PHP] BUG: require_once() or die(); = fatal error This code doesn't make much sense. By definition, if require cannot open a file it throws a fatal error, so you would never hit the or case anyway. Hence there is no return code from require and you can't write code like this. If you want to test the return code you need to use 'include' instead. -Rasmus On Wed, 26 Nov 2003, Daevid Vincent wrote: Using PHP 4.2.2 on Linux RH8: In a PHP script run from command line, require_once(gibberator_data.php) or die(No Data file found\n); Causes: [EMAIL PROTECTED] gibberator]# ./gibberator.php br / bFatal error/b: Failed opening required '1' (include_path='.:/php/includes;/usr/share/phpwebtools') in b/home/gibberator/gibberator.php/b on line b13/bbr / However require_once(gibberator_data.php); Works just fine. -- 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] php as cgi script
Ivone -- You are using a PERL invocation for php. PHP scripts begin with ?php the # sign is a comment in PERL - not in PHP. To run php as cgi you need to install the php cgi version (as opposed to the apache modular installation.) That will allow you to run cgi scripts on the command line. http://www.php.net/manual/en/install.commandline.php Best regards, Nicole Ivone Uribe wrote: Hello all! I have this problem: I need to run a php (http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains that line #!/usr/local/bin/php -q I get it an error from my apache log: malformed header from script. Bad header= php [options] -r cod e: /www/cgi-bin/pruebacgi.php I hope someone can help me! I don't know what can I do. In fact if I run any php that have this line #!/usr/local/bin/php I get an error like that Premature end of script headers: /www/cgi-bin/pruebacgi.php I have installed the php4.3.3 and apache 1.3.28. I configured the php with this line ./configure --with-mysql --with-apache=../apache_1.3.28 --enable-track-vars Do I need to configure some else in my apache or php configuration file. Whan can I do to solve this problem? Thanks in advance KISSES Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call to undefined function: imagecreatefromjpeg()
http://www.php.net/manual/en/function.imagecreatefromjpeg.php After using this code for some time it suddenly returns ... Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/crushme/public_html/includes/inc_members.php on line 564 ?Php // SNIP $quality=70; // JPEG Image Quality (0-95 Higher Value == Better) // Resize Create the Output Image (Do Not Disturb this part) $src_img = imagecreatefromjpeg($src_img); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imageinterlace($dst_img, 1); imagejpeg($dst_img, $dest_file, $quality); imagedestroy($src_img); imagedestroy($dst_img); // SNIP ? Is this the server or code that needs to be changed.
Re: [PHP] Call to undefined function: imagecreatefromjpeg()
Philip J. Newman wrote: http://www.php.net/manual/en/function.imagecreatefromjpeg.php After using this code for some time it suddenly returns ... It's not suddenly, someone must have recompiled php without gd/jpg support. Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/crushme/public_html/includes/inc_members.php on line 564 ?Php // SNIP $quality=70; // JPEG Image Quality (0-95 Higher Value == Better) // Resize Create the Output Image (Do Not Disturb this part) $src_img = imagecreatefromjpeg($src_img); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imageinterlace($dst_img, 1); imagejpeg($dst_img, $dest_file, $quality); imagedestroy($src_img); imagedestroy($dst_img); // SNIP ? Is this the server or code that needs to be changed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Important notice
Chris W. Parker wrote: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Wednesday, November 26, 2003 9:30 PM said: If you feel this transaction was made by our mistake, please press No. I keep clicking No but nothing is happening. PLEASE HELP! Maybe it's a bug with PHP?? Chris. My keyboard doesn't have a 'No' key. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function: imagecreatefromjpeg()
... just what i was thinking, i'll get back to them and complain. Thanks - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, November 29, 2003 8:29 AM Subject: Re: [PHP] Call to undefined function: imagecreatefromjpeg() Philip J. Newman wrote: http://www.php.net/manual/en/function.imagecreatefromjpeg.php After using this code for some time it suddenly returns ... It's not suddenly, someone must have recompiled php without gd/jpg support. Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/crushme/public_html/includes/inc_members.php on line 564 ?Php // SNIP $quality=70; // JPEG Image Quality (0-95 Higher Value == Better) // Resize Create the Output Image (Do Not Disturb this part) $src_img = imagecreatefromjpeg($src_img); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imageinterlace($dst_img, 1); imagejpeg($dst_img, $dest_file, $quality); imagedestroy($src_img); imagedestroy($dst_img); // SNIP ? Is this the server or code that needs to be changed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and Arrays
Dave - ...and then Dave Carrera said... % % Thank you for clearing up my rather lame explanation. % % So how can I process $_POST[dynamic-name][user-entered-value] arrays to give % me my desired output: % % fname0 = value flab0 = value fplc0 = value Do you really want a variable called $fname0 and another $fname1 and so on, or do you just want this output? It seems to me that you probably want the latter, so you need only walk through your array: foreach ( array_keys($_POST[fname]) as $k ) { print fname$k = {$_POST[fname][$k]} ; print flab$k = {$_POST[flab][$k]} ; print fplc$k = {$_POST[fplc][$k]}br\n ; } HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] php as cgi script
Hi Nicole! Thanks for your reply! I'm a little confused: Do I need to compile the php as cgi? I thought it was when you wanted to run php from commanline: as ./pruebacgi.php (Servers-CGI/Commandline) But in my case I want to call a php like that: http://xx.yy.zz/cgi-bin/pruebacgi.php and this php has this line #!/usr/local/bin/php Do I have to compile a php as a cgi, or do I need to do something on the apache server? Please could you clarify my doubts. For example this is a sample of the code: ?php header(Content-Type: text/vnd.wap.wml); $log=2; $fp1 = fopen(logs/$HTTP_X_UP_SUBNO.get_location, a); $separador=-x-x-x-x-x-x-x-x- .date(l dS of F Y h:i:s A). -x-x-x-x-x-x-x-x-; $qerror=0; ? ?echo ?xml version=\1.0\ encoding=\ISO-8859-1\?\r\n;? !DOCTYPE wml PUBLIC -//PHONE.COM//DTD WML 1.1//EN http://www.phone.com/dtd/wml11.dtd; wml card title=teste p align=center br/Testbr/ /p /card /wml I really appreciate your help. Kisses, Ivone --- Nicole Lallande [EMAIL PROTECTED] wrote: Ivone -- You are using a PERL invocation for php. PHP scripts begin with ?php the # sign is a comment in PERL - not in PHP. To run php as cgi you need to install the php cgi version (as opposed to the apache modular installation.) That will allow you to run cgi scripts on the command line. http://www.php.net/manual/en/install.commandline.php Best regards, Nicole Ivone Uribe wrote: Hello all! I have this problem: I need to run a php (http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains that line #!/usr/local/bin/php -q I get it an error from my apache log: malformed header from script. Bad header= php [options] -r cod e: /www/cgi-bin/pruebacgi.php I hope someone can help me! I don't know what can I do. In fact if I run any php that have this line #!/usr/local/bin/php I get an error like that Premature end of script headers: /www/cgi-bin/pruebacgi.php I have installed the php4.3.3 and apache 1.3.28. I configured the php with this line ./configure --with-mysql --with-apache=../apache_1.3.28 --enable-track-vars Do I need to configure some else in my apache or php configuration file. Whan can I do to solve this problem? Thanks in advance KISSES Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as cgi script
On Fri, 28 Nov 2003, Nicole Lallande wrote: Ivone -- You are using a PERL invocation for php. PHP scripts begin ?php #! is not a perl invocation, it is a Unix convention to tell the shell which program should be used to process the file contents. If you are running PHP as a CGI from a webserver, chances are good you do want #!/path/to/php as the first line, and ?php on the next line. I don't think you can pass a flag like #!/usr/bin/php -q though, and I doubt you would want to, since you still need to send the headers upon first output. If you did not send headers and just started outputting, the server would return a 500 Internal Server Error. The directory you're running it from needs to have ExecCGI permission (i.e. /cgi-bin/) and assuming no special setup has been done, you probably want to start the file off with that #! line as mentioned above. Also, you may want to try naming the file .cgi the # sign is a comment in PERL - not in PHP. # also denotes a comment in PHP. Though #! is not a comment, per se. (However, if you feed the file directly to some interpreter like perl, it does have the benefit of being ignored as a comment.) To run php as cgi you need to install the php cgi version (as opposed to the apache modular installation.) That will allow you to run cgi scripts on the command line. CGI stands for common gateway interface, which is the interface between a web server/request and some external program, so it has little to do with the command line. However, to run PHP from the command line, you do need to run it with the CGI version of PHP. The question did not specify needing to run PHP from the command line, but as a CGI by the webserver. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Blessing an object
Hi Wouter, The only disadvantage to assigning to $this is that it may not be supported in PHP 5 - php-internals discussion has described it as a bad idea. I would get beta 2 and test it out, see what happens. Incidentally, you don't need to unset new, and I would use $this = $New; Regards, Greg Wouter van Vliet wrote: Greg Beaver wrote: Wouter, you could try this adding this method to each object you need blessings from: function bless($classname) { if ($classname == get_class($this)) { return $this; } $vars = get_object_vars($this); $ret = new $classname; return $ret-loadValues($vars); } function loadValues($vals) { foreach ($vals as $name = $val) { $this-$name = $val; } return $this; } In the Load() method, you should determine what class you need, and call $ret = $this-bless('classname'), and then return $ret. Then, instead of doing $Thing-Load(); do $Thing = $Thing-Load(); and have Load() return an object instance (either $this or the newly blessed object). This will maintain encapsulation and achieve the results you're looking for. Regards, Greg Thanks Greg .. this comes pretty close to what I had done myself as a workaround. Only thing that's different is that in my bless implementation I don't return the blessed value, but overwrite the $this var. Which works. What advantage do you think I would get from your appraoch? [snip The Way I Bless {example from own memory, cannot reach the actual code at this time} ] function Bless($ClassName) { // return false if class doesn't exist if (!class_exists($ClassName)) return false; $New = new $ClassName(); foreach($this as $Key = $Value) $New[$Key] = $Value; $this = $New; unset $New); } [/snip The Way I Bless] Hmm .. maybe I'm thinking 'out of te box' here, but can I manually add this functionality to stdClass, so that they are available in each and ever object I create? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IE6 Session Problem
Hey all. Hope this will help someone hours of useless searching. Looks like out-of-the-box winXP machines running IE6 have session cookies automatically disabled! Ug, 24 hours slogging through newsgroups to stumble across this solution myself. If you have a login based site rely on session(s), IE6 users will not be able to log in unless they do the following: 1) Internet Options Privacy Advanced 2) Check the Always Allow Session Cookies checkbox HTH, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with Log() function
Hello, I'm having trouble getting a log formula to work. This forumla is supposed to return the number of payment required zero out a loan balance. !--- snip --- /* n = - (LN(1-(B/m)*(r/q)))/LN(1+(r/q)) q = amount of annual payment periods r = interest rate B = principal m = payment amount n = amount payment periods LN = natural logarithm */ $q = 12; $r = 0.07; $B = 15; $m = 733; print -(log(1-($B/$m)*($r/$q)))/log(1+($r/$q)); --- end snip It keeps returning a NaN. I've checked the syntax over and over, but to no avail. Any help would be appreciated TIA Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Static Array vs MySQL query
Hi, I'm designing my site to use drop down menus, and am having php generate the content of the main manus, as well as the sub-menus. What I'm wondering is what the performance hit will be with putting all the menu variables into an array in a config file vs storing the info in a MySQL table, and retriving the data from there. The main menu data is currently in a config file, and takes up 1.4kb, so I can only assume that with how many sub-menus that to config it all in a static array, the filesize is going to be well over 20kb. The data would have to be read into memory from both the static file, or from the db, so which do you think would be the fastest and/or least memory intensive? Thanks for any suggestions. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Static Array vs MySQL query
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm designing my site to use drop down menus, and am having php generate the content of the main manus, as well as the sub-menus. What I'm wondering is what the performance hit will be with putting all the menu variables into an array in a config file vs storing the info in a MySQL table, and retriving the data from there. The main menu data is currently in a config file, and takes up 1.4kb, so I can only assume that with how many sub-menus that to config it all in a static array, the filesize is going to be well over 20kb. The data would have to be read into memory from both the static file, or from the db, so which do you think would be the fastest and/or least memory intensive? Thanks for any suggestions. -- By-Tor.com It's all about the Rush http://www.by-tor.com Hi John A common solution I once found for saving database operation time, was to store information from the db in some kind of file. You could for example have a database with all the data, but you run a special script when there is any updates that updates a include file with the data. Under the generation process, you can simply make a script to get the data, and dynamically make a php file that will be stored. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Important notice
John Nichel wrote: Chris W. Parker wrote: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Wednesday, November 26, 2003 9:30 PM said: If you feel this transaction was made by our mistake, please press No. I keep clicking No but nothing is happening. PLEASE HELP! Maybe it's a bug with PHP?? Chris. My keyboard doesn't have a 'No' key. Hey! You're both in violation of Internal Rule #44.15/78 by following up on this thread! This is illegal! Or not. Or whatever. But anyway! I hope you're up to date with The Reg's last updates on Fermat's legal issues. Anonymous -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how can i get rid of newlines?
Hi, all -- As has been discussed before, the nl2br function doesn't actually convert newlines to breaks but instead is more like nl2nlbr. That is, input like this becomes input brlike brthis instead of inputbrlikebrthis as the name would indicate. I need a true nl2br function to get rid of newlines; I am accepting a changed ini file parameter but the newline kills me. I tried $v = preg_replace(/\n/,br,$v) ; but, even though $v had embedded newlines and wasn't merely a single line of that input, it didn't work. If this were perl I'd think that perhaps I'd change my record delimiter but I don't know how to do that in php. Any ideas? TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines?
David T-G wrote: I need a true nl2br function to get rid of newlines; I am accepting a changed ini file parameter but the newline kills me. Try: $text = preg_replace(/\r\n|\n|\r, 'br', $text); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how can i get rid of newlines?
$string = str_replace(\n, 'br', $string); David T-G wrote: Hi, all -- As has been discussed before, the nl2br function doesn't actually convert newlines to breaks but instead is more like nl2nlbr. That is, input like this becomes input brlike brthis instead of inputbrlikebrthis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how can i get rid of newlines?
Marek, et al -- ...and then Marek Kilimajer said... % % $string = str_replace(\n, 'br', $string); That didn't work for me. Interestingly enough, in light of Leif's post, neither did \r\n in the search pattern. Hmmph. Well, thank heavens once again for preg_replace() :-) Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines? [SOLVED]
Leif, et al -- ...and then Leif K-Brooks said... % % David T-G wrote: % % I need a true nl2br function to get rid of newlines; I am accepting a % changed ini file parameter but the newline kills me. % % Try: % $text = preg_replace(/\r\n|\n|\r, 'br', $text); Aha! Sure enough, that did it. In fact, just \r\n worked for me, but as long as I'm looking for both I might as well look for each. Who would think that input would be converted to DOS format? This tickles the back of my mind as something that I've seen before, now that it's shown to me again... I'm going to have to go looking now that I know the answer to see if I can find it in the archives. Thanks! HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines? [SOLVED]
Hi, all -- ...and then David T-G said... % ... % This tickles the back of my mind as something that I've seen before, now % that it's shown to me again... I'm going to have to go looking now that % I know the answer to see if I can find it in the archives. All I was able to find was some discussion of it back around July 13th, wherein some \r\n talk went around, but Jason Giangrande, although he said that his problem was solved, didn't say what the answer was! Well, now I have. This will never come up again, right? ;-) Thanks again HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines?
David T-G wrote: Marek, et al -- ...and then Marek Kilimajer said... % % $string = str_replace(\n, 'br', $string); That didn't work for me. Interestingly enough, in light of Leif's post, neither did \r\n in the search pattern. Hmmph. Well, thank heavens once again for preg_replace() :-) Thanks HAND :-D Right, I did not think about dos (\r\n) newlines. But Leif's code does not consider mac newlines (\r) :-). This takes care of all: $string = str_replace(array(\r\n,\n,\r), 'br', $string); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how can i get rid of newlines?
Marek -- ...and then Marek Kilimajer said... % % David T-G wrote: % % ...and then Marek Kilimajer said... % % % % $string = str_replace(\n, 'br', $string); % % That didn't work for me. Interestingly enough, in light of Leif's post, % neither did \r\n in the search pattern. Hmmph. Well, thank heavens once % again for preg_replace() :-) ... % % Right, I did not think about dos (\r\n) newlines. But Leif's code does Neither did I; after all, nothing in my loop is running DOS! % not consider mac newlines (\r) :-). This takes care of all: Are you sure about that? He had /\r\n|\n|\r which, once I close the search delimiter, certainly should capture a mac end-of-line... % % $string = str_replace(array(\r\n,\n,\r), 'br', $string); Hmmm... I didn't try it as an array, but str_replace() failed for me with both \n and \r\n... Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines?
David T-G wrote: Are you sure about that? He had /\r\n|\n|\r which, once I close the search delimiter, certainly should capture a mac end-of-line... My bad, I should not aswer questions at 4:30 a.m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] BUG: require_once() or die(); = fatal error
* Thus wrote Daevid Vincent ([EMAIL PROTECTED]): My way, the logic is that the file *is* 'required' (whereas I view 'include' files as optional), and I want to exit the program with a graceful message instead of the fatal error (which doesn't really doesn't tell me what the problem is -- Failed opening required '1' doesn't mean anything to me or the user) that is shown. My intent was to put a @require_once() so that I could do just that. Especially since I'm running my script on the command line, and your stock fatal error message uses HTML tags. Remove your 'or die()' and the message required opening required '1' will show up properly. About the html errors: 1. Use the php parameter -dhtml_errors=off 2. create a php-cli.ini in the location were php reads current php.ini 3. Use the -c parameter to tell php to use a different ini file to read. Not a critical bug or a show stopper, but I do still feel it is a bug. If your car does'nt float in the water is it the manufacturer's fault? Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how can i get rid of newlines?
Marek -- ...and then Marek Kilimajer said... % % David T-G wrote: % % Are you sure about that? He had % % /\r\n|\n|\r ... % % My bad, I should not aswer questions at 4:30 a.m. No problem, and I'm glad you and others do, because I'm just getting started for the long night ahead! :-) But str_replace works for you? Interesting... Thanks again HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] New line problem - but for Excel
Just now discussion was going on for new line - the same worked for me (I used string replace) Live Server : Linux / MySQL / PHP There is a field called 'Address' (textarea) - mysql stores \n for carriage return. Now from current disussion thread i know i can remove this with something like br (may be something else also) I want to export this to csv file. PHPMyAdmin 2.0 version has one option to convert to csv with delimiter e.g ';' . On my computer (Windows) If I do not use string replace command then '\n' goes as a new row. If i replace it with br then it appears in the Excel that is also I do not want. Is there any better way so that '\n' does not come out as new row - but do not want to make use of br as this will appear, please suggest, regards manisha When i open it in Excel now that \n becoms a new row which i do not want -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New line problem - but for Excel
Manisha -- ...and then Manisha Sathe said... % % Just now discussion was going on for new line - the same worked for me (I % used string replace) It worked for me, too, once I got the grammar right. Must have been a typo the first time I tried an array. % % Live Server : Linux / MySQL / PHP % % There is a field called 'Address' (textarea) - mysql stores \n for carriage ... % convert to csv with delimiter e.g ';' . ... % If I do not use string replace command then '\n' goes as a new row. If i % replace it with br then it appears in the Excel that is also I do not % want. Good question. The first thing I would try is embedding a return in a spreadsheet file and then exporting that as CSV and see how Excel writes it, and then as a close second read it back in and see if Excel can read it. Once you know the format you can work to output the same thing from your php script. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] how can i get rid of newlines?
Marek, et al -- ...and then David T-G said... % % But str_replace works for you? Interesting... I mucked about with it again and got it to work as long as I used an array for $search... I must have had a typo last time. Well, yay; I can rest easy knowing that I am using the faster function. Now, believe it or not, I'm trying to put the newlines BACK IN so that my users don't ever know the difference :-) It works fine so far except that I have a caching problem, I think, since upon load it's fine but the load-after-change just shows br in the field. But I'm getting close :-) Thanks again HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] DAMN
I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DAMN
On Fri, 2003-11-28 at 23:55, Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Look before you leap! Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New line problem - but for Excel
Actually I do not have phpscript for this. I am using readymade function from PHPMyAdmin 2.1.0. They are having option to export to csv file with delimeter ';' (It comes on screen first and then i copy to file manually.) So my csv fil looks like 22;33;address line1 address line2 What excel does is it shows this as 2 different lines. But this all should be in one line. if replace \n with br then 22;33;address line1braddress line2 Do u mean to say i need to write script only to produce proper '.csv' file ? Regards, Manisha David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New line problem - but for Excel
Manisha -- ...and then Manisha Sathe said... % % Actually I do not have phpscript for this. I am using readymade function % from PHPMyAdmin 2.1.0. They are having option to export to csv file with % delimeter ';' (It comes on screen first and then i copy to file manually.) Ah. % % So my csv fil looks like % % 22;33;address line1 % address line2 % % What excel does is it shows this as 2 different lines. But this all should % be in one line. OK. So what does Excel do if you start with data like that and then export to CSV? Can you have multi-line records in Excel? If so, are they written as such? HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] DAMN
Brona -- You have started a new thread by taking an existing posting and replying to it while you changed the subject. That is bad, because it breaks threading. Whenever you reply to a message, your mail client generates a References: header that tells all recipients which posting(s) your posting refers to. A mail client uses this information to build a threaded view (tree view) of the postings. With your posting style you successfully torpedoed this useful feature; your posting shows up within an existing thread it has nothing to do with. Always do a fresh post when you want to start a new thread. To achieve this, click on New message instead of Reply within your mail client, and enter the list address as the recipient. You can save the list address in your address book for convenience. ...and then Bronislav Klucka said... % % I've just realized I'm replaying to JeRRy only Could anybody fixt this Even worse, you have hijacked a completely separate thread rather than even the one remotely related to your post. That's like hijacking your own hijacking! % problem by setting the Reply To header correctly? to be able to reply PHP % conf. directly using Reply button?!!! Please, not this discussion again; the last one isn't even cool! If you somehow missed it, and if you can't check the archives, I will personally bounce you all 105 messages in the monster thread from earlier this week rather than have it start up again. If you're not careful, I suspect that a number of other list members will do the same thing to you. % % Brona HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] DAMN
Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona How many times is someone going to start this flame war this month? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DAMN
Till admin fix it Brona -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 6:18 AM To: PHP Konference Subject: Re: [PHP] DAMN Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona How many times is someone going to start this flame war this month? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DAMN
Sorry, I realized it was wrong :( -Original Message- From: David T-G [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 6:09 AM To: PHP General list Cc: Bronislav Klucka Subject: Re: [PHP] DAMN Brona -- You have started a new thread by taking an existing posting and replying to it while you changed the subject. That is bad, because it breaks threading. Whenever you reply to a message, your mail client generates a References: header that tells all recipients which posting(s) your posting refers to. A mail client uses this information to build a threaded view (tree view) of the postings. With your posting style you successfully torpedoed this useful feature; your posting shows up within an existing thread it has nothing to do with. Always do a fresh post when you want to start a new thread. To achieve this, click on New message instead of Reply within your mail client, and enter the list address as the recipient. You can save the list address in your address book for convenience. ...and then Bronislav Klucka said... % % I've just realized I'm replaying to JeRRy only Could anybody fixt this Even worse, you have hijacked a completely separate thread rather than even the one remotely related to your post. That's like hijacking your own hijacking! % problem by setting the Reply To header correctly? to be able to reply PHP % conf. directly using Reply button?!!! Please, not this discussion again; the last one isn't even cool! If you somehow missed it, and if you can't check the archives, I will personally bounce you all 105 messages in the monster thread from earlier this week rather than have it start up again. If you're not careful, I suspect that a number of other list members will do the same thing to you. % % Brona HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DAMN
I'll shut up, I didn't realized there were some flame war, but somebody should do: 1/ Fix this Reply to problem (mail comes from PHP conference I suppose I should reply to this conference) 2/ Fix the problem with non existing users (or mailboxes, where cannot be mail deliver to) I'll really shut up. but these problems are quite annoying... Brona P.S. Now I almost answered myself... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DAMN
I think... On 2003/11/29, at 14:30, Bronislav Klucka wrote: I'll shut up, I didn't realized there were some flame war, but somebody should do: 1/ Fix this Reply to problem (mail comes from PHP conference I suppose I should reply to this conference) You just missed the point: http://marc.theaimsgroup.com/?t=10697795341r=1w=2 2/ Fix the problem with non existing users (or mailboxes, where cannot be mail deliver to) I'll really shut up. but these problems are quite annoying... What problemS? -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DAMN
On 2003/11/29, at 14:17, John Nichel wrote: Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona How many times is someone going to start this flame war this month? Hmm... A *better* question would be How many people does NOT start it? ;) -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DAMN
I would really like to stop this thread but... 1/ What problemS?? the two I mentioned? 2/ I do not hawe time ro read the whole war you send me link to, I read just one mail Having read this thread, must say I wonder where is this world is going when people who consider themselves coders are confused about this email thingie. and I have to say that I have to wonder, that somebody could release it as mail conference... I consider myself as programmer and I would never do anything like this... Do not be wonder about our confusion, we are PHP programers and that is why we are confused : because we know that this bug has easy solution... Brona -Original Message- From: - Edwin - [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 6:39 AM To: Bronislav Klucka Cc: PHP Konference Subject: Re: [PHP] DAMN I think... On 2003/11/29, at 14:30, Bronislav Klucka wrote: I'll shut up, I didn't realized there were some flame war, but somebody should do: 1/ Fix this Reply to problem (mail comes from PHP conference I suppose I should reply to this conference) You just missed the point: http://marc.theaimsgroup.com/?t=10697795341r=1w=2 2/ Fix the problem with non existing users (or mailboxes, where cannot be mail deliver to) I'll really shut up. but these problems are quite annoying... What problemS? -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- 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] Static Array vs MySQL query
Hi, On 2003/11/29, at 8:10, John Nichel wrote: Hi, I'm designing my site to use drop down menus, and am having php generate the content of the main manus, as well as the sub-menus. What I'm wondering is what the performance hit will be with putting all the menu variables into an array in a config file vs storing the info in a MySQL table, and retriving the data from there. ...[snipped]... Instead of generating the menu(s) each time, why not create a static [HTML] file which you can call by using file_get_contents() or something and just insert it where it's needed? Just an idea... -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to escape '\'
I have magic_quotes_gpc ON 'Here's is' - this comes out after HTTP post as 'Here\'s is' But i want to get back the original string as it is - how to change ? manisha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to escape '\'
Manisha Sathe wrote: I have magic_quotes_gpc ON 'Here's is' - this comes out after HTTP post as 'Here\'s is' But i want to get back the original string as it is - how to change ? www.php.net/stripslashes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to escape '\'
try stripslashes() Brona -Original Message- From: Manisha Sathe [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 7:03 AM To: [EMAIL PROTECTED] Subject: [PHP] how to escape '\' I have magic_quotes_gpc ON 'Here's is' - this comes out after HTTP post as 'Here\'s is' But i want to get back the original string as it is - how to change ? manisha -- 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] DAMN
On 2003/11/29, at 14:54, Bronislav Klucka wrote: I would really like to stop this thread but... 1/ What problemS?? the two I mentioned? The first one was/is NOT a problem. 2/ I do not hawe time ro read the whole war you send me link to, I read just one mail [...] Why don't you read one more: http://marc.theaimsgroup.com/?l=php-generalm=106988902220400w=2 -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DAMN
On Fri, 2003-11-28 at 23:55, Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I believe we just discussed this for the past 2 or 3 daysI have an ingenious idea. Read the mailing lists archive. http://www.phparch.com/mailinglists/msg.php?a=734755s=Reply-to+headerp=0g= Starts at the link above -- I have a photographic memory. I just forgot the film --Unknown = Ryan Thompson [EMAIL PROTECTED] http://osgw.sourceforge.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as cgi script
Thanks very much to all, Ok, I understand now.. so I need to install php as a cgi oppose to the module apache. Do you have some good page that can help me to configure and compile correctly the php as cgi? Thanks in advance, Kisses, Ivone --- Kelly Hallman [EMAIL PROTECTED] wrote: On Fri, 28 Nov 2003, Nicole Lallande wrote: Ivone -- You are using a PERL invocation for php. PHP scripts begin ?php #! is not a perl invocation, it is a Unix convention to tell the shell which program should be used to process the file contents. If you are running PHP as a CGI from a webserver, chances are good you do want #!/path/to/php as the first line, and ?php on the next line. I don't think you can pass a flag like #!/usr/bin/php -q though, and I doubt you would want to, since you still need to send the headers upon first output. If you did not send headers and just started outputting, the server would return a 500 Internal Server Error. The directory you're running it from needs to have ExecCGI permission (i.e. /cgi-bin/) and assuming no special setup has been done, you probably want to start the file off with that #! line as mentioned above. Also, you may want to try naming the file .cgi the # sign is a comment in PERL - not in PHP. # also denotes a comment in PHP. Though #! is not a comment, per se. (However, if you feed the file directly to some interpreter like perl, it does have the benefit of being ignored as a comment.) To run php as cgi you need to install the php cgi version (as opposed to the apache modular installation.) That will allow you to run cgi scripts on the command line. CGI stands for common gateway interface, which is the interface between a web server/request and some external program, so it has little to do with the command line. However, to run PHP from the command line, you do need to run it with the CGI version of PHP. The question did not specify needing to run PHP from the command line, but as a CGI by the webserver. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with Log() function
On Saturday 29 November 2003 06:03, Jon King wrote: I'm having trouble getting a log formula to work. This forumla is supposed to return the number of payment required zero out a loan balance. print -(log(1-($B/$m)*($r/$q)))/log(1+($r/$q)); It keeps returning a NaN. I've checked the syntax over and over, but to no avail. Breakup your calculation into little steps to see where your error lies. Have to tried entering the above calculation into a real calculator? I believe your problem is that you cannot log() a negative number. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Algol-60 surely must be regarded as the most important programming language yet developed. -- T. Cheatham */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DAMN
- Edwin - wrote: On 2003/11/29, at 14:17, John Nichel wrote: Bronislav Klucka wrote: I've just realized I'm replaying to JeRRy only Could anybody fixt this problem by setting the Reply To header correctly? to be able to reply PHP conf. directly using Reply button?!!! Brona How many times is someone going to start this flame war this month? Hmm... A *better* question would be How many people does NOT start it? ;) -- - E - Well, I did my part, and stayed out of the first onebut I did bite my tongue quite a bit. ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php