RE: [PHP-DB] Register Globals Question
It is deprecated as it creates a massive security hole. However, all you have to do is change the setting in your php.ini file. Set register_globals=On. That's all. However, for all code you write from now on you should use $_POST, $_GET and the like. Read this article. http://www.zend.com/zend/art/art-sweat4.php ~ Matthew -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 6:34 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Register Globals Question I was recently told this: register_globals is a deprecated function due to security problems. It will NOT be available in the next version of PHP. As a result, the recommended way to access is with $_REQUEST[HTTP_USER_AGENT] instead. This is a joke right? I've got thousands of lines of code that rely on the availability of $HTTP_USER_AGENT. I've been doing it that way since 1998... It's not like the PHP guys to release new versions that are incompatible with the old ones. Please tell me this is not for real. Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] installing to connect to a remote database server
I'm not actually running PostgreSQL so it's setup could be different that MySQL. But if you want to install PHP with MySQL support and the database isn't running locally you just do '--with-mysql' in the configure statement. It'll give you a warning saying that its not suggested to do this, but from what I can tell nothing goes wrong. So for PostgreSQL you just need to do the same thing. ./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql --enable-track-vars Give it a shot. ~ Matthew -Original Message- From: Brian Noecker [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 9:08 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] installing to connect to a remote database server Newbie here. I need to install php with postgres support. Problem is I need to have it connect to a non-local database. Now, the pgconnect function seems to allow for that, but the install wants local files. Can someone point me in the right direction here? Thanks, Brian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mySQL settings
As Joni said you need to read about the GRANT functions in the MySQL manual. But basically here's what's happening. Each person your hosting has a specific login/pass into the database. When they login MySQL looks in the 'MySQL' database and checks the users privileges. By default Ensim sets up the database so that only the website associated with a specific DB can access it. So you'll need to make changes to the user's account (in MySQL) with a GRANT statement allowing him to have access to another specific database. Make sure you don't GRANT him access to everything, as that is naturally a massive security hole. ~ Matthew -Original Message- From: Georgie Casey [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 9:55 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mySQL settings rite, i run a web server and sell space to workers. my admin setup apache, mysql and php with all the settings. each customers gets one sql db with a host acc. the system runs ensim. but now i want one of my accounts do be able to access the database of another, but it wont let me. what setting do i change to allow me do this? -- Regards, Georgie Casey [EMAIL PROTECTED] *** http://www.filmfind.tv Online Film Production Directory *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] installing to connect to a remote database server
...listen to Ramsus =) ~Matthew -Original Message- From: Brian Noecker [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 9:08 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] installing to connect to a remote database server Newbie here. I need to install php with postgres support. Problem is I need to have it connect to a non-local database. Now, the pgconnect function seems to allow for that, but the install wants local files. Can someone point me in the right direction here? Thanks, Brian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database abstraction layer needed?
What's your current website? Why do you think you need one? ~MET -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 3:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Database abstraction layer needed? I'm redoing my web site, and I'm considering using a db abstraction layer. Would I need one, and should it be db-type specific (like, can just do one db type)? I don't plan to change database types. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Upgrading PHP
Don't forget to make register_globals equal to on instead of off. Well, actually this is just a security/preference issue. Prior to PHP 4.2.0 globals were default to on, but now they're default to off meaning that you have to use _GET['query_string_value'] instead of just $query_string_value. You can read about this all over php.net in the changelogs. ~ Matthew -Original Message- From: Adam Williams [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 3:52 PM To: Julio Cuz, Jr. Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Upgrading PHP I should add if you are going to upgrade apache also, to rpm -e apache first so that You will have a clean install. backup httpd.conf first though! But you might want to save /etc/logrotate.d/httpd because the rpm -e removed this, and it is what rotates the log files for /var/log/httpd/access_log and error_log Adam On Wed, 14 Aug 2002, Julio Cuz, Jr. wrote: Hi-- I'm currently running 4.0.4pl1 on RedHat 7.0 and I want to upgrade to PHP 4.2.2is there anything special I have to do BEFORE or AFTER the install? Or is it just a straight re-install of PHP on top of the current Version? THANKS! Julio Cuz, Jr. [EMAIL PROTECTED] Information Services Riverside Community College -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Supplied argument is not a valid MySQL result resource
I'm getting some massive errors on some pretty simple code. Included are the errors as well as the PHP function that is giving me issues. Any help would be greatly appreciated. And the weirdest thing, is that the code used to work ?? Line 267 is equal to this PHP line: $RSM = mysql_fetch_array($resultm); = ERRORS: = Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 267 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 269 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 287 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 289 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 295 Warning: Supplied argument is not a valid MySQL result resource in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 297 less than one inside of nothing found. Warning: Undefined index: format in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 327 Warning: Undefined index: bannerID in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: bannerID in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: width in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: height in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 Warning: Undefined index: alt in D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333 = CODE: = function view_order($keywords, $id) { global $phpAds_db, $phpAds_hostname, $phpAds_mysqluser, $phpAds_mysqlpassword, $REMOTE_HOST, $USER, $phpAds_tbl_banners; if(!isset($USER[$id][cbannerID])) $USER[$id][cbannerID] = -1; # $text = explode(/, $keywords); $keywords = ; $x = 0; foreach($text as $line) { if( $x == 0 ) { $keywords = (keyword LIKE '% . $line . %'; } else { $keywords = $keywords . OR keyword LIKE '% . $line . %'; } $x++; } $keywords .= ); # mysql_connect($phpAds_hostname,$phpAds_mysqluser,$phpAds_mysqlpassword) or die(Unable to connect to database); mysql_select_db($phpAds_db) or die(Unable to select database $phpAds_db); if($USER[$id][cbannerID] == -1) { $sqlm = SELECT MIN(bannerID), MAX(bannerID) FROM banners WHERE active='true';; $resultm = mysql_query($sqlm); $RSM = mysql_fetch_array($resultm); if( mysql_num_rows($resultm) 1 ) { $num1 = rand(1, 100); } Else { $num1 = rand($RSM[0], $RSM[1]); } $sql = SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords AND bannerID = $num1 ORDER BY bannerID LIMIT 0,1;; } else { $sql = SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords AND bannerID . $USER[$id][cbannerID] . ORDER BY bannerID LIMIT 0,1;; } $result = mysql_query($sql); $RS = mysql_fetch_array($result); if( mysql_num_rows($result) 1 ) { $sql2 = SELECT bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners WHERE active = 'true' AND $keywords ORDER BY bannerID LIMIT 0,1;; $result2 = mysql_query($sql2); $RS2 = mysql_fetch_array($result2); if( mysql_num_rows($result2) 1 ) { echo less than one inside of nothing found.; } Else { $USER[$id][bannerID] = $RS2[bannerID]; $USER[$id][banner] = $RS2[banner]; $USER[$id][format] = $RS2[format]; $USER[$id][width] = $RS2[width]; $USER[$id][height] = $RS2[height]; $USER[$id][alt] = $RS2[alt]; $USER[$id][url] = $RS2[url]; $USER[$id][cbannerID] = $RS2[bannerID]; }
[PHP-DB] Variables Not Staying Set
...slightly in regards to my last email. I have a database query which requires a variable ( $USER[$id][cbannerID] ) to be equal to the ID of the current banner being viewed. If you've come to the page for the first time my script gives that variable a default value of -1 . if(!isset($USER[$id][cbannerID])) $USER[$id][cbannerID] = -1; However the variable does not hold that value. So in my SQL statement it prints nothing returning a SQL statement error. I then tried this just or a test purposes...on a separate php page. $USER[5]['test'] = 1; echo $USER[5]['test']; Nothing gets returned either. Please note that this works on my local Win2k machine, however when I upload it my FreeBSD machine it does not work. I'm guessing it has something to do with my PHP installation. Currently the machine is running Apache 1.3.26 and PHP 4.1.2 (going to upgrade soon but also note my Windows machine is running the same ver. Of PHP). Any ideas? - Matthew /** Matthew Metnetsky [EMAIL PROTECTED] **/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php