[PHP] Re: Can I do this?
Ah! A little experimenting ... Yes I can :) Answered my own question. include(http://elsewhere.com/list.php?number=$number;); André Cerqueira wrote: John Taylor-Johnston wrote: Can I include a script on another server doing this? $sql = 'SELECT * FROM '.$table.' where number like '.$number.';'; http://foo.com?list.php?number=16 include(http://elsewhere.com/list.php;); My $sql is error-ing - obviously. http://elsewhere.com/list.php is not receiving $number. Can I even do this? No, you cant. Even if you could, if the server where the include file is located runs PHP, the include file would run there, and you would end up including the output of it instead of the code. Why would you want to do that? Maybe what you really want to do dont need that... -- John Taylor-Johnston - If it's not Open Source, it's Murphy's Law or broken. ' ' ' Collège de Sherbrooke ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can I do this?
On Sun, 2004-02-08 at 03:18, John Taylor-Johnston wrote: Ah! A little experimenting ... Yes I can :) Answered my own question. include(http://elsewhere.com/list.php?number=$number;); Careful with that. If someone were to stumble upon your list.php script they would be able to see your php code. You would probably be better off having a local copy of that file. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Revised: RE: [PHP] Re: Can I do this?
Ok so on this topic, I do something similar to this with my scripts, and if my includes are vulnerable... I need to know how? I have tested this and the includes parse the information as it includes it, I can't see the code, so how is this possible where you say: { If someone were to stumble upon your list.php script they would be able to see your php code. } I have tested this pulling it from the server without parsing the file, I only saw the html source with the include directory in it. Even if someone was to get ahold of that the only variable is a get variable correct, what's the difference from them having this information there or typing it into a Web browser? And if they did try anything with that variable, I have the script checking for valid input. Am I not safe in doing this? Maybe I'm being nieve here, but I thought I had covered most of my bases with this. Please explain where the security hole is! Anyone?I'm still learning and need to know the ins and outs of security for what I am scripting. Sorry for all the questions, but I'm truely concerned nowI'd like to know if I have to find alternative solutions to my include issues. TIA Wolf -Original Message- From: Adam Bregenzer [mailto:[EMAIL PROTECTED] Sent: Sunday, February 08, 2004 2:39 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Re: Can I do this? On Sun, 2004-02-08 at 03:18, John Taylor-Johnston wrote: Ah! A little experimenting ... Yes I can :) Answered my own question. include(http://elsewhere.com/list.php?number=$number;); Careful with that. If someone were to stumble upon your list.php script they would be able to see your php code. You would probably be better off having a local copy of that file. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
On Sun, 2004-02-08 at 04:14, PHP Email List wrote: Ok so on this topic, I do something similar to this with my scripts, and if my includes are vulnerable... I need to know how? I have tested this and the includes parse the information as it includes it, I can't see the code, so how is this possible where you say: Are you referring to including a file locally, or including a file from a remote server via http? From what I understand this thread is about including a php script from a different server over http. In this case the php code will be viewable if you open it via a web browser. If you know of a way to include a file remotely with php, but not browse to it, please let me know. Presumably you could use apache to restrict access to the file by ip, however that can still be subverted by a man in the middle attack. I would be curious to see an example where this method of including a file would be necessary. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt don't work.
Hi all, I have problem with mcrypt function. There is always an error that I don't know how to correct this. This is my code: $string = Text string; $key= My key; $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); echostringa cifrata= $encrypted; $key = My key; $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); echostringa decifrata= $string; And the errore message is Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 58 stringa decifrata= I see, with phpinfo(), that my server support mcrypt and RIJNDAEL-256. I don't know why there is this error message. All helps are precious. Thanks in advance Francesco [EMAIL PROTECTED] (P.S. this is the link for a view in real time of the problem www.automationsoft.biz/critto.php)
Re: [PHP] mcrypt don't work.
Mmm this same problem happen to me also... I use Apache 1.3.29 for Win32 and PHP v4.3.4 ... I do not know why but mcrypt module failed to initialize [EMAIL PROTECTED] wrote: Hi all, I have problem with mcrypt function. There is always an error that I don't know how to correct this. This is my code: $string = Text string; $key= My key; $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); echostringa cifrata= $encrypted; $key = My key; $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); echostringa decifrata= $string; And the errore message is Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 55 stringa cifrata= Warning: mcrypt_cfb(): Module initialization failed in /web/htdocs/www.automationsoft.biz/home/critto.php on line 58 stringa decifrata= I see, with phpinfo(), that my server support mcrypt and RIJNDAEL-256. I don't know why there is this error message. All helps are precious. Thanks in advance Francesco [EMAIL PROTECTED] (P.S. this is the link for a view in real time of the problem www.automationsoft.biz/critto.php) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Application-level variables
Greetings Everyone, I am still new to PHP but am progressing nicely. I has helped a lot that I have had vast experience with ColdFusion (sorry) but have seen the light and am now doing rather nicely in PHP. My question is as follows... I have certain functions, variables etc that I would like to be active in an application-wide state. CF has an application.cfm file that is read in (if it exists in the directory) which is used for this purpose. Is there a similar creature in PHP? If not, how is it best to define application-level stuff? Many Thanks In Advance, Lloyd. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Application-level variables
You can auto-prepend a file to all PHP scripts as they are called, in which you could store some application-wide variables like database usernames and passwords, config irectives, etc, BUT it's important to note that this file is loaded into PHP on every call basically as an include, and each instance of the script being called is separate to the others, and the PHP application remains stateless. Since you used the word DEFINE in your post, my guess is this would be sufficient. However, if you need something with state, or something more dynamic, then this may not be enough. FWIW, auto-prepended files can also include logic, database queries, include other files, or anything else that you can do with an include file... so it's not just a list of variables -- it's a PHP script. You can set the php.ini directive auto_prepend_file to the full path of the file at a server level (eg a dedicated server), or at a directory level using a .htaccess file, with something like: --- IfModule mod_php4.c php_value auto_prepend_file '/path/to/file.php' /IfModule --- Or you can do it the old-fashioned-way at script level with ? include('path/to/file.php'); ? If you want your scripts to be as portable as possible, the last option is fail-safe. Option requires you to basically be the sys admin of your server, and option 2 requires your sysadmin to allow .htaccess files with tweaking of PHP (quite common, but not always). Justin French On Sunday, February 8, 2004, at 09:54 PM, Lloyd Bayley wrote: Greetings Everyone, I am still new to PHP but am progressing nicely. I has helped a lot that I have had vast experience with ColdFusion (sorry) but have seen the light and am now doing rather nicely in PHP. My question is as follows... I have certain functions, variables etc that I would like to be active in an application-wide state. CF has an application.cfm file that is read in (if it exists in the directory) which is used for this purpose. Is there a similar creature in PHP? If not, how is it best to define application-level stuff? Many Thanks In Advance, Lloyd. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Application-level variables
I haven't worked with ColdFusion much so I'm not quite sure what application-level variables are. However, I did do some quick research and I believe they are basically variables that are available to all scripts running on the server (correct me if I'm wrong). Assuming the above definition of application variables, I would say that I don't know of any PHP mechanism that allows such functionality. However, I did find an article that talks about alternatives. Here it is: http://php.weblogs.com/php_application_variables HTH, Shaunak - Original Message - From: Lloyd Bayley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, February 08, 2004 5:54 AM Subject: [PHP] Application-level variables Greetings Everyone, I am still new to PHP but am progressing nicely. I has helped a lot that I have had vast experience with ColdFusion (sorry) but have seen the light and am now doing rather nicely in PHP. My question is as follows... I have certain functions, variables etc that I would like to be active in an application-wide state. CF has an application.cfm file that is read in (if it exists in the directory) which is used for this purpose. Is there a similar creature in PHP? If not, how is it best to define application-level stuff? Many Thanks In Advance, Lloyd. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
The security hole is probably not existant in my opinion. PHP is (normaly) parsed by the remote server(no source viewable) and the result is being included, not the source. When http://.../script.php?var=value; was mentioned, it implies the script is being parsed remotedly so that the http request variables are being used within the script. A test to confirm that, is to point the browser to the address being included. See the source? vulnerable. See the results? not vulnerable. HTH, Andrew On Sun, 2004-02-08 at 04:14, PHP Email List wrote: Ok so on this topic, I do something similar to this with my scripts, and if my includes are vulnerable... I need to know how? I have tested this and the includes parse the information as it includes it, I can't see the code, so how is this possible where you say: Are you referring to including a file locally, or including a file from a remote server via http? From what I understand this thread is about including a php script from a different server over http. In this case the php code will be viewable if you open it via a web browser. If you know of a way to include a file remotely with php, but not browse to it, please let me know. Presumably you could use apache to restrict access to the file by ip, however that can still be subverted by a man in the middle attack. I would be curious to see an example where this method of including a file would be necessary. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- 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] PHP Image : resolutions differs between platform
I created a script that creates a thumbnail based on the script . I tested the scripting using WinXP/Apache/PHP/php_gd ... the resolution is desirable .. but when I finally deployed my script on the web.. where the Host runs on Linux/Apache/PHP/php_gd ... the resolution of the resized image is not good at all. What happened? jun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] connecting with C-code
I have a tried-and-tested (15 years of it) piece of C code that I could port from Windows to Linux, and I thought I put a PHP front on it. Is there a way to interface the C-code with PHP 4.3.4 ? If so, could you point me to docs ? frgr Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question About Date Function in PHP/MySQL
I'm using PHP to display a MySQL table. I've got everything working fine except the date function. I designated the first two fields VARCHAR. Those columns display just fine when I preview my web page, as do all the other columns except the third. I designated that one DATE. (The field name is Birthday.) When I view my data in phpMyAdmin, all I see in that column is NULL. When I preview it in a webpage, nothing displays at all. If I change it to NOT NULL, I see -00-00 in every cell. Here's a row of text from the CSV file I imported into my MySQL table: Alberta,Edmonton,1905-09-01,11,NWT,AB,CAN As you can see, the date is listed as 1905-09-01. I've altered my MySQL table every way I can think of, and nothing works. The MySQL Manual doesn't shed any light on it. So I'm wondering if there's something wrong with my PHP code. Below's the source code from my web page. Do you see anything that would cause the third column - echo $myrow[Birthday]; - to malfunction, while everything else works fine? Thanks. ?php $db = mysql_connect(localhost, USERNAME, PASSWORD); mysql_select_db(test,$db); $result = mysql_query(SELECT * FROM states,$db); echo table; echotrtdbName/btdbCapital/btdbBirthday/btdbRank/bbOrigin/bbCode/btdbNation/b/tr; while($myrow = mysql_fetch_array($result)) { echo trtd; echo $myrow[Name]; echo /tdtd; echo $myrow[Capital]; echo /tdtd; echo $myrow[Birthday]; echo /tdtd; echo $myrow[Rank]; echo /tdtd; echo $myrow[Origin]; echo /tdtd; echo $myrow[Code]; echo /tdtd; echo $myrow[Bigcode]; echo /td/tr; } echo /table; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How can I run php 5 beta 3 on windows?
plz Help Omer Katz [EMAIL PROTECTED] ëúá áäåãòä:[EMAIL PROTECTED] Help!!! Omer Katz [EMAIL PROTECTED] ëúá áäåãòä:[EMAIL PROTECTED] Can I update PHPTraid's php files? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connecting with C-code
E.H.Terwiel wrote: I have a tried-and-tested (15 years of it) piece of C code that I could port from Windows to Linux, and I thought I put a PHP front on it. Is there a way to interface the C-code with PHP 4.3.4 ? If so, could you point me to docs ? frgr Erik Hello, there are two ways - you can execute a compiled exectable and talk to the executable with command line arguments and/or using popen() function. Another way is to wrap the code in a php extension. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About Date Function in PHP/MySQL
Freedomware wrote: When I view my data in phpMyAdmin, all I see in that column is NULL. When I preview it in a webpage, nothing displays at all. If I change it to NOT NULL, I see -00-00 in every cell. Here's a row of text from the CSV file I imported into my MySQL table: Alberta,Edmonton,1905-09-01,11,NWT,AB,CAN As you can see, the date is listed as 1905-09-01. Well, that's the right format for a MySQL date; -MM-DD, so I don't know why it wouldn't load from your CSV file. Can you show the command that you use to import the file? If the fields are NULL (or -00-00) in the database, then MySQL is not accepting your data (for the date field at least). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Use a Server or Client Socket?
Hi, If you only need to make a connection to the server every ten minutes you will be saving a lot of resources if you use a cron job to connect at intervals instead of keeping a permanently open connections. Creating a cron job is quite simple, if you type man 5 crontab you will be able to read more about it (at least in linux - a poor substitute exists in windows called scheduled tasks) With this approach you just need to call fsockopen to do connect to your server and do the needful. Tan Ai Leen wrote: Hi Raditha, Thanks, I have a better idea of how to write the codes. But I wonder, to check that the connection to the external server is on, where should I place the code? I need to do this every 10 minutes. If the connection is dropped, I have to reconnect. Where should I place this check? If I place it in the while(true) loop, I will be checking every few miliseconds rite? That will be too frequent. What about in another script? Will I be able to check that the connection is on? Regards, Ai Leen Raditha Dissanayake wrote: Hi Tan, If you are connecting to another server you are using a client socket you do not need to make a server socket. If you need to listen for connections make use of a server socket. To give you an example your browser makes use of client sockets while apache makes use of server sockets. That is an over simplified view of things but hope it helps you understand things better. Generally working with client sockets is easier. best regards -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
Hi, As andrew has said there is no risk here. What you will see is the parsed output (if the webserver has PHP installed) If this is indeed a vulerability we can just add lines similar to include(http://elsewhere.com/list.php;); in our code and be able to easily view other peoples php scripts. Andrew Séguin wrote: The security hole is probably not existant in my opinion. PHP is (normaly) parsed by the remote server(no source viewable) and the result is being included, not the source. When http://.../script.php?var=value; was mentioned, it implies the script is being parsed remotedly so that the http request variables are being used within the script. A test to confirm that, is to point the browser to the address being included. See the source? vulnerable. See the results? not vulnerable. HTH, Andrew On Sun, 2004-02-08 at 04:14, PHP Email List wrote: Ok so on this topic, I do something similar to this with my scripts, and if my includes are vulnerable... I need to know how? I have tested this and the includes parse the information as it includes -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About Date Function in PHP/MySQL
John W. Holmes wrote: Freedomware wrote: When I view my data in phpMyAdmin, all I see in that column is NULL. When I preview it in a webpage, nothing displays at all. If I change it to NOT NULL, I see -00-00 in every cell. Here's a row of text from the CSV file I imported into my MySQL table: Alberta,Edmonton,1905-09-01,11,NWT,AB,CAN As you can see, the date is listed as 1905-09-01. Well, that's the right format for a MySQL date; -MM-DD, so I don't know why it wouldn't load from your CSV file. Can you show the command that you use to import the file? If the fields are NULL (or -00-00) in the database, then MySQL is not accepting your data (for the date field at least). Wow, I think you solved it! I went to retrieve the link to the screen shots I put online when I was first trying to figure this stuff out - at http://geowebworks.geobop.org/test/php/ Towards the bottom of the page (#6) is a screen shot of something I was oblivious to this time around - Date and Time Formats. (I'm using a trial version of EMS MySQL Manager.) I'll bet that's my problem, though I'm still a bit confused. EMS lists the following: Short Date: M/d/ Long Date: , dd, Day followed by month, followed by another day, then year??? I thought it was supposed to be year first, followed by month and day, as in the example from CSV table - 1905-09-01. Should I change Long Date so that it reads -MM-DD, or something like that? Or maybe I can figure out how to do it in phpMyAdmin. I downloaded EMS phpMySQL because I couldn't create error-free tables with phpMyAdmin, but maybe I can use it to tweak my tables. Thanks for the tip! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] .html or.php extension
My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? The other way around is ok: put HTML code in a .php file... frgr Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 8 Feb 2004 16:58:49 -0000 Issue 2578
php-general Digest 8 Feb 2004 16:58:49 - Issue 2578 Topics (messages 177121 through 177146): Re: how to conver a string to float 177121 by: Michal Migurski 177123 by: Adam Bregenzer Re: refresh page (might be 0t) 177122 by: Adam Bregenzer Re: Use a Server or Client Socket? 177124 by: Tan Ai Leen 177125 by: Tan Ai Leen 177143 by: Raditha Dissanayake Can I do this? 177126 by: John Taylor-Johnston 177127 by: John Taylor-Johnston 177128 by: Adam Bregenzer Revised: RE: [PHP] Re: Can I do this? 177129 by: PHP Email List 177130 by: Adam Bregenzer 177136 by: Andrew Séguin 177144 by: Raditha Dissanayake mcrypt don't work. 177131 by: francesco.automationsoft.biz 177132 by: Miguel J. Jiménez Application-level variables 177133 by: Lloyd Bayley 177134 by: Justin French 177135 by: Shaunak Kashyap PHP Image : resolutions differs between platform 177137 by: jun connecting with C-code 177138 by: E.H.Terwiel 177141 by: Marek Kilimajer Question About Date Function in PHP/MySQL 177139 by: Freedomware 177142 by: John W. Holmes 177145 by: Freedomware Re: How can I run php 5 beta 3 on windows? 177140 by: omer katz .html or.php extension 177146 by: E.H.Terwiel Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Is there a possibility to convert a string like 10*500 (parsed from a XML-File) to a float? When i try to store this String in a float variable it only coverts the 10 but nothing after the *-sign, but i need the result of this expresison... Is there a function to calculate such string expressions? Another possibility is to pipe the expression to bc, which could do the input check for you, and probably covers a lot of syntactic ground. Slightly less resource-efficient, but you don't have to reinvent the wheel (untested, unix only): $result = shell_exec(echo '${expr}' | bc); - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html ---End Message--- ---BeginMessage--- On Sat, 2004-02-07 at 23:50, Michal Migurski wrote: Another possibility is to pipe the expression to bc, which could do the input check for you, and probably covers a lot of syntactic ground. Slightly less resource-efficient, but you don't have to reinvent the wheel (untested, unix only): $result = shell_exec(echo '${expr}' | bc); Both eval and piping to bc via the shell work but open up big security holes if you are not careful. If you have bcmath or gmp enabled in php I recommend looking at these functions: http://www.php.net/manual/en/function.gmp-mul.php http://www.php.net/manual/en/function.bcmul.php -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ ---End Message--- ---BeginMessage--- On Sat, 2004-02-07 at 23:03, Ryan A wrote: Heres what I am doing: I give the client a control panel where he can add,edit and delete accounts, after each of the actions I have a link back to the index page of the contol panel...problem is, unless he presses the refresh button it shows him the same cached content. How do i force the browser to display the new updated accounts after and edit or the new list of accounts after a delete? It sounds like you may want to set the page to not be cached. Here's what I use to prevent pages from being cached: function noCacheHeaders() { header('Expires: Tue, 1 Jan 1980 12:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, no-transform'); header('Pragma: no-cache'); } This should prevent proxies, browsers, etc from caching your pages. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ ---End Message--- ---BeginMessage--- Hi Raditha, Thanks, I have a better idea of how to write the codes. But I wonder, to check that the connection to the external server is on, where should I place the code? I need to do this every 10 minutes. If the connection is dropped, I have to reconnect. Where should I place this check? If I place it in the while(true) loop, I will be checking every few miliseconds rite? That will be too frequent. What about in another script? Will I be able to check that the connection is on? Regards, Ai Leen Raditha Dissanayake wrote: Hi Tan, If you are connecting to another server you are using a client socket you do not need to make a server socket. If you need to listen for connections make use of a server socket. To give you an example your browser makes use of client
Re: [PHP] Question About Date Function in PHP/MySQL
Freedomware wrote: EMS lists the following: Short Date: M/d/ Long Date: , dd, Day followed by month, followed by another day, then year??? That format means something like Friday, May 5, 2004 I thought it was supposed to be year first, followed by month and day, as in the example from CSV table - 1905-09-01. Should I change Long Date so that it reads -MM-DD, or something like that? Yeah, I'd try switching possibly both the long and short dates to -MM-DD and see if it's imported correctly. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .html or.php extension
E.H.Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? If you're using Apache, you can add .html to the list of file extensions php will parse. The other way around is ok: put HTML code in a .php file... Yes. You can also seperate html from php, and just include the html file in your php script. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .html or.php extension
On Friday 06 February 2004 06:15, E.H.Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? If you're using Apache then you should have a line something like: AddType application/x-httpd-php .php4 .php3 .phtml .php .inc in httpd.conf. Simply add '.html' to the line and restart Apache. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* One man's folly is another man's wife. -- Helen Rowland */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .html or.php extension
On Feb 5, 2004, at 5:15 PM, E.H.Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Right, the browser interprets the JavaScript that's sent to it; the server has to process the PHP before sending it to the client. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? You're spot on here. You can have your web server process other files as PHP. Check the documentation for your web server to figure it out. The other way around is ok: put HTML code in a .php file... Yep, that's fine. PHP ignores anything that's not in ? ? and just outputs it to the browser. HTH, -- Chris Garaffa [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .html or.php extension
If you start with one index.php then use that to include additional files, it should accept any file, even with no extension. At least it works that way for me. E . H . Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? The other way around is ok: put HTML code in a .php file... frgr Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: .html or.php extension
Paul Furman wrote: If you start with one index.php then use that to include additional files, it should accept any file, even with no extension. At least it works that way for me. Just be careful with that. Remember that the files can be requested on their own, also. If you have database.inc that you include to connect ot your database and someone requests it by itself, they'll see your PHP code as plain text. Either store your includes outside of the web root, deny access to them, or give them a .php extension. Even if you give it a .php extension to hide the code, remember the file can be requested on it's own and run out of context, still. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About Date Function in PHP/MySQL
John W. Holmes wrote: Freedomware wrote: EMS lists the following: Short Date: M/d/ Long Date: , dd, Day followed by month, followed by another day, then year??? That format means something like Friday, May 5, 2004 I thought it was supposed to be year first, followed by month and day, as in the example from CSV table - 1905-09-01. Should I change Long Date so that it reads -MM-DD, or something like that? Yeah, I'd try switching possibly both the long and short dates to -MM-DD and see if it's imported correctly. OK, I'll add that to my experiments to do list. In the meantime, I imported all the dates as VARCHAR, then went into phpMyAdmin and changed it to DATE. It seems to work! Thanks again for the tips. Oh, one other thing... Do you know if dates can be sorted in various ways, either by absolute date or by month alone, date alone, etc.? I'm going to be making sortable columns (JavaScript or PHP), and I'm not yet sure what all you can do with dates. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote: A test to confirm that, is to point the browser to the address being included. See the source? vulnerable. See the results? not vulnerable. If you do not see 'source' then what are you including? For example the following script could be included remotely: ?php echo EOF ?php \$sql = SELECT * FROM table WHERE id = $number; ? EOF; ? If you were able to do include the above source with: include(http://somewhere.com/file.php?number=123;); You could include and see php code. Not the original but something that is still useful. include() includes php code, if you can include a file from a remote source you can view it with a browser. What you say is true: See the source? vulnerable. See the results? not vulnerable. Of course if you can not see it you also can not include it remotely. As a side note it is safer to put includes outside the web path. An overflow or some other bug may be found that would bypass processing of .php files (or a different bug could be exploited to write a .htaccess file in that directory). If you have the option to move includes to a different directory it is more secure. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_POST trouble with html form
Why am I getting the error Undefined index: comment? It's probably a typo because I had something similar that worked. form action=?php include (ACTION_DIR./jpeg-comment.php); ? method=post textarea name=comment ROWS=6 COLS=60 ?php print $comments[$thumb_num] ? /textareabr input type=submit value=update annotation /form ?php echo $_POST[comment]; # this is just for debugging ? Also perhaps related, when I call $_POST[comment] in the action file, it gives me Forbidden You don't have permission to access...[error message] but this is my own server at home. I'm quite unfamiliar with forms (and new to PHP for that matter). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can I do this?
they would be able to see your php code. How?!?! Adam Bregenzer wrote: On Sun, 2004-02-08 at 03:18, John Taylor-Johnston wrote: Ah! A little experimenting ... Yes I can :) Answered my own question. include(http://elsewhere.com/list.php?number=$number;); Careful with that. If someone were to stumble upon your list.php script they would be able to see your php code. You would probably be better off having a local copy of that file. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- John Taylor-Johnston - If it's not Open Source, it's Murphy's Law or broken. ' ' ' Collège de Sherbrooke ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST trouble with html form
OK, it's only when I call $_POST[comment] in the included action file that I get Forbidden You don't have permission to access...[error message]. I set it up with the action as an include because if I tried to just give the location, it tried to download jpeg-comment.php. Like I said, this is all new to me. I never used form action= before, especially not with PHP. php.net assumes I know all this g. Paul Furman wrote: Why am I getting the error Undefined index: comment? It's probably a typo because I had something similar that worked. form action=?php include (ACTION_DIR./jpeg-comment.php); ? method=post textarea name=comment ROWS=6 COLS=60 ?php print $comments[$thumb_num] ? /textareabr input type=submit value=update annotation /form ?php echo $_POST[comment]; # this is just for debugging ? Also perhaps related, when I call $_POST[comment] in the action file, it gives me Forbidden You don't have permission to access...[error message] but this is my own server at home. I'm quite unfamiliar with forms (and new to PHP for that matter). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
On Sun, 2004-02-08 at 13:15, Paul Furman wrote: Why am I getting the error Undefined index: comment? It's probably a typo because I had something similar that worked. form action=?php include (ACTION_DIR./jpeg-comment.php); ? method=post textarea name=comment ROWS=6 COLS=60 ?php print $comments[$thumb_num] ? /textareabr input type=submit value=update annotation /form ?php echo $_POST[comment]; # this is just for debugging ? You will not have access to the $_POST[comment] variable until the form is submitted. It looks like you are trying to access this when the form is loaded. Whatever action is echoed in the jpeg-comment.php script is where you want to use you comment variable. Also perhaps related, when I call $_POST[comment] in the action file, it gives me Forbidden You don't have permission to access...[error message] but this is my own server at home. I'm quite unfamiliar with forms (and new to PHP for that matter). That looks like an access error from your web server. Make sure the directory this file is in is accessible from the web. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
Adam Bregenzer wrote: Also perhaps related, when I call $_POST[comment] in the action file, it gives me Forbidden You don't have permission to access...[error message] but this is my own server at home. I'm quite unfamiliar with forms (and new to PHP for that matter). That looks like an access error from your web server. Make sure the directory this file is in is accessible from the web. No, it's not accessible from the web, it's in my protected php_library outside public_html. Can't I execute a hidden script with a form? Should I make a little php action file in public_html that includes the actual file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
Paul Furman wrote: Adam Bregenzer wrote: Make sure the directory this file is in is accessible from the web. No, it's not accessible from the web, it's in my protected php_library outside public_html. It does load the protected action file as long as I don't try to call $_POST[comment] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt don't work.
On Sun, 2004-02-08 at 05:18, [EMAIL PROTECTED] wrote: Hi all, I have problem with mcrypt function. There is always an error that I don't know how to correct this. This is my code: $string = Text string; $key= My key; $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT); echostringa cifrata= $encrypted; $key = My key; $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT); echostringa decifrata= $string; If you are using mycrypt 2.4.x you need to do something like this: encrypt: # initialize the encryption module $mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, ''); mcrypt_generic_init($mc_module, $encryption_key, $iv); # encrypt the data $encrypted_data = mcrypt_generic($mc_module, $data); # de-initialize the encryption module mcrypt_generic_deinit($mc_module); mcrypt_module_close($mc_module); decrypt: # initialize the encryption module $mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, ''); mcrypt_generic_init($mc_module, $encryption_key, $iv); # decrypt the data $decrypted_data = mdecrypt_generic($mc_module, $encrypted_data); # trim any trailing \0, encrypted data is automatically padded to a 32byte boundary with \0 $decrypted_data = rtrim($decrypted_data); # de-initialize the encryption module mcrypt_generic_deinit($mc_module); mcrypt_module_close($mc_module); Check the documentation[1] for more information on encryption keys and initialization vectors. [1] http://www.php.net/mcrypt -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
On Sun, 2004-02-08 at 13:32, Paul Furman wrote: No, it's not accessible from the web, it's in my protected php_library outside public_html. Can't I execute a hidden script with a form? no Should I make a little php action file in public_html that includes the actual file? yes -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
Adam Bregenzer wrote: Should I make a little php action file in public_html that includes the actual file? yes OK thanks, I made this: ?php # jpeg-comment-public.php include (C:/_Paul/web/phplib/action/jpeg-comment.php); ? but now the hidden one isn't aware of any variables. Forbidden You don't have permission to access Notice: Undefined variable: thumb_num in C:/_Paul/web/phplib/action/jpeg-comment.php on line 4 etc... on this server. Apache/1.3.29 Server at 127.0.0.1 Port 80 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
Adam Bregenzer wrote: You will not have access to the $_POST[comment] variable until the form is submitted. Understood. That debug test only worked after submitting the form. So maybe the better way is to just submit the form with the action file simply reloading the main page to refresh it then put my code below with an if statement checking if the form has been submitted yet and clearing $_POST when I'm done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST trouble with html form
On Sun, 2004-02-08 at 13:58, Paul Furman wrote: OK thanks, I made this: ?php # jpeg-comment-public.php include (C:/_Paul/web/phplib/action/jpeg-comment.php); ? but now the hidden one isn't aware of any variables. Forbidden You don't have permission to access Notice: Undefined variable: thumb_num in C:/_Paul/web/phplib/action/jpeg-comment.php on line 4 Where are these variables coming from? The action in your form should be a url that points to the script you want to process the form. In that script you access the form variables by $_POST['variable_name']. IE: form.html: form method=post action=process.php input type=text name=comment / /form process.php: ?php echo $_POST['comment']; ? -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [SOLVED] $_POST trouble with html form
OK, this is what I've done and it seems to work: Paul Furman wrote: So maybe the better way is to just submit the form with the action file simply reloading the main page to refresh it then put my code below with an if statement checking if the form has been submitted yet and clearing $_POST when I'm done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I do this?
John Taylor-Johnston wrote: Can I include a script on another server doing this? $sql = 'SELECT * FROM '.$table.' where number like '.$number.';'; http://foo.com?list.php?number=16 include(http://elsewhere.com/list.php;); My $sql is error-ing - obviously. http://elsewhere.com/list.php is not receiving $number. Can I even do this? No, you cant. Even if you could, if the server where the include file is located runs PHP, the include file would run there, and you would end up including the output of it instead of the code. Why would you want to do that? Maybe what you really want to do dont need that... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] send script output to file
hi, i would like to send the output of a PHP script, to a file, and not to the browser. any ideas on how i can do this? tkx in advance, -- Herberto Graça. _ E-mail : [EMAIL PROTECTED] MSN : [EMAIL PROTECTED] HomePage : http://herbertograca.no-ip.org É devido à velocidade da luz ser mais rápida que a do som que certas pessoas parecem inteligentes antes de abrirem a boca! It's because the speed of light is greater than the speed of sound that some people look intelligent before they open their mouth! isik hizi ses hizindan fazla oldugundan, bazi insanlar agizlarini acmadan once zekiymis gibi gorunuyorlar! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to conver a string to float
Sebastian wrote: Is there a possibility to convert a string like 10*500 (parsed from a XML-File) to a float? When i try to store this String in a float variable it only coverts the 10 but nothing after the *-sign, but i need the result of this expresison... Is there a function to calculate such string expressions? Thanx... Using eval() can be dangerous If the source of the xml data is not trustworthy, validate the string with regex before eval()'ing it /^[^a-zA-Z]*$/ should be enough... That would refuse letters (simple (and maybe dumb) way to prevent function execution (but wouldnt prevent expression errors! just prevent people from breaking in through your eval!)) Note: you would also need to put 'return ' before and ';' after the string expression to eval ex: ? $expression = '10*500'; $expressionOK = preg_match ('/^[^A-Za-z]*$/', $expression); $result = ($expressionOK) ? eval('return '. $expression .';') : NULL; var_dump($result); ? Another more complex/slower, but maybe safer/elegant way, would be to parse the expression, piece by piece into a stack, and do the operations yourself -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send script output to file
Boneripper wrote: hi, i would like to send the output of a PHP script, to a file, and not to the browser. any ideas on how i can do this? tkx in advance, Use the manual, Luke. http://www.php.net/manual/en/ref.filesystem.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send script output to file
John Nichel wrote: Boneripper wrote: hi, i would like to send the output of a PHP script, to a file, and not to the browser. any ideas on how i can do this? tkx in advance, Use the manual, Luke. http://www.php.net/manual/en/ref.filesystem.php and: http://www.php.net/manual/en/ref.outcontrol.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Revised: RE: [PHP] Re: Can I do this?
Ok a couple of questions. I have include files that someone else is including from there server and he is unable to view the source code that he is utilizing in an include script. Of course this is running Apache and Unix with PHP 4.3.4. SO my questions are. 1 Are you testing or referring to this on a Windows server running IIS/Apache? 2 Are you referring to an older version of PHP? 3 Have you even tested what your saying? I am going to be running some more tests, but so far all of the testing that I have done running a http request is parsing the include files. I have even checked a broswser based ftp request and nothing shows for the php file. I'd be interested in hearing about you testing one of these ideas you have and posting a link so that we can see what you are talking about is actually working. -Original Message- From: Adam Bregenzer [mailto:[EMAIL PROTECTED] Sent: Sunday, February 08, 2004 11:49 AM To: Andrew Séguin Cc: PHP Email List; [EMAIL PROTECTED] Subject: Re: [PHP] Revised: RE: [PHP] Re: Can I do this? On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote: A test to confirm that, is to point the browser to the address being included. See the source? vulnerable. See the results? not vulnerable. If you do not see 'source' then what are you including? For example the following script could be included remotely: ?php echo EOF ?php \$sql = SELECT * FROM table WHERE id = $number; ? EOF; ? If you were able to do include the above source with: include(http://somewhere.com/file.php?number=123;); You could include and see php code. Not the original but something that is still useful. include() includes php code, if you can include a file from a remote source you can view it with a browser. What you say is true: See the source? vulnerable. See the results? not vulnerable. Of course if you can not see it you also can not include it remotely. As a side note it is safer to put includes outside the web path. An overflow or some other bug may be found that would bypass processing of .php files (or a different bug could be exploited to write a .htaccess file in that directory). If you have the option to move includes to a different directory it is more secure. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
Nope i see the server parsed output. Try loading the url directly in your browser!! what you see is what you get when you include. Adam Bregenzer wrote: On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote: A test to confirm that, is to point the browser to the address being included. See the source? vulnerable. See the results? not vulnerable. If you do not see 'source' then what are you including? For example the following script could be included remotely: ?php echo EOF ?php \$sql = SELECT * FROM table WHERE id = $number; ? EOF; ? If you were able to do include the above source with: include(http://somewhere.com/file.php?number=123;); You could include and see php code. Not the original but something that is still useful. include() includes php code, if you can include a file from a remote source you can view it with a browser. What you say is true: See the source? vulnerable. See the results? not vulnerable. Of course if you can not see it you also can not include it remotely. As a side note it is safer to put includes outside the web path. An overflow or some other bug may be found that would bypass processing of .php files (or a different bug could be exploited to write a .htaccess file in that directory). If you have the option to move includes to a different directory it is more secure. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Revised: RE: [PHP] Re: Can I do this?
On Sun, 2004-02-08 at 18:23, PHP Email List wrote: I am going to be running some more tests, but so far all of the testing that I have done running a http request is parsing the include files. I have even checked a broswser based ftp request and nothing shows for the php file. I'd be interested in hearing about you testing one of these ideas you have and posting a link so that we can see what you are talking about is actually working. I actually included a sample script in my last post. I think this may all be a communication problem. The original php is not included, but output is and there is nothing to prevent you from outputting php code from a php script. It was my understanding that this is what this thread was originally about: ?php echo EOF ?php \$sql = SELECT * FROM table WHERE id = $number; ? EOF; ? The bottom line is be careful with what you are including and where it comes from. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check for inactive sessions
Ok, I've developed a system that allows N number of users to log-in to my site under the same username/password combo. When a user logs-in, a flag is set marking that they have logged-in, their session id is stored and the current # of user's logged-in is iterated by one. If a user account has a maximum of 5 possible simultaneous user log-ins, the user stack will be full unless those users logout (which will reduce the stack by one), or their session expires. The problem being that I do not know how to check if a session is active, other than checking the current user session of course (not all session's currently associated with an account). I am storing all sessions associated with an account. Any ideas? Thanks in advance Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling php5 with gd-support
Hi php-general, I have continusously following error compiling php5 with gd-support: ext/gd/gd.lo: In function `zm_deactivate_gd': /usr/local/src/php-5.0.0b3/ext/gd/gd.c:445: undefined reference to `gdFreeFontCache' collect2: ld returned 1 exit status make: *** [sapi/cli/php] Fehler 1 Here is my config.nice: './configure' \ '--disable-libxml' \ '--with-apxs2=/usr/local/apache2/bin/apxs' \ '--with-config-file-path=/usr/local/etc' \ '--enable-magic-quotes' \ '--with-bcmath' \ '--enable-exif' \ '--enable-shared=max' \ '--enable-rule=SHARED_CORE' \ '--with-mysql=/usr/local/mysql' \ '--with-gd=/usr/local/include' \ '--enable-gd-native-ttf' \ '--with-jpeg-dir=/usr/lib' \ '--with-png-dir=/usr/lib' \ '--with-zlib-dir=/usr/include' \ without gd, I can compile, and it works. What I am also wondering is how I can disable freetype? I tried --without-freetype or --disable-freetype but that doesn't help. I have no freetype installed. Other thing, is that I have set --with-gd=/usr/local/include, but I had to put symbolic links to /usr/local/lib where the libgd.so and libgd.a are (from install). There is no way to enter both directories... And at last, why is the error related to /usr/local/src/php-5.0.0b3/ext/gd/gd.c:445? I entered /usr/local/include for gd and not the ext/gd/ directory? I just newly installed gd, newest release. I have Mandrake Linux 8.2. I would really appreciate help ;-) SvT -- Who is the ennemy? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [ERR] [PHP] compiling php5 with gd-support
Transmit Report: To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED]) ---BeginMessage--- Hi php-general, I have continusously following error compiling php5 with gd-support: ext/gd/gd.lo: In function `zm_deactivate_gd': /usr/local/src/php-5.0.0b3/ext/gd/gd.c:445: undefined reference to `gdFreeFontCache' collect2: ld returned 1 exit status make: *** [sapi/cli/php] Fehler 1 Here is my config.nice: './configure' \ '--disable-libxml' \ '--with-apxs2=/usr/local/apache2/bin/apxs' \ '--with-config-file-path=/usr/local/etc' \ '--enable-magic-quotes' \ '--with-bcmath' \ '--enable-exif' \ '--enable-shared=max' \ '--enable-rule=SHARED_CORE' \ '--with-mysql=/usr/local/mysql' \ '--with-gd=/usr/local/include' \ '--enable-gd-native-ttf' \ '--with-jpeg-dir=/usr/lib' \ '--with-png-dir=/usr/lib' \ '--with-zlib-dir=/usr/include' \ without gd, I can compile, and it works. What I am also wondering is how I can disable freetype? I tried --without-freetype or --disable-freetype but that doesn't help. I have no freetype installed. Other thing, is that I have set --with-gd=/usr/local/include, but I had to put symbolic links to /usr/local/lib where the libgd.so and libgd.a are (from install). There is no way to enter both directories... And at last, why is the error related to /usr/local/src/php-5.0.0b3/ext/gd/gd.c:445? I entered /usr/local/include for gd and not the ext/gd/ directory? I just newly installed gd, newest release. I have Mandrake Linux 8.2. I would really appreciate help ;-) SvT -- Who is the ennemy? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message---
Re: [PHP] Use a Server or Client Socket?
Hi, I need to be polling the connection constantly for new messages as well as have a check that the connection is on. These need to be done in one connection. That's where the headache comes in. In order to poll constantly, I placed the socket read in a while loop. Since the script is looping constantly there, I can't place the checking in the while loop. And I can't make a need connection to check if I am still login because the external server only allows one connection. Raditha Dissanayake wrote: Hi, If you only need to make a connection to the server every ten minutes you will be saving a lot of resources if you use a cron job to connect at intervals instead of keeping a permanently open connections. Creating a cron job is quite simple, if you type man 5 crontab you will be able to read more about it (at least in linux - a poor substitute exists in windows called scheduled tasks) With this approach you just need to call fsockopen to do connect to your server and do the needful. Tan Ai Leen wrote: Hi Raditha, Thanks, I have a better idea of how to write the codes. But I wonder, to check that the connection to the external server is on, where should I place the code? I need to do this every 10 minutes. If the connection is dropped, I have to reconnect. Where should I place this check? If I place it in the while(true) loop, I will be checking every few miliseconds rite? That will be too frequent. What about in another script? Will I be able to check that the connection is on? Regards, Ai Leen Raditha Dissanayake wrote: Hi Tan, If you are connecting to another server you are using a client socket you do not need to make a server socket. If you need to listen for connections make use of a server socket. To give you an example your browser makes use of client sockets while apache makes use of server sockets. That is an over simplified view of things but hope it helps you understand things better. Generally working with client sockets is easier. best regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese Language
Dear Mr. Ray, Before anything else, I would like to thank you for your repsonse. Anyway, as far as the MSWindows is concern, all the language, system and specification are all in Japanese System. And for the Database, here's the variables from the MySQL: | | language| /mysql/share/mysql/japanese/ | | | character_sets | latin1 big5 czech euc_kr gb2312 gbk sjis tis620 ujis dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257 latin5 | Hope to hear from you again Mr. Hunter regards, erwin --- Ray Hunter [EMAIL PROTECTED] wrote: On Thu, 2004-02-05 at 19:39, KidLat Ngayon wrote: my problem is the language from my database, they inputted some english and japanese language whenever i've open the file in staroffice, it can read the nihongo, however when i open it in microsoft office, it turns out that the nihongo are something like a garbage character. any suggestions would highly appreciated thanks and best regards Is your database set up to handle the lang type? Is excel set up with the lang type as well? -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: excel output question
- Original Message - From: Phillip Jackson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 4:37 AM Subject: Re: [PHP] Re: excel output question I would do it like this: $build = '%s','%s','%s','%s'\n; $build = sprintf($build,$field1,$field2,$field3,$fieldN); you could also try escaping the comma. if this doesn't work you can always just dump to html tables and save the file as *.xls (excel spreadsheet); excel understands html tables and simple markup as spreadsheet data. ie: html table tr tdfield1/tdtdfield2/tdtdfield3/tdtdfield4/td /tr tr tdvalue1/tdtdvalue2/tdtdvalue3/tdtdvalue4/td /tr /table /html ~phillip Jake McHenry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] - Original Message - From: Paul Furman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 1:56 AM Subject: [PHP] Re: excel output question Single quote everything should work. Jake McHenry wrote: Hi everyone. I'm outputing payroll information to an excel csv file, and when anyone get's paid over 1k, the amount is split into two fields because of the comma in the amount. Is there anyway I can tell excel that this particular comma is not a deliminator? Thanks, Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php like this? output = '$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',, ,,,'$sub401k ','$payrate','$gross5'\n; That just filled my spreadshit with quotes around everything... still the amounts larger than 1k are in 2 columns.. did I do something wrong? Thanks, Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This is in a simple while loop, data is coming from a mysql database. Creating a seperate function would too time consuming changing all of the existing code for what this page is doing. It orignally was in html form in an xls file, but when the file was opened, there were no cell borders anymore. If anyone can tell me how to turn on the cell boarders in an xls html outputted file, that would also work. This is the only reason I went back to a csv file. Thanks, Jake -- 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] julian date
Hello php-general, I wonder is there any class/function in php to convert from dates (dd/mm/ hh:mm:ss) to Julian date ? (I also wonder why there is no Julian date function in php function libraries ... i think it is nice to have Julian date ) thx -- Best regards, adwinwijaya mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 9 Feb 2004 05:32:10 -0000 Issue 2579
php-general Digest 9 Feb 2004 05:32:10 - Issue 2579 Topics (messages 177147 through 177182): Re: Question About Date Function in PHP/MySQL 177147 by: John W. Holmes 177153 by: Freedomware Re: .html or.php extension 177148 by: John Nichel 177149 by: Jason Wong 177150 by: Chris Garaffa 177151 by: Paul Furman 177152 by: John W. Holmes Re: Revised: RE: [PHP] Re: Can I do this? 177154 by: Adam Bregenzer 177173 by: PHP Email List 177174 by: Raditha Dissanayake 177175 by: Adam Bregenzer $_POST trouble with html form 177155 by: Paul Furman 177157 by: Paul Furman 177158 by: Adam Bregenzer 177159 by: Paul Furman 177160 by: Paul Furman 177162 by: Adam Bregenzer 177163 by: Paul Furman 177164 by: Paul Furman 177165 by: Adam Bregenzer Re: Can I do this? 177156 by: John Taylor-Johnston 177167 by: André Cerqueira 177168 by: André Cerqueira Re: mcrypt don't work. 177161 by: Adam Bregenzer Re: [SOLVED] $_POST trouble with html form 177166 by: Paul Furman send script output to file 177169 by: Boneripper 177171 by: John Nichel 177172 by: André Cerqueira Re: how to conver a string to float 177170 by: André Cerqueira check for inactive sessions 177176 by: news.php.net compiling php5 with gd-support 177177 by: Safran von Twesla [ERR] [PHP] compiling php5 with gd-support 177178 by: postmaster.hanmir.com Re: Use a Server or Client Socket? 177179 by: Tan Ai Leen Re: Japanese Language 177180 by: KidLat Ngayon Re: excel output question 177181 by: Jake McHenry julian date 177182 by: adwinwijaya Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Freedomware wrote: EMS lists the following: Short Date: M/d/ Long Date: , dd, Day followed by month, followed by another day, then year??? That format means something like Friday, May 5, 2004 I thought it was supposed to be year first, followed by month and day, as in the example from CSV table - 1905-09-01. Should I change Long Date so that it reads -MM-DD, or something like that? Yeah, I'd try switching possibly both the long and short dates to -MM-DD and see if it's imported correctly. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com ---End Message--- ---BeginMessage--- John W. Holmes wrote: Freedomware wrote: EMS lists the following: Short Date: M/d/ Long Date: , dd, Day followed by month, followed by another day, then year??? That format means something like Friday, May 5, 2004 I thought it was supposed to be year first, followed by month and day, as in the example from CSV table - 1905-09-01. Should I change Long Date so that it reads -MM-DD, or something like that? Yeah, I'd try switching possibly both the long and short dates to -MM-DD and see if it's imported correctly. OK, I'll add that to my experiments to do list. In the meantime, I imported all the dates as VARCHAR, then went into phpMyAdmin and changed it to DATE. It seems to work! Thanks again for the tips. Oh, one other thing... Do you know if dates can be sorted in various ways, either by absolute date or by month alone, date alone, etc.? I'm going to be making sortable columns (JavaScript or PHP), and I'm not yet sure what all you can do with dates. ---End Message--- ---BeginMessage--- E.H.Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? If you're using Apache, you can add .html to the list of file extensions php will parse. The other way around is ok: put HTML code in a .php file... Yes. You can also seperate html from php, and just include the html file in your php script. -- By-Tor.com It's all about the Rush http://www.by-tor.com ---End Message--- ---BeginMessage--- On Friday 06 February 2004 06:15, E.H.Terwiel wrote: My PHP system demands that files to be interpreted by PHP MUST have the .php extension. If I have an .html file with ?php ? in it, it won't interpret the PHP code. Unlike JavaScript, f.i. Is there a way to make the server do the PHP code anyway, in an HTML file ? Or must the action yes-php/no-php be taken before looking into the file ? If you're using Apache then you