Re: [PHP] RE: How do I prevent a session from rebuilding itself?
On 7/12/06, Daevid Vincent [EMAIL PROTECTED] wrote: I am thinking you are killing the first session, rming the files, then creating a new session. At the end of the page the data that was in memory is getting written to the new session file. Yes. That's what is happening as I said. I don't want it to re-write. Just to be clear, what exactly are you trying to do? Are you trying to kill a session, as in log a person off? Then do so within PHP: [code] // set $_SESSION to empty array $_SESSION = array(); // if saving session in cookie, clear that out too if(isset($_COOKIE[session_name()])) { setcookie(session_name(),'',time() - 4800,'/'); } // destroy session completely session_destroy(); [/code] HTH, John W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_search and in_array
Hi everyone. I´m facing a big trouble that a don understand why is it happenin. I´ve got an array with 1046 elements in it like this. Here is a part of a print_r of my array. Array ( [0] = 0001-01 [1] = 0003-01 [2] = 0140-01 [3] = 0141-01 [4] = 0142-01 [5] = 0170-03 [6] = 0181-01 [7] = 0182-04 [8] = 0186-06 [9] = 0186-08 [10] = 0550-01 [11] = 0720-01 [12] = 0730-01 [13] = 0740-01 [14] = 0750-01 [15] = 1311-07 [16] = 1316-01 [17] = 1316-02 [18] = 1316-03 [19] = 278980198657138 [20] = 278980198657139 [21] = 278980198657141 [22] = 278980198657142... I get some data from mysql and try to use both functions that´s in the subject to test if the code returned by database is in array, but it isn´t working. By a for i pass by each register returned by database and print the code and if it´s in my array, something like this: for($y=0; $y$con-count;$y++){ $con-Seek($y); echo $con-result['cod_loja']. - .(array_search($con-result['cod_loja'],$_SESSION[cod_loja])?Found:Not found).br; } Here is a part of result of the code above: 0003-01 - Not found 0140-01 - Not found 0141-01 - Not found 0142-01 - Not found 0170-03 - Not found 0181-01 - Not found 0182-04 - Not found 0186-06 - Not found 0186-08 - Not found 0550-01 - Not found Notice that the code 0003-01 is one code that is in my arrasy, but the function do not found it. Could anyone help me in this, please? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD to database directly
[snip] How much of a performance hit? [/snip] Here is an interesting read; http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database .html Your system receives a number of file read requests, requesting it to load a number of blocks from the disk into the mysqld process. Eventually, the blocks show up in the buffer cache, and mysqld is woken up, receiving file data for the read requests. But I will say this, in this day and age there may not be the performance hit that we had in days gone by due to improvements in software and hardware, so I may have misspoken. I do believe in a one for one comparison where we use PHP and the file system or PHP and MySQL on the same box that, however minimal, there will be a difference favoring the file system using the same images. I also believe that these methods should be compared to using MySQL to hold data about the image so that the benchmarks could be run like this; PHP + File System PHP + MySQL (where MySQL stores a BLOB) PHP + MySQL (data only) + File System The reason for the last one is that is the likely way these technologies would be used together. I spend a lot of time utilizing the MySQL command line and other similar query analysis tools for MS-SQL and Oracle. Image BLOBs become more of a hindrance than a help at this level because these tools are not designed to properly parse and display the files. This is important because it adds to my bias against storing images in a database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array_search and in_array
I found the trouble. The content of array had length of 20 and the database didn´t; Excuse me. João Cândido de Souza Neto [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi everyone. I´m facing a big trouble that a don understand why is it happenin. I´ve got an array with 1046 elements in it like this. Here is a part of a print_r of my array. Array ( [0] = 0001-01 [1] = 0003-01 [2] = 0140-01 [3] = 0141-01 [4] = 0142-01 [5] = 0170-03 [6] = 0181-01 [7] = 0182-04 [8] = 0186-06 [9] = 0186-08 [10] = 0550-01 [11] = 0720-01 [12] = 0730-01 [13] = 0740-01 [14] = 0750-01 [15] = 1311-07 [16] = 1316-01 [17] = 1316-02 [18] = 1316-03 [19] = 278980198657138 [20] = 278980198657139 [21] = 278980198657141 [22] = 278980198657142... I get some data from mysql and try to use both functions that´s in the subject to test if the code returned by database is in array, but it isn´t working. By a for i pass by each register returned by database and print the code and if it´s in my array, something like this: for($y=0; $y$con-count;$y++){ $con-Seek($y); echo $con-result['cod_loja']. - .(array_search($con-result['cod_loja'],$_SESSION[cod_loja])?Found:Not found).br; } Here is a part of result of the code above: 0003-01 - Not found 0140-01 - Not found 0141-01 - Not found 0142-01 - Not found 0170-03 - Not found 0181-01 - Not found 0182-04 - Not found 0186-06 - Not found 0186-08 - Not found 0550-01 - Not found Notice that the code 0003-01 is one code that is in my arrasy, but the function do not found it. Could anyone help me in this, please? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD to database directly
On 7/11/06, Adam Zey [EMAIL PROTECTED] wrote: The time taken per request, though (and that's about all we can get with a concurrency as low as 5) doesn't tell us much. We also don't know exactly what the PHP code is doing, how it does it, how your database is organized/indexed/accessed, if you have any PHP accelerators installed (Normally the PHP script would be reconverted to bytecode every execution), etc. Additionally, your test isn't really MySQL versus filesystem, it's PHP+MySQL versus filesystem. Perhaps a more useful comparison would be PHP+Filesystem versus PHP+MySQL. As in, the same PHP script for both benchmarks, except one copy uses file_get_contents and echo (Closer match than readfile, since MySQL would require loading the file into memory) and the other uses MySQL. This would be a closer match that would tell us how much latency is induced by the actual database itself rather than PHP and loading stuff into memory. Regards, Adam. I was just running a simple test based on how I work with images. I usually upload one, resize it on the fly, and save a new image which I directly link to. Therefore I don't need anything to read and send a raw image through PHP. If you think that is a valid test, then perhaps you should use your own time to achive your adequate benchmark. As for my script: ?php $link = mysql_connect('localhost', 'test', 'test') or die('unable to connect'); mysql_select_db('test') or die('unable to select'); $sql = SELECT imagedata FROM images WHERE id = 1; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); header('Content-Type: image/jpeg'); echo $row['imagedata']; There is an auto inc primary on the id column. I have APC disabled during this test so that isn't a problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5....
Thanks guys, Will contact the admin and see what can be done, your replies really helped me and I appreciate it. Cheers! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scrubbing URL's
Dear All, I have 150,000 + URLS I need to validate. When I say validate, I mean I would like to verify the URL opens up a web page that returns a '200' and not a '404'. I was thinking of first verifying the host has a DNS A record by using checkdnsrr(). Then using CURL to check server response. Does any one know of a function or class that already does this? Your thoughts would be greatly appreciated. TIA! -- Paul Nowosielski Webmaster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] order/reorder pull out data from arrays
At 10:01 PM +0200 7/11/06, Jochem Maas wrote: Anyway I can do that? as many as there ways to skin a cat probably :-) Yeah, but the cat ain't going to like any of them -- Jeff Foxworthy :-) tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ftp_put()'ing a string ...
Jake Gardner wrote: An intriguing method, but then it is the only answer I can think of (when I see it above) to what you must admit is a rather odd question... what is it that you consider odd? I have a generated string containing XML and I want it to end up on a remote server as a file - it would be easy enough to write the string into a tmp file in order to transfer that but I thought it would be nice to not have to make the extra hit to the filesystem to get the job done. I think I have figured out how to get some useful error messages using the 'notification' streams context parameter (using it to set a callback that traps notifications including error messages); nonetheless... if it is only the FILE writing that you care about without using ftp functions, one (not the most efficient way, but who gives a crap about a few seconds these days in a language like PHP?) use the ftp functions to test everything up to the write (connect, login, change directory, do everything right up to writing and then plug in your lines) not only inefficient but wrong: it would possibly result in a duplicate connection (which the ftp server may not allow) and if you closed the first connection first then you still have no garantee that the second connection via the streams wrapper actually did it's job. anyway thanks for the feedback. On 7/11/06, *Jochem Maas* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Jochem Maas wrote: hi everyone, I was wondering if anyone knew how (if possible) I could take a string and ftp_put()/ftp_fput() that string directly onto the remote server as a file (without first saving the string to disk temporarily locally) I imagine that there is a way to create a stream that refers to the string in question but I can't get my head round the streams functionality... Obviously saving the string temporarily to disk locally is an easy option but I was kind of using the situation I have now to try and do something a little fancy and learn something about streams. anyone with idea/pointers? I stumbled accross the following page while RTFMing: http://php.net/manual/en/wrappers.ftp.php very nice, it enabled me the come up wth the following to lines (nice and compact!): $context = stream_context_create(array('ftp' = array('overwrite' = true))); $retval = file_put_contents(ftp://{$ftp_user}:[EMAIL PROTECTED]:21/{$filename}, $xml, LOCK_EX, $context); BUT this leaves me with the problem of determining what went wrong if the file_put_contents() call fails. did the connection fail? did the login fail? did the write/upload fail (and why)? using the std. ftp functions it's [obviously] alot easier to determine at which point the failure occured. can anyone confirm I'm on the right track by trying to set 'notification' [stream]context parameter? TIA, Jochem. -- 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] [ANNOUNCE] dumpster :: dumps out all related records in a mySQL InnoDB database
Hey all. Well I just finished my first version of a little tool I have affectionately dubbed dumpster. I do use my own SQL wrapper functions, but they should map fairly cleanly to a search and replace for the stock PHP mysql_*() ones, or your own ones. Mad props to Peter Brawley [EMAIL PROTECTED] for the initial SQL statement to get the FK constraints. If someone can point me at how to get the information I need to fix that bug, that'd be swell. ÐÆ5ÏÐ (I posted this to both the [php-general] and [php-db] lists, mostly b/c it seems the [php-db] list is pretty dead and the majority of people hang out on this one... Sorry if this irks any of you -- I know how uppity some of ya'll get ;-p ) -- This script attempts to generate all the SQL statements needed to archive a snapshot of a single 'thing'. For example, it can harvest all records related to a given user. (This only works for InnoDB tables that utilize proper FK constraints) Usage: ./dumpster.php --database mydb --table users --id 1 [--delete] user_1.sql Then later simply mysql --force -u root mydb user_1.sql to put the 'user' back --help, -help, -h, or -? options, to get this help. --databasethe name of the database to use. --table the name of the table to use in the database --id the ID that joins all these tables together in the database --FKonly only show the Foreign Key list and exit. --debug to turn on output debugging. --version to return the version of this file. --delete deletes the record as it is output (in 'debug' mode this outputs only, no action). KNOWN ISSUE: if a column is defined as ON DELETE SET NULL, then there's a better than average chance that it might get NULL'd by a DELETE before it, therefore we won't be able to clean up some records properly as their FK ID is now NULL. catch22. :-| There is probably a way to find out which FKs have this particular constraint action and then we could save off their PK in an array and loop through them at the end I think? http://daevid.com/examples/dumpster.tgz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB Create Table help - using Pear DB
Scott Heinrichs wrote: Hello all, This is the first time I have posted an issue to this forum, so please excuse in noob questions or statement. I am trying to create a table from a string that created by a DESCRIBE TABLE query... this is the generated string: CREATE TABLE 'users' ( 'username' varchar(120) NOT NULL primary key, 'password' varchar(64) NOT NULL, 'level' int(11) NOT NULL DEFAULT '0' ) then I use the statement: $db is a PEAR DB object that has been set up with my database access info and connects to MYSQL. $stmt = above create string. $db-query ( $stmt ); for some reason it is not creating the desired table. Im sure the $db object has some error related methods that will give some information as to the problem. some ideas: 1. your using transaction and not commiting after the query 2. the user you connect as doesn't have 'create table' permissions 3. $stmt doesn't contain what you think it does. 4. the SQL is invalid (doesn't look like it though.) no.2 seems most likely. Can anyone give me a solution or a reason why the above situation would not work. Just to clarify that my Database info is correct I was able to generate the create string from a DESCRIBE TABLE query so the connection works and is valid and I have CREATE rights. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_put()'ing a string ...
hi everyone, I was wondering if anyone knew how (if possible) I could take a string and ftp_put()/ftp_fput() that string directly onto the remote server as a file (without first saving the string to disk temporarily locally) I imagine that there is a way to create a stream that refers to the string in question but I can't get my head round the streams functionality... Obviously saving the string temporarily to disk locally is an easy option but I was kind of using the situation I have now to try and do something a little fancy and learn something about streams. anyone with idea/pointers? TIA, Jochem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Message-ID showing up in html emails outlook
Dear All, I'm composing a HTML email. When I send it out it looks fine in all clients except outlook which shows the Message-ID. Heres the basic code: $html=htmlbodyimg src=\http://celebrityaccess.com/images/marketing/ca_july_advert.jpg\;/body/html; $recip = [EMAIL PROTECTED]; $subject = My Subject; $body = $html; $to = $recip; $headers = 'From:[EMAIL PROTECTED] ' . \r\n . 'Reply-To:[EMAIL PROTECTED] ' . \r\n .'Content-type: text/html;' . \r\n . 'MIME-Version: 1.0'.\r\n; mail($to,$subject,$body,$headers); Any thoughts? -- Paul Nowosielski Webmaster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple sessions
Hi. Is there a way to have multiple sessions open in one browser (specifically, Firefox or Safari)? For example, IE does not transfer session data from one window to another, however, Firefox does. So, if one user opens a session and then his/her friend wants to open a different session of that same program on the same computer, (s)he is not able to without overwriting the first session data. I have thought of one solution, but have yet to test it. Upon the first user logging in, I could assign them as session ID (along with the one that PHP creates). I could then verify that ID is being used on each page. For the second user, I could create a different one and do the same as the first. ? // User 1 $_SESSION[my_special_id] = abcd; // created upon logging in if ($_SESSION[is_logged_in] $_SESSION[my_special_id] == $_GET[my_special_id]) { // do stuff } ? ? // User 2 in a different window of Firefox $_SESSION[my_special_id] = efgh; // created upon logging in if ($_SESSION[is_logged_in] $_SESSION[my_special_id] == $_GET[my_special_id]) { // do stuff } ? Notice that they both share the same is_logged_in variable, but a different my_special_id variable. Actually, I just noticed something. If User 1 logs out and kills is_logged_in, that would also kill it for User 2. I don't know. I've confused myself now. Any suggestions? Common practices? Thanks in advance, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Debugging Log
What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? Mike -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? http://php.net/syslog or use a file. There are also various JS-based solutions floating around. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtTvgP9na3/DT5jQRAoD1AJ9CJDHTpgTJ6e+Kact0bIarlKYXPwCgs2QB raWCYaDcLjfwWG3dTCsnhH8= =4ozG -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Debugging Log
http://pear.php.net/package/Log/ works well for me. Supports writing messages to files, to a separate window via JavaScript, probably syslog as well as a few others. -Original Message- From: Michael B Allen [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 2:02 PM To: php-general@lists.php.net Subject: [PHP] Debugging Log What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? Mike -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple sessions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philip Thompson wrote: Is there a way to have multiple sessions open in one browser (specifically, Firefox or Safari)? For example, IE does not transfer session data from one window to another, however, Firefox does. So, if Not strictly true. It's actually based on instances. Firefox differs from IE because if you start a new Firefox instance it joins the existing instance if it exists. IE does not do this. To get the 'shared' session in IE open a new window from the existing window instead of starting a new copy of IE. one user opens a session and then his/her friend wants to open a different session of that same program on the same computer, (s)he is not able to without overwriting the first session data. I have thought of one solution, but have yet to test it. Upon the first user logging in, I could assign them as session ID (along with the one that PHP creates). I could then verify that ID is being used on each page. For the second user, I could create a different one and do the same as the first. ? // User 1 $_SESSION[my_special_id] = abcd; // created upon logging in if ($_SESSION[is_logged_in] $_SESSION[my_special_id] == $_GET[my_special_id]) { // do stuff } ? ? // User 2 in a different window of Firefox $_SESSION[my_special_id] = efgh; // created upon logging in if ($_SESSION[is_logged_in] $_SESSION[my_special_id] == $_GET[my_special_id]) { // do stuff } ? Notice that they both share the same is_logged_in variable, but a different my_special_id variable. Actually, I just noticed something. If User 1 logs out and kills is_logged_in, that would also kill it for User 2. I'm confused as to why you need a solution to this 'problem'. How likely is it that you'll have 2 users trying to access your site on the same machine at the same time? If it is likely (although I don't see how) then you need to design your session data as an array keyed on the username, but that would be very insecure. In short are you trying to solve a perceived problem when no such problem actually exists? Think about it for a while before jumping to working around it. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtT0dP9na3/DT5jQRAmUmAJ0XzG3ukmU4q6e7f6S1OrTtZ65M9QCfRbuj NSa/LAreelZGRLGysXGFMsU= =pzC4 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
I wrote my own, very simple, very easy. I think the code is in the archive somewhere. Otheres have written similar functions. CODE +++ function logError ($logentry, $lgname) { // simple function to log errors to text/log file. $logfile = @fopen ($lgname, a+); if (!$logfile) { echo (\n\n ERROR: Failed to open $lgname\n\n); } else { fwrite ($logfile, [.date (D M d Y h:i:s).] [$logentry]\n); fclose ($logfile); } } where you want to log logError($username.' has successfully logged in.','account.log'); CODE +++ Lately I have been using the syslog from php. On 7/12/06, KermodeBear [EMAIL PROTECTED] wrote: http://pear.php.net/package/Log/ works well for me. Supports writing messages to files, to a separate window via JavaScript, probably syslog as well as a few others. -Original Message- From: Michael B Allen [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 2:02 PM To: php-general@lists.php.net Subject: [PHP] Debugging Log What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? Mike -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? there is also error_log() (and the 'error_log' ini setting) - I abuse it for debugging now and again. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Language Translation and PHP...
Anyone know of any language translation APIs or anything of that sort out there? Looking to translate quite a bit of content and would rather not do it by hand.
Re: [PHP] Multiple sessions
Stut wrote: I'm confused as to why you need a solution to this 'problem'. How likely is it that you'll have 2 users trying to access your site on the same machine at the same time? If it is likely (although I don't see how) then you need to design your session data as an array keyed on the username, but that would be very insecure. In short are you trying to solve a perceived problem when no such problem actually exists? Think about it for a while before jumping to working around it. There are times when it's handy, but not often. For example, when I'm debugging my code it is useful to be able to log into my application's admin module (which uses sessions to ensure admin rights) without blowing away my user session. In my case, I flick between Firefox and Konqueror. It would be nice to be able to separate the sessions generally though. The case where you have several accounts is just one example. Regards, Austin. signature.asc Description: OpenPGP digital signature
[PHP] setting column width
I am using the Spreadsheet Excel Writer tool to export a php generated page to an Excel Spreadsheet. The information is being generated properly but the display is not functioning as I would like. The column headers are not automatically setting the width of the column as I was expecting. I have googled for this information but I have not been able to find an answer. I'm beginning to think that it is not possible. Before I go on to something else I thought I would ask the group. Is there a way to set the column width using the writer tool? Also, is there a way of putting a break in the column headers? For example I want... Total Amount to look like... Total Amount Thanks for any help Jef
Re: [PHP] Language Translation and PHP...
At 2:09 PM -0400 7/12/06, Russell Jones wrote: Anyone know of any language translation APIs or anything of that sort out there? Looking to translate quite a bit of content and would rather not do it by hand. I'm not sure as to what you want, but perhaps this might help: http://www.weberdev.com/get_example-4049.html hth's tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
Ahh yes I do that as well, I knew there was another other then syslog. On 7/12/06, Jochem Maas [EMAIL PROTECTED] wrote: Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? there is also error_log() (and the 'error_log' ini setting) - I abuse it for debugging now and again. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Language Translation and PHP...
Hello, on 07/12/2006 03:09 PM Russell Jones said the following: Anyone know of any language translation APIs or anything of that sort out there? Looking to translate quite a bit of content and would rather not do it by hand. Here you may find several classes that use remote translation Web services like Altavista, Google, etc.. http://www.phpclasses.org/browse/class/5/top/rated.html -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Proper configuration of safe mode
Hi, I'd like to enable safe mode in my current setup but it seems that I am doing something wrong. I have configure a webmail (IMP) and I can access my messages fine but when I try to send a new one I get error message in my log Jul 12 15:00:44 HORDE [error] [imp] sendmail [/var/www/phpexecdir/sendmail] is not a valid file [on line 1042 of /var/www/html/horde/imp/compose.php] My webserver configuration Directory /var/www/html/horde/ php_admin_flag safe_mode On php_admin_value upload_tmp_dir /var/www/html/horde/tmp php_admin_value safe_mode_include_dir /usr/share/pear:/var/www/html/horde/ php_admin_value open_basedir .:/usr/share/pear:/var/www/html/horde/ php_admin_value safe_mode_exec_dir /var/www/phpexecdir/ /Directory I have copied sendmail from it's original location to this new one. Any tips?
Re: [PHP] Debugging Log
On Wed, 12 Jul 2006 19:13:53 +0100 Stut [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? http://php.net/syslog or use a file. There are also various JS-based solutions floating around. I don't think I want to write boring CC failures to syslog. And error_log doesn't write a timestamp. But I guess this isn't rocket surgery. I think I can figure out how to maybe prefix error_log entries with a TS. Thanks, Mike -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setting column width
I did some more googling and found some information on setColumn(). Thanks for your responses. Jef -Original Message- From: Jef Sullivan [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 12:57 PM To: php-general@lists.php.net Subject: [PHP] setting column width I am using the Spreadsheet Excel Writer tool to export a php generated page to an Excel Spreadsheet. The information is being generated properly but the display is not functioning as I would like. The column headers are not automatically setting the width of the column as I was expecting. I have googled for this information but I have not been able to find an answer. I'm beginning to think that it is not possible. Before I go on to something else I thought I would ask the group. Is there a way to set the column width using the writer tool? Also, is there a way of putting a break in the column headers? For example I want... Total Amount to look like... Total Amount Thanks for any help Jef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple sessions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Austin Denyer wrote: Stut wrote: I'm confused as to why you need a solution to this 'problem'. How likely is it that you'll have 2 users trying to access your site on the same machine at the same time? If it is likely (although I don't see how) then you need to design your session data as an array keyed on the username, but that would be very insecure. In short are you trying to solve a perceived problem when no such problem actually exists? Think about it for a while before jumping to working around it. There are times when it's handy, but not often. For example, when I'm debugging my code it is useful to be able to log into my application's admin module (which uses sessions to ensure admin rights) without blowing away my user session. In my case, I flick between Firefox and Konqueror. I do this by giving the admin session a custom name. That way it doesn't trample over the user session. It would be nice to be able to separate the sessions generally though. The case where you have several accounts is just one example. If this is the case you want to handle then having a single session var which is an array of arrays of session vars keyed on the username will solve this problem, but it's your choice to needlessly over-complicate the situation. Personally I think it's reasonable to expect people to log out of one account before they can log in with another. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtVdO2WdB7L+YMm4RAntrAKDQoIdN8uTr3WSQygxPvq7zE+a5AACgzWEr BL/5GBUoopy+RNY6Emq7BLQ= =okNy -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael B Allen wrote: On Wed, 12 Jul 2006 19:13:53 +0100 Stut [EMAIL PROTECTED] wrote: Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? http://php.net/syslog or use a file. There are also various JS-based solutions floating around. I don't think I want to write boring CC failures to syslog. And error_log doesn't write a timestamp. But I guess this isn't rocket surgery. I think I can figure out how to maybe prefix error_log entries with a TS. So polluting the PHP error log is better than directing it to a log file via the syslog facility? Your choice, but remember that syslog is much more than just one log. If that's a revelation to you I suggest some RTFM is needed before dismissing the option. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtVfr2WdB7L+YMm4RAqEiAKCf/w6MIaT8e7r72uOjjaMgpF+JUACfauxm u3AaddpReuPabSvWPxmHlms= =PHUz -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Proper configuration of safe mode
mbneto wrote: Hi, I'd like to enable safe mode in my current setup but it seems that I am doing something wrong. have a look at the open_base_dir ini setting. IIRC safe_mode is being depreciated and will eventually be phased out. I have configure a webmail (IMP) and I can access my messages fine but when I try to send a new one I get error message in my log Jul 12 15:00:44 HORDE [error] [imp] sendmail [/var/www/phpexecdir/sendmail] is not a valid file [on line 1042 of /var/www/html/horde/imp/compose.php] My webserver configuration Directory /var/www/html/horde/ php_admin_flag safe_mode On php_admin_value upload_tmp_dir /var/www/html/horde/tmp php_admin_value safe_mode_include_dir /usr/share/pear:/var/www/html/horde/ php_admin_value open_basedir .:/usr/share/pear:/var/www/html/horde/ php_admin_value safe_mode_exec_dir /var/www/phpexecdir/ /Directory I have copied sendmail from it's original location to this new one. Any tips? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I prevent a session from rebuilding itself?
I would expect that if I 'rm -rf /tmp/sess_*' that the user would get prompted to re-login (since the flag is not set). Does it say someplace in the manual that you should be able to do that? Or is this a case of what you expect is not what the rest of the world expects? This is how it used to work. I know this, because (as mentioned in other email), we have a custom bug tracker and people were being randomly logged out it seemed. Well turns out a cronjob was periodically deleting all the sess_ files. Basically all I want is that if the sess_ file is gone, then PHP should NOT create a new one. It should only save it's memory out to the same sess_ file with the same session ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Searching and storing results index in cookies or session variables
Hello, I have a question about how I am searching through a products database. What I am wanting to do is store the result set so that I can provide a link to go back to previous searches quickly, and also manipulate it quickly. If I had a flat catalog of pages I could index the content in a few tables and go with that, but I want the results to be customizable, and more flexible than ten links to ten items on ten different pages. I want the results delivered and recombined in one page. Currently what I am doing is the following: 1. I open an SQL statement with delimiters 2. I circulate through the entries and append to a array called $pageset both the item number and a ranking based on keywords etc. 3. I sort the array by relevance ranking 4. I figure out what my limit and offset are in my array and paginate based on user input. 5. I grab the 20 or so array elements within the range and create a new array called $display set. 6. For each of the current page items I pull the full item details from the database and propagate the array to my html template I wonder if instead of propagating the $pageset (results index) array every time I could store the $pageset array as a cookie or session variable. It is a small array with a few hundred elements and rankings, but if I could store it, I wouldn't have to build the array and do a relevancy sort every time I paginate to the next page. I would just take the current stored search array which is already sorted, and grab element x through element y. Would this be an efficient way using a session variable? Does anybody else handle search results in a similar way? -Brian Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: How do I prevent a session from rebuilding itself?
Just to be clear, what exactly are you trying to do? Are you trying to logout a user No. We write enterprise level software probably far surpassing what PHP was ever intended for. However, our GUI is web based (LAMP). We have fail over cluster nodes. If a user is logged into one via a virtual IP, the browser sees it as transparent. When a node fails, it fails over fine (again, the browser still sees the same VIP). But the sess_ file is not on the new node -- by design. We purposely don't copy the /tmp/sess_ files. What we want is, since the session is gone, that $_SESSION['login'] is (in theory) missing/false [although it seems that PHP RAM takes precedence over HD now and this didn't used to be the case] that the user should be re-prompted to login. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB Create Table help - using Pear DB
Scott Heinrichs wrote: Hello all, This is the first time I have posted an issue to this forum, so please excuse in noob questions or statement. I am trying to create a table from a string that created by a DESCRIBE TABLE query... this is the generated string: CREATE TABLE 'users' ( 'username' varchar(120) NOT NULL primary key, 'password' varchar(64) NOT NULL, 'level' int(11) NOT NULL DEFAULT '0' ) then I use the statement: $db is a PEAR DB object that has been set up with my database access info and connects to MYSQL. $stmt = above create string. $db-query ( $stmt ); for some reason it is not creating the desired table. Can anyone give me a solution or a reason why the above situation would not work. Just to clarify that my Database info is correct I was able to generate the create string from a DESCRIBE TABLE query so the connection works and is valid and I have CREATE rights. is an error being generated? if so what does it say? -- life is a game... so have fun. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I prevent a session from rebuilding itself?
On Tue, July 11, 2006 4:27 pm, Daevid Vincent wrote: I've noticed a 'feature' that seems to be causing me some pain. When a user logs in, we store various pieces of info and their user class in a $_SESSION variables. This includes a flag saying that they've ben authenticated. I would expect that if I 'rm -rf /tmp/sess_*' that the user would get prompted to re-login (since the flag is not set). However what actually happens, is that PHP silently just re-creates the session with a new unique identifier but with all the same data in it. GRRR. How can I force this to NOT happen (either via php.ini or via some function or directive call in each page load)? Sequence of events: script starts you rm -rf /tmp/sess_* script writes out data script ends Exactly WHAT do you think should happen in this case?... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
On Wed, 12 Jul 2006 21:13:31 +0100 Stut [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael B Allen wrote: On Wed, 12 Jul 2006 19:13:53 +0100 Stut [EMAIL PROTECTED] wrote: Michael B Allen wrote: What is the standard method of logging debug info? Should I just fopen a file for append and write the message or is there a facility provided? http://php.net/syslog or use a file. There are also various JS-based solutions floating around. I don't think I want to write boring CC failures to syslog. And error_log doesn't write a timestamp. But I guess this isn't rocket surgery. I think I can figure out how to maybe prefix error_log entries with a TS. So polluting the PHP error log is better than directing it to a log file via the syslog facility? Your choice, but remember that syslog is much more than just one log. If that's a revelation to you I suggest some RTFM is needed before dismissing the option. Thanks for the tip dipshit. -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: How do I prevent a session from rebuilding itself?
Daevid Vincent wrote: Just to be clear, what exactly are you trying to do? Are you trying to logout a user No. We write enterprise level software probably far surpassing what PHP was ever intended for. hmm. However, our GUI is web based (LAMP). so the GUI uses php but the rest doesn't? kind of nullifies the statement aboveif thats the case. We have fail over cluster nodes. If a user is logged into one via a virtual IP, the browser sees it as transparent. When a node fails, it fails over fine (again, the browser still sees the same VIP). But the sess_ file is not on the new node -- by design. We purposely don't copy the /tmp/sess_ files. What we want is, since the session is gone, that $_SESSION['login'] is (in theory) missing/false [although it seems that PHP RAM takes precedence over HD now and this didn't used to be the case] that the user should be re-prompted to login. so the user is prompted to login in again if a cluster node he happened to be talking to fails whats the point of the transparency then? I really don't care if my browsers sees the IP consistently - I'd rather just stay logged in. have you considered that your enterprise level software might require a custom session handler (see http://php.net/manual/en/function.session-set-save-handler.php) maybe some kind of mysql cluster running a master-slave config? which would potentially give you real transparency in case of a failed node. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Proper configuration of safe mode
Hi Jochem, Thanks for the reply. What is wrong with my openbase_dir setting? (yes I've already read the manual - http://www.php.net/manual/en/features.safe-mode.php - before posting my first message). Since safe mode will be deprecated what is (will be) the alternative? On 7/12/06, Jochem Maas [EMAIL PROTECTED] wrote: mbneto wrote: Hi, I'd like to enable safe mode in my current setup but it seems that I am doing something wrong. have a look at the open_base_dir ini setting. IIRC safe_mode is being depreciated and will eventually be phased out. I have configure a webmail (IMP) and I can access my messages fine but when I try to send a new one I get error message in my log Jul 12 15:00:44 HORDE [error] [imp] sendmail [/var/www/phpexecdir/sendmail] is not a valid file [on line 1042 of /var/www/html/horde/imp/compose.php] My webserver configuration Directory /var/www/html/horde/ php_admin_flag safe_mode On php_admin_value upload_tmp_dir /var/www/html/horde/tmp php_admin_value safe_mode_include_dir /usr/share/pear:/var/www/html/horde/ php_admin_value open_basedir .:/usr/share/pear:/var/www/html/horde/ php_admin_value safe_mode_exec_dir /var/www/phpexecdir/ /Directory I have copied sendmail from it's original location to this new one. Any tips?
Re: [PHP] Startinga shell process with a life of its own
Oh yeah, you can maintain progressive status on multiple tasks in all the cron jobs/dbs, and then make pretty graphs for the user to look at as they check back in to see how far along things are. I do that a lot -- A few minutes of coding for eye candy for the suits does wonders sometimes... Plus, it provides and easy way for you to make sure that the cron jobs are actually running and doing something. On Tue, July 11, 2006 10:06 am, John Gunther wrote: Great approach! Slicker'n snot. I added one enhancement: The shell script writss progress info to the database which the trigger page displays on entry. Richard Lynch wrote: I would recommend, however, that you re-structure things slightly so that the Architecture is more like this: User visits web page. Page generates a database record of what needs to be done. Page finished. CRON JOB: Look in task list of what needs doing, and do some of them. Make sure only one job is done at a time, or whatever race conditions are handled here. I've done projects both ways, and always end up frustrated with the PHP attempts to background a process and the Task List + Cron always works out far far better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
On Tue, July 11, 2006 2:24 am, Roman Rumisek wrote: I am using apache 2.0.50 and php 4.4.3RC2 as mod (on Mandrake 10.1). When I run this script: ? echo $previous; ? in cli php, i give 'Undefined variable' error message - OK. But under apache, this variable has value 'N'. Is it error ? I found nothing about $previous variable in php.ini and php config directories. My first guess would be that you have register_globals set to ON in Apache, and $previous is set in Cookies or Get data. It's also possible that you have managed to do this in some setup with session.auto_start and where $_SESSION['previous'] is set to N Having register_globals set to ON is probably a Bad Idea for various reason. Using short tags (? instead of ?php) is also a Bad Idea. Finally, echo $previous; is silly, as the quote marks serve no purpose at all. echo $previous; would be better. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
On Wednesday 12 July 2006 14:31, Richard Lynch wrote: On Tue, July 11, 2006 2:24 am, Roman Rumisek wrote: I am using apache 2.0.50 and php 4.4.3RC2 as mod (on Mandrake 10.1). When I run this script: ? echo $previous; ? in cli php, i give 'Undefined variable' error message - OK. But under apache, this variable has value 'N'. Is it error ? I found nothing about $previous variable in php.ini and php config directories. My first guess would be that you have register_globals set to ON in Apache, and $previous is set in Cookies or Get data. It's also possible that you have managed to do this in some setup with session.auto_start and where $_SESSION['previous'] is set to N Having register_globals set to ON is probably a Bad Idea for various reason. Using short tags (? instead of ?php) is also a Bad Idea. Finally, echo $previous; is silly, as the quote marks serve no purpose at all. echo $previous; would be better. -- Like Music? http://l-i-e.com/artists.htm A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. Ray -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $previous variable ?
[snip] A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. [/snip] Two words, XML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael B Allen wrote: Thanks for the tip dipshit. Maybe I'm in a sensitive mood, but that was uncalled for. Michael, meet /dev/null, I hope you live happily ever after. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtW032WdB7L+YMm4RAgAfAJ9hHl56og8T0ut0wjnbNq6C1GM7WgCeIIlU Kiko9JIADAOO07l0/vS6qaY= =6Fs+ -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
On 12/07/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. [/snip] Two words, XML. Yep, they can interfere with xml processing, and they also make your code less portable, as they may not be enabled in another environment. If you are sure your code is never going to move or be mixed with xml, by all means use them, but why not get into good habits? -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
RE: [PHP] $previous variable ?
[snippage] [snip] A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. [/snip] Two words, XML. Yep, they can interfere with xml processing, and they also make your code less portable, as they may not be enabled in another environment. If you are sure your code is never going to move or be mixed with xml, by all means use them, but why not get into good habits? [/snippage] That is more than two words but spot on even if sent as HTML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Startinga shell process with a life of its own
On Wed, 2006-07-12 at 17:26, Richard Lynch wrote: Oh yeah, you can maintain progressive status on multiple tasks in all the cron jobs/dbs, and then make pretty graphs for the user to look at as they check back in to see how far along things are. I do that a lot -- A few minutes of coding for eye candy for the suits does wonders sometimes... Ajaxify the updates so they don't need to reload the page. Suits LOVE to see that something is happening without them needing to do anything :) Cheers, Rob. Plus, it provides and easy way for you to make sure that the cron jobs are actually running and doing something. On Tue, July 11, 2006 10:06 am, John Gunther wrote: Great approach! Slicker'n snot. I added one enhancement: The shell script writss progress info to the database which the trigger page displays on entry. Richard Lynch wrote: I would recommend, however, that you re-structure things slightly so that the Architecture is more like this: User visits web page. Page generates a database record of what needs to be done. Page finished. CRON JOB: Look in task list of what needs doing, and do some of them. Make sure only one job is done at a time, or whatever race conditions are handled here. I've done projects both ways, and always end up frustrated with the PHP attempts to background a process and the Task List + Cron always works out far far better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
[snip] Yep, they can interfere with xml processing, and they also make your code less portable, as they may not be enabled in another environment. If you are sure your code is never going to move or be mixed with xml, by all means use them, but why not get into good habits? [/snip] Good points. Thanks. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Proper configuration of safe mode
mbneto wrote: Hi Jochem, Thanks for the reply. What is wrong with my openbase_dir setting? I have no idea if there is anything wrong with it - I just missed that you had it at all! (yes I've already read the manual - http://www.php.net/manual/en/features.safe-mode.php http://www.php.net/manual/en/features.safe-mode.php - before posting my first message). Since safe mode will be deprecated what is (will be) the alternative? none (it disappears in php6) - well using CGI/fastCGI and running as the specific user in question is one way (I guess) but I have no experience using them. you will still have: open_basedir disable_functions disable_classes but read this page (again) http://php.net/features.safe-mode, the first paragraph explains why php shouldn't be doing the job safe_mode *tries* to tackle. ask yourself the question as to why you want/need safe_mode. you may be an ISP in which case there is probably good reason to wANt to use it, but realise safe_mode is not designed to protect the server from the outside world but to protect the servers' users from each other. On 7/12/06, *Jochem Maas* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: mbneto wrote: Hi, I'd like to enable safe mode in my current setup but it seems that I am doing something wrong. have a look at the open_base_dir ini setting. IIRC safe_mode is being depreciated and will eventually be phased out. I have configure a webmail (IMP) and I can access my messages fine but when I try to send a new one I get error message in my log Jul 12 15:00:44 HORDE [error] [imp] sendmail [/var/www/phpexecdir/sendmail] is not a valid file [on line 1042 of /var/www/html/horde/imp/compose.php] My webserver configuration Directory /var/www/html/horde/ php_admin_flag safe_mode On php_admin_value upload_tmp_dir /var/www/html/horde/tmp php_admin_value safe_mode_include_dir /usr/share/pear:/var/www/html/horde/ php_admin_value open_basedir .:/usr/share/pear:/var/www/html/horde/ php_admin_value safe_mode_exec_dir /var/www/phpexecdir/ /Directory I have copied sendmail from it's original location to this new one. Any tips? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where is phpinfo getting this?
On Mon, July 10, 2006 8:17 am, Robert Hicks wrote: include_path .;C:\php5\pear .;C:\php5\pear I have PHP5 sure but it is in C:\PHP. I have looked in my ENV and I have scoured the registry and nothing comes up for php5. So where is it getting this entry? Either from php.ini, the location of which in in your phpinfo() output, or, if there *IS* no php.ini file in that location, PHP uses whatever defaults where compiled in by whomever compiled your PHP binary. It's also remotely possible that you are using Apache 2 and/or PHP 5 which conspire with a directive in httpd.conf to change your php.ini location through Apache -- Which presumably would be output in phpinfo() still, but I've never played with it... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
At 2:40 PM -0700 7/12/06, Ray Hauge wrote: On Wednesday 12 July 2006 14:31, Richard Lynch wrote: Using short tags (? instead of ?php) is also a Bad Idea. Finally, echo $previous; is silly, as the quote marks serve no purpose at all. echo $previous; would be better. -- Like Music? http://l-i-e.com/artists.htm A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. Ray I read that as well -- it has been widely published. If you want to write code that will co-exist with xml then you MAY have problems because xml MAY use that tag as well. Of course you can turn off that in the php.ini file with short_open_tag directive, but it's simpler to just use the formal ?php. Besides, the formal version is better than using script language=php... code... /script. tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible IE problem
On Mon, July 10, 2006 10:55 am, Schalk wrote: Now that the parse error is fixed the login script works fine in FF but in IE it does not do the redirect. Is there a reason why this code may not work in IE? Is there a better way to do this? $_SESSION['email'] = $email; $_SESSION['memberpassword'] = md5($memberpassword); header(Location: http://demo.bdiverse.com/accessible/admin/listmypages.php;); exit; Bad News: Your sessions are using Cookies, unless you've turned on trans_sid and the SID is in the URL. The browsers are getting two headers: Cookie: php_session_id somevalue Location: http://demo.bdiverse.com/accessible/admin/listmypages.php Some browsers, as soon as they see the Location: header, will *IGNORE* the Cookie headers, and just do the re-direct. Using header(Location:) is prone to all kinds of problems... If this is on your own server, just do: include 'accessible/admin/listmypages.php'; exit; -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
On Wed, 12 Jul 2006 22:44:23 +0100 Stut [EMAIL PROTECTED] wrote: Michael B Allen wrote: Thanks for the tip dipshit. Maybe I'm in a sensitive mood, but that was uncalled for. Michael, meet /dev/null, I hope you live happily ever after. Oh, no. What am I going to do now? You're like The Man on this list. I'll never figure out how to write to a logfile now. I might as well just give up and use VB or something. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD to database directly
On Tue, July 11, 2006 1:48 am, Kevin Waterson wrote: This one time, at band camp, Austin Denyer [EMAIL PROTECTED] wrote: It is generally accepted that storing things like that in a database is a Bad Thing. Much better to store the images as files and store the path in the database. Storing paths and databases in slower than just storing images in the db or simnply storing them on the server. You are making a db request and a file system request. Rather than a single request to the db. What is a file system if not a database? Operating System File System: A highly-optimized well-tested database for large-sized binary data. Or... What is a database if not a file system? :-) You really need to TEST your assumption about the DB being faster. Where do you think the DB gets the humongous chunk of binary data? You think it's magic? No. It's coming FROM THE FILE SYSTEM. Ultimately, the hard drive is still getting pounded just as hard, by most DBs for most images, if you cram the image into the DB, because the chunk of data is: A) too large to be in RAM, and B) stored as a 'BLOB', which in most DBs, means it's stuck into a separate file, or at least into a separate offset within a monster file, which means the hard drive still has to do a seek to get to it. So, really, you're not saving anything, on MOST hardware setups, *unless* the images are all very very very tiny. If you've benchmarked on YOUR hardware and have a proven savings, fine, post your tests and output. If you have no benchmarks, I suggest you do that before you claim it's faster :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $previous variable ?
On Wed, July 12, 2006 5:18 pm, tedd wrote: At 2:40 PM -0700 7/12/06, Ray Hauge wrote: On Wednesday 12 July 2006 14:31, Richard Lynch wrote: Using short tags (? instead of ?php) is also a Bad Idea. Finally, echo $previous; is silly, as the quote marks serve no purpose at all. echo $previous; would be better. -- Like Music? http://l-i-e.com/artists.htm A bit off topic, but I hadn't heard about short tags being a bad idea. What reasons make short tags worse than the regular tags. Just curious. Well, if your code has to run on a server where short tags is off... The other reason I say that they are bad is that they're getting eliminated in PHP6, according to the roadmap, I *think*... You'll have to confirm that for yourself, mind you. -- 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] When is a global not a global?
hi all, After upgrading a CMS, im having a problem with global variables not showing up anymore -- configs and things could have changed, but search as i have, i cannot find anything to help me work out what the problem is. This should work of course: $foo = 'bar'; function foobar() { global $foo; print( -- . $foo); exit; } foobar(); It prints *nothing*. Does anyone have an idea as to what might stop this from functioning as expected? -- Nick Wilson http://performancing.com/user/1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: How do I prevent a session from rebuilding itself?
We write enterprise level software probably far surpassing what PHP was ever intended for. However, our GUI is web based (LAMP). so the GUI uses php but the rest doesn't? kind of nullifies the statement aboveif thats the case. Not really. We use DBUS calls to Ruby and C/C++ code. We manipulate networks. TCP/IP. UDP. LDAP. Iptables. Etc. We use RDBMS tricks to transfer data. SOAP. XML. And all sorts of other tactics to work around the limitations of PHP5. But that is all besides the point. We have fail over cluster nodes. If a user is logged into one via a virtual IP, the browser sees it as transparent. When a node fails, it fails over fine (again, the browser still sees the same VIP). But the sess_ file is not on the new node -- by design. We purposely don't copy the /tmp/sess_ files. What we want is, since the session is gone, that $_SESSION['login'] is (in theory) missing/false [although it seems that PHP RAM takes precedence over HD now and this didn't used to be the case] that the user should be re-prompted to login. so the user is prompted to login in again if a cluster node he happened to be talking to fails whats the point of the transparency then? I really don't care if my browsers sees the IP consistently - I'd rather just stay logged in. Because. That's also irrelevent. And for the record. They DO stay logged in. That's the whole problem I'm trying to get around! For various reasons beyond the scope of this discussion (some related to security), We wish for the user to re-authenticate. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Log
Michael B Allen wrote: On Wed, 12 Jul 2006 22:44:23 +0100 Stut [EMAIL PROTECTED] wrote: Michael B Allen wrote: Thanks for the tip dipshit. Maybe I'm in a sensitive mood, but that was uncalled for. Michael, meet /dev/null, I hope you live happily ever after. Oh, no. What am I going to do now? You're like The Man on this list. I'll never figure out how to write to a logfile now. I might as well just give up and use VB or something. please do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When is a global not a global?
On Wed, 2006-07-12 at 18:52, Nick Wilson wrote: hi all, After upgrading a CMS, im having a problem with global variables not showing up anymore -- configs and things could have changed, but search as i have, i cannot find anything to help me work out what the problem is. This should work of course: $foo = 'bar'; function foobar() { global $foo; print( -- . $foo); exit; } foobar(); It prints *nothing*. Does anyone have an idea as to what might stop this from functioning as expected? The above code is probably being included, and probably being included by a function and so $foo does not have global scope. To ensure global scope: ?php $GLOBALS['foo'] = 'bar'; function foobar() { global $foo; print( -- . $foo ); exit; } foobar(); ? Try that and let us know what happend. 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
RE: [PHP] How do I prevent a session from rebuilding itself?
Sequence of events: script starts you rm -rf /tmp/sess_* script writes out data script ends Exactly WHAT do you think should happen in this case?... I expect this to work like it USED TO WORK! Bug or not. I expect: Script starts Calls session_start(1234) No existing sess_1234 file. Creates a new EMPTY sess_1234 I make $_SESSION['authorized'] = true and PHP writes at that time I rm /tmp/sess_1234 Script ends Page load again. Calls session_start(1234). No existing sess_1234 file. Creates a new EMPTY sess_1234 Therefore $_SESSION['authorized'] doesn't exist == false But what happens is that PHP actually is writing a new sess_1234 WITH ALL THE SHIT IT HAD IN RAM *sigh* Why is this so complicated for anyone to understand? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is you IP ?
I want to filter IP addresses. I noticed that my script catches IP addresses that looks like they came from the internal LAN, ie 192.x.x.x and 10.x.x.x My script catched those IPs by $_SERVER['REMOTE_ADDR']. Am I not being able to catch IPs from transparent proxies that a user's ISP might use? Would $_SERVER['HTTP_X_FORWARDED_FOR'] be better ? Reasons ? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php