[PHP-DB] Re: How to get PHP to download web contents
Steve B. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How would you get PHP to download a file such as a web page and put it in a string? Try this: ?php // get contents of a file into a string $filename = http://somesite.com?user=someuserpwd=somepwd;; $handle = fopen ($filename, r); $contents = fread ($handle, filesize ($filename)); fclose ($handle); ? $contents is disired string variable. Best regards, Ognyan What keywords would relate to this (besides php download) I need a user to be able to put in a name and pass and have PHP go to a cetain site. The site can take the user/pass in the url so I do not need a form submit. Then I need the site contents to be in a php variable. Any tips on parsing html out of it would be great. Thanks __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Very confused with query
Good morning!! I'm trying to select 1 and only one record from each user based on the last date from a transaction file. This is what I'm using and it's not even close. It seems DISTINCT does not work!! SELECT DISCTINCT(transaction_user_id), MAX(transaction_date), * FROM transaction; Could some kind soul help me figure this one out?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP-DB] php.ini
i found that even i have not the php.ini in my SYSTEMROOT, php can still run ... why? For window XP, should it be placed in c:/WINDOWS? or any other ? thx for answer! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] stripping a get variable out of url string
I have an online tutorial build into a web page. It has button next step. If you are on page index.php?abc=123 for instance the code is smart enough to make it index.php?abc=123step=x The problem is how to remove step=x from the old url string so that steps don't pile up. index.php?abc=123step=1step=2 I'm trying ereg but could use a nudge with the wild card aspect of searching and replacing. The code below builds the get string. $stepnum = $_GET[step]; $laststep=$stepnum-1; $nextstep=$stepnum+1; $args = $_SERVER[REQUEST_URI]; if ($_SERVER[argc]0) $args.=; else $args.=?; if ($stepnum1) { echo bra href='$args; echo step=1'step 1/abr; } if ($laststep0) { echo bra href='$args; echo step=$laststep'backup 1 step/abr; } echo bra href='$args; echo step=$nextstep'next step/abr; thx __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] stripping a get variable out of url string
If all else fails, split on the . $url = split(, $_SERVER[REQUEST_URI]); $args = $url[0]; Cheers, ~Steve Steve B. wrote: I have an online tutorial build into a web page. It has button next step. If you are on page index.php?abc=123 for instance the code is smart enough to make it index.php?abc=123step=x The problem is how to remove step=x from the old url string so that steps don't pile up. index.php?abc=123step=1step=2 I'm trying ereg but could use a nudge with the wild card aspect of searching and replacing. The code below builds the get string. $stepnum = $_GET[step]; $laststep=$stepnum-1; $nextstep=$stepnum+1; $args = $_SERVER[REQUEST_URI]; if ($_SERVER[argc]0) $args.=; else $args.=?; if ($stepnum1) { echo bra href='$args; echo step=1'step 1/abr; } if ($laststep0) { echo bra href='$args; echo step=$laststep'backup 1 step/abr; } echo bra href='$args; echo step=$nextstep'next step/abr; thx __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: OCI_ASSOC returns key with upper case string
On Friday 04 July 2003 10:23 pm, Manuel Lemos wrote: Hello, On 07/04/2003 08:38 PM, Reuben D. Budiardja wrote: First let me say that I am not sure if this is PHP problem or Oracle. I posted this earlier in php-general, but after looking at the available mailing lists again, I thought this forum would be more appropriate. Sorry if someone get double post. snip Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the key in lower case. But ocifetchinto returns the key in UPPER case. So this discrepancy makes my code not as portable as I would like it. Is this PHP problem or Oracle config problem? No, that is just the way Oracle returns column names. Thanks for your reply. Do you or anyone know if there is something in the configuration of Oracle that can be changed for it to return lower case column? I read in the book Oracle 9i Complete Reference that oracle can use mixed case column and table name, but haven't found the how to do it yet. I'd rather do that than converting all my apps. The problem is we're supposed to write for mysql, but then client change their mind and use Oracle. Sorry if this is a bit OT. Thanks for any help. RDB It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated. That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability. http://www.phpclasses.org/metabase -- Reuben D. Budiardja Department of Physics and Astronomy The University of Tennessee, Knoxville, TN - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: OCI_ASSOC returns key with upper case string
Hello, On 07/05/2003 04:25 PM, Reuben D. Budiardja wrote: First let me say that I am not sure if this is PHP problem or Oracle. I posted this earlier in php-general, but after looking at the available mailing lists again, I thought this forum would be more appropriate. Sorry if someone get double post. snip Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the key in lower case. But ocifetchinto returns the key in UPPER case. So this discrepancy makes my code not as portable as I would like it. Is this PHP problem or Oracle config problem? No, that is just the way Oracle returns column names. Thanks for your reply. Do you or anyone know if there is something in the configuration of Oracle that can be changed for it to return lower case column? I read in the book Oracle 9i Complete Reference that oracle can use mixed case column and table name, but haven't found the how to do it yet. I'd rather do that than converting all my apps. The problem is we're supposed to write for mysql, but then client change their mind and use Oracle. Not that I know. I think you need to convert your applications soon or later to use numeric indexes. Meanwhile you may want to try do the case conversion in your database abstraction. That is what Metabase does. It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated. That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability. http://www.phpclasses.org/metabase -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mail()
Assuming you use MySQL (for example...) do something like : ? $result=mysql_query(SELECT * FROM Table) or die(mysql_error()); While($row = mysql_fetch_object($result)) { $MyVar .= $row-MyField; } mail([EMAIL PROTECTED],this is may email,$MyVar,From:[EMAIL PROTECTED]); ? Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: Phil Dowson [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2003 2:42 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mail() Hi, Could someone let me know if it is possible to pass a resultset of a query to a single variable so it can be included as the message part of the mail function? Thanks! Phil Dowson -- 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] Sessions help needed!
Hello all, I am new to php in general and am trying to set up a user authentification system with mysql. The registration page works well and sends all of the data to the appropriate table in mysql. However, when I try to get the registered user to log in and start a session, the system will not remember the session information past the page. For instance, this page will not work (the one that initially is supposed to register the session from the login form): ? session_start(); $username=chris; $database=login; $login = $_POST['login']; $password = $_POST['password']; if((!$login) || (!$password)){ echo Please enter ALL of the information! br /; include 'login.php'; exit(); } mysql_connect(localhost,$username); @mysql_select_db($database) or die( Unable to select database); $sql=mysql_query(SELECT * FROM login WHERE login='$login' AND password='$password'); $login_check = mysql_num_rows($sql); if($login_check 0){ // This is where I register the session session_register('login'); $_SESSION['login'] = $login; mysql_close(); include 'success.php'; } else { echo You could not be logged in! Either the username and password do not match or you have not validated your membership!br / Please try again!br /; include 'login.php'; } ? It proceeds to login the user for that page (I know this happens because I have played around with it looking at the error checks), but it will not display any variable that resembles $_SESSION['login']. The next page sequentially (success.php) looks like this: ? session_start(); echo 'Successful login for $_SESSION['login']'; ? Any and all variations of this page come up blank and white whenever the variable $_SESSION['login'] is called to display. It shows no memory of me registering a session. Any variation of quotes verse apostrophes changes nothing, so I figure that either I am blatantly screwing up the session code (possible for I have never written any sessions before) or my system is not supporting sessions. I have a php4 something, windows, apache 1.3.27 for my home network server, and mysql. Any help on this problem would be greatly appreciated. Thanks a lot for your time, John - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
[PHP-DB] PHP crashing with using Oracle
Hello, I installed PHP-4.3.2 with oci8 and oracle support (using --with-oci8 --with-oracle). I recompile apache-1.3.27 to use the libpthread as mentioned here: http://ww.php.net/oci8 Now, I got crashes when using oracle with php. In my apache error logs, I get: [Sat Jul 5 17:24:28 2003] [notice] child pid 17496 exit signal Segmentation fault (11) [Sat Jul 5 17:24:29 2003] [notice] child pid 17558 exit signal Segmentation fault (11) and the application would just do nothing (I tried reload, submit, etc). if this happens, the only way I can fix it is by restarting apache. Could anyone give me pointer what's going on here and how to fix it? In case this matters, the Oracle 9i DB server is also in the same box. Somehow it has it's own Apache, but I don't use that. Thanks for any help. RDB -- Reuben D. Budiardja -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: fatal error with DB.php
OK, I solved it. It seems that I **HAVE TO**, **MUST**, **NO CHOICE** place my php.ini in C:\WINNT (for NT and 2k) or PHP will not find it. This is a hardcoded path done at compile time. So, since no ini file, PHP was running on default values, thus it could not find DB.php since the default path there was 'C:\php4\pears' So, I copied my php.ini file to C:\winnt, renamed the added php4 to php4x (just to hide it to see if this would work), restarted my Apache (since the docs tell me that the PHP process that runs with Apache reads this file once at Apache startup) and I ran my script. It now works. Just thought I'd share to the next stubborn person finds this solution. Walter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQLite
With respect to the PHP manual, are there any documentation to using this extention? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Compiling 4.2.3 with MySQL ... what does it look for?
X-posted to PHP General, PHP DB, and MySQL Hi gang Attempting to get my Linux test-server working, but ran into a problem when making PHP... System is RedHat 8, Apache 1.3.27 (compiled myself, tested OK), MySQL 4.0.13. The Apache 2.0.40 and PHP 4.2.2 that came w. RH8 didn't work correctly, thus I've ventured into my own creation. Trying to build PHP 4.2.3 (because that's what my webhost runs, so need that version to test correctly) w. support for MySQL. Running ./configure --with-mysql=/[path to mysql] --with-apxs=/[path to apxs] Found the path to the apxs to be /usr/local/apache/bin/apxs, but for the life of me I cannot figure out what path to give it for MySQL. I installed MySQL from the the RPM files: MySQL-client-4.0.13-0.i386.rpm MySQL-devel-4.0.13-0.i386.rpm MySQL-embedded-4.0.13-0.i386.rpm MySQL-server-4.0.13-0.i386.rpm MySQL-shared-4.0.13-0.i386.rpm client and server first, the rest second ... used --force to get them in, because it complained about version issues with the one already there (even though the package manager was told not to put the Mysql in, it still put MySQL 3.something in...) When doing the configure above, I get this error: configure: error: Cannot find header files under /usr/include or whatever path I give it ... I'm having a hard time figuring out where the RPM puts everything, and an even harder time figuring out what path to stick to PHP ... Some detective work gave me these paths: MySQL (bins): /usr/bin /usr/share/mysql MySQL daemon (mysqld): /usr/libexec /usr/sbin MySQL headers (.h): /usr/include/mysql I've tried them all, but they all result in the above error. Anyone care to guess which path I should give to the configure? Or is it something else that causes this? I haven't ever used MySQL before, or any other SQL for that matter, so got 0 experience in getting the system up and running with it... TIA Rene -- Rene Brehmer aka Metalbunny http://metalbunny.net/ References, tools, and other useful stuff... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Compiling 4.2.3 with MySQL ... what does it look for?
try --with-mysql=/usr --- -{ Rene Brehmer }- [EMAIL PROTECTED] wrote: X-posted to PHP General, PHP DB, and MySQL Hi gang Attempting to get my Linux test-server working, but ran into a problem when making PHP... System is RedHat 8, Apache 1.3.27 (compiled myself, tested OK), MySQL 4.0.13. The Apache 2.0.40 and PHP 4.2.2 that came w. RH8 didn't work correctly, thus I've ventured into my own creation. Trying to build PHP 4.2.3 (because that's what my webhost runs, so need that version to test correctly) w. support for MySQL. Running ./configure --with-mysql=/[path to mysql] --with-apxs=/[path to apxs] Found the path to the apxs to be /usr/local/apache/bin/apxs, but for the life of me I cannot figure out what path to give it for MySQL. I installed MySQL from the the RPM files: MySQL-client-4.0.13-0.i386.rpm MySQL-devel-4.0.13-0.i386.rpm MySQL-embedded-4.0.13-0.i386.rpm MySQL-server-4.0.13-0.i386.rpm MySQL-shared-4.0.13-0.i386.rpm client and server first, the rest second ... used --force to get them in, because it complained about version issues with the one already there (even though the package manager was told not to put the Mysql in, it still put MySQL 3.something in...) When doing the configure above, I get this error: configure: error: Cannot find header files under /usr/include or whatever path I give it ... I'm having a hard time figuring out where the RPM puts everything, and an even harder time figuring out what path to stick to PHP ... Some detective work gave me these paths: MySQL (bins): /usr/bin /usr/share/mysql MySQL daemon (mysqld): /usr/libexec /usr/sbin MySQL headers (.h): /usr/include/mysql I've tried them all, but they all result in the above error. Anyone care to guess which path I should give to the configure? Or is it something else that causes this? I haven't ever used MySQL before, or any other SQL for that matter, so got 0 experience in getting the system up and running with it... TIA Rene __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Very confused with query
This one works, just change the fields... SELECT transaction_user_id, Max(transaction_date) AS transaction_max_date, * FROM transactions group by transaction_user_id; This works... but I tried it on a number field instead of date... but it should handle the same way... Ronald Villarosa www.pabahay.com www.bullsandbears.net www.2datop.com Sparky Kopetzky [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Good morning!! I'm trying to select 1 and only one record from each user based on the last date from a transaction file. This is what I'm using and it's not even close. It seems DISTINCT does not work!! SELECT DISCTINCT(transaction_user_id), MAX(transaction_date), * FROM transaction; Could some kind soul help me figure this one out?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Sessions help needed!
It recently happened to me too... however, I use the session_id() to keep track of the same session... I also use a table to check on who's who.. Anyway, it was working fine and all of a sudden the client complained that no one can log in... I echoed the session id of the pages and saw that different session ids were being given by SESSION_ID() when the user goes from one page to another... Basically, the system thought that each page visited is another session... when I can the session table, i saw that the user was autheticated ok... and that the session was log during login. When he was transfered to the welcome page, the check_session routine, checked the session_id agaisnt the log and since it gave him a new session id, the system thought he wasn't logged in and proceeded to ask him to log again... Anyway, in both our cases, the session wasn't being kept -- making each page visit seem a new session... SOLUTION -- at least for us: It turns out that their sysad upgraded to the latest PHP and with it came a new config: SESSION_ONLY_COOKIES This is a new config and it was ON and it wasn;t present in the previous PHP version. I just asked them to turn it of and test it and it worked again. session ids were the same and therefore... Hope this helps.. John Fuller [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I am new to php in general and am trying to set up a user authentification system with mysql. The registration page works well and sends all of the data to the appropriate table in mysql. However, when I try to get the registered user to log in and start a session, the system will not remember the session information past the page. For instance, this page will not work (the one that initially is supposed to register the session from the login form): ? session_start(); $username=chris; $database=login; $login = $_POST['login']; $password = $_POST['password']; if((!$login) || (!$password)){ echo Please enter ALL of the information! br /; include 'login.php'; exit(); } mysql_connect(localhost,$username); @mysql_select_db($database) or die( Unable to select database); $sql=mysql_query(SELECT * FROM login WHERE login='$login' AND password='$password'); $login_check = mysql_num_rows($sql); if($login_check 0){ // This is where I register the session session_register('login'); $_SESSION['login'] = $login; mysql_close(); include 'success.php'; } else { echo You could not be logged in! Either the username and password do not match or you have not validated your membership!br / Please try again!br /; include 'login.php'; } ? It proceeds to login the user for that page (I know this happens because I have played around with it looking at the error checks), but it will not display any variable that resembles $_SESSION['login']. The next page sequentially (success.php) looks like this: ? session_start(); echo 'Successful login for $_SESSION['login']'; ? Any and all variations of this page come up blank and white whenever the variable $_SESSION['login'] is called to display. It shows no memory of me registering a session. Any variation of quotes verse apostrophes changes nothing, so I figure that either I am blatantly screwing up the session code (possible for I have never written any sessions before) or my system is not supporting sessions. I have a php4 something, windows, apache 1.3.27 for my home network server, and mysql. Any help on this problem would be greatly appreciated. Thanks a lot for your time, John - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php