[PHP] Re: Form variables not passing: globals IS on
Monday, August 12, 2002, 4:57:36 AM, Petre wrote: PA> to the default php.ini, and have checked it and register_global = On PHP settings can be altered outside of php.ini (using Apache .htaccess files for example) Add this line to page2.php to see the run-time setting: echo " register_globals is : ".ini_get('register_globals'); Something might be wrong with your PHP install if it's a recent version and $_POST isn't there.. Try print_r($_POST); PA> echo " HTTP_POST_VARS :".$_HTTP_POST_VARS["test"].""; The deprecated POST array is $HTTP_POST_VARS (no preceding underscore). Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] massive find/replace on MySQL db
Hello, I've inherited a MySQL db (4MB on disk) that's riddled with inconsistent storage of character entities from being pasted from Word. At very least I hope to convert all quotes "‘" - "”" to HTML's """ and "'". I imagine I'll run a big query, save the id's needing edit in a file than have a script hit all those, pulling text/varchar fields, using strtr() to make changes and updating. I suppose I could have the script just do the 1st 10 in the file, remove those from the file, then I'd recall the script. I imagine this might take 10/20 minutes. Am I missing some internal MySQL feature that would do this? Hmm, what about running strtr() on a mysqldump-ed file? Any advice/links appreciated. Please CC me. Thanks a lot! Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] massive find/replace on MySQL db
Saturday, June 15, 2002, 11:11:49 AM, Julie wrote: JM> update tablename set fieldwithcrap = replace(fieldwithcrap, JM> 'oldstring', 'newstring'); Julie, lovely solution and shockingly fast. Thanks. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CGI / Apache module session permissions
Hello, To perform a certain task I have to run one of my PHP scripts as a CGI, which works fine except that the CGI doesn't have permissions to my sessions that were saved running under the Apache module. I expected different permissions, but I thought my user would have /more/ permission to those files than the PHP user since they're saved under my account.. Since I'm moving the user to a secure server with this script I want to start a new session anyway, but I at least need to read in the old session. ideas anyone? I do pass the script the SID so could I manually change the permissions on the session file? Any advice on transfering a session variable to a 2nd session? Thanks for any help.. Please CC me as I'm on digest.. Running Linux, shared-hosting :( Apache module: PHP 4.1.2 CGI module: PHP 4.0.6 :( Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: CGI / Apache module session permissions
Saturday, May 18, 2002, 1:05:30 PM, I wrote: SC> CGI, which works fine except that the CGI doesn't have permissions to SC> my sessions that were saved running under the Apache module. I Figured it out: from Apache mod script before CGI script: //allow CGI to access session $sess_file = session_save_path()."/sess_".session_id(); chmod($sess_file,0666); Sorry for the noise.. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] win32: migrating PWS to Apache
Hello, On winNT I have Personal Web Server, PHP4.1.1, MySQL. My target is Apache1.3, PHP4.2.2, Perl, MySQL. Should I uninstall both PHP and PWS then install Apache, then PHP? Would it be easier to uninstall mySQL and use a package like PHPtriad than to set up Apache & PHP seperately? A package of Apache, PHP and Perl for win32 would be ideal for me. Know of one? What kind of problems would I expect by choosing Apache2.0? This is for development so I like that I can bind Apache to 127.0.0.1 and have several virtual hosts.. I'm on digest so please, CC me. Thanks for any advice. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 'Pure' php vs 'mixed' (html + php)
Sunday, June 02, 2002, 7:55:09 PM, Andre wrote: AD> I've been wondering why code in 'pure' php? Is there some compelling reason AD> (that I'm unaware of) for doing so? Should I rewrite all my earlier code into Andre, Sorry to chime in so late, but IMO, be more concerned with saving output for the last step in execution, because once it's echoed out, there's no turning back or sending headers or a redirect.. Have functions return strings instead of echo them (and take advantage of "<<<" syntax for more readable string building), build up a document into variables, send out at very end. Some home-grown example code might be useful: connect()) { $Template["main_content"] = join('',file("DB_down_message.html",1)); include("main_template.php"); exit(0); } // build result table HTML $result_table = open_result_table(); $dbi->run_query("SELECT .."); while ($row = $dbi->next_row_array()) { $result_table .= << {$row["guns"]} {$row["butter"]} EOD; } $result_table .= "\n"; // load results content $results_copy = join('',file("about_results.html",1)); $Template["main_content"] .= <Point is, at any point in execution cookies or headers can be sent or content changed. You end up with most content in seperate files and script logic/execution very easy to understand/debug. Stick a "watch" echo anywhere in the code and it pops up at the top of the browser window. For the above code, main_template.php is a full HTML document (only HTML editor needed) with PHP tags in just a few spots to echo elements of the $Template array: Bogdan wrote: > There's an urban legend saying that switching php tags on and off would > slow parsing down. Content outside PHP tags gets to skip the parser. From the manual: "..for outputting large blocks of text, dropping out of PHP parsing mode is generally more efficient than sending all of the text through echo() or print() or somesuch." Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for modifiable web administration script for MySQL
On another note, Are there any open-source/freeware PHP scripts that have the functionality of PHPMyAdmin, but modifiable for my custom tables/needs? The admin script I could write at this point would be an inferior web interface for our MySQL DB (only 2 tables), so I'd rather save time and just alter existing, well-crafted code and stick this on our secure server. How easy would it be to alter PHPMyAdmin itself? Thanks for any insight.. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions not so secure..solution?
Hello, I'm building an e-commerce site which uses sessions to hold my $cart object. This works great but I've two worries: 1) When the user connects through our secure hostname, can I ensure the browser will send the server the cookie (w/ SESSID)? The user will shop through domain.com and checkout via https:secure.domain.com. (haven't got cert yet) 2) While the user shops the SESSID is thrown around insecurely (no big deal, just a cart). But when I move the user to a secure server to get sensitive info a resourceful hacker could also go to the checkout script using this SESSID and 'confirm' the real user's personal details (kept in another registered session object). If I can't keep the user's details in the old session, can I delete the old session and copy the cart to a new session? Should I do this anytime the user goes back to the insecure site and returns to finish checking out? As an alternative, would there be any problems with keeping the IP of the user in a session variable for further authentication? I assume I'd record the IP immediately upon checking in at the secure server then enforcing this per request. That way, worst case scenario the hackers gets a SESSID and heads to checkout first, server restricts real user from accessing (because of different IP). This is my first time coding for a secure server and my first post here as well.. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Anybody have a function to encode a string?
Tuesday, March 19, 2002, 2:51:33 PM, Alexander wrote: AS> Well, use GnuPG. Then you can use "PGP". And what you stated above is Just some advice if you go with GPG and you don't have root/chown access. Since you'll create your keyring under your user, you'll likely have to run PHP as a CGI so that it has access to your keyrings and can use a temp file. You might get around this by making your keyrings group-readable (for the PHP-user), but obviously w/ that *any* PHP user on your server could potentially access your private key. Then again, if you only need to /send/ encrypted messages and you don't include the server's key in the recipient list, it's no big deal because the worst they could do is send messages to people signed as your server. They couldn't get the data. In windows I found the easiest way to decode GPG-ed email from the server was to install PGP6.5, the Bat! email client and generate a key w/o using the IDEA algorithm. Import this pub key into GPG on the server. There are GPG tools for windows but I found Win mail clients still don't support GPG anywhere near as much as PGP. The Bat! can use GPG to decrypt fine, but you have to enter your username and passphrase for EVERY message. The Bat!s PGP plugin allows uid/passphrase cacheing for a specified period of time, which was enough for me to switch. A snippet of the code I'm using to encrypt: //this already has the plaintext message $plainfile = "/home/me/.gnupg/temp/".$this->hash.'plain'; //this will be created having the encrypted version $gpgedfile = "/home/me/.gnupg/temp/".$this->hash.'gpg'; //shell command to call gpg $command = "gpg -e -q --no-secmem-warning "; //encrypt for my array of recipients foreach ($this->recipients as $recipient) { $command .= "-r '$recipient' "; } //target will be ascii-armored and stderr sent to stdout $command .= "-ao '$gpgedfile' '$plainfile' 2>&1"; //environment variable for GPG putenv("GNUPGHOME=/home/me/.gnupg"); //execute command $this->error = exec($command); //check error / read in $gpgedfile, unlink the files.. Hope this helps.. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eating mySQL result rows 1 by 1.. a better way?
Hello, On my site I paginate query results by limiting rows output to a value, say LIMIT, and then the 2nd, 3rd pages run the same query with $skip=LIMIT, $skip=(LIMIT*2) value posted back. I use the following code to "skip" these result rows, which is just fetching the next row to an unused array. //if there are rows to skip if ($result_rows > $rows_to_skip) { while ( $rows_to_skip ) { // eat a row mysql_fetch_array($result); $rows_to_skip--; $total_results_shown++; } } Can I make this more efficient? Is there a way to eliminate this data before it leaves the mySQL server (and would it be faster)? If it makes any difference the average result row is probably around 40-50 bytes but some of these queries can return up to 850 rows.. Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RC4Crypt encryption opinions
Maxwell, I tried it out. The sample test crashed the PHP 4.0.5 CGI binary everytime on my winNT system. No script has ever /crashed/ the executable before, just might be worth note. Steve Friday, March 22, 2002, 12:45:11 AM, . wrote: > I'm looking for opinions on RC4Crypt -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] semi-OT: moving PWS to Apache on NT
Hello, I run Personal Web Server on NT just for local testing but I'm considering installing Apache. Would this allow me to run mod_php instead of the CGI? Ideally I'd like to configure Apache so that only local requests are served - Is this easily done? Anyone on NT/win2k have anything good to say about the v2.0 betas? Steve -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Code Bulk
GS> echo 'Finished'; ?>> I can do one better: ... ?>Finishedhttp://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Comparrison
Ron, You probably want strstr(). or stristr(). Just as a usability recommendation on you code below, please don't restrict your pages to IE only.. This would be better: if (!strstr($HTTP_USER_AGENT,"MSIE 5.5") { print "Please note this page has functionality designed for IE5.5"; } Users of perfectly good browsers like Mozilla, Opera, and IE5/mac won't be locked out. Steve Wednesday, March 27, 2002, 7:46:12 AM, Ron wrote: R> How would I compare to variables where I would want one variable to equal R> only part or some of the other variable? R> Here is the code R> if ($HTTP_USER_AGENT !== "%MSIE 5.5%") { R> print "You must upgrade your browser"; R> } else { R> exit; R> } ?>> R> Any suggestions -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions/Cookies and HTTP Auth
Just as a note, recent builds of Mozilla have a cookie manager that is the best for seeing exactly what's going on with your cookies. You can list by name or host and see all the properties of each. Know when your session cookies are sent/deleted, know if PHP is allowing use of the same SESSID in a new session.. BTW the rest of the browser is tops as well. As for David's post, keep in mind PHP won't generate an error if a cookie isn't accepted. I bet when cookies are turned off in some browsers, the browser may "accept" it but throw it away. Like junk mail. Could be wrong about this though.. Steve Wednesday, March 27, 2002, 10:10:19 PM, David wrote: DM> 3. I am thinking that I should get an error because I presume that DM> session_start() will attempt to set a cookie (which it appears to do). DM> (I tried setcookie() too and the cookie was accepted.) -- [EMAIL PROTECTED] ** http://mrclay.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Best way to do this: www.domain.com?page=var
Monday, January 16, 2006, 5:14:49 PM, tg-php wrote: > Should just be a matter of adding "start.php" to your defaults list in > whatever priority order you want. Apache's .htaccess: DirectoryIndex start.php index.php index.html In start.php: // instead of redirecting, just set page if (!isset($_GET['page'])) { $_GET['page'] = 'home'; } If, for some reason you /can't/ change the directory index page, make an index.php with this: // again, no redirect necessary $_GET['page'] = 'home'; require('start.php'); Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Best way to do this: www.domain.com?page=var
Tuesday, January 17, 2006, 10:54:21 AM, [EMAIL PROTECTED] wrote: > If you can't set a new 'default page' on your server, using a > header('Location: ...') will simulate the same thing. Not really. Sending a "Location:" header says, "this page is temporarily moved" and the browser has to send a 2nd request for the new location. Whether redirecting via PHP (header), javascript or meta-refresh, these all needlessly force the browser to ask for the page twice, and potentially cause bookmarking/spidering issues when used for the home page. Amazon does this and it's annoying; some browsers just will not "remember" the plain old "http://amazon.com/"; that you typed in because only a redirect lives there. With a proper server config, the contents of start.php would be immediately sent to the browser. This is good. But if you can't set this on the server, this simple PHP script (index.php) does the same thing: Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Validating Radio Buttons in two directions
Tuesday, January 17, 2006, 11:33:18 PM, HiFi Tubes wrote: > Thanks to all of you who responded. Yes, I am doing the grid --basically > 100 radio buttons, that is ten comments that must be ranked from 1 to 10. Ugh. If you absolutely can't use Javascript, here's an idea: Present this question by itself as two lists: on top an unordered list of options, on bottom an ordered list (initially empty). Each item will have a set of links (icons maybe) to place this item next (if in the top list) or move up/down or remove the item (if in the ordered list). The user would click the links to move around the choices until he/she is ready to submit that question: add items: _eggs_ , _milk_ 1 candy _remove_ 2 3 -- 1 candy _remove_ _down_ 2 eggs _remove_ _up_ _down_ 3 milk _remove_ _up_ The nice thing is, each page you generate would be a valid response so you, nor the user, has to worry about, eg. submitting two items in 3rd place. It would also be /much/ simpler for the user to rearrange items since he/she no longer has the burden of renumbering each choice. You could potentially add Javascript onto this setup so that the movement would be updated purely on the page or with only a minimal XMLHTTPRequest call. Another idea: just require Javascript and save yourself reinventing the wheel. http://www.phpsurveyor.org/index.php is a mature survey system with ranking question types and nice data export options. Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can PHP works with telnet?
Sunday, January 22, 2006, 8:56:01 PM, HoWang wrote: > software. I have made a quick search on php.net but I can't found amy > extension support telnet. Is there any way to do so? Or it is impossible Try http://www.geckotribe.com/php-telnet/ which uses fsockopen [1]. CURL [2] /claims/ telnet support, but this post [3] leads me to believe it's pretty limited. [1] http://us2.php.net/function.fsockopen [2] http://us2.php.net/curl [3] http://curl.haxx.se/mail/lib-2005-09/0013.html Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] XML and special characters
Sunday, January 22, 2006, 10:10:54 PM, Adam Hubscher wrote: > ee dee da da da? §ð <-- those that look like html entities are > the represented characters. I was mistaken, they are html entities, Can you show us a small chunk of this XML that throws errors? You said you've tried various parsers. Did none of those parsers have error logging capabilities? Show us the errors. Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Re: Managing sessions...
Monday, January 23, 2006, 5:06:02 AM, David BERCOT wrote: > But, I have just another question about all the options I have to put in > this file... Is it necessary to do all of this (sorry for my Check phpinfo(). Several of those settings may already be set by your server's php.ini file. Generally, using ini_set() should be a last resort because, once PHP is running, it's too late to change certain settings. http://php.net/manual/en/configuration.changes.php Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM saveHTML() not outputting XHTML Strict
Monday, January 23, 2006, 1:35:13 PM, Chris wrote: > the ->saveHTML() method ... outputs as `` > I need my output HTML to conform to XHTML strict. Since XHTML is XML, try ->saveXML()? Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please Help!
Wednesday, January 25, 2006, 2:52:21 PM, S Yang wrote: > Which method might I use to split the signature I have built in PHP into > (r,s)? How can I know what the signature looks like? Run the function http://us2.php.net/openssl_sign and pass it a $signature. According to the manual, if successful, $signature will be altered. You tell /us/ what it looks like and we'll help you split it. ;) Steve -- http://mrclay.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php