Re: [PHP] Re: How do you update multiple rows at the same time?
Steve! Could you be more specific and send some code you are using (even if it doesn't work). It may give some insight as to your specific need. That said, as far as I can tell, what you are trying to accomplish is this: $sql = UPDATE tablename SET 1column = '$newvariable' WHERE 1column = '$oldvariable'; This will effectively update any number of rows that match the criteria. Maybe you are trying to update rows where 1column values don't match? If so, you may need to run multiple queries. It's late and I'm guessing. Good Luck! RW Quoting Max Tappenden [EMAIL PROTECTED]: ### You on MySQL? ### If so do this ### UPDATE tblName SET firstcol = '$var41stcol', $secondcol = '$var42ndcol' ### and so on ### Steve Jackson [EMAIL PROTECTED] wrote in message ### 01c2c3a0$27591b50$[EMAIL PROTECTED]">news:01c2c3a0$27591b50$[EMAIL PROTECTED]... ### I am having trouble with this. ### I need to update 1column in a variable number of rows depending on how ### many categories are in my database at a given time. ### ### Can anyone provide any pointers or example code ### ### ### Steve Jackson ### Web Developer ### Viola Systems Ltd. ### http://www.violasystems.com/ http://www.violasystems.com ### [EMAIL PROTECTED] ### Mobile +358 50 343 5159 ### ### ### ### ### ### ### ### ### -- ### PHP General Mailing List (http://www.php.net/) ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### -- Richard Whitney Transcend Development Producing the next phase of your internet presence. [EMAIL PROTECTED] http://xend.net 602-971-2791 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a file manager with PHP?
On Monday 27 January 2003 15:34, Max Tappenden wrote: Basically I'm trying to make a file manager with PHP. Here's what I need to do Ok I have artists and coders working for my site No FTP I want them to be able to upload/download files from me as and when they please without having to email me the files The files that will be uploaded and downloaded are with these extentions .htm .html .php .phps .jpg .gif .swf I can scrape together the upload bit, but the download bit just runs the file rather than brings up the download feature of the web browser. How can I make it download it? TIA! Search the archives download files. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Work expands to fill the time available. -- Cyril Northcote Parkinson, The Economist, 1955 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] autoconf bug leads to configure syntax error when running buildconf
I am attempting to create an extension to php.. The only problem is, whenever I run buildconf after creating a skeletion with ./ext_skel --extname=my_module I receive the following output from buildconf ./buildconf using default Zend directory buildconf: checking installation... buildconf: autoconf version 2.13 (ok) buildconf: automake version 1.4-p5 (ok) buildconf: libtool version 1.4.2 (ok) rebuilding configure configure.in:562: AC_TRY_COMPILE was called before AC_AIX configure.in:562: AC_TRY_RUN was called before AC_AIX configure.in:562: AC_TRY_COMPILE was called before AC_AIX configure.in:562: AC_TRY_RUN was called before AC_AIX autoconf: Undefined macros: ***BUG in Autoconf--please report*** AC_ACVERSION ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF ***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF rebuilding main/php_config.h.in configure.in:562: AC_TRY_COMPILE was called before AC_AIX configure.in:562: AC_TRY_RUN was called before AC_AIX configure.in:562: AC_TRY_COMPILE was called before AC_AIX configure.in:562: AC_TRY_RUN was called before AC_AIX Then, when I run ./configure I receive a syntax error part way through.. My autoconf was 2.53 and got upgraded to 2.57 in case that was the problem... help! Josh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 27 Jan 2003 09:31:45 -0000 Issue 1847
php-general Digest 27 Jan 2003 09:31:45 - Issue 1847 Topics (messages 133193 through 133228): can't write and read on/from a file - Apache.exe access error 133193 by: phplam Re: Java call on object causes segfault. 133194 by: Philip Olson 133195 by: John Wells Re: Predefined Variables In Classes 133196 by: . Nilaab 133198 by: John W. Holmes 133199 by: . Nilaab 133201 by: . Nilaab Re: Masive mail Advice 133197 by: Manuel Lemos 133202 by: Mark Charette 133204 by: Manuel Lemos 133207 by: Mark Charette 133208 by: Manuel Lemos Re: Mass Mailing 133200 by: Manuel Lemos Session Variables 133203 by: Jed R. Brubaker 133215 by: Bobby Patel human language detection 133205 by: Marco Bleeker human language detection? 133206 by: Marco Bleeker 133209 by: Davy Obdam Transition Page? 133210 by: Lee Herron 133216 by: Chris Shiflett 133217 by: . Nilaab 133219 by: Lee Herron I'm new in PHP 133211 by: Beogradjanin 133212 by: Philip Olson 133213 by: Andy Turegano 133218 by: . Nilaab 133225 by: Max Tappenden Nesting level too deep 133214 by: Sascha Alexander Jopen Installation problem 133220 by: Jean-Christian Imbeault Re: Files PHP in tmp ? 133221 by: Max Tappenden Making a file manager with PHP? 133222 by: Max Tappenden 133227 by: Jason Wong Re: How do you update multiple rows at the same time? 133223 by: Max Tappenden 133226 by: Richard Whitney Re: total file size 133224 by: Max Tappenden autoconf bug leads to configure syntax error when running buildconf 133228 by: Joshua Moore-Oliva Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hello ! I'm in a mess. Please help me. Every time I tried to write with fwrite or fputs in a file, I get an error on windows nt sp6 , ie6 from Doc. Watson saying that Apache.exe makes an application access error . Filesystem functions: is_readable, is_writable,fopen,fclose are ok . I can create, find,open the file. versions: PHP 4.2.3, APACHE 1.3 httpd.conf : Alias /test/ C:/Apache/htdocs/test/ Directory C:/Apache/htdocs/test Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all /Directory -- example1: // start buffering the output ob_start(); $filename = c:\\apache\\htdocs\\test\files\\mifile.txt; // output format - either www or file $output = file; // print some output print Welcome to the Matrix, Neo; // now decide what to do with the buffered output if ($output == www) { // either print the contents of the buffer... ob_end_flush(); } else { // ... or write it to a file $data = ob_get_contents(); chmod ($filename, 0777); $fp = fopen ($filename, wb+); //ERROR IS HERE fwrite($fp, $data); fclose($fp); ob_end_clean(); } example 2: //I tried each of the following 5 $filename assignments. //$filename = c:\\apache\\htdocs\\mcm\\mifile.txt; //$filename = /mifile.txt; //$filename = mifile.txt; //$filename = c:\\tmp\\mifile.txt; $filename = c:\\apache\\htdocs\\test\files\\mifile.txt; $somecontent = Add this to the file\n; $fp = fopen($filename,wb); //NOTHING IS DISPLAYED echo brthis is fgets .fgets ( $fp ); // Write $somecontent to our opened file. //ERROR IS HERE if (!fwrite($fp, $somecontent)) { print Cannot write to file ($filename); exit; } fclose($fp); --- Thanks in advance phplam ---End Message--- ---BeginMessage--- Whenever you get a segfault, try the latest stable release and during compile be sure to use --enable-debug : http://snaps.php.net/ If the segfault exists here, write a bug report and include the backtrace: http://bugs.php.net/how-to-report.php http://bugs.php.net/ This will be of great help to the php-dev team. Also I believe many changes to the Java extension went into 4.3.0 so maybe it'll work for you. Regards, Philip On Sun, 26 Jan 2003, John Wells wrote: Working on getting Java integration going. I was able to get it to work with the online example and can create an object of java.lang.System and print various properties returned from there. However, if I create my own class, I can instantiate it, but if I call a method on that class it causes a SIGSEV. Could anyone provide some insight? Here's the code and backtrace: This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0. ? $obj = new Java('com.x.reports.Serv'); print $obj-getMsg(); ? --- java code stored off of class path in com/x/reports --- package com.x.reports; class Serv { public String msg = THIS IS A
RE: [PHP] Adjusting Indexed Field After Deleting Entry
Hi, I originally had a link #1, #2, and #3. I obviously deleted them. I was wondering if there is a way to use PHP/MySQL to get the indexed numbers to re-assign so that the first link you see is always #1 the second link you see is always #2 and so on? Thanks in advance, Roger PS The original script was not mine, it came from a 'php how to' article at web monkey, I did some modifications to fit what I needed. We don't want anyone thinking that I'm taking credit for their knowledge ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This e-mail has been scanned for viruses by the WorldCom Internet Managed Scanning Service - powered by MessageLabs. For further information visit http://www.worldcom.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adjusting Indexed Field After Deleting Entry
Hi, I originally had a link #1, #2, and #3. I obviously deleted them. I was wondering if there is a way to use PHP/MySQL to get the indexed numbers to re-assign so that the first link you see is always #1 the second link you see is always #2 and so on? (apologies for previous incomplete message - pressed Ctrl+Enter by mistake :-) If these are the primary keys in your database, you can reset the auto_increment with this query: ALTER TABLE tablename AUTO_INCREMENT = 1; Or set it to whatever you like: ALTER TABLE tablename AUTO_INCREMENT = 23; Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Update row problems
Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating! All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: - Catid | catname | catdesc | catorder | 1 name desc 1 2 name desc 2 3name desc 3 4name desc 4 __ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: form action=eshop_processcatorder.php method=post /td/tr ? while ($array = mysql_fetch_array($mysql)) { echo trtd width='150'span class='adminisoleipa'; echo {$array[catname]}; echo /tdtdinput type='text' size='2' name='catorder[{$array[catid]}]' value='{$array[catorder]}'; echo /span/td/tr; } ? trtdbr input type=submit name=Submit value=Submit class=nappi /form That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; } $result = mysql_query($query) or die(Query failure: .mysql_error()); if (!$result) { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'Could not change details: please a href='mailto:[EMAIL PROTECTED]'click here/a to email the administratorbrbr/span; echo /td; echo /tr; echo /table; } else { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'The category page has had the order in which categories appear changed.brbr/span; echo /td; echo /tr; echo /table; } Any help appraciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update row problems
your query needs to be inside the foreach loop so that it runs for every item, at the moment it just runs after you've scanned through all the items so just does the last one. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 11:46 AM Subject: [PHP] Update row problems Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating! All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: - Catid | catname | catdesc | catorder | 1name desc 1 2name desc 2 3name desc 3 4name desc 4 __ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: form action=eshop_processcatorder.php method=post /td/tr ? while ($array = mysql_fetch_array($mysql)) { echo trtd width='150'span class='adminisoleipa'; echo {$array[catname]}; echo /tdtdinput type='text' size='2' name='catorder[{$array[catid]}]' value='{$array[catorder]}'; echo /span/td/tr; } ? trtdbr input type=submit name=Submit value=Submit class=nappi /form That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; } $result = mysql_query($query) or die(Query failure: .mysql_error()); if (!$result) { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'Could not change details: please a href='mailto:[EMAIL PROTECTED]'click here/a to email the administratorbrbr/span; echo /td; echo /tr; echo /table; } else { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'The category page has had the order in which categories appear changed.brbr/span; echo /td; echo /tr; echo /table; } Any help appraciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- 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] Strip_Tags @ php 4.3
Hello, Has anyone noticed strange behaviour in strap_tags @ php 4.3? We did upgrade to the latest snap yet the problem remains. For some reason strip_tags acts weird.. -- georgep -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSH change password!
Mantas -- ...and then Mantas Kriauciunas said... % ... % And what I need this script for, is, not everyone knows how to use ssh % and I don't want to give access to 50 users that can run their % processes, my server will freeze. That's why I need to change it somehow Either your users plan to run major, major processes or your server is an old 486 with 16M of slow RAM... 50 users isn't a problem. If your users have real accounts, let them change their own passwords and then deal with them using the server. If they don't have real accounts, then maintain your own password list or whatever authentication you wish within apache. If you're executing system programs on their behalf, set up your web server to run subprocesses as the user rather than all as the apache user -- and then one of those subprocesses could be 'passwd'. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg94573/pgp0.pgp Description: PGP signature
RE: [PHP] Update row problems
I'm processing on a different page so what would I use instead of $_POST? print_r($_POST) Didn't display anything or diagnose anything. Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:57 To: Steve Jackson Subject: Re: [PHP] Update row problems sounds like $_POST[catorder] isn't an array - if you're posting to the same page you need to wrap the processing in something to test if the form has been posted (e.g. is_array($_POST[catorder])), or maybe you're using an older versionof PHP where $_POST isn't available -try using print_r($_POST) for diagnostics. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: 'Tim Ward' [EMAIL PROTECTED] Sent: Monday, January 27, 2003 12:52 PM Subject: RE: [PHP] Update row problems Ok, I put the query in the loop and now I get this error? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; $result = mysql_query($query) or die(Query failure: .mysql_error()); } Warning: Invalid argument supplied for foreach() in /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on line 27 Is it a $_POST problem? Using PHP 4.06 Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:11 To: PHP General; Steve Jackson Subject: Re: [PHP] Update row problems your query needs to be inside the foreach loop so that it runs for every item, at the moment it just runs after you've scanned through all the items so just does the last one. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 11:46 AM Subject: [PHP] Update row problems Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating! All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: - Catid | catname | catdesc | catorder | 1name desc 1 2name desc 2 3name desc 3 4name desc 4 __ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: form action=eshop_processcatorder.php method=post /td/tr ? while ($array = mysql_fetch_array($mysql)) { echo trtd width='150'span class='adminisoleipa'; echo {$array[catname]}; echo /tdtdinput type='text' size='2' name='catorder[{$array[catid]}]' value='{$array[catorder]}'; echo /span/td/tr; } ? trtdbr input type=submit name=Submit value=Submit class=nappi /form That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; } $result = mysql_query($query) or die(Query failure: .mysql_error()); if (!$result) { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'Could not change details: please a href='mailto:[EMAIL PROTECTED]'click here/a to email the administratorbrbr/span; echo /td; echo /tr; echo /table; } else { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'The category page has had the order in which categories appear changed.brbr/span; echo /td; echo /tr; echo /table; } Any help appraciated.
RE: [PHP] Adjusting Indexed Field After Deleting Entry
I originally had a link #1, #2, and #3. I obviously deleted them. I was wondering if there is a way to use PHP/MySQL to get the indexed numbers to re-assign so that the first link you see is always #1 the second link you see is always #2 and so on? Keep your own count variable when you output your links, don't rely on the auto_increment column in your database. The auto_increment number is only there as a unique identifier for each row, not to keep count for you. If you have problems with gaps in your auto_increment column then the script is not written correctly. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRON?
Nicole, et al -- BellSouth, eh? I'm in Atlanta :-) ...and then Nicole said... % % Thanks. But I would think if you can run cron jobs as certain users, you % could create cron jobs for those users only. I mean, if you can do it with % CPanel or these other Control Panels, then why not? It wouldn't have to run The reason you could do it in a control panel is that the panel process is running with special privs -- perhaps even in a separate httpd that is running as root. The way it's set up on my server is that httpd runs on port 80 and admind runs on port 88, and admind is allowed to do certain things as root *and* requires authentication before you can even get the first page of data out of it. % as root? I have a good bit to learn about linux. I am new to getting around % in ssh. % % I am learning from the command line now. It doesn't seem too bad yet. Not % sure. Give it all you've got and grow to love it. It's the only way to go. GUIs are for sissies. ducks and runs In all seriousity, though, the command line is incredibly powerful. I highly recommend it. % % Thanks! HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg94576/pgp0.pgp Description: PGP signature
Re: [PHP] Update row problems
what version of PHP? try $HTTP_POST_VARS instead. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 1:14 PM Subject: RE: [PHP] Update row problems I'm processing on a different page so what would I use instead of $_POST? print_r($_POST) Didn't display anything or diagnose anything. Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:57 To: Steve Jackson Subject: Re: [PHP] Update row problems sounds like $_POST[catorder] isn't an array - if you're posting to the same page you need to wrap the processing in something to test if the form has been posted (e.g. is_array($_POST[catorder])), or maybe you're using an older versionof PHP where $_POST isn't available -try using print_r($_POST) for diagnostics. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: 'Tim Ward' [EMAIL PROTECTED] Sent: Monday, January 27, 2003 12:52 PM Subject: RE: [PHP] Update row problems Ok, I put the query in the loop and now I get this error? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; $result = mysql_query($query) or die(Query failure: .mysql_error()); } Warning: Invalid argument supplied for foreach() in /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on line 27 Is it a $_POST problem? Using PHP 4.06 Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:11 To: PHP General; Steve Jackson Subject: Re: [PHP] Update row problems your query needs to be inside the foreach loop so that it runs for every item, at the moment it just runs after you've scanned through all the items so just does the last one. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 11:46 AM Subject: [PHP] Update row problems Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating! All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: - Catid | catname | catdesc | catorder | 1name desc 1 2name desc 2 3name desc 3 4name desc 4 __ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: form action=eshop_processcatorder.php method=post /td/tr ? while ($array = mysql_fetch_array($mysql)) { echo trtd width='150'span class='adminisoleipa'; echo {$array[catname]}; echo /tdtdinput type='text' size='2' name='catorder[{$array[catid]}]' value='{$array[catorder]}'; echo /span/td/tr; } ? trtdbr input type=submit name=Submit value=Submit class=nappi /form That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; } $result = mysql_query($query) or die(Query failure: .mysql_error()); if (!$result) { echo table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#629D39'; echo trtdimg src='images/admin_orders_administrate.gif'/td/tr; echo trtdnbsp;/td/tr; echo trtdspan class='adminisoleipa'Could not change details: please a href='mailto:[EMAIL PROTECTED]'click here/a to email the administratorbrbr/span; echo /td; echo
Re: [PHP] Transition Page?
Lee -- ...and then Lee Herron said... % % I'm interested in how most would create a transition page.. % % One thing you might consider is using flush() to output % what you have so far to the browser rather than sending % % The problem I'm having is that the uploading of the file takes time, and the Ah; you're waiting for the browser to send rather than for the server to send. I'm no expert, but I don't think there's a way to do this directly. Ideas that occur to me: - It wouldn't work for everyone since some (such as I :-) have javascript turned off, but you could first change the page on the click and then actually submit the form and start the upload. - You might send the just file name to upload back, get a new page containing the please wait, and let that page request the file by name. This doesn't sound great; if you can do that, what's to keep you from getting any file you want from a surfer's computer? Maybe you can, but I'd be moderately surprised, which means I'd be moderately surprised if this approach works -- but it's worth evaluating. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg94578/pgp0.pgp Description: PGP signature
RE: [PHP] Update row problems
Thanks. That was the problem. Im using 4.0.6 so it's a bit out of date. Cheers, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 15:32 To: PHP General; Steve Jackson Subject: Re: [PHP] Update row problems what version of PHP? try $HTTP_POST_VARS instead. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 1:14 PM Subject: RE: [PHP] Update row problems I'm processing on a different page so what would I use instead of $_POST? print_r($_POST) Didn't display anything or diagnose anything. Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:57 To: Steve Jackson Subject: Re: [PHP] Update row problems sounds like $_POST[catorder] isn't an array - if you're posting to the same page you need to wrap the processing in something to test if the form has been posted (e.g. is_array($_POST[catorder])), or maybe you're using an older versionof PHP where $_POST isn't available -try using print_r($_POST) for diagnostics. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: 'Tim Ward' [EMAIL PROTECTED] Sent: Monday, January 27, 2003 12:52 PM Subject: RE: [PHP] Update row problems Ok, I put the query in the loop and now I get this error? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where catid=$catid; $result = mysql_query($query) or die(Query failure: .mysql_error()); } Warning: Invalid argument supplied for foreach() in /home/stephenj/public_html/viola/eadmin/eshop_processcatorder.php on line 27 Is it a $_POST problem? Using PHP 4.06 Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: 27. tammikuuta 2003 14:11 To: PHP General; Steve Jackson Subject: Re: [PHP] Update row problems your query needs to be inside the foreach loop so that it runs for every item, at the moment it just runs after you've scanned through all the items so just does the last one. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 11:46 AM Subject: [PHP] Update row problems Hi all, I've been playing with this for a few hours now (over the course of a couple of days) and it's getting frustrating! All I want to do is to be able to make one row in the database set the order that my categories appear on my website. Now I can do this fine simply by using ORDER_BY but I want to have my users be able to update the order through an admin page like so: - Catid | catname | catdesc | catorder | 1name desc 1 2name desc 2 3name desc 3 4name desc 4 __ Basically I have a form which takes data from the table above and displays catname (just echoed) and catorder in a text form field. When I submit the form I want to update catorder with whatever number the user puts in the field. Currently my code updates only one of the category order numbers. So my form code: form action=eshop_processcatorder.php method=post /td/tr ? while ($array = mysql_fetch_array($mysql)) { echo trtd width='150'span class='adminisoleipa'; echo {$array[catname]}; echo /tdtdinput type='text' size='2' name='catorder[{$array[catid]}]' value='{$array[catorder]}'; echo /span/td/tr; } ? trtdbr input type=submit name=Submit value=Submit class=nappi /form That does everything I need it to do. However what am I doing wrong when I try to process it using this code? foreach($_POST[catorder] as $catid = $catorder) { $query = update categories set catorder=$catorder where
Re: [PHP] converting a Recorset into an XML string
Thank you Sean , your comment was useful for me, I was having that problem and what I was doing is changing every record in my database that have an or ' on it Thank you again -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting a Recorset into an XML string
Sean, could you please send me how do you will do the function to convert a recordset into an XML string? Thank You OCTAVIO HERRERA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Files PHP in tmp ?
No , it's not sessions, it's files with php545382 and into these files , there are piece of html of my sites Nico Max Tappenden [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Are they things like php45a45s879a787g54a21s3a12g3a21s31a3a? If so, yup i know the feeling 297,548,197 of them using up 128GB of storage on my HD! Don't worry They're just sessions Oh and don't worry Unless your site is a huge wooper with 500,000 - 1,000-,000 users loggin in a day, you won't get huge amounts lol Nico [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I've a lot of files named php in my tmp folders .. What's these files ? Nico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] target for ftp_ssl_connect
Hello, I would like to make use of the function ftp_ssl_connect. Can anyone tell me an appropriate server for this function? WU-FTP with ssl-support does not exist anymore (I read); the openssl.9.6.g port 22 (of the default config) does not seem to work. Which server-deamon is the right one? Or must I use cURL ?? Thanks in advance Markus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] slides
Hallo, does anybody knows where can I find a set of presentation sildes of the PHP language base(or PHP toghether with mysql)? . May be coming from any tutorial or previous course. Thank you very much Ornella
Re: [PHP] slides
On Mon, 2003-01-27 at 10:20, Ornella Fasolo wrote: Hallo, does anybody knows where can I find a set of presentation sildes of the PHP language base(or PHP toghether with mysql)? . May be coming from any tutorial or previous course. Thank you very much http://talks.php.net/ Ornella -- The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs. - Joseph Weizenbaum -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Files PHP in tmp ?
It's include files. Ex : in index.php i call index2.php , the content of index2.php 'll be written in /tmp Nico Max Tappenden [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Are they things like php45a45s879a787g54a21s3a12g3a21s31a3a? If so, yup i know the feeling 297,548,197 of them using up 128GB of storage on my HD! Don't worry They're just sessions Oh and don't worry Unless your site is a huge wooper with 500,000 - 1,000-,000 users loggin in a day, you won't get huge amounts lol Nico [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I've a lot of files named php in my tmp folders .. What's these files ? Nico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache webprotect logout
Hi! I have protected a folder on my apache server with a username and password. When I browse to this folder I get a popup to type my name and password in( automatic popup by internet explorer or something ). My question is, how do I log out? I tried to destroy the session, but it didn't help. Thanks Tommy Jensehaugen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] apache webprotect logout
-Original Message- From: Tommy Jensehaugen [mailto:[EMAIL PROTECTED]] Sent: Monday, January 27, 2003 10:32 AM To: [EMAIL PROTECTED] Subject: [PHP] apache webprotect logout When I browse to this folder I get a popup to type my name and password in( automatic popup by internet explorer or something ). My question is, how do I log out? You can't. There is no way to log out of http authentication other then closing the browser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache webprotect logout
--- Tommy Jensehaugen [EMAIL PROTECTED] wrote: I have protected a folder on my apache server with a username and password. When I browse to this folder I get a popup to type my name and password in( automatic popup by internet explorer or something ). My question is, how do I log out? I tried to destroy the session, but it didn't help. Probably because there is no session. It sounds like you are talking about HTTP basic authentication. This form of authentication requires the browser to authenticate itself with every single request. Thus, there is no idea of being logged in, because this does not require any state management. However, browsers will try to be helpful and re-send the same authentication credentials, so that you don't get prompted every time for a username and password. This is what makes it seem as if you are logged in. Some people do things such as change the realm whenever they want to make it seem as if the user is logged out. You will only be able to do this type of thing with PHP (as opposed to letting your Web server handle it). I think the user notes on HTTP authentication have many suggestions that might help you out: http://www.php.net/manual/en/features.http-auth.php Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IFRAMES PHP
Hi, I have a form with an IFRAME nested in it. When the form is submitted, I can't get the values of the checkboxes in the IFRAME, is there any way to do this? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about GD and colors
With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
--- Greg [EMAIL PROTECTED] wrote: Hi, I have a form with an IFRAME nested in it. When the form is submitted, I can't get the values of the checkboxes in the IFRAME, is there any way to do this? Well, I think (I could be wrong) you're looking at this wrong. Forms submit to resources identified by URLs. You specify this with the action attribute of the form tag. There is no idea of frames here. If you mean that the resource that your iframe loads does not have access to the form variables, then change your action attribute to that resource, and then it will. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- 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] IE 'Back' Button problem + SELECT dropdowns
Hi, I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form: 'value=?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?' However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components: ?php require(dobdod.fdd); if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth']; if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ? Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a ?php . . . ? around each if(!empty . . .); statement above with same result.] Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE 'Back' Button problem + SELECT dropdowns
I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form: 'value=?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?' However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components: ?php require(dobdod.fdd); if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth']; if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ? Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a ?php . . . ? around each if(!empty . . .); statement above with same result.] Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form? SELECT boxes work differently from text boxes. To set a select box to a certain value, you need to put SELECTED into the option tag, like: option value=some_value SELECTEDText Value/option So, you need to create some loop or test to see where you should put the SELECTED. For short lists, doing something like: option value=some_value ? if(isset($_SESSION['select']) $_SESSION['select'] == 'some_value') { echo SELECTED; }?Text Value/option For larger lists, it's easier to put the values into an array and make a function that loops through and test each value for where to put the SELECTED text. Hope that helps. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE 'Back' Button problem + SELECT dropdowns
On Monday 27 January 2003 11:46 am, 1LT John W. Holmes wrote: I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form: 'value=?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?' However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components: ?php require(dobdod.fdd); if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth']; if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ? Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a ?php . . . ? around each if(!empty . . .); statement above with same result.] Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form? SELECT boxes work differently from text boxes. To set a select box to a certain value, you need to put SELECTED into the option tag, like: option value=some_value SELECTEDText Value/option So, you need to create some loop or test to see where you should put the SELECTED. For short lists, doing something like: option value=some_value ? if(isset($_SESSION['select']) $_SESSION['select'] == 'some_value') { echo SELECTED; }?Text Value/option For larger lists, it's easier to put the values into an array and make a function that loops through and test each value for where to put the SELECTED text. Hope that helps. ---John Holmes... Thanks John, Great to get your excellent advice again. I've been off-list for a few months. Never thought of doing the extra coding IN the require file! That's probably why it didn't work. I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
Here's the basic layout of my html page, this isn't the real html, just the basic idea. html form action=test.php method=post input type=text name=test1 iframe src = iframetest.php/iframe input type=button label=Submit /form /html Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!! Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Greg [EMAIL PROTECTED] wrote: Hi, I have a form with an IFRAME nested in it. When the form is submitted, I can't get the values of the checkboxes in the IFRAME, is there any way to do this? Well, I think (I could be wrong) you're looking at this wrong. Forms submit to resources identified by URLs. You specify this with the action attribute of the form tag. There is no idea of frames here. If you mean that the resource that your iframe loads does not have access to the form variables, then change your action attribute to that resource, and then it will. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
try imagecreatetruecolor() instead of imagecreate() - Original Message - From: Philipp [EMAIL PROTECTED] To: Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 4:21 PM Subject: Re: [PHP] question about GD and colors Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- 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
[PHP] Question about SSL/php globals
Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? Thanks! Wei -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about SSL/php globals
On Mon, 27 Jan 2003, Wei Weng wrote: Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? $_SERVER['HTTPS'] Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strip_Tags @ php 4.3
On Mon, 27 Jan 2003, George E. Papadakis wrote: Hello, Has anyone noticed strange behaviour in strap_tags @ php 4.3? We did upgrade to the latest snap yet the problem remains. For some reason strip_tags acts weird.. Please be specific with a short self-contained example that demonstrates your definition of weird Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
Greg wrote: Here's the basic layout of my html page, this isn't the real html, just the basic idea. html form action=test.php method=post input type=text name=test1 iframe src = iframetest.php/iframe input type=button label=Submit /form /html Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!! not directly .. the form does not 'contain' the iframe - in fact the iframe is a different page ... so form elements within the iframe page will not be a part of the form submission process you /might/ be able to do something with javascript inter-frame communication - but I doubt you would want to (and the iframe doesn't sound like a valid page which could cause problems) what would probably make more sense would be to make the 'html' page include iframetest.php' html.php -- html form action=test.php method=post input type=text name=test1 ?php include(/path/iframetest.php); ? input type=button label=Submit /form /html - then you form elements will be properly contained within the form -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IFRAMES PHP
Here's the basic layout of my html page, this isn't the real html, just the basic idea. html form action=test.php method=post input type=text name=test1 iframe src = iframetest.php/iframe input type=button label=Submit /form /html Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? If you set a hidden form element in iframetest.php, does it show up when you do a print_r($_POST) in test.php ? It's probably an HTML thing. I don't know how iframes are interpreted, but it's probably not really a part of your form, even though it looks like it is when you view it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IE 'Back' Button problem + SELECT dropdowns
I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior? No. $_POST['bday'] should always show up, regardless of OS, if the scripts and PHP version are the same. Double check your logic. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg Sean Burlington [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Greg wrote: Here's the basic layout of my html page, this isn't the real html, just the basic idea. html form action=test.php method=post input type=text name=test1 iframe src = iframetest.php/iframe input type=button label=Submit /form /html Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!! not directly .. the form does not 'contain' the iframe - in fact the iframe is a different page ... so form elements within the iframe page will not be a part of the form submission process you /might/ be able to do something with javascript inter-frame communication - but I doubt you would want to (and the iframe doesn't sound like a valid page which could cause problems) what would probably make more sense would be to make the 'html' page include iframetest.php' html.php -- html form action=test.php method=post input type=text name=test1 ?php include(/path/iframetest.php); ? input type=button label=Submit /form /html - then you form elements will be properly contained within the form -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
It's probably an HTML thing. I don't know how iframes are interpreted, but it's probably not really a part of your form, even though it looks like it is when you view it. The contents of an IFRAME, by definition, is a totally different document. It behaves for all intents and purposes as a normal frame except that it appears inline. You may or may not be able to access the contents via the DOM of the document it is part of - I've never tried. But in any case, it will not be posted as part of the form. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IFRAMES PHP
Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg Then put the entire form into the iframe. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about SSL/php globals
Thanks for the prompt reply! One more question, do you know how PHP implements this variable? In other words, how does PHP detect whether the connection is SSLed or not? (Specific to apache) Thanks! Wei - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Wei Weng [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 12:19 PM Subject: Re: [PHP] Question about SSL/php globals On Mon, 27 Jan 2003, Wei Weng wrote: Is there any environment/Global variable in PHP that indicates whether the server port you connect to is SSL port? $_SERVER['HTTPS'] Regards, Philip -- 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] IFRAMES PHP
But the buttons are outside of the iframe, so that no matter how large the frame gets, the buttons are always in the same place :/ -Greg John W. Holmes [EMAIL PROTECTED] wrote in message 000501c2c629$f98c8590$7c02a8c0@coconut">news:000501c2c629$f98c8590$7c02a8c0@coconut... Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg Then put the entire form into the iframe. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
Greg wrote: Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg in that case you either need to try getting some javascript to pass the info between frames - or see if there is some style sheet wizadry (fixed size divs, visible area, clipping ...???) that will produce the same effect on an acceptable proportion of browsers Sean Burlington [EMAIL PROTECTED] .uk wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Greg wrote: Here's the basic layout of my html page, this isn't the real html, just the basic idea. html form action=test.php method=post input type=text name=test1 iframe src = iframetest.php/iframe input type=button label=Submit /form /html Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!! not directly .. the form does not 'contain' the iframe - in fact the iframe is a different page ... so form elements within the iframe page will not be a part of the form submission process you /might/ be able to do something with javascript inter-frame communication - but I doubt you would want to (and the iframe doesn't sound like a valid page which could cause problems) what would probably make more sense would be to make the 'html' page include iframetest.php' html.php -- html form action=test.php method=post input type=text name=test1 ?php include(/path/iframetest.php); ? input type=button label=Submit /form /html - then you form elements will be properly contained within the form -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
Hi Adrian, thank you very much, that solved my problem. Regards, Philipp - Original Message - From: adrian [EMAIL PROTECTED] [EMAIL PROTECTED] To: Philipp [EMAIL PROTECTED]; Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 6:10 PM Subject: Re: [PHP] question about GD and colors try imagecreatetruecolor() instead of imagecreate() - Original Message - From: Philipp [EMAIL PROTECTED] To: Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 4:21 PM Subject: Re: [PHP] question about GD and colors Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- 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] IFRAMES PHP
Hi Greg, But the buttons are outside of the iframe, so that no matter how large the frame gets, the buttons are always in the same place :/ So stick an image of the button outside the iframe, wrap it in an a, and use the onclick handler to call a javascript function that submits the form. Of course, this will break for anyone who doesn't have javascript enabled (some estimates put this as high as 20%, but it depends on your audience). Alternatively, put your form inside a div with a fixed height and width, and the overflow property set to scroll or auto. This should behave in much the same way as your iframe, but with everything on the same page. Again, this will break for some users (those whose browsers *cough*NN4*cough* don't support fixed positioning and overflow), but at least it degrades more gracefully than the scripted solution. Thirdly, if you provide a link to a sample page, someone might be able to come up with a way to rework your form so you can avoid all this entirely :-) Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Do php extension need to be thread-safe?
Do php extension need to be thread-safe? I am running php on apache2. I would guess that since it's compiled in as a module, it would need to be thread-safe correct? Josh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
hmm.. it'll get real ugly with javascript,but this works with newer browsers. ...iframe has a name ...main page has a hidden form field with id checkbox in the iframe has id also iframe.php html head script function submit_form(){ if(frames[myiframe].document.getElementById(one).checked == true){//see if the checkbox in iframe is checked // if it is checked assign it's value to the hidden field in this page document.getElementById(one_copy).value = frames[myiframe].document.getElementById(one).value; } document.form1.submit(); } /script /head body ?php if($_POST['test1']){ echo $_POST['test1'] . 'br /' . $_POST['one_copy']; } ? form name=form1 action=iframe.php method=post input type=text name=test1br iframe name =myiframe src = iframetest.htm/iframebr input type=hidden id=one_copy name=one_copy value= input type=button value=sub onclick=submit_form() /form /body /html iframetest.htm html body form input type=checkbox id=one name=one value=hello /form /body /html - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'Greg' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:31 PM Subject: RE: [PHP] IFRAMES PHP Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg Then put the entire form into the iframe. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.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] Simple Solution To Login And Upload
Hi guys, I am looking for a very simple login script that logs a person in with a unique login username/password and then logs them into a very basic control panel where they can upload image files and delete them. Can anybody help me out that would be much appreciated. Cheers, Ian. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Solution To Login And Upload
Hi guys, I am looking for a very simple login script that logs a person in with a unique login username/password and then logs them into a very basic control panel where they can upload image files and delete them. Can anybody help me out that would be much appreciated. www.hotscripts.com www.sourceforge.net www.phpclasses.org Unless you want to send me a very simple check to write it for you?? :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES PHP
Thank you guys for all the help, I'll try a few of these things, if not I'll just redesign the page. -Greg Adrian [EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message 00e001c2c631$b402e160$1a8f43d9@ADE2">news:00e001c2c631$b402e160$1a8f43d9@ADE2... hmm.. it'll get real ugly with javascript,but this works with newer browsers. ...iframe has a name ...main page has a hidden form field with id checkbox in the iframe has id also iframe.php html head script function submit_form(){ if(frames[myiframe].document.getElementById(one).checked == true){//see if the checkbox in iframe is checked // if it is checked assign it's value to the hidden field in this page document.getElementById(one_copy).value = frames[myiframe].document.getElementById(one).value; } document.form1.submit(); } /script /head body ?php if($_POST['test1']){ echo $_POST['test1'] . 'br /' . $_POST['one_copy']; } ? form name=form1 action=iframe.php method=post input type=text name=test1br iframe name =myiframe src = iframetest.htm/iframebr input type=hidden id=one_copy name=one_copy value= input type=button value=sub onclick=submit_form() /form /body /html iframetest.htm html body form input type=checkbox id=one name=one value=hello /form /body /html - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'Greg' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:31 PM Subject: RE: [PHP] IFRAMES PHP Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg Then put the entire form into the iframe. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.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] IE 'Back' Button problem + SELECT dropdowns
Thanks John, I sort of thought that it should work. Will do as you suggest. Regards, Andre On Monday 27 January 2003 12:28 pm, John W. Holmes wrote: I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior? No. $_POST['bday'] should always show up, regardless of OS, if the scripts and PHP version are the same. Double check your logic. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Found a PHP bug!!!!!!!!!
Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September, so I have been playing around it and found the problem. I recently wrote a demo script for you all to play around with. Let me know which PHP version does this bug not affected you I'm going to file a PHP bug at http://bug.php.net.. I'll let you know where PHP bug # is it. To tell you the truth, I don't know how to search for existing bug on this one if there is any because I don't know if it is an if-statement issue or if it is something else Feel free to submit a patch if you know how. Let me know what you found and post it here... --clip-- ? //Sample Code. == $VARIABLE[0] = 2002-01; $VARIABLE[1] = 2002-02; $VARIABLE[2] = 2002-03; $VARIABLE[3] = 2002-04; $VARIABLE[4] = 2002-05; $VARIABLE[5] = 2002-06; $VARIABLE[6] = 2002-07; $VARIABLE[7] = 2002-08; $VARIABLE[8] = 2002-09; $VARIABLE[9] = 2002-10; $VARIABLE[10] = 2002-11; $VARIABLE[11] = 2002-12; //Loop Code to check the variable === for ($x=0;$x12;$x++) { $month = substr($VARIABLE[$x],5,2); echo The # of month is .$x.br; if ($month == 01) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 02) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 03) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 04) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 05) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 06) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 07) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 08) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 09) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 10) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 11) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 12) { echo It's a Match!!br; } else { echo It's not a Match!!br; } echo br; } //Strange Workaround to 08 and 09 === echo Strange Workaround to the Problem!!brbr; $month = substr($VARIABLE[7],5,2); echo The # of month is 08br; if (trim($month) == 8) { echo It's working!!!br; } $month = substr($VARIABLE[8],5,2); echo The # of month is 09br; if (trim($month) == 9) { echo It's working!!!br; } //Testing (Should this be working or not??) = echo brbr; $month = substr($VARIABLE[0],5,2); echo The # of month is 1br; if (trim($month) == 1) { //With 1 as an integer... echo It's working!!!br; } echo br; $month = substr($VARIABLE[0],5,2); echo The # of month is 01br; if (trim($month) == 01) { //With 01 as an integer echo It's working!!!br; } echo br; $month = substr($VARIABLE[0],5,2); echo The # of month is 1br; if (trim($month) == 1) { //With 1 as an integer... echo It's working!!!br; } echo br; $month = substr($VARIABLE[0],5,2); echo The # of month is 01br; if (trim($month) == 01) { //With 01 as an integer echo It's working!!!br; } ? --clip-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
On Tuesday 28 January 2003 03:56, Scott Fletcher wrote: Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September, so I have been playing around it and found the problem. I recently wrote a demo script for you all to play around with. Let me know which PHP version does this bug not affected you I'm going to file a PHP bug at http://bug.php.net.. I'll let you know where PHP bug # is it. To tell you the truth, I don't know how to search for existing bug on this one if there is any because I don't know if it is an if-statement issue or if it is something else Feel free to submit a patch if you know how. Let me know what you found and post it here... --clip-- [snip] if ($month == 01) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 02) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 03) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 04) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 05) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 06) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 07) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 08) { echo It's a Match!!br; } else { echo It's not a Match!!br; } if ($month == 09) { echo It's a Match!!br; } else { echo It's not a Match!!br; } Have a look at the manual Types Integers -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* I'm having a BIG BANG THEORY!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Found a PHP bug!!!!!!!!!
-Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
--- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Found a PHP bug!!!!!!!!!
Scott, Because 8 != 8. 8 (and 08) is a string with the numerals representing the number eight. It is not the number eight. (think back to basic math, the difference between a number and a numeral) PHP does some conversions for you automatically but that just saves you from yourself. (Personally, I wish it wouldn't. People have more trouble *because* of the automatic conversions than they would if they had to do the converting themselves.) To keep from running into this simply do the conversions yourself before you do comparisons. intval(08)==8 =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Sent: Monday, January 27, 2003 2:14 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Found a PHP bug! I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- 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] Found a PHP bug!!!!!!!!!
Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- 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] Found a PHP bug!!!!!!!!!
I'm referring to '08' and '09' that don't work Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- 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] phpMyAdmin for Microsoft SQL
Hey all, Does any body know of anything similar to phpMyAdmin for MS SQL? I have been doing some googling and haven't come across anything that would help me out. I have also checked out www.sourceforge.net and can't seem to come across anything either. I am looking for something that will be easy enough for my client to utilize to update/manipulate a database, rather than having me re-create the wheel so-to-speak. -- Joshua Minnie Advantage Computer Services, LLC Senior Project Manager [EMAIL PROTECTED] www.advantagecomputerservices.com Tel: 269.276.9690 Fax : 269.342.8750
Re: [PHP] Found a PHP bug!!!!!!!!!
Whoop! FOund it, it is doubleval()... What does settype() do exactly Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- 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] Found a PHP bug!!!!!!!!!
I would need to use intval() to solve this problem Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm referring to '08' and '09' that don't work Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
U might want to do a type cast to integer from string... http://www.php.net/manual/en/language.types.type-juggling.php On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote: I would need to use intval() to solve this problem Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm referring to '08' and '09' that don't work Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Because 8 != 8. 8 (and 08) is a string with the numerals representing the number eight. It is not the number eight. (think back to basic math, the difference between a number and a numeral) Actually, 08 is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal. PHP does some conversions for you automatically but that just saves you from yourself. (Personally, I wish it wouldn't. People have more trouble *because* of the automatic conversions than they would if they had to do the converting themselves.) Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero. Run this bit of code for an example: echo br . ((01 == 1) ? Match : No Match); echo br . ((02 == 2) ? Match : No Match); echo br . ((03 == 3) ? Match : No Match); echo br . ((04 == 4) ? Match : No Match); echo br . ((05 == 5) ? Match : No Match); echo br . ((06 == 6) ? Match : No Match); echo br . ((07 == 7) ? Match : No Match); echo br . ((08 == 8) ? Match : No Match); echo br . ((09 == 9) ? Match : No Match); The last two won't match because 08 and 09 are invalid octal numbers, like Kirk Johnson already said. So 08 != 08 and 8 != 08, for example. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote: Whoop! FOund it, it is doubleval()... What does settype() do exactly Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Found a PHP bug!!!!!!!!!
Even doing a type cast won't make a difference for the original problem. Even if you cast 08 to an integer and compare it to 08 (invalid octal number), it'll still fail. The original solution was the best, remove the leading zero from the comparisons and let PHP handle the type casting. ---John Holmes... - Original Message - From: Ray Hunter [EMAIL PROTECTED] To: Scott Fletcher [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 3:45 PM Subject: Re: [PHP] Found a PHP bug! U might want to do a type cast to integer from string... http://www.php.net/manual/en/language.types.type-juggling.php On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote: I would need to use intval() to solve this problem Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm referring to '08' and '09' that don't work Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Scott Fletcher [EMAIL PROTECTED] wrote: Found a PHP bug ... if ($month == 01) I guess you mean: if ($month == '01') If so, this is not a bug. Otherwise, please explain what you think is wrong. Chris -- 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] Help with Filesize
How do i use the function filesize, because i´m using like: I just want associate the variable $body with a html file $file_name = 'c:/templates/resp_rep_efetiva_contrato.php'; $fd = fopen($file_name,r); line 27 $size = filesize($file_name); / Dá erro aqui $body = fread($fd, $size); $mail = mail($address, $subject, $body, $header); it keeps saind that: Warning: stat failed for c://templates/resp_rep_efetiva_contrato.php (errno=2 - No such file or directory) in line 27 but, the file exists because the fopen function works ok, I don´t known what to do Thanks in advance Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED]
RE: [PHP] Found a PHP bug!!!!!!!!!
John. Actually, 08 is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal. No they are not equal. Yes, PHP will do the conversion so that they are equal. That does not refute the fact that logically '08' != 8. Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero. I understand the problem at hand. (and did when I posted) However, if Scott had been doing the conversions manually, he would never have run across this problem. It is a bad idea to rely on the language (whatever the language) to do automatic variable conversions. =C= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Yea, it's too bad that not many people know about it. I first asked and they told me it is done automatically. That was 3 years ago. I never had a problem for 3 years until now. So, I'm going back to the old way as I did in Javascript and C programming. I first started PHP 3 years ago, so it's no wonder why there's all the confusion when I was just an innocent victim. :-) Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... John. Actually, 08 is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal. No they are not equal. Yes, PHP will do the conversion so that they are equal. That does not refute the fact that logically '08' != 8. Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero. I understand the problem at hand. (and did when I posted) However, if Scott had been doing the conversions manually, he would never have run across this problem. It is a bad idea to rely on the language (whatever the language) to do automatic variable conversions. =C= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Double and Float are not exactly the same thing. Double is --- 11.123 Float is -- .00238823993 Leif K-Brooks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote: Whoop! FOund it, it is doubleval()... What does settype() do exactly Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Aw nut!!! The intval() doesn't work.. I had enough, I'm going to do what Kirk Johnson recommend. That one work better. Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Yea, it's too bad that not many people know about it. I first asked and they told me it is done automatically. That was 3 years ago. I never had a problem for 3 years until now. So, I'm going back to the old way as I did in Javascript and C programming. I first started PHP 3 years ago, so it's no wonder why there's all the confusion when I was just an innocent victim. :-) Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... John. Actually, 08 is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal. No they are not equal. Yes, PHP will do the conversion so that they are equal. That does not refute the fact that logically '08' != 8. Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero. I understand the problem at hand. (and did when I posted) However, if Scott had been doing the conversions manually, he would never have run across this problem. It is a bad idea to rely on the language (whatever the language) to do automatic variable conversions. =C= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Another workaround to this problem is as an addition to Kirk Johnson's suggestion --clip-- $month = 08; if (trim($month) == 8) { echo You got it!!!; } --clip-- Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Aw nut!!! The intval() doesn't work.. I had enough, I'm going to do what Kirk Johnson recommend. That one work better. Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Yea, it's too bad that not many people know about it. I first asked and they told me it is done automatically. That was 3 years ago. I never had a problem for 3 years until now. So, I'm going back to the old way as I did in Javascript and C programming. I first started PHP 3 years ago, so it's no wonder why there's all the confusion when I was just an innocent victim. :-) Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... John. Actually, 08 is equal to 8 in PHP. PHP will convert the string to an integer and the two will compare as equal. No they are not equal. Yes, PHP will do the conversion so that they are equal. That does not refute the fact that logically '08' != 8. Someone already posted why the problem was happening, because the numbers were being converted to invalid octal numbers and being set to zero. I understand the problem at hand. (and did when I posted) However, if Scott had been doing the conversions manually, he would never have run across this problem. It is a bad idea to rely on the language (whatever the language) to do automatic variable conversions. =C= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
doubleval doubleval -- Alias of floatval() http://www.php.net/manual/en/function.floatval.php Description This function is an alias of floatval() http://www.php.net/manual/en/function.floatval.php. Note: This alias is a left-over from a function-renaming. In older versions of PHP you'll need to use this alias of the floatval() http://www.php.net/manual/en/function.floatval.php function, because floatval() http://www.php.net/manual/en/function.floatval.php wasn't yet available in that version. Scott Fletcher wrote: Double and Float are not exactly the same thing. Double is --- 11.123 Float is -- .00238823993 Leif K-Brooks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote: Whoop! FOund it, it is doubleval()... What does settype() do exactly Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use 08 (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then 08 = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). Kirk Johnson [EMAIL PROTECTED] wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
--- Scott Fletcher [EMAIL PROTECTED] wrote: Double and Float are not exactly the same thing. Double is --- 11.123 Float is -- .00238823993 They are the same thing. Please, read this: http://www.php.net/manual/en/language.types.php and this: http://www.php.net/manual/en/language.types.float.php Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Scott Fletcher wrote: Double and Float are not exactly the same thing. Double is --- 11.123 Float is -- .00238823993 I am absolutely new to PHP but what is above (since PHP seems to take most of its low-level terminology from C) is a fixed point number and the next is a floating point number, which may not fit into the 8 significant digits what is guaranteed for a float on all platforms. What do I miss? WW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
Okay, correction... Double -- 11.1237 Float -- 0. Cheers! It's the way it work in C Programming... Double won't be as long or as infinite as the floating point. White Wolf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Scott Fletcher wrote: Double and Float are not exactly the same thing. Double is --- 11.123 Float is -- .00238823993 I am absolutely new to PHP but what is above (since PHP seems to take most of its low-level terminology from C) is a fixed point number and the next is a floating point number, which may not fit into the 8 significant digits what is guaranteed for a float on all platforms. What do I miss? WW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help needed with session variables
hello, I am making use of sessions in my PHp/MySQL Database application. When the user is successfully authenticated against the database, a session is created in following manner: session_register(valid_user,firstname,lastname); $valid_user = $login; $firstname = $first_name; $lastname = $last_name; While I am able to use the $valid_user variable all thru the sesion , when I try to use the $valid_user it works fine (i.e. I am able to access the value) throughout the session, however when I try to use the other two registered session variables i.e firstname and lastname, I am not able to extract the value. Can you suggest what might be going wrong. Note I am locally testing the setup on my Mac. Many Thanks Pushpinder Singh Garcha _ Web Architect
[PHP] Help : I need modify a the header information in a JPEG image file
Hi, I new to the php world ant the image too, and I need modify the header information in a JPEG image file, is that possibly? How? I need put some information in the image at the instant when the user download this from the web site. Thanks in Advance. Saludos, Patricio Vera.
Re: [PHP] Found a PHP bug!!!!!!!!!
Scott Fletcher: Okay, correction... Double -- 11.1237 Float -- 0. Cheers! It's the way it work in C Programming... Double won't be as long or as infinite as the floating point. Absolutely wrong (if you would be in a C newsgroup you would even be accused of trolling :-))) double (in C) means: double precision floating point number float in C means: floating point number Float is guaranteed to store 6 significant digits (and usually noone uses it except on some very weird architectures) while double's minimum is 10 significant digits. WW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help needed with session variables
Are you sure $first_name and $last_name have a value? Double check... ---John Holmes... - Original Message - From: Pushpinder Singh Garcha [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 4:44 PM Subject: [PHP] help needed with session variables hello, I am making use of sessions in my PHp/MySQL Database application. When the user is successfully authenticated against the database, a session is created in following manner: session_register(valid_user,firstname,lastname); $valid_user = $login; $firstname = $first_name; $lastname = $last_name; While I am able to use the $valid_user variable all thru the sesion , when I try to use the $valid_user it works fine (i.e. I am able to access the value) throughout the session, however when I try to use the other two registered session variables i.e firstname and lastname, I am not able to extract the value. Can you suggest what might be going wrong. Note I am locally testing the setup on my Mac. Many Thanks Pushpinder Singh Garcha _ Web Architect -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help : I need modify a the header information in a JPEG image file
--- Patricio Vera S. [EMAIL PROTECTED] wrote: I new to the php world ant the image too, and I need modify the header information in a JPEG image file, is that possibly? How? Those are EXIF headers. I am not sure if there is support for modifying them (aside from doing it manually yourself), but there are some functions that help you read them. Rasmus mentions this in his presentations: http://talks.php.net/show/oscon2002/46 Hopefully that can get you started. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help : I need modify a the header information in a JPEG image file
--- Chris Shiflett [EMAIL PROTECTED] wrote: --- Patricio Vera S. [EMAIL PROTECTED] wrote: I new to the php world ant the image too, and I need modify the header information in a JPEG image file, is that possibly? How? Those are EXIF headers. I am not sure if there is support for modifying them (aside from doing it manually yourself), but there are some functions that help you read them. Rasmus mentions this in his presentations: http://talks.php.net/show/oscon2002/46 Hopefully that can get you started. After looking into it further, I think the EXIF headers may only exist in jpeg images from digital cameras, so I'm not sure if the information I gave will help any. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple entry forms !!
hi looking for some advice I have a site in progress. user to it have to enter a LOT of information (it will contain a club directory) in order to try and make it a less unpleasant experience for the user, I want to give them 7 smaller input forms, each one following the other what would be the correct way to do this, one very large, complex coded php conditional form that does everything, or several smaller ones ? if I use one form, it will conatin rather a lot of code, but execution would all be handled by the form itself but if I use multiple smaller forms, each form would need to process the previous forms input, and then display it's inputs for entry I am also using sessions, which adds a little to complexity any general good coding practice tips/links would be helpful thanks _scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output of fread() is blank
Hello, I'm a recent convert from CGI/Perl and so am still getting my feet wet in PHP. Here's my code: $filename = http://www.myserver.com/include/sometext.txt;; $handle = fopen ($filename, rb); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo $contents; exit; The problem is nothing shows up, it's a blank browser window. I'm sure this is a stupid questions and very easily fixed. Also, if the text file I'm trying to read is multi lined, shouldnt I be placing the contents into an array? or is that old cgi habits coming through? Thanks, Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multiple entry forms !!
Use several smaller forms and store the results of each into a session variable. Also store a got-results-for-form-1 (through 7) that gets set for each of the 7 forms. Once all 7 are set you can do the final processing. Set the action of each form to say save.php and pass in a saving_what field. save.php can then do a switch on the saving_what field to determine what needs checking/storing/etc. Works good for me. On Mon, 27 Jan 2003, scott wrote: hi looking for some advice I have a site in progress. user to it have to enter a LOT of information (it will contain a club directory) in order to try and make it a less unpleasant experience for the user, I want to give them 7 smaller input forms, each one following the other what would be the correct way to do this, one very large, complex coded php conditional form that does everything, or several smaller ones ? if I use one form, it will conatin rather a lot of code, but execution would all be handled by the form itself but if I use multiple smaller forms, each form would need to process the previous forms input, and then display it's inputs for entry I am also using sessions, which adds a little to complexity any general good coding practice tips/links would be helpful thanks _scott -- 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] output of fread() is blank
Hello, The PHP manual page for filesize (http://www.php.net/manual/en/function.filesize.php) mentions that it will not work on remote files. fread will stop once n number of bytes are read or EOF is received so you could set this to the maximum file size (in bytes) that you want to download. Jason On Mon, 2003-01-27 at 16:27, Guru Geek wrote: Hello, I'm a recent convert from CGI/Perl and so am still getting my feet wet in PHP. Here's my code: $filename = http://www.myserver.com/include/sometext.txt;; $handle = fopen ($filename, rb); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo $contents; exit; The problem is nothing shows up, it's a blank browser window. I'm sure this is a stupid questions and very easily fixed. Also, if the text file I'm trying to read is multi lined, shouldnt I be placing the contents into an array? or is that old cgi habits coming through? Thanks, Roger -- 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: output of fread() is blank
I could be wrong, but I'd guess that filesize fails for remote files. If all you're doing is spitting out the text, why not use readfile()? -philip On Mon, 27 Jan 2003, Guru Geek wrote: Hello, I'm a recent convert from CGI/Perl and so am still getting my feet wet in PHP. Here's my code: $filename = http://www.myserver.com/include/sometext.txt;; $handle = fopen ($filename, rb); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo $contents; exit; The problem is nothing shows up, it's a blank browser window. I'm sure this is a stupid questions and very easily fixed. Also, if the text file I'm trying to read is multi lined, shouldnt I be placing the contents into an array? or is that old cgi habits coming through? Thanks, Roger -- 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] output of fread() is blank
On Mon, 27 Jan 2003, Guru Geek wrote: Hello, I'm a recent convert from CGI/Perl and so am still getting my feet wet in PHP. Here's my code: $filename = http://www.myserver.com/include/sometext.txt;; $handle = fopen ($filename, rb); $contents = fread ($handle, filesize ($filename)); [snip] See: http://www.php.net/filesize You cannot use it with urls. Also if you can help it, don't go through http like this. But anyway, see also: file(), fgets(), and include() Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone?? file uploads received, but mangled
Hi all. Last try -- I know there's a lot of noise in this group, but could someone please offer an opinion? Is the following possible to work around, or is it a bug that I should be reporting? I'm having issues uploading files whose names don't necessarily end with the correct extension, in particular plain text files which don't end in .txt. (Why they don't is complicated, and it's impractical to insist that they must.) The files are received, but altered -- they are prepended with garbage data which makes them difficult to deal with in an elegant automated way, which is the whole point. No doubt this is a mime type issue, as the files are received as type application/x-macbinary when sent from OSX IE (its best guess, I suppose). Is there any way to force plain text, or raw data? All I want to happen is for the files to be uploaded completely unchanged. Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on OpenBSD. Thanks, Alex [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail () format
I have a number of field entries that I am trying to send through to the body of an email. How can I format the mail() command to send these multiple fields. EG $name, $address, $comments. All to go into the body of an email. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail () format
Something like... $body = blah blah blah\n; $body .= Name = $name\n; $body .= Address = $address\n; $body .= Comments = $comments\n; mail([EMAIL PROTECTED], subject, $body); would do it. On Tue, 28 Jan 2003, Bruce Levick wrote: I have a number of field entries that I am trying to send through to the body of an email. How can I format the mail() command to send these multiple fields. EG $name, $address, $comments. All to go into the body of an email. Cheers -- 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] output of fread() is blank - FIXED
Here's my code now: $filename = /usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt; $handle = fopen ($filename, r); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo readfile($filename); exit; now it displays the contents of the text.txt file. I originally had just /include/text.txt but it told me no such file existed. But once I added the root directory stuff in front of that, it works. I'm having a similar problem getting smarty to run, it keeps telling me that it can't find index.tpl and now I think I know what the problem is... Thanks to everyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP vs Perl for system scripts (non-web)
I have to write a swath of code to manage system-related stuff based on database content. Scripts will be run as root by cron, and determine what they have to do via user interaction and SQL lookups. Functions will include manipulation of system configuration files, legacy text file configs, and some signalling with posix_kill. On some of the machines in question, there won't even be an httpd installed, so I'd be building a php as a standalone binary, and running it with shell magic and a -q option. I've done this kind of stuff in the past in smaller environments, and it seems to work nicely. I'm more comfortable writing stuff in PHP. I use PHP alot more, and I find the resultant code more readable and easier to maintain. Aside from Perl's ubiquity and the dubious advantage of future flexibility by using Perl's DBI interface to talk to different SQL servers (I'm using MySQL at the moment), are there any compelling reasons I should write system stuff in Perl rather than PHP? Thanks. -- Paul Chvostek [EMAIL PROTECTED] Operations / Abuse / Whatever it.canada, hosting and development http://www.it.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] output of fread() is blank - FIXED - updated
Sorry, here is the code now ( I need a nap ) $filename =/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt; $handle = fopen ($filename, r); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo $contents; exit; Guru Geek wrote: Here's my code now: $filename = /usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt; $handle = fopen ($filename, r); $contents = fread ($handle, filesize ($filename)); fclose ($handle); echo readfile($filename); exit; now it displays the contents of the text.txt file. I originally had just /include/text.txt but it told me no such file existed. But once I added the root directory stuff in front of that, it works. I'm having a similar problem getting smarty to run, it keeps telling me that it can't find index.tpl and now I think I know what the problem is... Thanks to everyone -- 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] HELP session cache limiters
I dont know where this came from. The site was working fine, unless someone else on my team made a fix in this file. Any thoughts on this error? Warning: Cannot send session cache limiter - headers already sent (output started at /home/sisource/public_html/stage/administration/config.php:19) in /home/sisource/public_html/stage/administration/phpSecurePages/checklogin.php on line 134 _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php