Re: [PHP] seraching / indexing in php
PHPdig comes with extensive documentation and you are free to rewrite the code so that the search engine does exactly what you want. But, you have to be rather familiar with PHP. My own impression was that it is easy (more or less) to do some basic configuration on the search engine. When it comes to adopting the code for your own needs, so to say, it is sometime necessary to do some extensive research on the PHP manual. However, Phpdig is capable of indexing dynamically generated pages (I just tested it). To write a little script in order to update the index when the pages content changed, shouldn't be a problem either. Download the package and take a look at the source code. regards, frank 2005-03-22 kl. 16.01 skrev Reinhart Viane: Thanks Frank, One question: on most of these search engines I can't seem to find if the index and search dynamically generated pages. The intention is to make a site where several users have one page each which they can edit on there own. Do you think most of those engines can index pages like that? Or should I create an index every time a page is updated / made? Greetings -Oorspronkelijk bericht- Van: Frank Arensmeier [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 22 maart 2005 15:54 Aan: php list general Onderwerp: Re: [PHP] seraching / indexing in php Hello! I suggest you take a look at: http://www.phpdig.net/ Regards, Frank 2005-03-22 kl. 15.47 skrev Reinhart Viane: I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays not recognized in Simple XML Objects (using print_r)
hi! i'm trying to use the simple_xml functions to get an arrray of data from a sample xml file. here's my sample_data.xml ?xml version=1.0 encoding=ISO-8859-1? sample_data first_names first_nameamit/first_name first_nameamar/first_name /first_names /sample_data the php file ?php $sample_data = simplexml_load_file(sample_data.xml); print_r($sample_data); print_r($sample_data-first_names); print_r($sample_data-first_names-first_name); ? output of $ php test_xml_1.php SimpleXMLElement Object ( [first_names] = SimpleXMLElement Object ( [first_name] = Array ( [0] = amit [1] = amar ) ) ) SimpleXMLElement Object ( [first_name] = Array ( [0] = amit [1] = amar ) ) SimpleXMLElement Object ( [0] = amit ) The above output shows $sample_data-first_names-first_name as an ARRAY in the first 2 print_r 's however when a print_r is run on itself it shows it as a SimpleXMLElementObject. Question is why the last print_r gives different information compared to the other 2. I also tried running $key = array_rand($sample_data-first_names-first_name) and it gives a warning message Warning: array_rand(): First argument has to be an array in /home/yvb/work/practice/php/XML/foo.php on line 16 any clue how do i use the $sample_data-first_names-first_name as an array ? thx. yashesh. -- go pre http://www2.localaccess.com/rlalonde/pre.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] seraching / indexing in php
If you are using Apache you also have the option of using the rewrite rule to change your urls - for example http://www.mydomain.com/index.php?a=foob=bar to http://www.mydomain.com/foo/bar If you are interested there is plenty of info on the net about the apache rewrite rule... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reduce the following code if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){
Hello; Can any one show me a way to reduce the following code? ## ?php if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){ $someVar = Something; } ? I was thinking there must be a way to place all the Colors into a $allColorVar and check to see if $colorVar = $allColorVar? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seraching / indexing in php
Thanks everyone, Time to dig myself in and see what is best for my purpose. :) -Oorspronkelijk bericht- Van: Chris Ramsay [mailto:[EMAIL PROTECTED] Verzonden: woensdag 23 maart 2005 9:53 Aan: php list general Onderwerp: Re: [PHP] seraching / indexing in php If you are using Apache you also have the option of using the rewrite rule to change your urls - for example http://www.mydomain.com/index.php?a=foob=bar to http://www.mydomain.com/foo/bar If you are interested there is plenty of info on the net about the apache rewrite rule... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: reduce the following code if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){
* Lupita [EMAIL PROTECTED]: Can any one show me a way to reduce the following code? [...] I was thinking there must be a way to place all the Colors into a $allColorVar and check to see if $colorVar = $allColorVar? I think http://de3.php.net/manual/en/function.in-array.php is what you want :) Ciao, Gerhard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL statement - date
How should I formulate my sql statement to create a result set of members who registered between now and 7 days ago? I have tried the following and it is obviously incorrect: $sqlnewmembers = Select uid, uprofilename from tblusers where udatereg between (date() and date() - 7); Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reduce the following code if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){
?php $allColor = array('Black','Red','White','Blue'); if (in_array($colorVar, $allColor)) { $someVar = 'Something'; } ? /frank 2005-03-23 kl. 09.54 skrev Lupita: Hello; Can any one show me a way to reduce the following code? ## ?php if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){ $someVar = Something; } ? I was thinking there must be a way to place all the Colors into a $allColorVar and check to see if $colorVar = $allColorVar? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Frank Arensmeier Marketing Support NIKE HYDRAULICS AB Box 1107 631 80 Eskilstuna Sweden tel +46 16 82 34 fax +46 16 13 93 16 email: [EMAIL PROTECTED] www.nikehydraulics.com
Re: [PHP] SQL statement - date
take a look here http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html the first example should help you... regards jesper Jacques wrote: How should I formulate my sql statement to create a result set of members who registered between now and 7 days ago? I have tried the following and it is obviously incorrect: $sqlnewmembers = Select uid, uprofilename from tblusers where udatereg between (date() and date() - 7); Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! configure Apache as a proxy
[EMAIL PROTECTED] wrote: I configured a Apache server as a proxy. But it's very slow. when I use this server connect internet it is NOT so slow. I think it ss because,my config has some error! Who can help me? This is a PHP programming list, not an Apache list. Ask in the Apache list to get better responses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: http authentication with safe mode enabled?!
Richard Lynch wrote: You can always add more .htaccess files in more directories, or edit the one that's there. And that's precisely what I did. The only reason why I only have .htaccess in the top-level directory is that I don't have any directives specific to one subdomain that the others shouldn't use and according to the apache docs when requesting a file apache looks in every higher-level directory for .htaccess as well. The fact that the uid of the script is appended to the realm specified shouldn't require any changes in the code, or should it? No. It would only invalidate any saved logins or passwords from the old realm being managed by the browser. Different realm == different login/credentials needed. Thanks for that info, seems my understanding of the matter is not as for off as I thought it to be although I've read your posting saying you only got to know the specifics through years of practice. That's your ISP being silly, not PHP 4.3.10 changing That's what I thought. That said, HTTP Authentication WILL NOT WORK with CGI. It is disabled in PHP source because, because your password would be transmitted insecurely from Apache to PHP, and the PHP Team is not willing to do that for obvious reasons. Get your host to go back to PHP as Module, or switch to a form login. I already contacted their support asking them to at least have PHP5 built as a module when they'll upgrade. I'm not to happy with their support anyways, responses are fast but they've never told me anything I hadn't known before asking them. I've moved from trying to use HTTP based authentication-methods to php sessions and html-form based authentication, it's much more configurable especially visual-design-wise and wasn't half as challenging to implement as I'd expected. Don't you just love when you teach yourself something new and can use it to do what you want to, and it actually works. Okay, enough chatting. I just wanted to thank you for your answers Richard, very helpful and informative. Cheers from germany, Roman. P.S.: WILD GUESS: $_SERVER['REMOTE_PASSWORD'] ??? Nope, tried dumping $_SERVER, $_ENV and $_REQUEST upon cancelling the authentication, nothing useful in there. It says in a comment to the manual that the authdata is in $_SERVER['REMOTE_USER'] and you can either base64_transcode it (or whatever the function is called) or use apache's ModRewrite but I can't confirm that, maybe the person that suggested it was using apache2, in any case it didn't work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php pattern, software development pattern
I looked at php pattern (www.phppatterns.com). I did not understand it well. Is that supposed to be pattern as in software development pattern? If so why the uml diagrams are not there? For example A sample Strategy pattern for form validation. What does that mean? I am confused. -- symbulos partners -.- symbulos - ethical services for your organisation http://www.symbulos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Arrays not recognized in Simple XML Objects (using print_r)
Yashesh Bhatia wrote: hi! i'm trying to use the simple_xml functions to get an arrray of data from a sample xml file. here's my sample_data.xml ?xml version=1.0 encoding=ISO-8859-1? sample_data first_names first_nameamit/first_name first_nameamar/first_name /first_names /sample_data the php file ?php $sample_data = simplexml_load_file(sample_data.xml); print_r($sample_data); print_r($sample_data-first_names); print_r($sample_data-first_names-first_name); ? output of $ php test_xml_1.php SimpleXMLElement Object ( [first_names] = SimpleXMLElement Object ( [first_name] = Array ( [0] = amit [1] = amar ) ) ) SimpleXMLElement Object ( [first_name] = Array ( [0] = amit [1] = amar ) ) SimpleXMLElement Object ( [0] = amit ) The above output shows $sample_data-first_names-first_name as an ARRAY in the first 2 print_r 's however when a print_r is run on itself it shows it as a SimpleXMLElementObject. Question is why the last print_r gives different information compared to the other 2. I also tried running $key = array_rand($sample_data-first_names-first_name) and it gives a warning message Warning: array_rand(): First argument has to be an array in /home/yvb/work/practice/php/XML/foo.php on line 16 any clue how do i use the $sample_data-first_names-first_name as an array ? thx. yashesh. That's how print_r displays objects and nested objects - try a var_dump on the item and you'll see that simplexml does NOT return arrays but instead returns simplexml objects - if you want to use array_rand you can cast (http://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting) the object to an array, or check out the user notes on simplexml http://us2.php.net/manual/en/ref.simplexml.php to find example functions to change a simplexml object to an array personally I prefer dom and use a domtoarray function - but YMMV - please read the simplexml documentation again, it returns objects (nested ones) NOT arrays -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML - to - PDF
Matt Babineau wrote: Hi All, I have some reports I need converted from HTML to PDF, I'm on a LAMP box, so does anyone have any free suggestions? google fpdf -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] access violation
Hello Rob, Tuesday, March 22, 2005, 4:14:55 PM, you wrote: R That's interesting - it also started happening for me after R installing PHP 5.0.3. But I have reverted to 4.3.10 for now, and I R can't see how installing 5.0.3 into an entirely separate directory R can break my old php install. Hmm.. R Incidentally, are you using Pear at all? No, I'm not doing anything with Pear (just haven't gotten around to it). I did the same thing you did, installed into a separate directory and fixed all the references in the webserver, and have deleted any PHP 4.3 files from the Windows/System folder. Luckily it doesn't appear to be a big security problem as it only displays the access violation in the browser window (no paths or anything). A reboot fixes it until I do something like refreshing POST data a few times again. Until I get the problem resolved, I don't refresh POST data anymore on that server. The frustrating thing is that the crash doesn't show up in any logs. Even the Windows system logs. I also didn't do any major changes from the default php.ini except to enable some extensions I needed, set up the SMTP stuff, and that's really about it. I am running 5.0.3 on other servers (various web servers and MySQL versions, but all Windows), and am not experiencing this problem. The only difference with those servers is that 5.0.3 was installed fresh (no previous PHP). I'm wondering if I missed one of the extension files somewhere from 4.3. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GIF instead of JPG..
Hey! Thanks for sharing mate! I'll run it and get back to you if I have any problems. Cheers, Ryan On 3/22/2005 10:49:42 PM, Andras Kende ([EMAIL PROTECTED]) wrote: Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files... and not with GIFs, can someone please help me convert it to GIF too? I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. The below script works perfectly for jpgs: ?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); if ($width ($width_orig $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GIF instead of JPG..
Hey! Thanks for replying. I started out to do exactly that: changeing everything from JPEG to GIF, but I also wanted to know what exactly i was doing so i started to read the manual for each function that i was using and i got a bit stumped when i came to imagecreatetruecolor as its only for JPEG...hence the confusion. My server supports GIF and i've been reading up on the image manipulation parts of the manual...lets see how it goes :-) Cheers, Ryan On 3/22/2005 8:44:39 PM, Mike ([EMAIL PROTECTED]) wrote: Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files...and not with GIFs, can someone please help me convert it to GIF too? If your version of GD supports GIFs (which not all do), then it's almost as simple as changing every place you see the string jpeg to gif. Look in the online manual for the image functions. You'll see reference to the ones here (such as imagecreatfromjpeg()) and also ones for PNGs and GIFs and a few others. Just realize that when you are reading a file of a particular type, you need to use those imagetype() functions... But in most cases they are completely interchangable if you're passing paths to images of the appropriate type. Hope all of that makes sense :) -M I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. The below script works perfectly for jpgs: -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GIF instead of JPG..
Hey, Thanks for replying. The best part of your reply was: Or, you could even use http://php.net/imagegetsize and IGNORE the filename, and base your decision on what's actually *IN* the file, so when some idiot renames a jpeg to .gif because they think that will make it a GIF (yes, that really happens) hehe, made my day as I just got up :-D Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php pattern, software development pattern
Symbulos Partners wrote: I looked at php pattern (www.phppatterns.com). I did not understand it well. Is that supposed to be pattern as in software development pattern? If so why the uml diagrams are not there? They are design patterns for code. But the design patterns there are more micro than your typical UML (though I suppose you could diagram the design using UML if you really want). Think of those patterns as a blueprint for building a class. While your problem at hand is unique, there are repeatable solutions (patterns) that you can use and re-use to solve those unique patterns. *That* is what design patterns are all about. For example A sample Strategy pattern for form validation. What does that mean? Form validation is a problem you will have over and over again. The strategy pattern is a *repeatable solution* to that problem. So you can use the Strategy pattern to solve your form validation problem the first time around. Then the next time you need to validate a form you say hey, wait a minute, I know how to solve this problem! Poof! Light bulbs go on, angels sing and the beer flows like water. Better yet: if you're careful about the way you design your Strategy class, then you can re-use it for future projects. You become more efficient because now you have this code base that you can re-use. Easily. *Hopefully*. ;) It takes a lot of practice to get good at this and even then you will end up scrapping designs later. I am confused. Hopefully you're less confused now. To summarize: if you have a repeatable problem with a single answer that you can use to answer that problem then design patterns are A Good Thing. In addition, having those classes around will make it easier for you to get a solution the second, third, etc. time around. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Borrowed code- how to give credit
Well, if your code is open source or you are distributing the code add a comment right on top of the file like this /* This line's : code here original author was, and I am very greatful to this person for writing this beautiful piece of code that i am useing */ maybe? :-) Cheers, Ryan On 3/22/2005 9:47:36 PM, [EMAIL PROTECTED] wrote: On Tue, March 22, 2005 4:54 pm, C Drozdowski said: I used a single line of code (ver batim) from a pear class in my own code. I try to always be honest and not steal code but this single line does exactly what I need. The code is for a NPO website and will never be sold or anything like that. How should I give credit for the line of code in my own code? -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php command
is there a command that will allow me to connect to another box and execute commands? for instance, I want to create an automated php script that will connect to a unix box and run a series of commands. I believe that ssh2_exec() and ssh2_shell() are not supported in the 4.3.4 version of php I am running. I thought of exec(); i could telnet in to the box but I didn't know if another exec() statement would pass the aurguments to the original telnet session set up in a previous exec() statement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php command
I think what you need to do is look at the sockets section of the manual. Regards, Mikey -Original Message- From: D A GERM [mailto:[EMAIL PROTECTED] Sent: 23 March 2005 14:46 To: php-general@lists.php.net Subject: [PHP] php command is there a command that will allow me to connect to another box and execute commands? for instance, I want to create an automated php script that will connect to a unix box and run a series of commands. I believe that ssh2_exec() and ssh2_shell() are not supported in the 4.3.4 version of php I am running. I thought of exec(); i could telnet in to the box but I didn't know if another exec() statement would pass the aurguments to the original telnet session set up in a previous exec() statement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php pattern, software development pattern
Thanks for your explanation, it makes things clearer, but I need to work on it a bit more before saying that is perfectly clear for me. Are there more pattern repositories available than simply www.phppatterns.com? -- symbulos partners -.- symbulos - ethical services for your organisation http://www.symbulos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] executed script URL
I'm firt time here so hello everybody I have some skill in php coding so don't worry, I will no boring with stupid question. Due to I'm unable to test my app on all http servers with all configs I need to know is it possible to get from PHP engine information about executed script URL (not file system path). Now what I'm investigated It's began since I cannot use relative path for Location header on IIS servers. It must contains URI. I cannot build the URL with $_SERVER['PHP_SELF'] because it not always returns relative to server path (due to server configuration it sometimes returns full URL) building URL using method described in documentation comments: $_SERVER['SERVER_NAME'] + $_SERVER['SCRIPT_NAME'] is good until the system is started with embeded php. If php runs as cgi, $_SERVER['SCRIPT_NAME'] returns path co cgi.exe $_SERVER['SCRIPT_FILENAME'] and $_SERVER['PATH_TRANSLATED'] are filesystem based variables, and are useless because we still have no information about URL path related to server base URL. So, is it possible to get this URL automaticly, or I will have add variable with fixed URL into config file of system I'm working on. best regards -- ***Media-IT Micha Kousznik *** *** IT networks - databases - multimedia *** ***[EMAIL PROTECTED] *** *** http://www.media-it.net *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: executed script URL
Rasmus answered this question a week or two ago. Search the archives for 'getenv request' and you will likely find the answer. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Bug in look-behind assertions in PCRE patterns ?
Dear All Is this a bug ? I'm using look-behind assertions within preg_match() to ignore certain combinations of patterns. E.g. from ref. manual is: (?!foo)bar matches bar but only if it's not preceded by foo. Here's my test script: $line = '$res = foobar(ddd, dfdf);'; if (preg_match(/(?!foo)(bar)/, $line, $matches)) { echo Should NOT match foobar, but found: .$matches[1]; } $line = '$res = $bar(ddd, dfdf);'; if (preg_match(/(?!\$)(bar)/, $line, $matches)) { echo Should NOT match \$bar, but found: .$matches[1]; } In the first preg_match() is correctly ignores the foobar function name. However the second preg_match() does NOT ignore the $bar as I expected. I converted this to Perl and it correctly ignores both! Is this a bug, or am I missing something ? using PHP-4.3.10 + apache 1.3.33 + fc 1 Many thanks Ian -- Ian Thurlbeckhttp://www.stams.strath.ac.uk/ Statistics and Modelling Science, University of Strathclyde Livingstone Tower, 26 Richmond Street, Glasgow, UK, G1 1XH Tel: +44 (0)141 548 3667 Fax: +44 (0)141 552 2079 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Bug in look-behind assertions in PCRE patterns ?
Ian Thurlbeck wrote: Dear All Is this a bug ? [...] $line = '$res = $bar(ddd, dfdf);'; if (preg_match(/(?!\$)(bar)/, $line, $matches)) { echo Should NOT match \$bar, but found: .$matches[1]; } In the first preg_match() is correctly ignores the foobar function name. However the second preg_match() does NOT ignore the $bar as I expected. This is a quoting issue. Above you are using double quotes, which interpolates embedded PHP variables. Therefore if you want a literal $ inside a double-quoted string you have to escape it, as you have done. However, the $ character is ALSO a preg metacharacter (matches end of line). This means that you must also escape it for the preg parser as well, so you need to escape it twice, by putting another literal backslash behind it: if (preg_match(/(?!\\\$)(bar)/, $line, $matches)) { Either that or you can use single quotes instead of double quotes: if (preg_match('/(?!\$)(bar)/', $line, $matches)) { Either one will work. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
Richard Lynch mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 10:31 PM said: Personally, I'd opt for working on the macro first, and making that as clean and clear as you can, really thinking deeply on it. Put it away for a day or two and pull it out. Does it all still make sense? Ok, I can try this. Sounds good. It's much too easy (guilty!) to start diving in and writing code/functions/pages without reflecting enough on the big picture. Yes, and this is what I am trying to avoid. Course, you sometimes have the PHB breathing down your neck who will accuse you of not working if you aren't typing code. Sigh. Time to quit *that* job and look for another one. PS I'm looking for a new job. :-^ Good luck. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
Burhan Khalid mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 10:56 PM said: One approach that I liked (I forgot what book it was mentioned in) involves using a whiteboard and post-it notes. You put your entities on the post it notes, then draw flow lines on the whiteboard. This way, you can easily move your entities around. Yeah that might work out pretty well. I found a free mind mapping program on www.lifehacker.com called FreeMind (found on 2nd page today). I've yet to try it out (dang thing is only dl'ing at 3.5Kb) but it looks promising. Anyway, my experiences in the past with mind mapping have been pretty good so that might play into your post-it notes idea pretty well. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: die function
Hi all, just to give you another solution that I've successfully adopted: function die_script($errmsg) { $sendto = [EMAIL PROTECTED]; $from = [EMAIL PROTECTED]; $subject = FAILED; $message = CONNECTION FAILED\nTYPE OF ERROR:\n . mysql_error(); $message .=\n\n; $headers = From: $from\r\n; mail($sendto, $subject, $message, $headers); print $errmsg . /body/html; die; } $connessione = mysql_connect (192.168.168.1,user,password) or die(die_script($errmsg)); mysql_select_db (dbnamei); Thanks for your help Regards Barbara Barbara Picci wrote: Hi all, I have a machine that must insert in cron in a mysql db in another remote machine. The problem is that I cannot know if the connection in the first machine (adsl) go down because no entry in the machine log is generated. I would like to redirect the die function in a e-mail that say me what happens. I think the way you want to solve this problem is to create a customized error handler. Check out this link: http://php.net/manual/en/function.set-error-handler.php ?php function email_error_handler($level, $msg, $file, $line) { switch ($level) { /** E_ERROR, E_USER_ERROR, etc. */ mail_to_admin($level: $msg in $file on line $line); } } function mail_to_admin($msg) { /** stuff */ } ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins Content-Type: application/pgp-signature; name=signature.asc Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Attachment converted: Barbara OS9:signature 276.asc (/) (000B65CD) -- Barbara Picci Micro srl viale Marconi 222, 09131 Cagliari - tel. (+39) 070400240 http://www.microsrl.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fedora-Apache2-PHP exec() failure
Hi all, I'm having the same problem as Jim Poserina. Richard pointed out some things to try. Here's my story. We installed Fedora 3 on a new box. Then we installed Apache 2 and PHP 4.3.9 from the RPMs that came on the CDs. Pretty much everything works as expected, except the exec() functions do not work in the web server. There is no error message displayed in the browser or in the error_log of apache. Here's the script: ?php $x = exec(/bin/pwd, $y, $z); echo brx is ; var_dump( $x ); echo bry is ; var_dump( $y ); echo brz is ; var_dump( $z ); ? Here is the output: x is string(0) y is array(0) { } z is int(127) If I run the php interpreter from the command line, exec() does work ok. I can turn safe mode on and define a safe_mode_exec_dir and copy /bin/pwd to it and then run that and the command line interpreter honors that setting ok. The web page result doesn't change though. No error message, no output. Just the 127 (-1?) So, what do I have to change in my setup to get the exec functions to work in the web server? Thanks, Bill Rausch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session woes
I had my script working beautifully on my box but when transferring to dev server no such luck Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the session.use_trans_id = 1 so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now. It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3. I'm also getting [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 where line 60 is my session_start(); I'm kinda clueless as to what to try next. Thanks for any ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session woes
You need to make sure that output_buffering is turned on in your php.ini file on the dev server. ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? From: Mignon Hunter [EMAIL PROTECTED] Date: Wed, 23 Mar 2005 11:20:24 -0600 To: php-general@lists.php.net Subject: [PHP] session woes I had my script working beautifully on my box but when transferring to dev server no such luck Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the session.use_trans_id = 1 so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now. It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3. I'm also getting [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 where line 60 is my session_start(); I'm kinda clueless as to what to try next. Thanks for any ideas -- 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] session woes
Mignon Hunter wrote: ... [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 Your script has output on line 5. (it's possible that this is whitespace character(s) as those count as output as well). mr_obviousYou currently are trying to send headers after you already sent output. This is a problem because PHP thought it already sent all of the headers, but oops, it didn't!/mr_obvious If the output buffering answer doesn't work for you then you should go back to line 5 and verify / eliminate the output that is produced on that line. Or you can move the session_start() and / or other functions that are sending headers before output on line 5. There's more than one way to skin this cat. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: reduce the following code if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){
Thank You that did it. Lupita [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello; Can any one show me a way to reduce the following code? ## ?php if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){ $someVar = Something; } ? I was thinking there must be a way to place all the Colors into a $allColorVar and check to see if $colorVar = $allColorVar? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() Alternative?
Hi All, I've had a production system moved to a new server. Our geniuses here have refused to allow sendmail on the server and all my e-mail functions are now gone. Is there a way around this? I have already checked the manual, I don't see anything -- -Dan Joseph Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() Alternative?
I've had a production system moved to a new server. Our geniuses here have refused to allow sendmail on the server and all my e-mail functions are now gone. Is there a way around this? I have already checked the manual, I don't see anything You can always look into utilizing PEAR::Mail. Once implemented, tt makes it very easy to switch how you send email out. I recently had to do that and it was as easy as doing a global search and replace. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() Alternative?
You can always look into utilizing PEAR::Mail. Once implemented, tt makes it very easy to switch how you send email out. I recently had to do that and it was as easy as doing a global search and replace. Oh ok. I will look into Pear, thank you Chris! -- -Dan Joseph Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() Alternative?
Another way is the famous phpmailer() class. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pagination
Hello all, I am wanting to paginate records from a MySQL Database. I want there to be 5 records on a page, on multiple pages. Can someone point me in the right direction or show me a way to do this? I can get five records on a page with a LIMIT statement, however, I can not get it to show the first five, then put a next link to the next 5 and so on. (I would like there to be a next and previous.) Thank you for any help. -- Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pagination
Marquez Design wrote: Hello all, I am wanting to paginate records from a MySQL Database. I want there to be 5 records on a page, on multiple pages. Can someone point me in the right direction or show me a way to do this? I can get five records on a page with a LIMIT statement, however, I can not get it to show the first five, then put a next link to the next 5 and so on. (I would like there to be a next and previous.) Your next and previous buttons either need to pass where they left off in the db (either in the query string or by means of a form post), so that your script will know where to start from. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pagination
Please send replies to the list. [EMAIL PROTECTED] wrote: I've been working on this same project for one of my pages, and it seems relatively straight forward if you are just using a full set of records to paginate, but if you are using a filtered set (or search results) then it becomes a bit more tircky to ascertain where in the search results you are. I'm still working on that, and reading this thread intently. Thanks, */ Martin Austin /* *John Nichel [EMAIL PROTECTED]* Marquez Design wrote: Hello all, I am wanting to paginate records from a MySQL Database. I want there to be 5 records on a page, on multiple pages. Can someone point me in the right direction or show me a way to do this? I can get five records on a page with a LIMIT statement, however, I can not get it to show the first five, then put a next link to the next 5 and so on. (I would like there to be a next and previous.) Your next and previous buttons either need to pass where they left off in the db (either in the query string or by means of a form post), so that your script will know where to start from. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pagination
Marquez Design mailto:[EMAIL PROTECTED] on Wednesday, March 23, 2005 12:19 PM said: I am wanting to paginate records from a MySQL Database. I want there to be 5 records on a page, on multiple pages. Can someone point me in the right direction or show me a way to do this? I can get five records on a page with a LIMIT statement, however, I can not get it to show the first five, then put a next link to the next 5 and so on. Since you're already using limit you're doing better than most. At this point you can do one of two things: 1. When the search is first executed get a count of all available records and display only the ones you want on your page. On each subsequent page (next/previous) return, using the LIMIT clause, only those records you need. With this technique you'll be able to show the user how many total pages there are instead of the using guessing as to when they'll reach the end of their search results. If you don't have a lot of results you might not care to go this route. One requirement with this option is that you must pass the total number of records during each next/previous page transition. This is to tell the page that you've already done the initial look up. 2. Use the LIMIT clause to return only the records you need. This is what you seem to be doing already. The only other piece to your puzzle is to send the starting point for the LIMIT clause on each page change. For the first page you probably had SELECT ... FROM ... LIMIT 0,5. Considering we're on the first page the previous link will not be clickable since we can't go back any further. However, the next link will pass the value 5 to the page so that the limit clause knows to start at record 5 on the next pass. i.e. SELECT ... FROM ... LIMIT 5,5. So... Page 0: previous a href=page.php?start=5next/a Page 1: a href=page.php?start=0previous/a a href=page.php?start=10next/a Page 2: a href=page.php?start=5previous/a a href=page.php?start=15next/a etc. Of course, you'll need to pass all your search criteria (and any other data you need) within each link as well. HTH! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting to a string
Hello guys, i am using date(l dS of F Y h:i:s A) and want to put the value in a database as a string, How do I converting it to a string, this is what I have got so far:- $v_ship_date = date(l dS of F Y h:i:s A); Lots of thanks. - Original Message - From: PartyPosters To: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:01 PM Subject: Passing Arrays between pages Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
Re: [PHP] Borrowed code- how to give credit
And if you make money from it, send them some money for the effort. yep, money would really tell the author you appreciate his contribution / what he thought of. :-) -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Converting to a string
PartyPosters mailto:[EMAIL PROTECTED] on Wednesday, March 23, 2005 12:44 PM said: i am using date(l dS of F Y h:i:s A) and want to put the value in a database as a string, How do I converting it to a string, this is what I have got so far:- $v_ship_date = date(l dS of F Y h:i:s A); That's pretty much all you need. Just make sure you enclose the data you're passing to the database in the proper quotes (either ' or , depending on your needs). INSERT INTO table (v_ship_date) VALUES ('$v_ship_date'); Chris. p.s. For clarity, it's best to start a completely new email to start a new thread instead of replying to an already established thread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session woes[RESOLVED]
Bingo ya know I knew that about the headers but it threw me since it worked on my box perfectly no matter where I put the session_start(); Lo and behold I check out the php.ini on my box and there it was: output buffering=4096 I did not know about the output buffering. BUT I just moved my session_start(); to the very tip top in we're in ship shape. Sorry for all the strange sayings Thanks so much to Jason, Stephen and John Ciao Stephen Johnson [EMAIL PROTECTED] 03/23/05 11:30AM You need to make sure that output_buffering is turned on in your php.ini file on the dev server. ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? From: Mignon Hunter [EMAIL PROTECTED] Date: Wed, 23 Mar 2005 11:20:24 -0600 To: php-general@lists.php.net Subject: [PHP] session woes I had my script working beautifully on my box but when transferring to dev server no such luck Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the session.use_trans_id = 1 so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now. It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3. I'm also getting [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60 where line 60 is my session_start(); I'm kinda clueless as to what to try next. Thanks for any ideas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Insertion of integer in a database
Hi folks, Problem is fairly simple, but how can I insert integer in an SQL statement? So, I only had strings, but now I have introduced a timestamp column (bigint to cover the milleseconds), and I have the following statement: $queryInsert = INSERT INTO mytables (..., timestamp) VALUES ('; $queryInsert .= ...; // several columns $queryInsert .= ', '; $queryInsert .= time() . '); $result = mysql_query($queryInsert); This is not working as time() returns an integer and .= only works with strings! How can I cope with that? Thanks. DvJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CVS solution
Hiya guys, I need some type of extremely simple (yet intuitive) CVS solution, preferbly written in PHP. Namely I want to allow fairly unsavvy computer users (lets say my mom for example) to checkout files of interest, located on some server, via a web-interface and PHP\MySQL backbone. I really don't want to write this myself, does anyone have any suggestions. Thanks in advance, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insertion of integer in a database
I don't think the integer is the problem, but if it is you can turn time() into a variable and then, $time = time(); david joffrin wrote: Hi folks, Problem is fairly simple, but how can I insert integer in an SQL statement? So, I only had strings, but now I have introduced a timestamp column (bigint to cover the milleseconds), and I have the following statement: $queryInsert = INSERT INTO mytables (..., timestamp) VALUES ('; $queryInsert .= ...; // several columns $queryInsert .= ', '; $queryInsert .= time() . '); $result = mysql_query($queryInsert); This is not working as time() returns an integer and .= only works with strings! How can I cope with that? Thanks. DvJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insertion of integer in a database
david joffrin mailto:[EMAIL PROTECTED] on Wednesday, March 23, 2005 1:01 PM said: So, I only had strings, but now I have introduced a timestamp column (bigint to cover the milleseconds) Why not use VARCHAR instead? Timestamp doesn't need to be numeric does it? For sure it's not required to be numeric. and I have the following statement: $queryInsert = INSERT INTO mytables (..., timestamp) VALUES ('; $queryInsert .= ...; // several columns $queryInsert .= ', '; $queryInsert .= time() . '); $result = mysql_query($queryInsert); May I suggest the following? ?php $timestamp = time(); $queryInsert = QQQ INSERT INTO mytables (columnA , columnB , ... , timestamp) VALUES ('$valueA' , '$valueB' , ... , $timestamp) QQQ; ? HTH, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fedora-Apache2-PHP exec() failure
Bill Rausch wrote: Hi all, I'm having the same problem as Jim Poserina. Richard pointed out some things to try. Here's my story. We installed Fedora 3 on a new box. Then we installed Apache 2 and PHP 4.3.9 from the RPMs that came on the CDs. Pretty much everything works as expected, except the exec() functions do not work in the web server. There is no error message displayed in the browser or in the error_log of apache. Here's the script: ?php $x = exec(/bin/pwd, $y, $z); echo brx is ; var_dump( $x ); echo bry is ; var_dump( $y ); echo brz is ; var_dump( $z ); ? Here is the output: x is string(0) y is array(0) { } z is int(127) If I run the php interpreter from the command line, exec() does work ok. I can turn safe mode on and define a safe_mode_exec_dir and copy /bin/pwd to it and then run that and the command line interpreter honors that setting ok. The web page result doesn't change though. No error message, no output. Just the 127 (-1?) So, what do I have to change in my setup to get the exec functions to work in the web server? My guess it that it is an selinux issue. That stuff is such a mess in Fedora. Try playing with that. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting to a string
Thanks guys, you were right - I needed to change the format of the field in the database. :D - Original Message - From: Daniel Gerzo [EMAIL PROTECTED] To: PartyPosters [EMAIL PROTECTED]; php-general@lists.php.net Sent: Wednesday, March 23, 2005 8:58 PM Subject: Re: [PHP] Converting to a string Hello PartyPosters, Wednesday, March 23, 2005, 9:43:30 PM, si odoslal: Hello guys, i am using date(l dS of F Y h:i:s A) and want to put the value in a database as a string, How do I converting it to a string, this is what I have got so far:- $v_ship_date = date(l dS of F Y h:i:s A); well, php doesn't really cares if you got string or bool or integer like c or pascal does. php is converting automatically integers to strings and so far, you can add your value to the database whithout any manual converting... Lots of thanks. -- Later +--==/\/\==--+ (__) FreeBSD | DanGer [EMAIL PROTECTED] |\\\'',) The | [EMAIL PROTECTED] ICQ261701668 | \/ \ ^Power | http://danger.rulez.sk | .\._/_)To +--==\/\/==--+ Serve [ Ved evidenciu o svojich udajoch, je to dokaz tvojej prace. ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending a Table Via mail
Hello is there any way I can send a table (or just tabulated data) via email. I've tried this but comes up with an error. $to = [EMAIL PROTECTED]; $re = Test Email from system; $msg = TABLE BORDER=\2\TRhello/TR/TABLE mail($to, $re, $msg); Thanks in advance.
Re: [PHP] Sending a Table Via mail
PartyPosters wrote: Hello is there any way I can send a table (or just tabulated data) via email. I've tried this but comes up with an error. $to = [EMAIL PROTECTED]; $re = Test Email from system; $msg = TABLE BORDER=\2\TRhello/TR/TABLE mail($to, $re, $msg); It's in the manual... http://us4.php.net/manual/en/function.mail.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session questions
Hi, I am new to session of php. I need pass the form content from the the first page all the way down to the last page to process it. I used to use $_POST['sth'] to pass the data, but it is very painful since there are several pages between the first and last page. I am using $_SESSION['sth'] now. It saves a lot of time, but when I clicked the 'Back' button on the tool bar, I always got the message The page cannot be displayed. Can you help me? Thank you and regards. Guirong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session questions
[EMAIL PROTECTED] wrote: ... tool bar, I always got the message The page cannot be displayed. Can you help me? Yes. Use a real browser like Firefox so that you can get real error messages ;) -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: PHP CVS solution
Christian Calloway wrote: Hiya guys, I need some type of extremely simple (yet intuitive) CVS solution, preferbly written in PHP. Namely I want to allow fairly unsavvy computer users (lets say my mom for example) to checkout files of interest, located on some server, via a web-interface and PHP\MySQL backbone. I really don't want to write this myself, does anyone have any suggestions. Thanks in advance, Christian Horde's Chora. It's not simple to install, nor is it written in a pretty way, but it works. www.horde.org/chora cvs.php.net uses the same. - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to write IF statement for login script
Hi, I have a login script which has worked fine in the past, however i need to change the IF statement. Basically all i want it to do is verify that $squadnum variable is inbetween 1-98 or is 99. I'm not even entirely sure if i need to use the ereg function and i dont think the 1-98 bit is formatted correctly, any help would be much appreciated. Heres the code i have so far: if (ereg(1-98, $squadnum)) { // users with id 1-98 should get sent to squad page header(Location: squad.php); } else if(ereg(99, $squadnum)) { // 99 is the id number of the site administrator header(Location: admin.php); } else { header(Location: login.php); } Thanks, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending a Table Via mail
Great thanks! Sorry I didn't realise it was in there. what I've got so far is the following, I want to include a variable in there but have tried different combos but can't get it to work reading the variable. $to = [EMAIL PROTECTED] # subject of message $re = Test Email from system; $tablecontent = !DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'htmlheadtitleUntitled Document/title/headbodyTABLETRTDhello/td/TR/TABLE/body/ html; #message from the form $msg = $tablecontent; $message = ' html head titleBirthday Reminders for August/title /head body pHere are the birthdays upcoming in August!/p table tr thPerson/ththDay/ththMonth/ththYear/th /tr tr tdJoe/tdtd3rd/tdtdAugust/tdtd1970/td /tr TR TD$username/TD /TR /table /body /html '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; # send the mail now mail($to, $re, $message,$headers); ### MAIL ENDS HERE ? - Original Message - From: John Nichel [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, March 23, 2005 9:37 PM Subject: Re: [PHP] Sending a Table Via mail PartyPosters wrote: Hello is there any way I can send a table (or just tabulated data) via email. I've tried this but comes up with an error. $to = [EMAIL PROTECTED]; $re = Test Email from system; $msg = TABLE BORDER=\2\TRhello/TR/TABLE mail($to, $re, $msg); It's in the manual... http://us4.php.net/manual/en/function.mail.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] how to write IF statement for login script
Nick wrote: Hi, I have a login script which has worked fine in the past, however i need to change the IF statement. Basically all i want it to do is verify that $squadnum variable is inbetween 1-98 or is 99. I'm not even entirely sure if i need to use the ereg function and i dont think the 1-98 bit is formatted correctly, any help would be much appreciated. Heres the code i have so far: if (ereg(1-98, $squadnum)) { // users with id 1-98 should get sent to squad page header(Location: squad.php); } else if(ereg(99, $squadnum)) { // 99 is the id number of the site administrator header(Location: admin.php); } else { header(Location: login.php); } Thanks, Nick how about a non regular-expression solution? if($squadnum 0 $squadnum 99) { header('Location: squad.php'); } elseif($squadnum == 99) { header('Location: admin.php'); } else { header('Location: login.php'); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fedora-Apache2-PHP exec() failure
At 13:22 -0800 3/23/05, Rasmus Lerdorf wrote: Bill Rausch wrote: Hi all, I'm having the same problem as Jim Poserina. Richard pointed out some things to try. Here's my story. We installed Fedora 3 on a new box. Then we installed Apache 2 and PHP 4.3.9 from the RPMs that came on the CDs. Pretty much everything works as expected, except the exec() functions do not work in the web server. There is no error message displayed in the browser or in the error_log of apache. So, what do I have to change in my setup to get the exec functions to work in ... My guess it that it is an selinux issue. That stuff is such a mess in Fedora. Try playing with that. -Rasmus Bingo. I'd told my staff NOT to install the Selinux stuff so I never bothered looking for it because I knew it wasn't there. :( Thank you very much. Bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to write IF statement for login script
Thanks, that seems to have worked. M. Sokolewicz wrote: Nick wrote: Hi, I have a login script which has worked fine in the past, however i need to change the IF statement. Basically all i want it to do is verify that $squadnum variable is inbetween 1-98 or is 99. I'm not even entirely sure if i need to use the ereg function and i dont think the 1-98 bit is formatted correctly, any help would be much appreciated. Heres the code i have so far: if (ereg(1-98, $squadnum)) { // users with id 1-98 should get sent to squad page header(Location: squad.php); } else if(ereg(99, $squadnum)) { // 99 is the id number of the site administrator header(Location: admin.php); } else { header(Location: login.php); } Thanks, Nick how about a non regular-expression solution? if($squadnum 0 $squadnum 99) { header('Location: squad.php'); } elseif($squadnum == 99) { header('Location: admin.php'); } else { header('Location: login.php'); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GIF instead of JPG..
Hi, Wednesday, March 23, 2005, 11:30:53 PM, you wrote: RA Hi, RA I found this beautiful piece of code on the php site which make a RA proportional thumbnail, problem is its only working with JPEG files...and RA not with GIFs, can someone please help me convert it to GIF too? RA I tried but got a bit confused as there are no functions that are equal to RA imagecreatetruecolor that is in the below script. RA The below script works perfectly for jpgs: Here is a function I use for scaling that you can use as an example,it also handles transparent gifs. You can set $x or $y leaving the other at 0 to maintain aspect ratio or set both to force a fixed box. function Scale($input,$out,$x,$y){ $info = getimagesize($input); $width = $info[0]; $height = $info[1]; $colors = array(); if($width 0 $height 0){ if($x 0){ $w2 = $x; if($width $w2){ $scale = $width/$w2; $h2 = intval($height/$scale); }else{ $scale = $w2/$width; $h2 = intval($height * $scale); } }elseif($y 0){ $h2 = $y; if($height $h2){ $scale = $height/$h2; $w2 = intval($width/$scale); }else{ $scale = $sw2/$height; $w2 = intval($width * $scale); } } switch($info[2]){ case 1: $im = ImageCreateFromGif($input); $t = ImageColorTransparent($im); $itype = gif; if($t != -1){ $colors = imagecolorsforindex($im, $t); } $im2 = ImageCreate($w2,$h2); break; case 2: $itype = jpeg; $im = ImageCreateFromJpeg($input); $im2 = ImageCreateTrueColor($w2,$h2); break; case 3: $itype = png; $im = ImageCreateFromPng($input); $t = ImageColorTransparent($im); if($t != -1){ $colors = imagecolorsforindex($im, $t); } $im2 = ImageCreateTrueColor($w2,$h2); break; default: return; break; } if(count($colors) 0){ $transp = ImageColorAllocate($im2, $colors[red],$colors[green], $colors[blue]); } imagecopyresampled($im2, $im, 0, 0, 0, 0, $w2, $h2, $width, $height); if(count($colors) 0){ ImageColorTransparent($im2,$transp); } if(eregi(\.gif$,$out)){ ImageGif($im2,$out); }elseif(eregi(\.jpe?g,$out)){ ImageJpeg($im2,$out,90); }elseif(eregi(\.png$,$out)){ ImagePng($im2,$out,20); } } } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Preorder Modified Tree Traversal
Hi all, I'm trying to use pmtt to display a windows explorer style view of products in a database. If anyone is familiar with pmtt could you send me an email, I'm looking for some help. I built some code to pull the Levels out of the database, I need some help tracking which level the user is clicking on so that I can create a drill-down scenario. I know this can most likely be achieved more easily using the adjacent tree method, but I need something a bit more robust than that. Let me know if you have created any systems that are drill-down style menus or whatnot, I'm interested in the methods you used to achieve your success. Thanks All! PS- Thanks to those who suggested the Linux command line HTML 2 PDF package!! Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED]
Re: [PHP] Apache user can't use exec(), passthru(), etc.
The output is: OS Error: 127. I have a second server that I use as a downtime backup. On that one, all the scripts work normally. I don't have to give a path for the commands, any commands with permission problems return permission denied, and the apache user (nobody) actually has /sbin/nologin as the shell. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, March 21, 2005 8:20 pm, Jim Poserina said: If I run this PHP script: ?php echo 'pre'; echo exec('whoami'); The first most biggest thing wrong is that you aren't using the additional arguments to exec() to find out what your output is, and if your command generated an error. For starters, I'm betting that at least one of the following is true: whoami is not in the $PATH/$path of the PHP user. whoami is not executable by the PHP user. You'll never find out which unless you use the extra args to exec http://php.net/exec echo '/pre'; ? from the web, the output is pre/preand from the command line running as the apache user(webuser), the output is. Content-type: text/html X-Powered-By: PHP/4.3.9 pre/pre EXCELLENT attempt to diagnose this, though! But if I run from the command line as root, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 preroot/preand from the command line as a user in the root group, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 prejimpoz/preSafe mode is turned off. As webuser (or any non-root-group user), no shell commands work. Not echo, not ls, not whoami, not touch. And no shell functions work: no exec(), no passthru(), no shell_exec(), no backticks. Every command I'm trying to run is world-readable and world-executable. But are they in the $path of webuser? Use the full path to them if they aren't exec(/bin/whoami, $output, $error); if ($error) echo (OS Error: $error.br /\n); echo implode(br /, $output); If I turn safe mode on, it gives me a safe mode is on warning only about lines that call shell_exec(), and not for exec() or any of the others. Other than that, it doesn't hang or give any kind of error or anything when it comes to a shell function call; apparently it just ignores them. No, it tries to run them, and fails, and provides the error messages and error number in the variables you aren't using :-) Some days, I think the PHP Dev Group should just make those arguments to exec() required. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] NetFlix Drag and Drop Row Ordering
For those who have netflix, does anyone know how you would recreate their 'drag and drop' queue widget? basically, you can drag and drop movies in the order you choose is this a combination of javascript and php ? how would you go about creating something like this to order rows in your own CMS ? extremely cool g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache user can't use exec(), passthru(), etc.
Wed 23 Mar 2005--23:05:30--/home/webuserwhoami root Wed 23 Mar 2005--23:05:33--/home/webusercat test.php ?php echo exec(whoami).\n; ? Wed 23 Mar 2005--23:05:36--/home/webuserphp test.php Content-type: text/html X-Powered-By: PHP/4.3.9 root Wed 23 Mar 2005--23:05:39--/home/webusersu webuser [EMAIL PROTECTED] ~]$ php test.php Content-type: text/html X-Powered-By: PHP/4.3.9 [EMAIL PROTECTED] ~]$ whoami webuser [EMAIL PROTECTED] ~]$ exit Jim Poserina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The output is: OS Error: 127. I have a second server that I use as a downtime backup. On that one, all the scripts work normally. I don't have to give a path for the commands, any commands with permission problems return permission denied, and the apache user (nobody) actually has /sbin/nologin as the shell. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, March 21, 2005 8:20 pm, Jim Poserina said: If I run this PHP script: ?php echo 'pre'; echo exec('whoami'); The first most biggest thing wrong is that you aren't using the additional arguments to exec() to find out what your output is, and if your command generated an error. For starters, I'm betting that at least one of the following is true: whoami is not in the $PATH/$path of the PHP user. whoami is not executable by the PHP user. You'll never find out which unless you use the extra args to exec http://php.net/exec echo '/pre'; ? from the web, the output is pre/preand from the command line running as the apache user(webuser), the output is. Content-type: text/html X-Powered-By: PHP/4.3.9 pre/pre EXCELLENT attempt to diagnose this, though! But if I run from the command line as root, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 preroot/preand from the command line as a user in the root group, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 prejimpoz/preSafe mode is turned off. As webuser (or any non-root-group user), no shell commands work. Not echo, not ls, not whoami, not touch. And no shell functions work: no exec(), no passthru(), no shell_exec(), no backticks. Every command I'm trying to run is world-readable and world-executable. But are they in the $path of webuser? Use the full path to them if they aren't exec(/bin/whoami, $output, $error); if ($error) echo (OS Error: $error.br /\n); echo implode(br /, $output); If I turn safe mode on, it gives me a safe mode is on warning only about lines that call shell_exec(), and not for exec() or any of the others. Other than that, it doesn't hang or give any kind of error or anything when it comes to a shell function call; apparently it just ignores them. No, it tries to run them, and fails, and provides the error messages and error number in the variables you aren't using :-) Some days, I think the PHP Dev Group should just make those arguments to exec() required. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail() Alternative?
Hello, on 03/23/2005 04:14 PM Dan Joseph said the following: I've had a production system moved to a new server. Our geniuses here have refused to allow sendmail on the server and all my e-mail functions are now gone. Is there a way around this? I have already checked the manual, I don't see anything You may want to try this MIME message class. It comes with wrapper functions that act as direct replacements of the mail() function and let you send the messages by alternative means which can be calling the sendmail program directly or relaying the message to a SMTP server of choice. http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preorder Modified Tree Traversal
Matt Babineau wrote: Hi all, I'm trying to use pmtt to display a windows explorer style view of products in a database. If anyone is familiar with pmtt could you send me an email, I'm looking for some help. I built some code to pull the Levels out of the database, I need some help tracking which level the user is clicking on so that I can create a drill-down scenario. I know this can most likely be achieved more easily using the adjacent tree method, but I need something a bit more robust than that. Let me know if you have created any systems that are drill-down style menus or whatnot, I'm interested in the methods you used to achieve your success. How are you tracking them now? What's not working? Sitepoint has a great article that has PHP snippets on both pmtt and the flat drill-down method. http://www.sitepoint.com/article/hierarchical-data-database -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Memory use
Greetings, I'm trying to help a C programmer understand and use PHP for web development. So far all the similarities between C++ and PHP are making the process rather speedy. He asked what seemed like a very simple question, but I couldn't find the answer. The questions is how can you determine how much memory a variable/object/struct/etc are using? For instance: $myObject = new myClass(); $myObject-performAction_and_holdResult(); At this point, how can you tell how much memory $myObject is using? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NetFlix Drag and Drop Row Ordering
Graham Anderson wrote: For those who have netflix, does anyone know how you would recreate their 'drag and drop' queue widget? basically, you can drag and drop movies in the order you choose is this a combination of javascript and php ? how would you go about creating something like this to order rows in your own CMS ? I don't have an account with Netflix, but Flex has a great drag and drop widget. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php