[PHP] Enabling the chroot() function in PHP 5.4
Hi All, Does anybody know how to enable the chroot() function in PHP 5.4? It was easy in PHP 5.3 as long as you were building the CLI by itself. In the PHP 5.4 configure script there is a new PHP_BINARIES variable being used instead of setting PHP_SAPI=cli and thus the #define ENABLE_CHROOT_FUNC 1 is never written to the output file. I have been able to manually enable it by adding the define to the main/php_config.h after running configure. The issue seems to be a line: if test program = program. This comparison being true is what causes the configure script to add cli to the PHP_BINARIES variable instead of setting the PHP_SAPI variable. The other prerequisites (HAVE_CHROOT and ZTS) are all at the required settings. It is only the ENABLE_CHROOT_FUNC which is causing the function to not be compiled into the resulting binary. Any information or explanation would be very helpful. For the record, I know what the chroot() function does and does not do. I am experimenting with using chroot() to isolate an already running script to a particular subset of the filesystem for file operations. -- - Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] APC opcode cache behavior
Hello, I'm trying to find some information on APC opcode cache behavior. We noticed an issue where, when switching symlinks to different versions of sites, old code was running from the previous version after switching the symlink. Anyone know where I can find more information on this? Thanks, Aaron holmes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: APC opcode cache behavior
Driving home, I realized how vague this was. Specifically, I'm looking for information on when APC will cache a file or directory, and what it checks before doing so. Thanks again, Aaron Holmes On 2/13/2013 6:53 PM, Aaron Holmes wrote: Hello, I'm trying to find some information on APC opcode cache behavior. We noticed an issue where, when switching symlinks to different versions of sites, old code was running from the previous version after switching the symlink. Anyone know where I can find more information on this? Thanks, Aaron holmes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
No one has mentioned Cacti yet? It does exactly what Bulent is looking for. http://cacti.net/ On 2/5/13 6:46 PM, Sean Greenslade wrote: On Tue, Feb 5, 2013 at 10:13 AM, Bulent Malik bma...@ihlas.net.tr wrote: This task is not really suited for php. I would suggest looking into Ntop. It does exactly what you described. Hello I have a freebsdbox firewall . also I have some internet customers. I want to save how much data they used in a table ( such as mysql table ) for each ip address. Apache2, php5 and mysql5.5 work on the box. How can I do it ? any script or tool. Thanks How can i save in table using ntop ? is there any document ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Read the man pages. There are sql export options that you can specify on run. I could not see any sql options on the man file of ntop. Where is it? Whoops, my mistake. I was reading the NetFlow documentation and going off vague memories of older versions of Ntop. Ntop saves data in RRD files. There are PHP libraries to parse this data [1]. You could theoretically scrape the RRDs and put them in a SQL DB, but they may be useful enough on their own if you can parse them correctly. (Note: I have never personally parsed RRDs manually. This info was pulled from a simple Google search. YMMV.) [1] http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programmers and developers needed
Hi, Can we let this thread die now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Instance inheritance
Hello, I would like some input on the best way to do something that I can only think to call instance inheritance. I want to return, from a class method, an object that has the same methods as $this, with some additional data, and without altering $this. The way I'm doing this now is with clone, but that doesn't seem ideal, and I suspect I'm missing something simpler. I am also using __get() and __set() for class properties, so perhaps some traditional accessors are invalidated. Here's the gist of what I have right now. class Super Implements Iterator { private $position= 0; private $properties = array('some_prop'); private $data = array('data'); function current() { $clone = clone $this; $property = $this-properties[$this-position]; $data= $this-data[$this-position]; $clone-$property = $data; return $clone; } ... } class Sub extends Super { ... } $obj = new Sub(); foreach($obj as $k=$v) { // $v now has the same methods as Sub, but it also has the current property set to some value, while $obj does not var_dump($obj-some_prop); // NULL var_dump($v-some_prop);// string(4) data } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating zip's with php - high memory usage
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am working on a script that will take a few folders, copy them to a temp location, and then create a zipfile. The problem i'm running into is that some of these zips are upwards of 300mb, and when I use exec to execute the zip function, or use the ZipArchive extension, the php memory usages increases - close to 300mb. Is there any way to get around this spike of memory usage from within php? Or is there a better way alltogether to handle this? I'm open to suggestions! - -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIUEYuuucONIvD0AMRAnhCAJ9BaE1jA0VSmhxs9o7EnCGmOxUbdgCglbCs iWFyJr5MVW5rBfmAB8MbSDo= =oBqU -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send XML file with curl functions
Option 2 is what I'm trying to do, but the problem is that when curl sends the file over the command line, when it's processes via PHP the attached file comes over $_FILES. But, added the postdata obviously doesn't allow it to come over that way. Is there any way to use option 2 and transmit the file so it will come over under $_FILES? -- Aaron Bojan Tesanovic wrote: On Apr 12, 2008, at 11:37 PM, Aaron Axelsen wrote: I am trying to create the following command with the php curl functions: curl -F [EMAIL PROTECTED] http://path/to/api; The problem i'm having is that i'm creating the xml file with php - so the contents are stored in a variable. How can I send the contents of that variable via curl? I thought just assigning the xml variable to data would work - but it hasn't. Any suggestions? -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What I can suggest 1. save the XML to file eg xmldata.xml and use system('curl -F [EMAIL PROTECTED] http://path/to/api; '); 2. or Use PHP CURL functions fufunction postData($postFileds,$url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST ,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postFileds); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL $data = curl_exec($ch); curl_close($ch); return $data; } $xmlData = 'some xml data'; $postFileds = 'data='. urlencode($xmlData); //call function postData($postFileds,http://path/to/api;); --- Bojan http://www.carster.us/ -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send XML file with curl functions
The problem is that it is a 3rd party API that I am trying to submit data to. I have submitted a request to make the necessary changes for what I'm trying to do. Nathan Nobbe wrote: On Sun, Apr 13, 2008 at 1:07 PM, Aaron Axelsen [EMAIL PROTECTED] wrote: Option 2 is what I'm trying to do, but the problem is that when curl sends the file over the command line, when it's processes via PHP the attached file comes over $_FILES. im lost here. in option 2 from Bojan's post there is no attached file. there is only a variable that happens to store xml. if php is handling the request on the system hosting $url from said post then the xml data will be made available in the $_POST array albiet the 'data' index. ergo, php on said system would look something like this ?php $rawRequestXml = $_POST['data']; try { $requestXml = new SimpleXmlElement($rawRequestXml); } catch(Exception $e) { // do error handling stuff } ? But, added the postdata obviously doesn't allow it to come over that way. Is there any way to use option 2 and transmit the file so it will come over under $_FILES? i dont understand the 'need' to have the request data available in the $_FILES array; whats wrong w/ $_POST ? -nathan -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Send XML file with curl functions
I am trying to create the following command with the php curl functions: curl -F [EMAIL PROTECTED] http://path/to/api; The problem i'm having is that i'm creating the xml file with php - so the contents are stored in a variable. How can I send the contents of that variable via curl? I thought just assigning the xml variable to data would work - but it hasn't. Any suggestions? -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Banned from #php
Brenden Wilson wrote: I hope this is the right place to ask because I simply can't find any place else to ask for help. I have been banned from chatting in ##php and I really don't deserve it. The chat log can be found here: http://pastebin.com/f6941dae7 (I've deleted conversations from other people) Wolfpaws banned me for calling him obnoxious. I don't know if he does this to everybody, but he rarely helps me but almost always calls me an idiot for asking questions. He has been doing this for several weeks now and I have only once said something in return to him. He didn't even give me a warning How can I get unbanned? I'm not a problem in the least bit and when I can legitimately answer somebody else's question, I always do. Thanks, Brenden Wilson Hmm, suspicious at best. I find it difficult to believe there are any obnoxious PHP people. :) Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Fatal error: Call to undefined function hash_hmac()
We are running Novell SUSE Linux Enterprise Server 10 sp1. It has php 5.1.2. We are using a standard out of the box install, and for some reason the hash functions only work using the cli interface, and fails to work with apache giving the following error: PHP Fatal error: Call to undefined function hash_hmac() Does anyone have any suggestions as to what might be causing this? -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP make test error report question
Hello, first of all I want to make sure I am emailing the correct location/list. I have recently installed php-5-2-3 and built it from source. First time user and very green. I used: ./configure --prefix=/opt/php-4.4.7 --with-apxs2=/opt/apache/bin/apxs --enable-mbstring ?with-imap=/opt/imaptemp/imap-2006k-src as my configure command. I then completed it with make and make install, and then make test. It passed the test but returned a number of failures as well. I chose to send the report to whomever at PHP at the end of the make test, but I would like to know if there was anything critical in the test summary. Can you confirm where I need to send this request to and obtain some help? Thanks in advance for anybodies help and direction, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Heredocs
RodgerW wrote: Are heredocs supported by PHP 5.2.3 running in WinXP/Apache2.2.4 ? I prrint via heredocs and its not working. Print with single quotes and double quotes work. p h6string init method 3: heredocs/h6 ?php print END Test END; ? /p It works here on 5.2.3. Try removing ALL whitespace before and after the END; portion of your heredocs. If there's whitespace, it doesn't work. -- Aaron Gould -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zend framework
I've been experimenting with it for a new site revision at the company I work at. I have to agree, it's feels heavy, almost bloated. Mind you, I've only used a small fraction of the framework -- namely the Zend_Db, Zend_Config and Zend_Controller portions. The lack of Javascript seems like a curious omission, but perhaps that's not the point of ZF. I've been using CakePHP for another site, and it feels very efficient and easy to use. Javascript/AJAX helpers are all integrated too. Perhaps this is contributing to my somewhat negative view on ZF? I still intend to try out ZF a bit more to give it a fair shot, but after using CakePHP, I'm not so sure for how long... -- Aaron Gould Greg Donald wrote: Has anyone looked at the Zend Framework lately? http://framework.zend.com/manual I've been playing with a few parts of it off and on the past couple of days. It seems really heavy overall and there is no Javascript integration anywhere. Nothing on the roadmap about Javascript either: http://framework.zend.com/roadmap It might be worth using if it actually did something better than my current toolset. Right now it really doesn't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
I did some more investigating, and tracked down the problem. Apparently, even though i was setting a separate save_path inside the default save path the garbage collector was still picking up the sessions in that directory. I moved the session save_path dir to a separate location and the sessions were removed according to the ini settings. The 1 weird thing I noticed is that the session cookie on the client PC is not getting set properly. I am trying to set a session timeout of 3 hours, the server is set to GMT time, and the client PC is set to CST time. The cookie on the client PC reports that it has an expiration time of 1.5 hours instead of 3. Does anyone have any ideas why thats happening? Aaron Axelsen wrote: Everything i've read in the documentation states to call session_start after you have changed your necessary settings. Do you have a working example using session cookies I can compare this with? Richard Lynch wrote: On Fri, April 27, 2007 1:37 pm, tedd wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. I don't think you want to do that... You want all those settings to take effect BEFORE you actually start the session which sends out the headers. -- Aaron Axelsen Technical Director Modevia Web Services LLC 1-866-451-9198 x802 [EMAIL PROTECTED] www.modevia.com -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
I now have the following settings: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout / 60); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); I logged in and then left the computer untouched for an hour. When I came back the session was timed out, and I was required to login. Something still isn't working right. Any ideas? I have checked the settings using phpinfo() and confirmed that the values are in fact being set by the above commands. -- Aaron Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I now have the following settings: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout / 60); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); I logged in and then left the computer untouched for an hour. When I came back the session was timed out, and I was required to login. Something still isn't working right. Any ideas? I have checked the settings using phpinfo() and confirmed that the values are in fact being set by the above commands. -- Aaron My mistake, gc_maxlifetime is in seconds, i meant to say that, but i said it was in minutes :) if you change this: ini_set('session.gc_maxlifetime', $mytimeout / 60); back to ini_set('session.gc_maxlifetime', $mytimeout); It will work i guess :) Tijnema Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- Aaron Axelsen Technical Director Modevia Web Services LLC 1-866-451-9198 x802 [EMAIL PROTECTED] www.modevia.com -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Everything i've read in the documentation states to call session_start after you have changed your necessary settings. Do you have a working example using session cookies I can compare this with? Richard Lynch wrote: On Fri, April 27, 2007 1:37 pm, tedd wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. I don't think you want to do that... You want all those settings to take effect BEFORE you actually start the session which sends out the headers. - -- Aaron Axelsen -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGMlEWuucONIvD0AMRAp+4AKDJK9D06s+yWt4tkHw4dUhZvz0VngCgjiA3 x117Mf7dwR3VIpvuhZFxTgg= =jOud -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing Session Timeout
I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I force my script to exit after 5 seconds?
I have a script that connects to a networked device via PHP's socket functions. This device accepts proprietary commands (e.g.: KPRINT, as seen below), and returns data. However, this device does not have any sort of EXIT command to end the processing of events. So it essentially loops forever. I do know that if this device does not return anything after 5 seconds, it will never return anything. So, my question is: how can I force this script to stop after 5 seconds has elapsed? Here's the script: $fp = fsockopen('192.168.3.25', 10001, $errno, $errstr, 5); if (!$fp) { echo 'Error...'; } else { $command = KPRINT\r\n; fwrite($fp, $command); while (!feof($fp)) { $buffer = fgets($fp, 1024); } fclose($fp); } Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I force my script to exit after 5 seconds?
I tried this earlier, but it does not seem to work... It appears to just hang when no data is returned from the networked device. It seems as if the loop stops, and is waiting for something. Brad Bonkoski wrote: I think something like this will work for you.. $start_time = time(); ...loop.. if( time() - $start_time 5 ) exit; -B Aaron Gould wrote: I have a script that connects to a networked device via PHP's socket functions. This device accepts proprietary commands (e.g.: KPRINT, as seen below), and returns data. However, this device does not have any sort of EXIT command to end the processing of events. So it essentially loops forever. I do know that if this device does not return anything after 5 seconds, it will never return anything. So, my question is: how can I force this script to stop after 5 seconds has elapsed? Here's the script: $fp = fsockopen('192.168.3.25', 10001, $errno, $errstr, 5); if (!$fp) { echo 'Error...'; } else { $command = KPRINT\r\n; fwrite($fp, $command); while (!feof($fp)) { $buffer = fgets($fp, 1024); } fclose($fp); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I force my script to exit after 5 seconds?
Thanks very much, I've added stream_set_timeout functionality, and it seems to work very well! For reference, here's the modified script: $fp = fsockopen('192.168.3.25', 10001, $errno, $errstr, 5); if (!$fp) { echo 'Error...'; } else { /** Set socket timeout period */ stream_set_timeout($fp, 5); /** KPRINT outputs scale values */ $command = KPRINT\r\n; fwrite($fp, $command); while (!feof($fp)) { /** Check for timeout */ $info = stream_get_meta_data($fp); if ($info['timed_out']) { echo 'Timeout...'; break; } $buffer = fgets($fp, 1024); } fclose($fp); } Brad Bonkoski wrote: Aaron Gould wrote: I tried this earlier, but it does not seem to work... It appears to just hang when no data is returned from the networked device. It seems as if the loop stops, and is waiting for something. probably blocking on the socket have you tried: www.php.net/stream_set_timeout Brad Bonkoski wrote: I think something like this will work for you.. $start_time = time(); ...loop.. if( time() - $start_time 5 ) exit; -B Aaron Gould wrote: I have a script that connects to a networked device via PHP's socket functions. This device accepts proprietary commands (e.g.: KPRINT, as seen below), and returns data. However, this device does not have any sort of EXIT command to end the processing of events. So it essentially loops forever. I do know that if this device does not return anything after 5 seconds, it will never return anything. So, my question is: how can I force this script to stop after 5 seconds has elapsed? Here's the script: $fp = fsockopen('192.168.3.25', 10001, $errno, $errstr, 5); if (!$fp) { echo 'Error...'; } else { $command = KPRINT\r\n; fwrite($fp, $command); while (!feof($fp)) { $buffer = fgets($fp, 1024); } fclose($fp); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't get PHP extension to Load
I have a Microsoft 2003 server running IIS 6.0 and PHP 5.1.2. We have an application (Moodle) that uses a database connection to our MSSQL 2000 server. For whatever reason, it doesn't work properly with the built in php_mssql.dll so we have to use a replacement of either FreeTDS or ODBTP. ODBTP is working on the production machine, but is slow as molasses. I configured a test server (Everything the same, OS, IIS, PHP) and set it up to use FreeTDS. It worked a lot faster so I attempted to move the production machine over to FreeTDS. It loads a PHP extension called php_dblib.dll that replaces (the same way ODBTP does) the php_mssql.dll. The problem is that on the production machine, even though it is the same version of everything, it refuses to load the php_dblib.dll. The only error it says is that the specified module could not be found. The DLL file is definitely in extensions directory, and the path that the error message presents has been triple checked to exist. The version of the DLL file is the same between the two servers and I even went so far as to copy the production server's entire C:\php directory over to the test server and it STILL worked. The only other component is a freetds.conf file that lives at the root directory of C:\. I checked the permissions of said file and they match on both servers. Anyone have an ideas on this? Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College
RE: [PHP] Can't get PHP extension to Load
It seems to me that if external libraries were required, they'd be in the PHP directory. But when I took the php directory from the production (non-working) server, and put it in place on the test server, it loaded the extension just fine. I'm going to, however, see if there are any differences between the components that are installed in IIS on the two machines. Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College -Original Message- From: Sergiu Voicu [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 30, 2007 12:54 PM To: Aaron Smith Subject: Re: [PHP] Can't get PHP extension to Load Hello Aaron Check to see if this module doesn't require other external libraries, that you don't have on the production machine. Also try to use a debugger to see what calls are made by the apache server when starting. Sergiu Aaron Smith wrote: I have a Microsoft 2003 server running IIS 6.0 and PHP 5.1.2. We have an application (Moodle) that uses a database connection to our MSSQL 2000 server. For whatever reason, it doesn't work properly with the built in php_mssql.dll so we have to use a replacement of either FreeTDS or ODBTP. ODBTP is working on the production machine, but is slow as molasses. I configured a test server (Everything the same, OS, IIS, PHP) and set it up to use FreeTDS. It worked a lot faster so I attempted to move the production machine over to FreeTDS. It loads a PHP extension called php_dblib.dll that replaces (the same way ODBTP does) the php_mssql.dll. The problem is that on the production machine, even though it is the same version of everything, it refuses to load the php_dblib.dll. The only error it says is that the specified module could not be found. The DLL file is definitely in extensions directory, and the path that the error message presents has been triple checked to exist. The version of the DLL file is the same between the two servers and I even went so far as to copy the production server's entire C:\php directory over to the test server and it STILL worked. The only other component is a freetds.conf file that lives at the root directory of C:\. I checked the permissions of said file and they match on both servers. Anyone have an ideas on this? Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't get PHP extension to Load
Interesting. Running that comes up with 2 missing dependencies: MSJAVA.DLL (delay-load dependency) and MSVCR71.DLL (apparently a required dependency). However, running the SAME thing on the test server results in the same errors...but it works over there. I did a search for those two files on both servers and they both have the MSVCR71.dll file in the same location but neither of them have the MSJAVA.dll file. Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College -Original Message- From: Roman Neuhauser [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 30, 2007 4:00 PM To: Aaron Smith Cc: php-general@lists.php.net Subject: Re: [PHP] Can't get PHP extension to Load # [EMAIL PROTECTED] / 2007-01-30 12:09:44 -0500: It loads a PHP extension called php_dblib.dll that replaces (the same way ODBTP does) the php_mssql.dll. The problem is that on the production machine, even though it is the same version of everything, it refuses to load the php_dblib.dll. The only error it says is that the specified module could not be found. The DLL file is definitely in extensions directory, and the path that the error message presents has been triple checked to exist. use depends.exe to see which library php_dblib.dll depends on is missing on the production server. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't get PHP extension to Load
AHA! I have discovered the culprit, but am uncertain WHY it is the culprit. The production server as Microsoft.NET Framework 2.0 installed on it and the test server does not. I installed the 2.0 framework on the test server and BAM, the extension refused to load. I'll see if uninstalling it causes it to work again as I have a feeling that .NET 2.0 is not needed on the production machine. If so, though, is there a way around this? Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College -Original Message- From: Aaron Smith Sent: Tuesday, January 30, 2007 4:58 PM To: php-general@lists.php.net Subject: RE: [PHP] Can't get PHP extension to Load Interesting. Running that comes up with 2 missing dependencies: MSJAVA.DLL (delay-load dependency) and MSVCR71.DLL (apparently a required dependency). However, running the SAME thing on the test server results in the same errors...but it works over there. I did a search for those two files on both servers and they both have the MSVCR71.dll file in the same location but neither of them have the MSJAVA.dll file. Aaron Smith[EMAIL PROTECTED] System Administrator (269) 337-7496 Kalamazoo College -Original Message- From: Roman Neuhauser [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 30, 2007 4:00 PM To: Aaron Smith Cc: php-general@lists.php.net Subject: Re: [PHP] Can't get PHP extension to Load # [EMAIL PROTECTED] / 2007-01-30 12:09:44 -0500: It loads a PHP extension called php_dblib.dll that replaces (the same way ODBTP does) the php_mssql.dll. The problem is that on the production machine, even though it is the same version of everything, it refuses to load the php_dblib.dll. The only error it says is that the specified module could not be found. The DLL file is definitely in extensions directory, and the path that the error message presents has been triple checked to exist. use depends.exe to see which library php_dblib.dll depends on is missing on the production server. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- 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] using return in include files
I'm trying to figure out what the desired behavior is of using the return function to bail out of an include page. I did some testing, and this is what I concluded. First, I created the following file: ?php if (defined('TEST_LOADED')) { return; } define('TEST_LOADED',true); echo blah blah blah blahbr/; ? I then called it as follows: include('test.php'); include('test.php'); include('test.php'); The output is: blah blah blah blah Second, I changed the test.php file to be the following: ?php if (defined('TEST_LOADED')) { return; } define('TEST_LOADED',true); echo blah blah blah blahbr/; function myFunc($test) { } ? When I load the page now, it throws the following error: PHP Fatal error: Cannot redeclare myfunc() It appears that if there are functions in the include page that you can't use return to bail out. What is the desired functionality in this case? Is this a bug in how php handles it? or was return never designed to be used this way? Any thoughts are appreciated. -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass a relative path [with slashes] into a 'clean' url
Assuming you mean URLs as GET variable values, urlencode() and urldecode() might be the ticket: http://ca.php.net/urlencode Aaron On 12/4/06, Graham Anderson [EMAIL PROTECTED] wrote: What is a good/accepted way to pass a relative or absolute path into a clean url ? I could replace the relative url's slashes with another character, but would love to know a cleaner less confusing way...if it exists example url: http://localhost/testscript/../image.png/jpeg/42/0/ example php: list($dummy,$relative_path,$type, $color, $cache) = explode('/', $_SERVER['PATH_INFO']); where: $relative_path=../image.png $type=jpeg $color=42 $cache=0 many thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- +- | Aaron Koning | Information Technologist | Prince George, BC, Canada. +- | Flexible Internet Spatial Template: | http://fist-mapping.org +-
Re: [PHP] Splitting a string
Assuming var1 and var2 only ever use the last four numbers (untested): $length = strlen($number); // get string length $var1 = substr($number,0,$length-4); // get number until only 4 numbers are left $var2 = substr($number,$length-4,2); // get 3rd and 4th last numbers. $var3 = substr($number,$length-2,2); // get last two numbers. Aaron On 11/14/06, Børge Holen [EMAIL PROTECTED] wrote: This numer has dynamic lenght, witch is the root of my problems. $number = 123456789 should print as following: var1: 12345 (and it is this lengt witch varies) var2: 67 var3: 89. I've been using substr with negative numbers to fetch the last two vars. thereafter explode to get the first number. Ok I understand the code and can use it, but it feels wrong. Does anyone have any idea on suitable functions for such a task, both more size (as in code) and speed effective. It is not a mission critical, but moreover a opinion of what things should look like. I've been looking into string/explode functions on php.net without getting past my current code. -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- + | Aaron Koning | Information Technologist | Prince George, BC, Canada. + | http://datashare.gis.unbc.ca/fist/ | http://datashare.gis.unbc.ca/gctp-js/ +
Re: [PHP] local php.ini not recognized in php 5.1.x?
Marten, I have also been trying to figure this out. Have you came to any conclusions? I have done some searching and so far haven't found any answers. Is there anyone else on the list that can shed some light on this? Thanks! -- Aaron Marten Lehmann wrote: Hello, we switched from php 5.0.6 to 5.1.6. php is running as CGI. We have a global php.ini in the /lib directory of the php installation with settings that are valid for all users. In php 5.0.6 (and previous php releases) additionally the local php.ini in the directory of the executed php-script has been parsed so users could overwrite options like register_globals. But now in php 5.1.6 this local php.ini doesn't seem to be recognized at all, not any option in it is evaluated. Is there anything that changed from php 5.0.x to 5.1.x regarding the handling of php.ini's? I don't have any idea what went wrong because I compiled php 5.1.6 with the same options as php 5.0.6. Regards Marten -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting to Webdav with php
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I am looking to create a small script which can connect to a webdav server, authenticate and spit back the contents of a given directory on the server. What is the best way to do this? I've bene looking around and so far haven't found anything. Thanks! - -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE+FuvuucONIvD0AMRAl94AKCjnoLBQ4n/F3kucQD2KiyVcRrqLgCeKOuP mp8zPv1ktojV2oDmNfnL9jo= =sIQc -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out the upload date of the file
http://ca.php.net/stat Might do it for you. Maybe check access time, although if you access the file at after its uploaded, the access time is changed. Maybe mtime? Aaron On 6/23/06, Ko Ko [EMAIL PROTECTED] wrote: Hi, How can I find out the upload date of the file to the server using PHP function? Regards, Ko Ko Reality starts with Dream - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. -- + | Aaron Koning | Information Technologist | Prince George, BC, Canada. + | http://datashare.gis.unbc.ca/fist/ | http://datashare.gis.unbc.ca/gctp-js/ +
[PHP] mail function in 4.2.2
I am working with a server that has version 4.2.2 on it. I know...I know...its old. Its my ISPs server so I don't have too much control over it. Anyway, I am seeing a problem where when I use the mail function to send out an email only some of the messages get to the destination. I wrote a simple test script that runs through a loop and is supposed to send out five emails. Usually only one or two of the emails make it. And on top of that its not always the first two that get sent. Here is my test script. I also have tried using the sleep command to give it 5 seconds between each email thinking maybe it was a time thing. for($i=0;$i5;$i++){ echo $i.br; mail([EMAIL PROTECTED],test_.$i, test_.$i); sleep(5); } Is there something with this version of PHP that could be effecting the mail function. I checked the change log and there has been some improvements to the mail function, but not much detail on why the changes were necessary. Just wondering if I have come across an old bug or something. I've already asked my ISP to upgrade this server so if that's the solution its on its way to being fixed. Is there anything else that could be wrong? Thanks Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function in 4.2.2
Thanks for the reply. I'll ask the ISP about throtteling next time I talk with them. I would also like to mention that I am also getting intermitent results when just sending a single email. One if the web pages I am testing is a support request form. When the form is submitted it sends an email to me so I can test that it is working. But sometimes it never makes it. In this case I wouldn't thing that throttleing would be the cause. Sometimes when I start working on it at 8 in the morning and do a test run it never makes it. In that case nothing has been sent through PHP for at least 8 hours. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file and CPU wait state (IO)
Are you sure its the move_uploaded_file() function that is causing the delay? It could be the actual upload of the file itself. If it is the function causing the delay than try the rename() function instead. Also, I have used the copy() and unlink() functions and they work fast. Aaron On 2/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, My first mailing, if I'm in wrong group or such, let me know ;) Here comes my question. I have implemented file uploads to my server. At the end of upload, file is beeing moved from /tmp to permanent directory. However, whenever this happens, CPU goes berzerk and waits for disk to finish moving file. As allowed files may be up to 100 MB per file, having more then 3 users makes complete server freeze. Meantime, server load reaches skyhigh 40+. After file is moved, server resumes normal operation, however while moving file server is completely not responding. Is there a work around? I am not so good with linux (yet ^^), so I do not know if there is place for improvement on OS itself. I asked this question on Debian forum, but am trying here as well. If someone has same problem and prefferably solution, or even sugestions - all is welcome! :) Server P4 2.0 512 MB RAM (will be 2 GB by the end of the week) 2 x 80 GB IDE HDD Thank you! Regards, Aleksandar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- + | Aaron Koning | Information Technologist | Prince George, BC, Canada. + | http://datashare.gis.unbc.ca/fist/ | http://datashare.gis.unbc.ca/gctp-js/ +
Re: [PHP] how 2 open File Browser window in PHP
Please attempt to search www.php.net first for this information. A search for 'file uploads' reveals what you want: http://ca.php.net/features.file-upload Aaron On 1/16/06, suresh kumar [EMAIL PROTECTED] wrote: hi, i dont know exact PHP code for how 2 open file browser window to uplad file or an image plz help me.its very urgent. A.suresh Send instant messages to your online friends http://in.messenger.yahoo.com
Re: [PHP] Cookie problem
Try simplifying the problem to determine the error point. For example don't involve $_POST just try setting a cookie with hard coded variables. If that works then add in the $_POST and test for BOTH $_POST['prefs'] and $_POST['filter']. Example of simplification: ?php // Send cookie setcookie(listpref,selected,time()+7776000); ? Aaron On 1/14/06, Al [EMAIL PROTECTED] wrote: Can't get a cookie to set. Below is the code near the file top BEFORE any html output. $_POST['prefs'] comes from a hidden field in the middle of the html output. $_POST['filter'] comes from a select option. A Submit button closes the page and refreshes it. print_r($_POST) shows $_POST['prefs'] $_POST['prefs'] are just as I expect when the page refreshes. ## code print_r($_POST) session_start(); print_r($_COOKIE); if(isset($_POST['prefs'])) $cookie= setcookie(listpref, $_POST['filter'], time()+7776000); var_dump($cookie) shows bool TRUE I added the session_start() as a test. print_r($_COOKIE) shows the session ID cookie works just fine. IE6 and Firefox don't record the regular cookie. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private, public, protected in 4.3.11
exception, final, php_user_filter, interface, implements, extends, public, private, protected, abstract, clone, try, catch, throw where not introduced until PHP 5 (http://ca3.php.net/reserved). Therefore, var is the only way to define member variables prior to PHP 5. Aaron On 1/11/06, Peter Lauri [EMAIL PROTECTED] wrote: Hi, Example code that I try to run in version 4.3.11: Class Page { private $myID; function Page() { $this-myID=1; } function getID() { return $this-myID; } } But I get error message: Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS Asia\webserver\ework\classes\page.class.php on line 8 If I change to var $myID; it works. What is wrong? /Peter
Re: [PHP] question about compositing objects
$map is not a member variable of the Loc class in your code... Instead do this: class Loc { // Defines a member variable var $map; // Constructor function Loc() { $this-map = new Map(); // Create map object and save to Loc object $this-map-setKey(); } } $loc = new Loc(); $loc-map-publicMapFunction(); Aaron -- On 1/12/06, jonathan [EMAIL PROTECTED] wrote: I have a class which creates another class within it such as: class Loc{ public function outputInfo() { $map=new Map(); $map-setKey(); } } In my main page can I access the $map object like this: $loc=new Loc(); $loc-map-publicMapFunction(); I thought I would be able to but it doesn't seem like it. thanks in advance. -jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: Missing argument 7 calling a function
Why not send us the Call and the Function for arguments sake (pun intended). Aaron On 1/6/06, enediel gonzalez [EMAIL PROTECTED] wrote: Hello I've a function with 6 arguments that works properly. Trying to add a 7th argument an being sure that calling the function I pass that one I received the following message (several times) on my web page Warning: Missing argument 7 for getcommanddeclaration() in /var/www/cp/apply.php on line 56 It's only one place where this function is called Thanks in advance for any help Enediel Linux user 398956 Debian GNU/Linux -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set variable outside of scope (redo)
Generally, scope is fairly loose in PHP. If $row is set by mysql_fetch_array(...) it should carry throughout your script as it is, unless modified. Try commenting out non-relavant pieces of the code and var_dump(...)ing the $row variable at the start and throughout the script. Aaron On 1/5/06, Mike Tuller [EMAIL PROTECTED] wrote: Excuse the last post, I didn't have all the code it there. I have a table listing items in a database, and have a delete button next to each item, and I want to be able to click on the delete and delete only that record in the database and then reload the page where it would display the updated information. Here is part of the code I have. // list elements one by one until there are no more in the database while ( $row=mysql_fetch_array($result2) ) { if ($row[range] != ) { echo form action=.$_SERVER['PHP_SELF']. method=\post\ name= \deleteRange\ tr class=\trlist\ td$row[id]/td td$row[range]/td td align=\right\input type=\submit\ name=\deleteRange\ value=\Delete\ //td /tr /form ; } } echo /table; echo br / form action=.$_SERVER['PHP_SELF']. method=\post\ name= \addrange\ table class=\nolist\ tr tdAdd Range: $row[id]/td tdinput type=\text\ name=\name\ size=\53\ tabindex=\9 \ //td td align=\right\input type=\submit\ name=\addRange\ value=\Add Range\ //td /tr /table /form; } elseif (isset($_POST['deleteRange'])) { $query = delete from district.ip_range where id = $row[id]; mysql_query($query, $link) or die (mysql_error()); echo Record .$row[id]. has beed deleted.; } They key I am using to find the record I want to delete is the the $row[id], but that is out of the scope of where the variable is set. Is there a way to set a variable so that it goes outside the scope? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] One big file or many includes?
I don't know about whats best for the compiler (rather interpreter), but if it is a really big site with a lot of access, transaction and management functionality I recommend you start breaking the code into classes and separating each class into a file and documenting... A LOT! It will be clearer to understand and maintain. IMHO. There are lots of sites out there that describe how to separate web code into layers such as: display, logic/rules, database interactivity, etc. Aaron On 12/15/05, Martin Leduc [EMAIL PROTECTED] wrote: Hi everyones, I coding PHP since 2002 and this is the first time I have to take this decision. My group and I have to build a VERY, VERY BIG website for a callcenter users. Understand I have to create (or use ;)) several code for access, transactions and management. The customer had buy MSSQL server, so we have to use it and it's working very fine. NO MYSQL (is not my personal choice ;)) Currently it's already hard to program and now we have many file. We have only 20% done and the code are a real mess!!! Creating Class, functions, splitting code in several php files using include, see the files sitemap?? So for the optimisation topic, what is THE BEST for the PHP compiler. One big file or many included files? Regards Martin PS: If some one know somes related links about the subject, please dont hesitate. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Post-Vars doubled / corrupted
I wasn't aware you could use = instead of echo (? =$_SERVER['PHP_SELF'] ?). Try making an even simpler HTML/PHP example and see if the problem exists there. Then you can incrementally build your HTML/PHP back up to the point where it is breaking. Example: ?php print_r($_POST); ? html head /head body form action= method=post input type=hidden name=testvar value=pleasedontcorrupt / input type=submit name=submit value=Submit / /form /body Aaron On 12/15/05, Sabine [EMAIL PROTECTED] wrote: Hello to all, I distributed my app to a new server and suddenly had values saved twice in the db and so on. I tracked it down and found out, that the problem is the content of $_POST. Vars are doubled, Strings corrupted. Absolutely absurd. I have no idea where to search for the reasons. PHP-Version is 4.3.11 Does anybody else have an idea? Thank you in advance Sabine A simple testcase: ?php echo Post:; var_dump($_POST); ? html body form id=formular action=?=$_SERVER['PHP_SELF'] ? method=post ul id=colors liinput class=buttons name=colors[] id=id1 type=checkbox value=1 title=chose color /label for=id1red/label/li liinput class=buttons name=colors[] id=id2 type=checkbox value=2 title=chose color /label for=id2blue/label/li liinput class=buttons name=colors[] id=id3 type=checkbox value=3 title=chose color /label for=id3green/label/li liinput class=buttons name=colors[] id=id4 type=checkbox value=4 title=chose color /label for=id4yellow/label/li /ul fieldset class=nolegend input type=submit value=change colors name=aendern /nbsp;nbsp;nbsp; input type=submit value=save colors name=speichern / /fieldset /form /body /html Output for $_POST, if you just click on change colors: Post: array(1) { [aendern]= string(34) change colorsaendern=change colors } Output, if you check only red and click change colors: Post: array(2) { [colors]= array(1) { [0]= string(1) 1 } [aendern]= string(13) change colors } output for 2 colors checked: Post: array(2) { [colors]= array(3) { [0]= string(1) 1 [1]= string(1) 2 [2]= string(1) 2 } [aendern]= string(13) change colors } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] encrypt and dcrypt
Ganu, Are you simply looking to use the md5 string for authentication? If so you don't need to retrieve the decrypted version, simply encrypt what the user submits and compare the two md5 strings. Aaron On 12/15/05, Chris Shiflett [EMAIL PROTECTED] wrote: ganu wrote: I want a function like md5() by which I can encrypt a code and again when I need from db i can dcrypt also. but in md5() this func. is not there. I can not go in reverse way. If a simple PHP function could encrypt and decrypt data with no arguments other than the string, anyone could decrypt your data. In other words, it can't be as simple as md5(). You might find the code samples at the bottom of this page helpful: http://phpsecurity.org/code They primarily cover using mcrypt. There's also an article by Robert Peake that's pretty good: http://www.phpmag.net/itr/online_artikel/psecom,id,667,nodeid,114.html Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Post-Vars doubled / corrupted
Hi Sabine, Its been my experience that you need square brackets after the input checkbox name for PHP to see an array. This page discusses that: http://www.evolt.org/article/Storing_form_array_data_to_MySQL_using_PHP/18/60222/ Change your code to the following and give it a try. ul id=colors liinput name=colors[] id=id1 type=checkbox value=1 /label for=id1red/label/li liinput name=colors[] id=id2 type=checkbox value=2 /label for=id2blue/label/li /ul Aaron On 12/15/05, Sabine [EMAIL PROTECTED] wrote: Hi Aaron, thanks for your answer. The HTML elements, which represent arrays are causing problems. I just added ul id=colors liinput name=colors id=id1 type=checkbox value=1 /label for=id1red/label/li liinput name=colors id=id2 type=checkbox value=2 /label for=id2blue/label/li /ul to your minimalistic script. Checked both and got Array ( [colors] = Array ( [0] = 1 [1] = 2 [2] = 2 ) [testvar] = pleasedontcorrupt [submit] = submit ) for post. I don't really think it's a problem of my code. Perhaps a problem of the servers configuration. But I'm not really familiar with installation and configuration duties. So I don't know where to search. But meanwhile I read something about input filters in Apache 2. And thought if there is a filter on this server which corruptes my post vars? Config is (I don't know which parameters are really importend): [IHOST_VERSION]= Linux-1.0 [SERVER_SOFTWARE]= Apache/2.0.55 [SERVER_PROTOCOL]= HTTP/1.1 PHP 4.3.11 Server API Apache 2.0 Filter I searched for information if PHP 4.3.11 is supposed to work fine with Apache 2.0.55, but didn't find a clear answer. Perhaps you know (or someone else knows) if my thoughts are going in the right direction? Bye Sabine Aaron Koning schrieb: I wasn't aware you could use = instead of echo (? =$_SERVER['PHP_SELF'] ?). Try making an even simpler HTML/PHP example and see if the problem exists there. Then you can incrementally build your HTML/PHP back up to the point where it is breaking. Example: ?php print_r($_POST); ? html head /head body form action= method=post input type=hidden name=testvar value=pleasedontcorrupt / input type=submit name=submit value=Submit / /form /body Aaron On 12/15/05, *Sabine* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello to all, I distributed my app to a new server and suddenly had values saved twice in the db and so on. I tracked it down and found out, that the problem is the content of $_POST. Vars are doubled, Strings corrupted. Absolutely absurd. I have no idea where to search for the reasons. PHP-Version is 4.3.11 Does anybody else have an idea? Thank you in advance Sabine A simple testcase: ?php echo Post:; var_dump($_POST); ? html body form id=formular action=?=$_SERVER['PHP_SELF'] ? method=post ul id=colors liinput class=buttons name=colors[] id=id1 type=checkbox value=1 title=chose color /label for=id1red/label/li liinput class=buttons name=colors[] id=id2 type=checkbox value=2 title=chose color /label for=id2blue/label/li liinput class=buttons name=colors[] id=id3 type=checkbox value=3 title=chose color /label for=id3green/label/li liinput class=buttons name=colors[] id=id4 type=checkbox value=4 title=chose color /label for=id4yellow/label/li /ul fieldset class=nolegend input type=submit value=change colors name=aendern /nbsp;nbsp;nbsp; input type=submit value=save colors name=speichern / /fieldset /form /body /html Output for $_POST, if you just click on change colors: Post: array(1) { [aendern]= string(34) change colorsaendern=change colors } Output, if you check only red and click change colors: Post: array(2) { [colors]= array(1) { [0]= string(1) 1 } [aendern]= string(13) change colors } output for 2 colors checked: Post: array(2) { [colors]= array(3) { [0]= string(1) 1 [1]= string(1) 2 [2]= string(1) 2 } [aendern]= string(13) change colors } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random Images with no duplicates?
This should work, although if there are only 9 lines in the file, it will run infintely (or until the page times out)... so put a check in for that. $imagesNeeded = 10; $imageArr = array(); // Create array with $imagesNeeded number of elements. for($i=0;$i$imagesNeeded;$i++) { // choose image $tmpImg = $openFile[array_rand($openFile)]; // Keep getting images until the image you have is not in the existing array of images while(in_array($tmpImg,$imagesArr)) { // choose image $tmpImg = $openFile[array_rand($openFile)]; } // Put unique image into array array_push($imageArr,$tmpImg); } // You now have an array called imageArr with 10 elements/images in it. Aaron On 12/15/05, Mike Rondeau [EMAIL PROTECTED] wrote: Hi, I'm still very green with PHP, but am working to fix that. I've searched high and low for an answer to this question and so far no solution has presented itself. I have a script to populate my web page with random images: ?php #random images example #this is your file $file = images.txt; #open the file $openFile = file($file); #generate a random number srand((double)microtime()*100); #get one of the entries in the file $random_image = $openFile[array_rand($openFile)]; #display the entry echo img src='$random_image' height='170' width='100'/img; ? This works beautifully, but my problem is that sometimes, the same image displays twice or more on the same page-load. My page requires 10 different places where my images need to load, but I can't have any duplicate images show up. Any suggestions on what I need to modify here? Thanks in advance! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple-ish question but something i never knew
My experience was with the Location keyword, it might work better with the Redirect keyword in the header function. I stopped using header and Location after a few problems and meta has never failed for me. MHO. Aaron On 12/9/05, Michael Hulse [EMAIL PROTECTED] wrote: On Dec 9, 2005, at 11:35 PM, Aaron Koning wrote: Its been my experience that meta tags work better. I guess what you are saying is that this: meta http-equiv=refresh content=0;url=https://www.theNewUrl/forward.html; Is better than this: header(Refresh: 0; URL=https://www.theNewUrl/forward.html;); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple-ish question but something i never knew
I have found that using the header function doesn't actually redirect the page, it pulls the content into the page that the function is called from (which works good for somethings, but can get confusing with post variables and such). Its been my experience that meta tags work better. Aaron On 12/9/05, Robert Cummings [EMAIL PROTECTED] wrote: On Sat, 2005-12-10 at 02:07, matt VanDeWalle wrote: I am wanting to forward a user on a signup or similar page (based on a few of their answers) and so far i have it split into basically a two-step process where i have on the first part, an option list with 4 choices, they hit continue or some such labled link, and then having passed all the session variables and making the decision in the next script it would forward them to the right page automatically, do I have to use meta tags to do this or is there some simple way e.g, url=http://rightpage.php?SID; of course without the 's except for in the actual url I could have probably done this switch on the fly like some pages do but I was told that requires java and i don't have or want to use java lol matt if possible i want to keep my webpages java free header( 'Location: http://www.somewhere.com/the/page/to/load.php' ); The parameter to the Location header should be a full URL, although many browsers tolerate relative. Cheers, 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
[PHP] Re: PHP Framework
Yonatan, And since I'm the Lampshade guy, I'll throw Lampshade out there, as well: http://www.thinkcomputer.com/software/lampshade/index.html Unlike a lot of frameworks, Lampshade is entirely procedural, and it's designed specifically for use with MySQL. I suppose that makes it less flexible than some people would want, but if it fits your application specs, then it's very fast and straightforward. In general, it's been around since 2002 (no plans to go away next year), it's in use at Harvard and at very large companies, and at very small ones, too, and there's a whole lot of documentation, in both HTML and PDF format. I also happen to think that as far as programming frameworks go, it's pretty easy to learn. The Lampshade Starter Kit, which you can download alongside the core files, gives you an example application that you can work with and modify. Good luck with your search! Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LDAPS agaisnt Active Directory
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have been successful in getting apache to use the cert for .htaccess authentication. But i'm not seeing a clear way on how to make this happen with php. Can anyone offer any suggestions? - -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com Aaron Axelsen wrote: Hello, I am trying to authenticate against an Active Directory 2003 server using LDAPS. I have the cert from the server, however i'm not exactly sure how to set it up so that php will recognize it. I have read the docs and googled a bit, but everyone seems to have a different way. What is the best way to accomplish this? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDV6HCuucONIvD0AMRAnvMAKCZ259ydN/ZSeiMdmz9U2c7NtjmHACg3iY8 ODRThzU6AuiniDUT58tDHHc= =2atb -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Open Lampshade
Hi everyone, Just thought you might like to know that Lampshade, our previously closed PHP framework, is now open-source: http://www.thinkcomputer.com/corporate/news/pressreleases.html?id=24 Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LDAPS agaisnt Active Directory
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I am trying to authenticate against an Active Directory 2003 server using LDAPS. I have the cert from the server, however i'm not exactly sure how to set it up so that php will recognize it. I have read the docs and googled a bit, but everyone seems to have a different way. What is the best way to accomplish this? - -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDVWc2uucONIvD0AMRApAhAJ4uc7kriaMLXavTWHz6eFUYZjcLSgCfWQgo wypmsI10a/J5goQi8cp1ZuU= =fpYX -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext() troubles
Denis Gerasimov wrote: ?php putenv(LANG=ru_RU); setlocale (LC_ALL,ru); $domain = 'messages'; echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng'); echo textdomain ($domain); echo bind_textdomain_codeset($domain, 'UTF-8'); echo gettext(string); ? Here's what I use to set my language (to French in this case). It works 100% of the time for me: // Set locale to preferred language setlocale(LC_ALL, 'fr_FR'); bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale'); textdomain('messages'); I don't do the putenv line that you have, so I'm not sure if it's necessary... -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP based MySQL report generators?
Has anyone encountered an open-source PHP-based report generator for MySQL? I haven't been able to find one yet. We have several people in our company that need to create reports from a master database (consisting of several tables). Ideally I'd like a similar functionality that MS Access or Navicat (navicat.com) offer. We don't need a huge number of features, but we do at least need the ability to select the fields deemed necessary, and correlate them into a report. We are currently using Access for this, but would like to move away from Microsoft (including Office). I'm sure it's not out of reach to write this from scratch, but if I don't need to... -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: security/sql issues with php
Bruce, If you're looking for commercial-grade open-source packages, I think you're going to have a pretty hard time finding much. Most commercial-grade software is...commercial. The truly robust open-source packages, i.e. Mozilla, MySQL, JBoss, BerkeleyDB, etc., are backed by some sort of commercial, or at the very least, corporate, entity. The rest, more often than not, are not commercial-grade; the support structures that companies require just don't exist for those packages. I've offered to help you before via our commercial framework, Lampshade, which handles I'd say 98% of everything you want, and can be easily customized or added to in order to handle the remaining 2%. It's not open-source, but it also doesn't need to be since the documentation is so extensive. It's used in applications for all sorts of organizations from Harvard University to companies traded on the NYSE. There may be other open frameworks that are used just as widely--I would venture to guess phpNuke and the-CMS-formerly-known-as-Mambo--but as you've discovered, they don't do half of the things you'd like to see all in one place. Also, Mambo's political machinations are a good example of what you don't want to see in a commercial-grade product. If you want to keep searching, I suppose no one's going to stop you. I'm just afraid it's not out there. Anyone, correct me if I'm wrong. Best of luck, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Modifying data in forms with values
Robert, The Lampshade framework (and I'm sure others, too) handles pretty much all of the form controls for you. There' also a specific country() function used to make a drop-down of countries. Using Lampshade, you would only need one line of code in your form: dropdownBox('country', country(), $myrow['country'], 'Country'); The first parameter is the name of the field in the form. The second provides the list of items to display in the drop-down box. The third is the present value of the box (so it handles the if statements you were talking about), and the fourth is the label that shows up on the form on the user's screen. You should try it out, and I'd be happy to help you get set up. http://www.thinkcomputer.com/software/lampshade/index.html Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Deny access from certain hosts
Jordan, I have a similar problem where someone is using copyrighted images on my site in a bulletin board. It's not that one specific host is requesting the files--it's people from all over--but rather that I want to block one referring URL using Apache, rather than PHP, since the images are GIF files. Can you do that with .htaccess? Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: user registration/login - admin functions...
Bruce, If your project isn't commercial in nature, you can use Lampshade for free... http://www.thinkcomputer.com/software/lampshade/index.html The Lampshade Starter Kit should already have a schema outlined for user and security management that you can integrate into your own application. Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] weird results from imagettfbbox()
I have an array of strings in which I am passing to imagettfbbox() in order to calculate the height of the text box for each string. I am then subtracting the height from the y position in order to deviate the pivot point form the top left corner to the bottom left corner when I used imagettftext() to draw the text on an image. I am giving both commands a fontsize of 50, an angle of 0 and I am using the font ARIAL. I am having an issue where the first string comes back with a height of 50 and the next comes back with 47. Then 50 again for the next following string and then 47 again for the next one foloowing that. It keeps going on and on like this and I do not understand why. I am using the same font, font size, and angle for each string so shouldnt they all come back as the same size? Here's a snippet of what I am doing: $file = this can be any file; $im = imagecreatefromjpeg($file); $textcolor = imagecolorallocate($im, 0, 0, 0); $fontfile = arial.ttf; $fontsize = 50; $arr = split(CR, $_GET['text']); $boxes = count($arr); if (preg_match('/[0-9]/', $boxes)){ for($c=0;$c$boxes;$c++){ $text = stripslashes($arr[$c]); $y = $fontsize * $c; $bbox = imagettfbbox($fontsize, 0, $fontfile, $text); $dy = $bbox[7] - $bbox[1]; $py = $y-$dy; imagettftext($im, $fontsize, 0, 1, $py, $textcolor, $fontfile, $text); } } header(Content-type: image/jpeg); imagejpeg($im, ,95); imagedestroy($im); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sort table by column and pagination
Daevid, Lampshade, an API we've put together (as a commercially-backed alternative to PEAR) does table pagination and column sorting for you. It's free for non-commercial use, there's a lot of documentation, and I'm always around to answer questions: http://www.thinkcomputer.com/software/lampshade/index.html All you have to do is include the Lampshade files, set up a $table array in your page, and then call the table() function. You can integrate it with your current stylesheets, too. Let me know if you have any other questions. Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form Processor?
Hi, Another shameless plug... Lampshade makes form processing really easy. You define a $form array in your PHP file, you lay out the form in your form file, and go. It error-checks and submits for you. Non-commercial use is free, and there's an example application in the starter kit so you can see how it works. http://www.thinkcomputer.com/software/lampshade Or more specifically for forms... http://www.thinkcomputer.com/software/lampshade/documentation.html?function=form Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help Building Dynamic Checkboxes
Hi, There are a couple of problems with your code. The first is that you have global variables enabled, which makes things easier, but also makes things less secure. You should definitely disable them in your php.ini file if possible. Also, when you put the square brackets after gmev (gmev[]), you turn $_POST['gmev'] into an array. Yet your code just checks to see if the $_POST['gmev'] variable has any value at all, which of course, it does. if ($gmev) { $checked = ' checked=checked'; } else { $checked = ''; } Therefore, when you go to present the form, $checked always has the string from the first case in the if statement, since you're not specifying which part of the $gmev array you really care about. My suggestion to everyone dealing with these form problems, which are a general pain... Use Lampshade. It's so much easier! You can do this all in three lines of code: two to set up your choices for the form element, and one to draw the element itself. http://www.thinkcomputer.com/software/lampshade I'd be glad to help you with it if you have any questions. Best of luck, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dropdown Building Function
Jay, This is why I think frameworks are helpful Here's how I'd do it with Lampshade in one line of code with my own hypothetical field names: dropdownBox('answerid', SELECT answerid, CONCAT(questions.description,' - ',answers.description) AS display FROM questions LEFT JOIN answers ON questions.questionid=answers.questionid ORDER BY questions.description, answers.description, $myrow['answerid'], 'Question and Answer', 'Choose an Answer'); For more information on this function: http://www.thinkcomputer.com/software/lampshade/documentation.html?function=dropdownBox I'd be happy to help you get it set up if you have any questions. Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: application-wide shared data/object
Hi, Not sure if everyone would agree, but I think the best way to go about doing this is just to make a table in a relational database. You can restrict access permissions using MySQL if that's something you're really concerned about, but there's basically no disadvantage to just storing your data in a MyISAM table instead of a shared object. You can index, sort, etc. very quickly that way. You can even load the result of the query into your $_SESSION variable after the first time so that you essentially have the result set cached. If indexing isn't a big deal, I'd just say store the data in a flat file. You can always move it outside of the web-accessible directory if you're worried about people accessing it directly. Alternately, you could just store the data in a PHP file and include it in your scripts. Either way works, I think. Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] open_basedir Question
Hi, Has anyone else had a problem with the open_basedir restriction completely ignoring what you tell it? I've added several directories to my allowed path (separated by colons) in my Apache configuration file, and then when I go to run my scripts, I'm told that /home/sites/site1/web/ and so on is not in my allowed path of /home/sites/site1. Trailing slashes don't change anything. A little weird... This is on Linux with PHP 4.3.11. Several bugs on bugs.php.net from 2002 reported similar behavior, but I don't think it's really been corrected. If this is a bug, it's a serious one from my perspective, because it means I turn off those restrictions entirely, which makes my entire server less secure. Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cannot connect to MySQL server and not sure why
Bruce, Do you mean to have a space before the word password? Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Blocking login on the same username from diffrent computers
Yaron, The Lampshade framework handles this for you. Any given user for an application can only log in from one place at a time; otherwise they'll be signed out from all of their other sessions. If you're interested, take a look: http://www.thinkcomputer.com/software/lampshade/free.html Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lampshade Download Site
Hello again, Before I say anything else, Jaap and Casey, thanks for your feedback on our site design. I was laughing while I read it because I tend to agree with pretty much everything you mentioned. I don't know if I will sack the design staff, but I'll see what I can do. Meanwhile, site design notwithstanding, you can visit: http://www.thinkcomputer.com/software/lampshade/free.html to download the free version of the Lampshade framework, version 1.0.2. We require you to tell us something about yourself, but that's basically it. Not a bad deal for normally expensive stuff that's being used all the way up to the Fortune 500. (Note: there's a catch--the e-commerce libraries aren't included in the free version, since profit automatically means commercial use, which you have to pay for.) Aside from the obvious marketing value of doing this, my hope is that Lampshade will help prove that PHP is just as able as Java (and other languages) in a commercial environment, if not more so. If you have any questions or comments, please feel free to e-mail. Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New Free PHP Framework: Lampshade
Hi everyone, We've been charging for our PHP framework, Lampshade, for a long time, but we just decided to make it free for personal and academic use: http://www.thinkcomputer.com/corporate/news/pressreleases.html?id=22 If you have any questions or would like a copy for yourself, let me know. Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: incrementing a register global
Just so there is no confusion...I mistyped the line: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); It should be a 5 instead of a 7 at the end: $names = substr(strrchr($_SERVER['QUERY_STRING'],),5,1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: incrementing a register global
Thanks for all the suggestions. I am going to plan on trying them out just to see some other ways of making it work. I finally got it to work after hours of just playing around with the code. Here is what I ended up doing: for($i=1;$i=$boxes;$i++){ echo $_GET['name'.$i]; } Moving the $i inside the bracket but not inside the single quote seem to make things happy. Thanks, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] incrementing a register global
I dont know it this is possible, but here it goes. Hopefully I cac explain it well enough for someone to understand. I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } This is where my problem is. And I dont know if this is even possible, but if you look at the echo line in the loop I am trying to add the number of $i to the register global. I dont get an error in doing this, but when I run the script I get the number of $i instead of the value of $_GET['name1'] Like I said, I hope I explained this good enough for someone to know what I am trying to do. If anyone has any suggestions or comments about doing something like this please let me know. Thanks, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP mail
Eustace wrote: I am relatively new to PHP and could use some help. I have a form, which is basically in an email format, from, subject, and message. How do I then send this to an email? I know a bit about the mail function, somebody show me the ropes please! Eustace Everything you need to know should be gleamed from the following page: http://ca3.php.net/manual/en/function.mail.php Check the examples, and you'll be well on your way. -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Certification Exam
Chris Ramsay wrote: Perhaps it came across as a bit cheeky to Aaron - I kind of got the impression that an answer from someone who has had a go but not passed the exam was not good enough for you... Really, I doubt whether there is any difference in doing the exam whatever the outcome, seeing as what you wanted to know was about taking the exam in the first place. That's exactly the impression I got too Chris. Glad I'm not the only one to see it that way! I felt a bit inadequate there for a moment. :) Regardless, my advice still stands (if it still matters coming from a unsuccessful exam taker) -- don't rush the exam and take your time. Some of the questions are tricky in their wording. As an aside -- for those who are unsuccessful with the exam, don't worry, it doesn't mean your a bad programmer. I've been programming PHP for five years now, and there's very little I can't do with it. I just stink at exams; I get antsy when sitting for 30-60 minutes with just a pencil and paper in a quiet room. -- Aaron Gould Programmer/Systems Administrator PARTS CANADA Proudly underperforming in exams for years... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Certification Exam
M Saleh EG wrote: Any advice from the ones that passed? Thanks What exactly are you after? Why does it matter if a person has passed or not? As long as someone has taken the exam, that should be sufficient enough to provide some advice. A couple tidbits of advice have already been given to you, including by me. -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Certification Exam
M Saleh EG wrote: Hi everyone.. kind of OT Anyone who's passed it in the list? I'm having my exam on May 7th. Gone through the guide book once. Sounds easy according to the guide. I dont think it's as easy as i'm thinking it is any experience? Thanx in advance. My advice -- take the full amount of time given to you, and go back over your answers should you have time left over. I took it at the 2005 PHP Quebec Conference (it was part of the fee). I finished it in an hour, but had 90 minutes alotted. I did not pass, and still regret not taking the time to go back over the answers I was unsure of. I think that if I had taken the full time, I would have had a better shot. You'll likely have better luck, as I normally don't do well with exams in general. As an aside, I think the exam needs to mature a bit more. I was confused a few times, and found a few questions that involved cases I had certainly experienced in five plus years of PHP development. I'm sure that'll happen in due time as the certification is only a couple years old. -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] AutoPostgreSQLBackup Released
Greetings, I am proud to announce the initial release of AutoPostgreSQLBackup! It is based on the AutoMySQLBackup script written by [EMAIL PROTECTED] A previous version of this script was ported to Postgresql by Friedrich Lobenstock [EMAIL PROTECTED]. I have been using the script for a couple weeks, and so far it's working like a charm. Visit the project page for my details: http://autopgsqlbackup.frozenpc.net Any problems, questions, bugs can be posted on the forum. I hope others can find this as useful as I do! -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rawurldecode
All I am doing is adding a file name as a variable in the URL.http://www.mysite.com/mypage.php?variable=this is my image.jpg When I do a echo $_GET['variable']; it only writes the first word. Is there some setting that might be turned off in the php.ini file that would disable this functionality? Thanks Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Aaron Todd wrote: I am trying to use the rawurldecode() function to decode a variable that is begin passed from a different page through the url. The PHP manual doesnt say much for this function, but it does have quite a bit on the urldecode() function which says using urldecode on a $_GET variable wont produce the desired results. Is there another way to decode a url variable? Or maybe a better way to get a variable from one page to another so I can use it. The variable may contain all types of characters, but mainly a space(%20) is the biggest problem. If anyone has some kind of workaround for this please let me know. You should not need it, %20 is decoded to space and as such is already in $_GET variable. If it's still encoded then you encoded it where it was not necessary. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rawurldecode
I have been playing around with the varialbe that I am sending here and I have found that this function is actually working correctly. Spaces an punctuation decode properly, but an amperstand seems to be where my ploblem is. I know its a very weird character to be using, but it is a valid character in a filename so I must acount for it. Has anyone previously dealt with this and might be able to give me a quick work around? Thanks Aaron Todd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to use the rawurldecode() function to decode a variable that is begin passed from a different page through the url. The PHP manual doesnt say much for this function, but it does have quite a bit on the urldecode() function which says using urldecode on a $_GET variable wont produce the desired results. Is there another way to decode a url variable? Or maybe a better way to get a variable from one page to another so I can use it. The variable may contain all types of characters, but mainly a space(%20) is the biggest problem. If anyone has some kind of workaround for this please let me know. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rawurldecode
I got it. After you said I shouldn't need it I started playing around and found that you were right...I didnt need it for spaces and other punctuation. But I was then having a problem with amperstands. It was dropping everything after an amperstand off. I ended up doing a rawurldecode of $_SERVER[QUERY_STRING] and then a strrchr() on it to return everything past the = sign. Then I had to do a substr() to get rid of the =. Its probably a long way of doing this and I know it probably wont work if I add a second variable to the url, but I have already taken precautions against that. This should work unless anyone see's amore major security issue with it. $end = strlen(strrchr(rawurldecode($_SERVER[QUERY_STRING]),=)); echo substr(strrchr(rawurldecode($_SERVER[QUERY_STRING]),=), 1, $end); Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rawurldecode
I am trying to use the rawurldecode() function to decode a variable that is begin passed from a different page through the url. The PHP manual doesnt say much for this function, but it does have quite a bit on the urldecode() function which says using urldecode on a $_GET variable wont produce the desired results. Is there another way to decode a url variable? Or maybe a better way to get a variable from one page to another so I can use it. The variable may contain all types of characters, but mainly a space(%20) is the biggest problem. If anyone has some kind of workaround for this please let me know. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: So this isnt a bug?
Ive made it clear. If I use the success_box function that uses java to redirect it works perfectly, but if I use the header command the variables are stripped. This is only when a $_FILE is passed. A. S. Milnes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Aaron wrote: http://bugs.php.net/bug.php?id=32449 I dont see how its not a bug. You might find the advice here helpful as well:- http://www.catb.org/~esr/faqs/smart-questions.html Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] So this isnt a bug?
http://bugs.php.net/bug.php?id=32449 I dont see how its not a bug. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FREETYPE and GD
Hello, I've created a simple script that takes in image and draws some lines and some text on top of it. I am having a problem with the text part of this. When the string that I am drawing on the image contains and apostrophe ( ' ) there is always a backslash ( \ ) before it. It make sense that it is the escape character, but I need to be able to show the apostrophe. Anyone have any ideas about this? ?php $backdir = /var/www/html/backgrounds/; $im = ImageCreatefromJPEG($backdir.$_GET['background']); $textcolor = imagecolorallocate($im, 255, 255, 255); $font = /var/www/html/fonts/arial.ttf; imagepolygon($im, array(36, 24, 36, 456, 684, 456, 684, 24), 4, $textcolor); imagepolygon($im, array(72, 48, 72, 432, 648, 432, 648, 48), 4, $textcolor); maketext($im, 30, 0, 360, 240, $textcolor, $font, $_GET['toparea']); Header(Content-type: image/jpeg); Imagejpeg($im); imagedestroy($im); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FREETYPE and GD
BEAUTIFUL Thats exactly what I was looking for. I'm not doing anything with MySQL so I am going to leave Magic Quotes on and just use stripslashes() Thanks a bunch. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Aaron Todd wrote: I've created a simple script that takes in image and draws some lines and some text on top of it. I am having a problem with the text part of this. When the string that I am drawing on the image contains and apostrophe ( ' ) there is always a backslash ( \ ) before it. It make sense that it is the escape character, but I need to be able to show the apostrophe. Anyone have any ideas about this? ?php $backdir = /var/www/html/backgrounds/; $im = ImageCreatefromJPEG($backdir.$_GET['background']); Because you have Magic Quotes GPC on, all GET/POST/COOKIE data automatically has addslashes called on it, before you see it. That's good because you are probably usually putting your data into a MySQL database that needs that. In this case, though, you want to use http://php.net/stripslashes to undo the automated addslashes of Magic Quotes. Or, if your site mostly/only takes GET data and puts it on images, and rarely puts it into the database, go ahead and turn Magic Quotes GPC off in php.ini (or in your .htaccess) Note that you can't turn it off in your script with ini_set since the GPC data is already altered by the time your script starts. GD is not really directly involved, per se, in this issue. You'd have the same problem if you were putting your GET data into a file, or displaying it directly to the user, or pretty much doing anything at all with it *except* for stuffing it into MySQL. -- 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] Strip alternating spaces in first word of paragraph
I have a series of paragraphs in which the first word contains alternating spaces. How can I strip out the spaces of only this first word, while leaving the remainder of the paragraph untouched? Here's an example: T h i s is the first paragraph. Only the first word is wacky. A n o t h e r paragraph with a wacky first word! Strange stuff... E n d l e s s insanity here! -- Aaron Gould Parts Canada - Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strip alternating spaces in first word of paragraph
Burhan Khalid wrote: ?php $string = 'E n d l e s s insanity here!'; $letters = explode( ,$string); foreach ($letters as $key = $letter) { if (strlen($letter) == 1) { //Possible letter of our first word $word .= $letters[$key]; } else { $split_point = $key; } } echo Original : .$string.\n; echo Word : .$word.\n; echo Modified : .$word. ; echo implode( ,array_slice($letters,$split_point-1)).\n; ? Thanks for the example, looks like it might just work! -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sentence case
Diana Castillo wrote: with php, HOW CAN I CONVERT SENTENCES LIKE THIS . TO BE UPPER AND LOWER CASE to become like this : How can I convert sentences like this. To be upper and lower case. Sounds like you need a combination of ucfirst() and strtolower(). $newstring = ucfirst(strtolower($oldstring)); -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image Creation
I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Thanks for the compliment on my function. I have since improved upon it...see below. I can do the exact same thing as you and get results, but what I can't do is show the image within an HTML table. I think it is something to do with the header line, but I dont know how to get around it. I've tried just calling the function like I have in the code below. I've also tried calling the function inside of img command. Both ways dont work. Check out the code if you can and let me know if you seen anything that I am doing wrong. Thanks ?php function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255, 255, 255); $black = ImageColorAllocate($im, 0, 0, 0); $white = ImageColorAllocate($im, 255, 255, 255); $red = ImageColorAllocate($im, 255, 0, 0); $blue = ImageColorAllocate($im, 0, 0, 255); //imagefilledellipse($im, 75, 75, 125, 125, $red); //imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $blue, IMG_ARC_PIE); imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_NOFILL); imagefilledarc($im, 75, 75, 125, 125, $pieslice, 315, $red, IMG_ARC_PIE); imagefilledarc($im, 75, 75, 125, 125, $pieslice, 315, $black, IMG_ARC_NOFILL); //Return Header(Content-type: image/png); ImagePNG($im); } echo table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#11' width='200' bgcolor='#FFD1A4' tr td width='100%' colspan='2' align='center'This is a testbr.makepie(20,200)./td /tr /table; ? James Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dude - that works fine! can you check your code - make sure you havnt got any white space at all before the php starts in ANY file, and then check that you've got ALL erros being reported (because you might have the error cant send headers, output allready sent at line x) which will prenvent the header being sent and then you dump the image to the screen which is the random wierd characters (that means the image create functions are all ok and installed, and you have an image object or similar). my code was simple ?php {your function} makepie(10,100); ? NO WHITESPACE NO BLANK LINES NOTHING. (ps you might even have a php include in the php file (php prepend or something?) which might be inserting a space or a newline or ending headers or something. Look at error_reporting() or similar in the manual to turn error reporting on for your script. Hope you find the bug, thats quite a nice function you have there. J Aaron Todd wrote: I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Creation
Hey Guys, I think I fixed my own problem. I tried calling the PHP script from a different page like this: img border='0' src='include/pie.php?slice=100total=200' This gave me the results I wanted. Thanks for all your help. Aaron Aaron Todd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I just wrote a little script to play around with the GD library but I am having a problem displaying it in the browser. I have not problem at all when I just run the script. But I was trying to make the image in a custom function which will return the image when its called. All I end up getting is a bunch of weird characters. Here's my code: function makepie($slice, $total){ $height = 150; $width = 150; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 0, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0); imagefilledellipse($im, 75, 75, 125, 125, $red); imageellipse($im, 75, 75, 125, 125, $black); //Making the Slice $pieslice = (($slice / $total) * 360) + 315; imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black, IMG_ARC_PIE); //Return header(Content-type: image/png); echo ImagePNG($im); } Anyone have any idea why I cant return the image? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fireing function with onChange
I have a loop that is putting the filenames of files in a certain directory into a listbox. I am then using the onChange event of the listbox to fire a function. In this script the onchange event sends the function the path an filename of the chosen file from the list. I have tested what I am sending with a javascript alert and it looks ok. The funstion is supposed to open the file and then make a new file(im working with jpegs using GD). Unfortunately it isnt working the way I would want it to. Can soneone check this code and see if there is anything wrong. In the browser it doesnt do anything. I had hoped for at least an error code. Hope someone can help...Thanks ?php function createimage($picpath){ $im = imagecreatefromjpeg($picpath); imagejpeg($im,images/temp.jpg); } $path = images; $dir_handle = @opendir($path) or die(Unable to open $path); echo select name='filelist' size='14' multiple onchange=createimage('$path/'+this.options[this.selectedIndex].value)\n; while ($file = readdir($dir_handle)) { if($file!=. $file!=..){ echo option value='$file'$file/optionbr/\n; } } echo /select\n; echo img border='0' src='images/temp.jpg' width='300' height='224'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] png.h not found, something's going wrong in my PHP installation
I found a thread a couple of weeks ago where someone had to create symbolic links in order to get their install of PHP to work because PHP wasn't able to find png.h. I am having the same problem. I made no changes to the installation of libpng, installed it in its default location and PHP cannot find png.h, no matter what I set the dir= flag to. Here is my ./configure: ./configure --with-mysql --with-apxs=/www/bin/apxs --with-xml --enable-ftp --with-gd --enable-magic-quotes --with-jpeg-dir=/usr --with-mcrypt --with-png-dir=/usr --enable-sockets --enable-track-vars --enable-versioning --with-zlib --enable-bcmath --enable-calendar --with-xpm-dir=/usr/X11R6 --enable-memory-limit png.h on my system is located in /usr/lib -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling PHP error, please help (configure: error: libjpeg.(a|so) not found.)
The error I'm getting when running ./configure is this: configure: error: libjpeg.(a|so) not found. I know libjpeg is installed, I just installed it. Here is my ./configure: ./configure --with-mysql --with-apxs=/www/bin/apxs --with-xml --enable-ftp --with-gd --enable-magic-quotes --with-jpeg-dir=/usr/lib --with-mcrypt --with-png-dir=/usr --enable-sockets --enable-track-vars --enable-versioning --with-zlib --enable-bcmath --enable-calendar --with-xpm-dir=/usr/X11R6 Side question - if there's anything I'm missing in my ./configure that I should have in it, please let me know. This is my first from-scratch PHP install. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple code to replace one line?
Can someone help me out with a little bit of simple code please? I know that the line in a file that I want to replace completely is line number 9. Is there a simple function I can use to replace that line? Thanks, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Very Odd Session Array Problem
Let me see if i can explain this. Basically, if i dont have this chunk of code: $quoteString = implode(,,$_SESSION['quotes'][$key]); $_SESSION['quotes'][$key] = explode(,,$quoteString); If i dont do that, when i do a print_r($_SESSION['quotes'][$key]) i get errors that say RECURSION and its almost like the arrays are making new arrays instead of just storing them in the one session array. It is a very odd problem. Does that make things any clearer? Richard Lynch wrote: Aaron Axelsen wrote: We have the chunk of code at the bottom of the page. It is behaving very strangly under php 4.3.9. Basically, if it is not coded exactly as listed below, it will not work right. The development server is running 5.0.3, and it works fine. However, the live server has 4.3.9. Is there something vastly different with arrays and session variables? You are going to have to define behaving very strangely and will not work right Right now, we've got *NOTHING* to work with in terms of what your problem is. -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Very Odd Session Array Problem
I understand the recursion part, but i dont understand why this fixes it: $quoteString = implode(,,$_SESSION['quotes'][$key]); $_SESSION['quotes'][$key] = explode(,,$quoteString); That is essentially just reading the values out, and sticking them back in. Jason Barnett wrote: If i dont do that, when i do a print_r($_SESSION['quotes'][$key]) i get errors that say RECURSION and its almost like the arrays are making new If you have a SESSION['quotes'] array... and one of the elements in the array references the same SESSION['quotes'] array... then you are going to have recursion. It's not exactly an error, but it *is* a recursive array that never ends because it keeps pointing to itself. Hopefully this makes sense? -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get 2 columns to display?
Hi guys, I'm trying to get two columns of td/td to display side by side and then go to a new row. I am using this code but nothing I seem to do is working this far. ?php for ($r=0;$products = db_fetch($productsQuery);$r++) { ? td align=centera href=?php echo $base_url; ?products/?php echo $category; ?/?php echo $products['name_url']; ? class=product_linkimg src=?php echo $base_url; ?product_images/thumbs/?php echo $products['thumb']; ? border=0 width=159br?php echo $products['name']; ?/a/td ?php if ((($r+1) % 2) == 0) { ? /tr tr valign=top ?php } } ? What is happening with this code is I am getting results like: tr tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td /tr What I WANT is: tr tdIMAGE HERE/td tdIMAGE HERE/td /tr tdIMAGE HERE/td tdIMAGE HERE/td /tr tdIMAGE HERE/td td/td /tr ANY clue where I am going wrong? Thanks so much. Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Path to ImageMagick??
Hey all, How can I find out the path ImageMagick on my server the php is running on? Need it for a software and I don't know where to look. Phpinfo() tells me nothing. Thanks! Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php