[PHP] php4apachi.dll
Hi. I just installed a fresh copy a windows 95. I installed winsock 2, apache 1.3.19 and php4. I followed the instructions with the php installation and I booted apache, I got a missing dll error message from apache. I got the impression that it wasn't php4apache.dll that was missing as it was there and http.conf was pointing to it. I can only assume that there is another dll somewhere that is missing. Any ideas? Thank you Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php4apachi.dll
Chris Adams <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On 6 May 2001 05:53:54 -0700, Darren <[EMAIL PROTECTED]> wrote: > > Hi. I just installed a fresh copy a windows 95. I installed winsock 2, > > apache 1.3.19 and php4. I followed the instructions with the php > > installation and I booted apache, I got a missing dll error message from > > apache. I got the impression that it wasn't php4apache.dll that was missing > > as it was there and http.conf was pointing to it. I can only assume that > > there is another dll somewhere that is missing. Any ideas? > > Try running the CGI version of PHP - you should get a nice error saying what > couldn't be loaded. The most common cause of this is due to extensions - either > it can't find the extension itself or, more commonly, the extension needs to > load another DLL and it can't find that. It may help to simply clear out your > php.ini's extension section and see if the problem goes away. > > Chris Hi Chris. I got it working in the end, I just installed both pws and mysql and one of them had the right Dlls Thanks mate :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] custom libraries for php
hello All. I run php 4 for windows on top of apache. how would I write by own bolt on modules for php? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] stream_socket_accept() on an SSL socket
I'm trying to connect to an SSL server, but I keep on getting these errors: - PHP Warning: stream_socket_accept(): SSL operation failed with code 1. OpenSSL Error messages: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol in C:\scripts\bouncer.php on line 273 PHP Warning: stream_socket_accept(): Failed to enable crypto in C:\scripts\bouncer.php on line 273 PHP Warning: stream_socket_accept(): accept failed: The operation completed successfully. in C:\scripts\bouncer.php on line 273 - Line 273: while ($client = stream_socket_accept($srv_socket)) { Over the past few days of searching I've found a lot of people asking a similar thing but without any answers. I've tried the latest PHP snapshot too. Can anyone here give any insight to these errors?? Thanks for any help Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stream_socket_accept() on an SSL socket
Darren wrote: I'm trying to connect to an SSL server, but I keep on getting these errors: - PHP Warning: stream_socket_accept(): SSL operation failed with code 1. OpenSSL Error messages: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol in C:\scripts\bouncer.php on line 273 PHP Warning: stream_socket_accept(): Failed to enable crypto in C:\scripts\bouncer.php on line 273 PHP Warning: stream_socket_accept(): accept failed: The operation completed successfully. in C:\scripts\bouncer.php on line 273 - Line 273: while ($client = stream_socket_accept($srv_socket)) { Over the past few days of searching I've found a lot of people asking a similar thing but without any answers. I've tried the latest PHP snapshot too. Can anyone here give any insight to these errors?? Thanks for any help Darren Ok thanks guys. Turns out the SSL server was messing up, so PHP wasn't at fault here. (It's a bespoke server app, not apache). Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Two very useful PHP functions
This was discussed for PHP6, but eventually decided not to have such a function. Instead, we now have the following:$var = $_GET['var'] ?: 5; Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html 'you'd be able to do something like this: "$foo = $_GET['foo'] ?: 42;" (i.e. if foo is true, $foo will equal 42).' 2009/5/1 Raymond Irving > > Hi Colin and Daniel, > > Thanks for the feedback. > > I know that this functionality can be added to a framework or a stand alone > function but I'm assuming that we would not get the same performance: > > Case 1 > --- > $c = isset($a) ? $a : ''; > // total time = overhead of isset() + overhead of ?: > > Case 2 > --- > $c = myWrapper($a,$b) > // total time = overhead of myWrapper() + overhead of isset() + overhead of > ?: > > Case 3 > --- > $c = ifset($a,$b) > // total time = overhead of ifset() > > > > Best regards > > __ > Raymond Irving > > --- On Thu, 4/30/09, Daniel Brown wrote: > > > From: Daniel Brown > > Subject: Re: [PHP] Two very useful PHP functions > > To: "Raymond Irving" > > Cc: php-general@lists.php.net > > Date: Thursday, April 30, 2009, 11:37 AM > > On Wed, Apr 29, 2009 at 22:32, > > Raymond Irving > > wrote: > > > > > > What do you think? Can they make it into 5.3? > > > > Not when doing the ternary operator that you > > even displayed > > yourself takes up less code and time than a core function > > would. It's > > a good idea, but better handled on the frontend of > > things. You may > > want to consider contributing that to a framework, which is > > where it > > would be more appropriate. > > > > -- > > > > daniel.br...@parasane.net > > || danbr...@php.net > > http://www.parasane.net/ || http://www.pilotpig.net/ > > 50% Off All Shared Hosting Plans at PilotPig: Use Coupon > > DOW1 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] Suppressing X-Return-Path
Has anyone had experience with PHP or a mail server setting the X-Return-Path header on mail sent using PHP's mail() command? Our tests indicate the X-Return-Path is being set to the "sendmail_from" address found in php.ini. Our code definately isn't doing it, as a hello-world mail() example proved. The system is running Win 2K, all current service packs and hot fixes, IIS 5, php 4.2.3 (running as a CGI), and the Zend optimizer 2.0.1. The mail server is Microsoft Exhange Server. Does anyone know why the webserver or mail server would set the X-Return-Path, and if it can be suppressed? Regards, Darren Fehrmann Storefront.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with php.net
Good day, This is a bit off-topic for the list, but, I'm not sure where else I can send this. The "search" function on php.net appears to be broken. One can search through the function list, but any query via "whole site" or "online documentation" returns no results. I tried to send a message to [EMAIL PROTECTED], the address posted on the site for this sort of thing. However, my message eventually bounces back to me, with the php.net qmail deamon stating that it can not confirm that my address was valid. I presume that there is some sort of system that replies to me to confirm that my return address is valid, but this also appears to be broken, as no such e-mail is ever received. If anyone can pass this along, or even suggest where this could be sent, that would be great. This problem has been present for a couple of weeks now, at least. Thanks, Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templates
I'm looking around for some options on using templates with PHP. I've used several Perl solutions in the past, but never tried it in PHP. Digging on the web yields several options so I'd love some thoughts or comments. The real driver is that the basic site design could change over time and I'd like to have the basic HTML in the templates, and the real logic in the PHP code. Thanks in advance, Darren Young -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Templates
That's pretty much what I'm doing today, header page, menu page, content page and a footer. Each of which includes a shared functions file as well via require_once(). Only real problem is keeping track of tables/rows/columns across all the various files. The 'where was that supposed to be...' kind of thing. Here's another one, there's no way to set a cookie after the headers have been sent, true? Any way around this at all or at that point am I best to use session variables and/or hidden fields. I haven't done pure web development in a few years and am trying to catch back up quickly. Any "best practices" assistance would be appreciated. Thanks for the response by the way. /DAY -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 5:22 PM To: Darren Young; [EMAIL PROTECTED] Subject: Re: [PHP] Templates Go for a complex situation if that's what you want, or consider the basics: home.php tag // include('inc/header_html.php'); ?> Welcome to our website! contact.php tag // include('inc/header_html.php'); ?> Contact us: [EMAIL PROTECTED] If you update any code in any of the 3 include files, you will update the entire site's look, feel and actions. It still allows for you to execute unique PHP code either before or after the HTML starts too. Strip your site down to what's common, and what's unique to each page, and see where you go from there. Justin on 14/02/03 10:00 AM, Darren Young ([EMAIL PROTECTED]) wrote: > > I'm looking around for some options on using templates with PHP. I've > used several Perl solutions in the past, but never tried it in PHP. > Digging on the web yields several options so I'd love some thoughts or > comments. The real driver is that the basic site design could change > over time and I'd like to have the basic HTML in the templates, and > the real logic in the PHP code. > > Thanks in advance, > > Darren Young > -- 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] Calendar
Check http://www.cascade.org.uk/software/php/calendar/ I've used that one on several sites. -Original Message- From: Jason D. Williard [mailto:[EMAIL PROTECTED] Sent: Saturday, March 01, 2003 4:28 PM To: [EMAIL PROTECTED] Subject: [PHP] Calendar Is there an easy way to create a calendar in PHP, such as a calendar function? All I need is a dynamically created calendar to link to other pages. Jason D. Williard -- 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] RedHat
Does anyone know if the PHP included in RedHat 8.0 has sockets enabled? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RedHat 8.0 MySQL Problem
I have an app that runs just fine on RedHat 7.2 with compiled Apache and PHP along with MySQL binaries installed from MySQL's site. I have a new machine running RedHat 8.0 that is completely "generic", i.e only RedHat Apache, PHP and MySQL RPM's installed. The error message I'm getting is: [04-Mar-2003 23:38:46] PHP Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/zzmysql.php on line 49 That's in the app log file by the way, we all the errors there. The page displayed is completely blank at the moment in time the error fires. Persistent MySQL connections are disabled in the RedHat RPM's? RPM's installed are currently (via rpm -qa): httpd-2.0.40-11 php-devel-4.2.2-8.0.7 php-imap-4.2.2-8.0.7 php-odbc-4.2.2-8.0.7 php-snmp-4.2.2-8.0.7 php-ldap-4.2.2-8.0.7 php-pgsql-4.2.2-8.0.7 php-4.2.2-8.0.7 php-manual-4.2.2-8.0.7 php-mysql-4.2.2-8.0.7 I'd really like to keep the RedHat install generic and would prefer no compile from source for this app. The onIy other change I've made is to copy the php.ini from the 7.2 machine over to /etc/php.ini to get the config the same. If I restore the original php.ini back the page displays but the app just does not work. It seems as though the mysql functions just don't work quite right. Thoughts would be most appreciated. thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SOAP
Is there any way to act as a SOAP client with PHP other than with pear? Thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] web services
I seem to remember reading somewhere about compiling PHP pages to 'bytecode' thus removing the need to distribute the source PHP pages. I'm going to have the need down the road to distribute a PHP based app to others and am curious about the same "hiding code" issues. I'm not all that worried about people "stealing" code, but more making local modifications when they're not supposed to. I know I could simply protect the pages on the *NIX machines via decent file system permissions except that the local admin has the root password. Is there some type of bytecode compiler/interpreter combo for the PHP engine? Either free or commercially available? > -Original Message- > From: Steve Magruder [mailto:[EMAIL PROTECTED] > Sent: Friday, March 21, 2003 9:07 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] web services > > > "David Otton" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] > > On Fri, 21 Mar 2003 22:49:05 +0100, you wrote: > > > > >I am currently trying to understand how to place content on a > > >different > site > > >without giving away my code. SOAP seems to be the solution. I am > absolutly > > > > First off, I have to say this is a social problem, not a technical > > one. If you're worried about the theft of your code (and, to be > > honest, most code is worthless anyway), tackle it with a > contract, not > > a hack. > > Too many people use contracts like toilet paper... just my > experience, for what it's worth. > > Steve > > > > -- > 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] Detailed error message?
I use the set_error_handler and have a local function that dumps that stuff. I then redirect all of that to a log file on disk so the user doesn't have to see it. Check http://www.php.net/manual/en/function.set-error-handler.php There's a whole section in the manual that deals with error handling in some detail. > -Original Message- > From: CF High [mailto:[EMAIL PROTECTED] > Sent: Friday, March 21, 2003 12:46 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Detailed error message? > > > Hey all. > > I'm having a difficult time adjusting my php.ini file to > display detailed error messages in my local testing environment. > > For example, when a query returns an error, I do not get the > line # where the error occurred or really any info other than: > > "Query not executed. Unknown column 'Array' in 'where clause'" > > How can I get a full error report; i.e. file where error > occurred; the line number, etc. > > Thanks for any help, > > --Noah > > -- > > > > > -- > 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] Sessions question
It's a "session" cookie, the browser clears it when it's closed. IIRC you set the time to 0 to turn the cookie into a session one. Not sure how it'll work with sessions though. > -Original Message- > From: Justin French [mailto:[EMAIL PROTECTED] > Sent: Friday, March 21, 2003 9:59 AM > To: Beauford.2002; PHP General > Subject: Re: [PHP] Sessions question > > > I think it's defined as "when the browser is closed", not > "when the browser is no longer in your domain" -- but you'd > have to ask an expert or read the specs to be sure. > > Justin > > > on 22/03/03 2:27 AM, Beauford.2002 ([EMAIL PROTECTED]) wrote: > > > What about cookies - someone said if you put no time limit > on a cookie > > it dies when you leave the site - I'm not sure about this, but any > > help is appreciated. > > > > > > - Original Message - > > From: "Justin French" <[EMAIL PROTECTED]> > > To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" > > <[EMAIL PROTECTED]> > > Sent: Friday, March 21, 2003 2:46 AM > > Subject: Re: [PHP] Sessions question > > > > > >> on 21/03/03 4:57 PM, Beauford.2002 > ([EMAIL PROTECTED]) wrote: > >> > >>> I have read some posts to this list on sessions and have read as > >>> much as > > I > >>> can find on them, but one problem still exists which I > can't figure > >>> out. > > How > >>> do I kill the session when the user leaves my site. So if > a user is > >>> on www.mine.com and logs in successfully, then goes to > www.hers.com > >>> - the > > user > >>> should have to log in again once coming back to > www.mine.com, but at > > present > >>> the user is still logged in - and all variables are still set. > >> > >> How can PHP possibly tell when the user closes a window, > or manually > > enters > >> a new URL into the browser? > >> > >> It can't because PHP is only server side. > >> > >> Set the appropriate session max lifetime and garbage clean out > > probability, > >> and sessions should die within a reasonable time of not being used > >> (see php.ini for more info). > >> > >> Or, present the user with a logout link, to be sure the session is > >> killed instantly. > >> > >> You can also do some *extra* insurance by creating a javascript > >> pop-up triggered on a window close event which forces a > log out, but > >> this will > > only > >> help in some cases, and more to the point, client-side scripting > >> cannot be relied upon. > >> > >> If you want to kill sessions as people click on external > links within > >> your site, you can do so by creating a middle-man script > between your > >> page and the external site: > >> > >> Instead of > >> click you would do this: > >> > >> href='out.php?url=http://newsite.com')?>'>click > >> > >> out.php would be responsible for killing the session before doing a > > header() > >> redirect to the target url. > >> > >> > >> But, end of the day, all these are work-arounds. Offer a > logout link > >> on every page of your site. If the user chooses not to > logout, then > >> they are consciously making this decision -- they may want to come > >> back shortly, or they may not care about the security > implications -- > >> either way, it's > > their > >> call. > >> > >> > >> Justin > >> > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > > --- > > [This E-mail scanned for viruses] > > > > > > > -- > 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] mcrypt
Good day, > i started using crypt() > > then changed to mcrypt() > > which was not any good cause of the high ascii characters > > then i read about converting the high ascii characters to hex . > > Is this the ideal way to encrypt passwords or is their > something better. The crypt() function will generate a standard UNIX crypt password that other programs can understand. UNIX crypt has some limitations (only using the first 8 characters is the major one) but it's good enough for most people and is probably the most widely supported. If you want something stronger, you can use md5(). The examples on php's documentation for this function should help you if you're interested in having other programs use it (to have it the right format and length). Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Agh! trim (#$@#@^%!!!)
Good day, Well, for one, you are discarding the results of trim(). Check out the online manual page for trim(). The trim'ed string is returned. It does not say it modifies the string it is passed. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: Mike At Spy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 21, 2002 7:12 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Agh! trim (#$@#@^%!!!) > > > > Here is the complete code - I have a lot of prints to watch > things as they > happen. $whois is the result of a WHOIS search. > > > > // beginning of my stuff > > function get_date ($whois){ > trim ($whois); > $whoisarray = explode ("\n", $whois); > print_r(array_values ($whoisarray)); > > $total_elements = count ($whoisarray); > > print "$total_elements elements in this array"; > > $ce = 0; > > while ($ce < $total_elements){ > > $single_line = array_pop ($whoisarray); > > $expiration = strstr ($single_line,"xpires"); > > if ($expiration != '' || 0) { > > print "This is the line you want! Line $ce that sez: > $single_line"; > > // $single_line = preg_replace (".", " ", $single_line); > > $single_line = substr($single_line, 0, -2); > > // $single_line = rtrim ($single_line," \t\s\n\r"); > > $getdatearray = explode (" ", $single_line); > print_r(array_values ($getdatearray)); > > $total_expire_elements = count ($getdatearray); > > print "".$total_expire_elements; > > $dc = 0; > > while ($dc < $total_expire_elements){ > > $element = array_pop($getdatearray); > > $date_dash = strstr($element,"-"); > > if ($date_dash != '' || 0){ > > print "First Detection > ".$element; > > // $trimmed = rtrim ($element," \t."); > > print "Last print before > date function ".$element; > > month_replace ($element); > > print "Result after function > ".$element.""; > > $MySQLDate=date_validate($element); > if (substr($MySQLDate, 0, 5)=="Error") { > // Insert Error Code if you want > } else { > // Insert Valid Date Code if you want > } > > print "The MySQL Formated date is > $MySQLDate"; > > > } > else {} > > $dc++; > >} > > > } > else {} > > $ce++; > > } > > } > // end of my stuff > > > Thanks, > > -Mike > > > > > > > > -Original Message- > > From: Jason Wong [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, August 21, 2002 8:53 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Agh! trim (#$@#@^%!!!) > > > > > > On Wednesday 21 August 2002 20:36, Mike At Spy wrote: > > > Get this - it didn't work! :( > > > > > > I tried decreasing the -1 to -2 and so on, but nothing on that > > either. :( > > > > Post your exact code which didn't work. > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications > Development * > > > > /* > > You can't go home again, unless you set $HOME. > > */ > > > > > > -- > > 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] new PHP chat room (with Flash interface)
here's a chat room that I made in PHP/MySQL with a Flash 5 front-end. All the other PHP chat rooms that I've found have an annoying "click" every few seconds when the webpage is refreshed. http://www.tufat.com/chat/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP socket connections with SSL
Good day, I'm trying to create a PHP app to connect to a remote port that uses SSL. According to the documentation for fsockopen() ... As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host. I don't see a 4.3.0 version available for download. The CVS changelog refers to a 4_3 branch someplace, so I presume I could get this feature by compiling from CVS, but there are a number of other applications that upgrading could break so I'd like to try to avoid using CVS if possible. Is there any other way to do this via PHP, other than calling stunnel via a shell command and using fsockopen to the unencrypted endpoint? I have Googled and searched though the PHP site, but I haven't come up with anything else. I don't need to supply a client certificate, if that helps any... Thanks in advance, Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Images retrieved from MYSQL database using PHP becoming corrupted.
I have spent the last 3 days trying to figure this out. And will probably give up very soon. I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:- I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge). When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !! Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok. Store binary data into SQL Database This file has the following Database ID: $id"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> File to upload/store in database: Here is the code to display the image:- MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image_thumbnail"); $type = @MYSQL_RESULT($result,0,"image_thumbnail_type"); Header( "Content-type: $type"); echo $data; }; ?> I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id primary key field for whichever record I want to display. I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like) For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections. Darren. CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '-00-00 00:00:00', item_datemodified DATETIME DEFAULT '-00-00 00:00:00', category ENUM ("none","single herbs","general vitality","ageing","arthritis","eyesite","prostate","ahlzheimers", "weight loss","menopause","depression","fatigue","headaches","insomnia","colds and flues","allergies", "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for women","for men","books"), name VARCHAR (30), name_dateadded DATETIME DEFAULT '-00-00 00:00:00', name_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_name (name), desc_brief VARCHAR (255), desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_desc_brief (desc_brief), desc_long TEXT, desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00', price DECIMAL (7,2), price_dateadded DATETIME DEFAULT '-00-00 00:00:00', price_datemodified DATETIME DEFAULT '-00-00 00:00:00', image LONGBLOB, image_name VARCHAR (50), image_size INT UNSIGNED, image_type VARCHAR (50), image_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_datemodified DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail LONGBLOB, image_thumbnail_name VARCHAR (50), image_thumbnail_size INT UNSIGNED, image_thumbnail_type VARCHAR (50), image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail_datemodified DATETIME DEFAULT '-00-00 00:00:00' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MYSQL and PHP Storing and retrieving images getting corrupted
I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:- I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge). When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !! Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok. Store binary data into SQL Database This file has the following Database ID: $id"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> File to upload/store in database: Here is the code to display the image:- MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image_thumbnail"); $type = @MYSQL_RESULT($result,0,"image_thumbnail_type"); Header( "Content-type: $type"); echo $data; }; ?> I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id primary key field for whichever record I want to display. I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like) For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections. Darren. CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '-00-00 00:00:00', item_datemodified DATETIME DEFAULT '-00-00 00:00:00', category ENUM ("none","single herbs","general vitality","ageing","arthritis","eyesite","prostate","ahlzheimers", "weight loss","menopause","depression","fatigue","headaches","insomnia","colds and flues","allergies", "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for women","for men","books"), name VARCHAR (30), name_dateadded DATETIME DEFAULT '-00-00 00:00:00', name_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_name (name), desc_brief VARCHAR (255), desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_desc_brief (desc_brief), desc_long TEXT, desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00', price DECIMAL (7,2), price_dateadded DATETIME DEFAULT '-00-00 00:00:00', price_datemodified DATETIME DEFAULT '-00-00 00:00:00', image LONGBLOB, image_name VARCHAR (50), image_size INT UNSIGNED, image_type VARCHAR (50), image_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_datemodified DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail LONGBLOB, image_thumbnail_name VARCHAR (50), image_thumbnail_size INT UNSIGNED, image_thumbnail_type VARCHAR (50), image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail_datemodified DATETIME DEFAULT '-00-00 00:00:00' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Query to select every other record
Does anybody know of a SELECT QUERY that will select every other record of a table ? I want to do this so that I can display my products in 2 columns (I will also be using arrays of course). The first column would show the result of the first query starting at record 1. The second column would show the result of the second query starting at record 2. Each query just needs to skip a record so that products are ordered correctly (1,2 in first row. 3,4 in second row...) And I want the query to work without relying on ID fields. The reason being is that when you delete a record, you can end up with a column ID of say 1,2,3,5 (like if you delete record 4). Originally, I set up my tables up using Dreamweaver with repeat regions. But that's only ok if you want one record per row going down vertically. The Macromedia web site does show you how to display all your records repeating horizontally but doesn't tell you how to limit to 2 columns. So both ways are useless to me. Darren. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Browser
I'm looking for some type of file storage / browsing script to park on an Intranet site. I need to have people log in and be presented with a listing of files stored on the server along with other info such as dates/times, description, author and perhaps some versioning abilities. The files themselves should be stored on disk and the "metadata" about the files inside a database (MySQL preferred but Postgres is OK). All the db should house is a "pointer" to the path of the file on the server's disk. I'd like them to be categorized by topic or subject area (network, sales, finance, etc) and have some type of search interface to locate them. If general users can have the ability to upload it would be nice if there were some type of permissioning on who can view/edit/save docs back to the server/database. If it could have some type of version control (CVS preferred) that would be wonderful. Anyone have any pointers to existing scripts? What would this type of application be called? A document repository perhaps? Thanks in advance, Darren Young [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert MySQL table into Access or Excell format
I seem to remember some Windows application that will do the conversion for you. I believe it's called mysql2access and the other way is access2mysql. IIRC, it's not open/free though. On Sat, 13 Jul 2002, Alex Shi wrote: > The thing is that, the MySQL table resides on a remote web server, my client > want to download it and access it in Access. > > Alex > > > You can also use ODBC (Ships with Acess) to make a DSN connection to > MySQL. > > Access can retrieve data from any ODBC DSN. > > > > Jason White > > > > - Original Message - > > From: "Jason Wong" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, July 12, 2002 9:48 PM > > Subject: Re: [PHP] Convert MySQL table into Access or Excell format > > > > > > > On Saturday 13 July 2002 06:48, Alex Shi wrote: > > > > Hello, > > > > > > > > My client has a website and it support MySQL/PHP. The client want > > > > to download the MySQL tables and then access them in Excell or > > > > Access. So my question is, is it possible to convert MySQL table into > > > > Access or Excell format? Thanks in advance for all answer! > > > > > > archives -> "mysql excel" > > > > > > -- > > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > Open Source Software Systems Integrators > > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > > > /* > > > After years of research, scientists recently reported that there is, > > > indeed, arroz in Spanish Harlem. > > > */ > > > > > > > > > -- > > > 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] Convert MySQL table into Access or Excell format
Tunnel port 3306 over an SSH connection if you can get an SSH session to open to the remote. On Sat, 13 Jul 2002, Alex Shi wrote: > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > On Saturday 13 July 2002 13:31, Alex Shi wrote: > > > The thing is that, the MySQL table resides on a remote web server, my > > > client want to download it and access it in Access. > > > > Doesn't matter, ODBC works across a network. > > But what can we do if the ISP closed 3306 port on their firewall? > > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > The young lady had an unusual list, > > Linked in part to a structural weakness. > > She set no preconditions. > > */ > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there a way?
Good day, > In Perl you could print a block of information as it was > written like this; > print < > This a whole bunch of HTML code!!! > > HTML_END > > The best part about this, was that you did not have to escape > your " and you > could mix in your variables making it easy to design and > layout the HTML. Is > there a similiar way to do this in PHP? Yeppers. It's lmost the same. echo <
[PHP] Problems with imagecreatefromjpeg ?
Good day, I'm having a problem working with an image that I've made with imagecreatefromjpeg. Here's the code: $in_file = "IMG_0050.jpg"; echo "Testing for image ".$in_file."\n"; $image = imagecreatefromjpeg($in_file) || die("Failed to create image from file. \n"); echo "Resource ID: ".$image."\n"; echo "Image width: ".imagesx($image)."\n"; It reads in the file OK and prints out "1" as the Resource ID, as expected. However, imagesx fails with: imagesx(): supplied argument is not a valid Image resource in on line 9 The resource ID was returned from imagecreatefromjpeg, so, I have no idea why it's "not valid". The image in question displays fine in Mozilla, etc, if that matters at all- and it's also a fairly large image, if that matters at all too. Other PHP functions that work with the image resource fail in the same way. This is on 4.3.3 / FreeBSD 5.1, built from the ports collection . I have also tried this on Red Hat 9, with a similar failure. Here's my phpinfo()'s configure: './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all' '--with-regex=php' '--disable-cli' '--with-apxs2=/usr/local/sbin/apxs' '--with-bz2=/usr' '--enable-calendar' '--enable-ctype' '--with-curl=/usr/local' '--enable-dba' '--with-dom=/usr/local' '--with-dom-xslt=/usr/local' '--with-dom-exslt=/usr/local' '--enable-exif' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-xpm-dir=/usr/local' '--with-gdbm=/usr/local' '--with-gettext=/usr/local' '--with-iconv=/usr/local' '--with-imap=/usr/local' '--with-imap-ssl=/usr/local' '--with-inifile' '--enable-mbstring' '--enable-mbregex' '--with-mcal=/usr/local' '--with-mcrypt=/usr/local' '--with-mhash=/usr/local' '--with-mime-magic=/usr/share/misc/magic.mime' '--with-mysql=/usr/local' '--with-ncurses=/usr' '--with-ldap=/usr/local' '--with-openssl=/usr' '--enable-overload' '--with-pcre-regex=yes' '--enable-posix' '--with-pspell=/usr/local' '--with-readline' '--enable-session' '--enable-sockets' '--enable-tokenizer' '--enable-xml' '--with-expat-dir=/usr/local' '--with-xmlrpc' '--enable-xslt' '--with-xslt-sablot=/usr/local' '--with-zip=/usr/local' '--with-zlib=yes' '--prefix=/usr/local' 'i386-portbld-freebsd5.1' I have a feeling that I am missing something simple, but I don't know what it could be. I didn't find anything in the mailing list archives, and Googling for the error message just shows pages and pages of actual broken web pages. Thanks in advance for any help, Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with INSERT query
I recently downloaded a phpDownload app. I'm having problems with it and can not reach the creator of this app. The INSERT query from the Admin portion of this app will not insert the info passed from a form. Can someone offer any help with this? Here is a portion of the code: } else { // Insert new entry $query = "INSERT INTO Downloads (Name, Description, FileSize, FileName, DownloadCount, Category, Redirect) VALUES ('"; $query .= addslashes($Name) . "','" . addslashes($Description) . "'," . $FileSize . ",'" . addslashes($FileName) . "'," . $DownloadCount . "," . $Categories . ",'" . addslashes($Redirect) ."')"; } Darren Evans Senior Site Coordinator www.bombs-away.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help with INSERT query
""Thor M. Steindorsson"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Some of your single quotes between values are missing (the . "','" . ), > messing up the query. > However it would probably be easier to do the addslashes() beforeyou do the > query so you don't have to break the query up like that. > > So I'd do it like this: Thank you VERY much Thor! It worked like a charm! :o) Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] cURL library and auto-loggin to a site
Does anyone know if it is possible to use PHP and cURL to auto-login into a site (which sets a cookie) and then fill in a form to send an sms message? I need to do this to test a site automatically and check response times for sending the SMS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Newbie: Can't find function error.
Hi Guys, Newbie to the list and the world of PHP. I'm having a LOT of trouble getting PHP to work. The PHP and Apache installs have gone well as evidenced by: # ./httpd -l Compiled-in modules: http_core.c mod_env.c mod_log_config.c mod_mime.c mod_negotiation.c mod_status.c mod_info.c mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_asis.c mod_imap.c mod_actions.c mod_userdir.c mod_alias.c mod_access.c mod_auth.c mod_so.c mod_setenvif.c mod_ssl.c mod_php4.c mod_perl.c And httpd.conf has the handlers for php3 and php but whenever I browse to a test php3 file it says: Fatal error: Call to undefined function: php_info() in test.php3 on line 1 The file looks like: Any ideas on what i should be looking at or for? Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Newbie: Can't find function error.
Thanks to all who replied, that works fine although only as extenmsion php and not php3 but I'll sort that out. A second follow up question is where I should place the ini file to change environment variables? What I've read doesn't work :( Darren -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 06, 2001 7:57 PM To: Darren Ward; [EMAIL PROTECTED] Subject: Re: [PHP] Newbie: Can't find function error. Addressed to: Darren Ward <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Darren Ward <[EMAIL PROTECTED]> Tue, 6 Mar 2001 18:17:11 +1100 > > Hi Guys, > > Newbie to the list and the world of PHP. > > I'm having a LOT of trouble getting PHP to work. > > The PHP and Apache installs have gone well as evidenced by: > > # ./httpd -l > Compiled-in modules: > http_core.c > mod_env.c > mod_log_config.c > mod_mime.c > mod_negotiation.c > mod_status.c > mod_info.c > mod_include.c > mod_autoindex.c > mod_dir.c > mod_cgi.c > mod_asis.c > mod_imap.c > mod_actions.c > mod_userdir.c > mod_alias.c > mod_access.c > mod_auth.c > mod_so.c > mod_setenvif.c > mod_ssl.c > mod_php4.c > mod_perl.c > > And httpd.conf has the handlers for php3 and php but whenever I browse to a > test php3 file it says: > > Fatal error: Call to undefined function: php_info() in test.php3 on line 1 > > The file looks like: > > Try: Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] php vs php3 weirdness
Hi All, Can anyone think of a reason that php files would work but anything named php3 would attempt to download? Another wierd thing is that test.php3?mode=phpinfo works but test.php3 does not (but should) If you rename test.php3 to test.php it does work. httpd.conf section: AddType application/x-httpd-php-source .phps AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .phtml Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] WDDX Deserialisation problem/bug?
Hi I'm using wddx_deserialize($packet) and what I'm getting returned does not seem right in the slightest my code is: $values = wddx_deserialize($packet); Packet: Senior Legal AdviserHead of Litigationblah blah blahblah blah blah234236< /data> when I run wddx_deserialize on my packet, I'm getting a string with the contents "Senior Legal Adviser" i.e. the first value of the first field I was expecting a nice associative array, what am I doing wrong? FWIW the packet is coming through fine regs -- Darren Beale Web Developer Vardus Ltd - www.vardus.com +44 (0) 20 7471 8899 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Possible bug: Using "h" and "H" with unpack()
Good day, I can not seem to get the "h" or "H" options to work at all with unpack(). I'm pretty sure that I have this right, although the documentation for this function is bit sparse. The code: print "The data has been encoded (".strlen($varbind)." bytes in size)."; print "Hex: "; $hex_unpacked = unpack( "H*" , $varbind ); for ( $i=1 ; $i <= sizeof($hex_unpacked) ; $i++) { print $hex_unpacked[$i] . "|"; } print "\n". sizeof($hex_unpacked) . " elements unpacked.\n"; print "\n"; prints out: The data has been encoded (20 bytes in size).Hex: | 1 elements unpacked. .. for the sample binary string. If I use "C*" instead of "H*" (to print out characters instead of hex strings) then I get the expected result: The data has been encoded (20 bytes in size).Hex: 6|49|0|2|52|0|0|0|0|48|57|6|49|0|2|52|0|0|0|0| 20 elements unpacked. Now, I can work around this problem by combining sprintf with the "C*" format to format the characters into hex strings. But, if this is a bug then it should be addressed. Alternatively, if unpack() isn't supposed to support all of the options of pack() (such as "H" and "h") then the documentation should state which options it can support. Is this a bug, or have I just missed something? Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] sql question
Good day, This isn't a PHP question, but hey... This is dependant on the database platform that you're using. The suggested statement would work on MySQL. On Informix, for example, you would say 'where lit_source matches "c*" '. You should consult your database manual for more information. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Janet Valade [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 3:04 PM To: Wolf-Dietrich von Loeffelholz; [EMAIL PROTECTED] Subject: Re: [PHP] sql question select * from tbl_lit where lit_source like "c%" Janet - Original Message - From: "Wolf-Dietrich von Loeffelholz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 15, 2002 12:09 PM Subject: [PHP] sql question i want that a select query display me all words beginning with an a .. like select * from tbl_lit where lit_source = 'c*' .. thnx bSue -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] bug in echo function?
Good day, The reason that the first statement doesn't work as intended is due to the order that the operands are processed. The operands in the line: "" . ($i*8)+$j . "" are being processed like this: ("" . ($i*8))+($j . "") If you change the line to: "" . (($i*8)+$j) . "" then you'll get the desired result. Rule of thumb: Use parenthesis whenever you have a complex operation to ensure the result is what you want. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Billy Harvey [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 11:44 AM To: php Subject: [PHP] bug in echo function? I ran across a curious bug in the echo function this morning. My PHP is Debian binary 4.1.1-1. The first example below does not work (it should draw a checkerboard-like table): - Chess "; for ($j=0 ; $j<8 ; $j++) { echo "" . ($i*8)+$j . ""; } echo "\n"; } ?> - However, by changing the echo line to two echo lines, it works as desired: - Chess "; for ($j=0 ; $j<8 ; $j++) { echo ""; echo ($i*8)+$j . ""; } echo "\n"; } ?> - I don't see any limitations about concatenating strings in the man page of the echo statement. Perhaps this is a bug? Billy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] bug in echo function?
Good day, No, that's not it. It's just a simple matter of order of operations. You have an expression- that expression needs to be evaluated into one thing, and that one thing is then passed to echo() as the single argument. I'm not a php expert, but evidently the "." operator is evaluated before the "*" operator, which in turn is evaluated before the "+" operator. Perhaps it would be easier to understand if you thought of the "." operator like the exponent operator in math- it is evaluated before "*" or "+" is. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Billy Harvey [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 12:07 PM To: Darren Gamble Cc: php Subject: RE: [PHP] bug in echo function? On Fri, 2002-01-18 at 13:54, Darren Gamble wrote: > Good day, > > The reason that the first statement doesn't work as intended is due to the > order that the operands are processed. > > The operands in the line: > > "" . ($i*8)+$j . "" > > are being processed like this: > > ("" . ($i*8))+($j . "") > > If you change the line to: > > "" . (($i*8)+$j) . "" > > then you'll get the desired result. > > Rule of thumb: Use parenthesis whenever you have a complex operation to > ensure the result is what you want. Hmmm - so my assumption that the concatenation operator between the strings gives them a delination equivalent to listing this as three separate echo statements is incorrect, I take it. Shouldn't the echo function process it in this manner from a standpoint of consistency? Thanks for the clarification. Billy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] how to send to URL on if statement?
Good day, I've had to do something similar to this. I do not think there is a way to do this with only HTML- you either need to use a header like the one shown, or a META tag, and they have to be written right away. I worked around this once with Javascript. The page had an ONLOAD function that would look on the page for a URL (stored as a hidden input element) and then try to go there if the input element had any data in it. This works nicely since you don't actually have to write this data with PHP until you're ready to close your tag. Then, when the page is loaded, the ONLOAD triggers and does its work. I don't have the code on me, but this should be a good enough push in the right direction. Hope this helps, ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Andrea Caldwell [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 2:19 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] how to send to URL on if statement? Sorry, I'm new at this... I have already sent output... any way to do this? Thanks again, Andrea "Ing. Daniel Manrique" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Can anyone advise or direct me to the documentation that references how to > > send a user to a URL if an 'if' statement is satisfied? > > Assuming you hadn't sent any output before: > > if ($condition){ > header("Location: http://wherever.com";); > exit; > } > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] RTFM
Good day, I would agree that there certainly are some questions that deserve a bit more thought before they are posted to the list. Witness, for example, posters who respond to their own question 10 minutes later with "Never mind, I solved it". However, I don't think anyone is in a position to say whether a question is stupid or not. Sometimes there is a simple way to do something, but it escapes the poster who is otherwise a good programmer. Or, sometimes, it's just because other readers don't read the question properly, and think it's a lot simpler than it really is. I know I, on _many_ occasions, have posted "I need to do foo, and A won't work because X, and B would be too much overhead because Y" and have people answer with my own rejected solution "Do A, you newbie" , obviously without even reading the entirety of the message. With apologies to Bart, I will point out that the question that Bart quoted is a perfectly valid question with non-trivial solutions. The original poster is well aware of how "if" statements work, but that appeared to be lost in Bart's reading. Does using Javascript to redirect a user to another page have to do anything with PHP? In this case ... yes! The situation described by the original poster would be something that only a PHP programmer (or ASP, etc.) would run into, where a user has to make a decision whether or not to redirect a user halfway though a page. Where would be the best place to ask for advice on how to do that? Is this PHP mailing list perhaps not the MOST suitable place for something like that? Yes, for a user to succeed with a programming language it's important that they not use a mailing list as a crutch, and be told to examine the documentation when appropriate (especially documentation as good as it is with PHP). But I, for one, would much rather have a friendly community such as this one to encourage and support the use of PHP for all. My two cents CND (one cent USD). Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Bart Brinkmann [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 3:25 PM To: Andrew; Nick Wilson; [EMAIL PROTECTED] Subject: RE: [PHP] RTFM > no such thing as a stupid question... I strongly disagree. Refer to the topic: "RTFM". A stupid question is one that is posted to this message board before the poster bothers to do a shred of independent thinking. I've seen way too many of these questions come through this list. The MySQL list was about the same. It was more of a bother to read than it was a benefit. This list is about the same quality. Every once in a long while something useful comes along, but unfortunately their burried underneath 100 other postings of lazy newbies asking questions like *scrolls about 10 messages down* "How to send url on if statement". 1) if statements are surely covered on php.net 2) It is not a php-specific question 3) If you don't understand how "if statements" work, use that 8lb mass on your shoulders - RTFM Just my $0.02 USD. /bart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] break statement usage
Good day, Actually, using the "break" statement is the accepted, proper way to break out of a switch statement, just as it is in other programming languages. And yes, the "break" statement can be used to terminate other loops, such as "while" and "for", just like in other languages. Using it there is not considered bad programming practice either, although in the case of the while statement you should try to utilize the loop condition if possible. FYI, the command to break to the next iteration of a loop is "continue". The PHP site has very good documentation on the usage and appropriateness for "switch", "break" and "continue". I would highly recommend you take a look, if you have not already. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 2:11 PM To: PHP Subject: [PHP] break statement usage Hello, all I have a quick question about using the "break" statement from within a switch() statement. After accepting user input from a form, I want to run this input through some error checking via PHP code (not Javascript error checking). So the first thing is the code puts the input through to a couple of error functions (this is all inside of a switch statement that is determined by a radio button on the previous page). If the error functions show the input as invalid, I echo back a specific error-message telling the user which field needs to be fixed, and then "break" to end the case statement. That way the input never comes near the database functions (mysql_query()) if it is invalid input. Is this a poor way to code -- using the "break" as a shortcut to jump out of the switch statement? Are there other ways that "break" can be used -- such as from loops? I've been learning Python on the side, and in that language, the "break" statement is used often, sometimes in a loop like while 1 do some code if condition is true break This is basically an infinite loop until the condition is true -- though I've never seen a WHILE loop in PHP that is formed this way (using a 1 to make it happen infinitely until a condition is met and then BREAKing out of the loop). Usually, at least from what I've seen, PHP WHILE loops are constructed so that they terminate when a condition is met specified immediately after the WHILE, as in: while (x < $number_of_iterations) { do some code } So what I'm wondering is, Is it bad coding practice to make heavy use of "break" statements in switch() flow control? Thank you for your opinions, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mailing to 19000 users
Good day, I've already done this once with Perl and qmail, which was used against about 50,000 users. I'm sure it would not be much different with PHP. All I did was create a program to get the addresses from the DB, and then use what effectively is a wrapper script for qmail-inject (you would use whatever program you use) that would add 500 people to the BCC list at a time and pass the text of the e-mail to the program via a pipe. It was about a 15 minute job. I would recommend it, as it's easy to convert if you have to switch MTAs. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 8:37 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] mailing to 19000 users On Monday 28 January 2002 23:33, Anas Mughal wrote: > I am soon to encounter the problem Mostafa is facing. > Currently, I have written my custom code to mail to > users subscribed to mailing lists on my site. (It is > custom code using PHP, MySQL, Linux cron.) > I was wondering if there is a mailing list system that > could use MySQL to retreive the list of subscribers. > Thanks. If you're using qmail, then ezmlm (or even better ezmlm-idx) can be made to work with MySQL. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Leveraging always beats prototyping. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] browser back button - "Page has Expired.. " problem
Good day, By default, IE will cache these pages (i.e. you won't get this message). If you're receiving that message, it means that the browser doesn't have a cached version of the page. Getting a new version would obviously mean submitting the form information again, which IE, thankfully, doesn't automatically do. It may be that the IE users aren't caching their pages, or the cache is automatically cleaned (had this happen once with users writing onto their profile). Or, it may be that meta tags on the page have instructed the browser not to cache the page, or to quickly expire it. You should check the page source for such headers. I know it is tempting to trash-talk IE, but in this situation, regardless of the problem, most likely the browser is just doing what the user or web page has instructed it to do. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Lee P Reilly [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 3:27 PM To: PHP List Subject: [PHP] browser back button - "Page has Expired.. " problem Hi, I wonder if anyone can offer me a few pointers..? I'm building a portal to do various bits and bobs. I'm using sessions to facilitate the user authentication/login, etc. The only problem I have is that when viewing these (.php) pages in IE once the session variable has been set, a "Warning: Page has Expired " page is displayed whenever the 'Back' button is pressed. This means that the user can only access the page again by hitting 'Refresh' (and therefore posting the form data back & executing whatever scripts again). The rest of IE's error message reads, "The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you." I know from using other web applications (Hotmail is one example), that this doesn't always have to be the case. Is there anyway I can eliminate this security precaution on the *server side* i.e. without telling users to ditch IE ;-) Thanks very much in advance for any advice. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Tables Loading Slow
Good day, As it has been said, this is a function of the browser. You can get around this by not using a large table to render your data. You could use one table per row, with all columns formatted with the same width. You could also try to use containers to store the data, but in my experience only IE supports the "width" style attribute of these. You will also have to ensure that PHP is flushing the output as it displays it. And, you could also optimize your data structure so that the results are returned quicker. =) ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Bryan Gintz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 7:39 AM To: PHP List Subject: [PHP] Tables Loading Slow Hi. I have a large database query that returns anywhere from 10-30ish records. The problem comes from loading them in tables. With IE5 and Netscape 5 on windows, the results do not display until the last tag is written. Does anyone have any ideas on how to show the results as the come from the query? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Installing PHP 4.1.1 on Redhat w/ RPMs
Good day, This isn't strictly a PHP question, but, I am hoping someone on this list has gone through this already and can provide some assistance. I'd like to upgrade to PHP 4.1.1 on our Redhat 7.2 servers, and so I've downloaded all of the PHP RPMs from Rawhide. I would really, really like to do this with RPMs if at all possible. When I go to install, I find out that: error: failed dependencies: libcrypto.so.3 is needed by php-4.1.1-1 OK, no problem so far. I just need to get the new openssl packages. But, after downloading them and adding them to the install list, I then find that libcrypto.so.2 (which would be replaced by libcrypto.so.3) is needed by dozens of packages on the system. I really can't upgrade them all. I am just going from openssl-0.9.6b-8 to openssl-0.9.6c-2 . It appears to me that openssl must have changed the API for their library between an extremely minor version number (is that even supposed to happen?), which is what I think is causing me the problem. I'm not quite sure how to proceed. Has anyone else on the list done this yet? Thanks to all who reply, ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and CGI
Good day, The php file can have whichever extension that you want, provided that the webserver understands which application is associated with which extension. If you want to run a PHP script as a CGI or without the webserver , just install the PHP standalone executable. This is done by default with many RPM packages, and can easily be done with a tarball. To run the script, just put: #!/usr/local/bin/php (or whatever location it's installed into) as the first line of your php script. Your CGI program can run this program like any other shell command and get the results. Also, if the extension is .cgi , your web server should understand that it's a cgi program and exec it appropriately. ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:20 PM To: [EMAIL PROTECTED]; php Subject: Re: [PHP] PHP and CGI That I know, the file with the php code needs to have the extension of .php I absolutely don't know anything about CGI, but could you somehow "include" a .php file in your script? - Original Message - From: "SpyProductions Support Team" <[EMAIL PROTECTED]> To: "hugh danaher" <[EMAIL PROTECTED]>; "php" <[EMAIL PROTECTED]> Sent: Tuesday, February 12, 2002 12:07 PM Subject: RE: [PHP] PHP and CGI > > No, it is in a CGI script. > > And I can't recompile PHP for cgi extensions. :( > > -Mike > > > > -Original Message- > > From: hugh danaher [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 12, 2002 2:43 PM > > To: [EMAIL PROTECTED]; php > > Subject: Re: [PHP] PHP and CGI > > > > > > is your file extension .php? > > hugh > > - Original Message - > > From: "SpyProductions Support Team" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, February 12, 2002 11:25 AM > > Subject: [PHP] PHP and CGI > > > > > > > > > > I did some research in the archives on this, but couldn't come up with a > > > straight answer. > > > > > > I have a CGI script that uses and HTML template/form. I would like to > > embed > > > a PHP script in the template to take some of the values of the > > CGI and put > > > them in a database. I set up the database, wrote the PHP, but now find > > that > > > the CGI script apparently won't recognize my PHP. > > > > > > Anyone have any ideas as to what I need to do? > > > > > > The CGI is a preset thing I can't re-write in PHP (at least for > > now). And > > I > > > don't know much CGI myself. > > > > > > Thanks! > > > > > > -Mike > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and CGI
Good day. That's not a comment. The #! at the start tells the shell to execute that as the interpreter for the script. Are you sure that you typed it in correctly? Did you install the PHP standalone application? Is it installed in that location? Did you set the file as executable? Did you try to run the script? What error did you receive? Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Michael R @ Spy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 2:28 PM To: Darren Gamble; php Subject: RE: [PHP] PHP and CGI I made some time to test, and no dice. The comment doesn't seem to matter. :( Thanks, -Mike > -Original Message- > From: Darren Gamble [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 3:26 PM > To: 'hugh danaher'; [EMAIL PROTECTED]; php > Subject: RE: [PHP] PHP and CGI > > > Good day, > > The php file can have whichever extension that you want, provided that the > webserver understands which application is associated with which > extension. > > If you want to run a PHP script as a CGI or without the webserver , just > install the PHP standalone executable. This is done by default with many > RPM packages, and can easily be done with a tarball. > > To run the script, just put: > > #!/usr/local/bin/php > > (or whatever location it's installed into) as the first line of your php > script. Your CGI program can run this program like any other > shell command > and get the results. > > Also, if the extension is .cgi , your web server should > understand that it's > a cgi program and exec it appropriately. > > > Darren Gamble > Planner, Regional Services > Shaw Cablesystems GP > 630 - 3rd Avenue SW > Calgary, Alberta, Canada > T2P 4L4 > (403) 781-4948 > > > -Original Message- > From: hugh danaher [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 1:20 PM > To: [EMAIL PROTECTED]; php > Subject: Re: [PHP] PHP and CGI > > > That I know, the file with the php code needs to have the > extension of .php > I absolutely don't know anything about CGI, but could you somehow > "include" > a .php file in your script? > - Original Message - > From: "SpyProductions Support Team" <[EMAIL PROTECTED]> > To: "hugh danaher" <[EMAIL PROTECTED]>; "php" > <[EMAIL PROTECTED]> > Sent: Tuesday, February 12, 2002 12:07 PM > Subject: RE: [PHP] PHP and CGI > > > > > > No, it is in a CGI script. > > > > And I can't recompile PHP for cgi extensions. :( > > > > -Mike > > > > > > > -Original Message- > > > From: hugh danaher [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, February 12, 2002 2:43 PM > > > To: [EMAIL PROTECTED]; php > > > Subject: Re: [PHP] PHP and CGI > > > > > > > > > is your file extension .php? > > > hugh > > > - Original Message - > > > From: "SpyProductions Support Team" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, February 12, 2002 11:25 AM > > > Subject: [PHP] PHP and CGI > > > > > > > > > > > > > > I did some research in the archives on this, but couldn't > come up with > a > > > > straight answer. > > > > > > > > I have a CGI script that uses and HTML template/form. I > would like to > > > embed > > > > a PHP script in the template to take some of the values of the > > > CGI and put > > > > them in a database. I set up the database, wrote the PHP, but now > find > > > that > > > > the CGI script apparently won't recognize my PHP. > > > > > > > > Anyone have any ideas as to what I need to do? > > > > > > > > The CGI is a preset thing I can't re-write in PHP (at least for > > > now). And > > > I > > > > don't know much CGI myself. > > > > > > > > Thanks! > > > > > > > > -Mike > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP 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] Re-Importing .CSV file into Database
Good day, The proper syntax is: INTO TABLE and not: INTO Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 9:54 AM To: Jason Murray Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Re-Importing .CSV file into Database Hi, Ok, considering the FULL PATH and the QUOTES thingy, this is the code i'm applying : And this is the error i'm getting : error:You have an error in your SQL syntax near 'fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED' at line 1 So... what's the problem?? Thanks guys, though. T. Edison jr. = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.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] Re-Importing .CSV file into Database
Good day, That's difficult to say, as I'm not familiar with running MySQL on Windows. You should print out $query, and then make sure the file exists and that the MySQL server has the permissions to read it. Remember that it's the server that's reading in the file, not whatever the client is (be it PHP or whatever). You should really take this conversation over to a MySQL list, since you need help with MySQL and not PHP. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 10:35 AM To: Darren Gamble Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Re-Importing .CSV file into Database Hi Darren, Actually your code worked, those errors did go way by putting in INTO TABLE .. but there's a very funny new problem. I get this error on the page : error:Access denied for user: 'mjimm@localhost' (Using password: YES) And believe me, i'm using the correct password/user! The same file, i just insert any other code than the $query, it works! But if i use the loading data infile code.. it gives me this access denied error! What is happening!! T. Edison jr. --- Darren Gamble <[EMAIL PROTECTED]> wrote: > Good day, > > The proper syntax is: > > INTO TABLE > > and not: > > INTO > > > Darren Gamble > Planner, Regional Services > Shaw Cablesystems GP > 630 - 3rd Avenue SW > Calgary, Alberta, Canada > T2P 4L4 > (403) 781-4948 > > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 9:54 AM > To: Jason Murray > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Re-Importing .CSV file into > Database > > > Hi, > > Ok, considering the FULL PATH and the QUOTES thingy, > this is the code i'm applying : > > $db = mysql_connect("localhost","mydb","pwd"); > mysql_select_db("mydb",$db); > > $query = "LOAD DATA INFILE 'D:\Apache > Group\Apache\htdocs\mjimm\php3\tabledata\fanlist.csv' > INTO fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY > ENCLOSED BY '\"' LINES TERMINATED BY '\n' "; > > mysql_query($query) or die("error:". mysql_error()); > ?> > > And this is the error i'm getting : > > error:You have an error in your SQL syntax near > 'fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY > ENCLOSED BY '"' LINES TERMINATED' at line 1 > > So... what's the problem?? > > Thanks guys, though. > T. Edison jr. > > > > = > Rahul S. Johari (Director) > ** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : [EMAIL PROTECTED] > Tel : 91-4546512/4522124 > *** > > __ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.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 > = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how a function 'return' statement works
Good day, You're returning $current_page_name. $current_page_name is set to the return value for array_slice. And array_slice returns an array. So, $current_page_name will be an array. So, you'll always return an array. I think what you're trying to do is return one particular element out of the array. If that's the case, just use something like: return $current_page_name[-1] to return the last element in the array. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 2:56 PM To: PHP Subject: [PHP] how a function 'return' statement works Can anyone give my puny mind an explanation as to why the following function only returns the value "Array" ? # === # get_current_page_name() # --- # Returns the current document # Arguments # --- # no arguments # === function get_current_page_name() { $current_page_name = explode("/", $_SERVER['PHP_SELF']); $current_page_name = array_slice($current_page_name, -1); return $current_page_name; } (I know this does the same thing as 'basename("$_SERVER['PHP_SELF'])', I just want to understand something a bit more fundamental to the way functions work) Thanks, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] Sorting an array of arrays....
Good day, uasort() should do what you need. http://www.php.net/manual/en/function.uasort.php There's an example for the usort function that does something similar to what you want, in fact. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Fifield, Mike [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 9:26 AM To: [EMAIL PROTECTED] Subject: [PHP] Sorting an array of arrays What I am trying to do is sort a array of arrays but I want to sort by one of the pieces of data stored in the arrays inside the array. For example; $data[blue] = array("name", "age", "time", "3"); $data[green] = array("name", "age", "time", "7"); $data[red] = array("name", "age", "time", "6"); $data[yellow] = array("name", "age", "time", "2"); $data[white] = array("name", "age", "time", "1"); $data[black] = array("name", "age", "time", "9"); I want to be able to sort this array of arrays by the very last element, the numbers. Mike Fifield Charles Schwab & Co, Inc. WARNING: All e-mail sent to or from this address will be received by the Charles Schwab corporate e-mail system and is subject to archival and review by someone other than the recipient. -- 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] argv and argc
Good day, The array $argv contains what you're looking for (I'm not sure if this is deprecated in 4.1.0, though) so you'll have to flip through the manual and release notes. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 3:00 PM To: PHP General Subject: [PHP] argv and argc The other day, I was reading the docs and I just happened across something that emulated argc and argv. However, I just spent 2 hours in the docs and can't find it. Is there something in PHP that you can use to get this info? thnx, 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
RE: [PHP] preg_replace("/^\//".. doesnt work?
Good day, The first argument should just be a normal regular expression, not a replacement regular expression. I'm not at my server right now, but I would guess that it'll work once you get rid of the last / in the first expression. ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: John Ericson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 1:25 PM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace("/^\//".. doesnt work? Im having a weird regexp problem in PHP that I think is correct but it doesnt appear to work. The code is this: $a = "/test/"; preg_replace("/^\//", "", $a); echo $a; I want preg_replace to replace the first '/' in $a with '' so that the echo function echoes "test/", but instead it echoes "/test/" as if preg_replace didnt worked? What am I doing wrong? Im using: PHP Version 4.1.1 Configure Command: './configure' '--with-mysql=/usr/local/mysql' '--with-apxs=/usr/local/apache/bin/apxs' '--with-db2--disable-debug' '--disable-static' '--enable-sockets' '--with-yp' '--with-zlib' Regex Library: Bundled library enabled PCRE (Perl Compatible Regular Expressions) Support: enabled PCRE Library Version: 3.4 22-Aug-2000 Please CC me since Im not a member of this maillinglist. -- * John Ericson [EMAIL PROTECTED] * ICQ: 7325429 JID: [EMAIL PROTECTED] * web: http://john.pp.se -- 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] Nasty DoS in PHP
Good day, Just reading this thread, figured I would put my $0.02 in. This is apparently a known problem. It seems to occur whenever the php script uses lots of memory, actually, and it does the same thing whether it's run standalone or as a module. I first experienced it when I had a PHP script load a 10 meg LDAP database into memory, which took some 90 Megs of RAM to do (overhead, I guess). If I ran the script standalone, it wouldn't quit right away. If it was run as a module, Apache would have to kill the child off (it logged this activity) if I asked Apache to shut down. If I ran the script a few times, all of the memory of the machine would be used up, and I'd have to kill off Apache to get it back. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jason Soza [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 12:10 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP Mine produced the same error message as yours, Jason, but the memory and CPU usage continued until I hit the 'stop' button on the browser. It seemed to have overridden both time and memory limits, as it had racked up 320 megs of my RAM by the time I stopped it. Jason -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 9:57 PM To: 'CC Zona'; [EMAIL PROTECTED] Subject: RE: [PHP] Nasty DoS in PHP > So that was both as an Apache mod and a CGI binary? Sounds like it's > reproducible. Running as an Apache module here, it terminated as expected at 30 seconds. Jason -- 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] Regex
Good day, Just off the top of my head, try: /.+\@.*([^\.]*\.[^\.]*)$/ Might not have the exact syntax, but, you get the idea. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: James Taylor [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 22, 2002 2:17 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Regex > > > I'm trying to come up with a regular expression that will > match the TL > and Second Level domain names in someone's email address ONLY. > > So, say someone's address is > "[EMAIL PROTECTED]", I > need to match ONLY pacbell.net. It shouldn't matter what > the address > looks like, I'm looking for any number of digits, a dot, any > number of > digits, and the end of the line. The closest thing I can > come up with > is /\@.+?(.+\..+)?$/, but, as you can guess, that matches everything > except the very first character. Can anyone help me with this? Thanks > > > -- > 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] file() and macintosh line break
Good day, Calm down, the excessive !'s are a bit unnecessary. One possible solution is to read the entire thing into one string, and then use the split or preg_split function on the \r against it. This will give you an array with one line per entry. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: Rodrigo Peres [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 01, 2002 8:55 AM > To: [EMAIL PROTECTED] > Subject: [PHP] file() and macintosh line break > > > Hi list, > > I'm in a problem that is driving me crazy!!! I want open a > file and puts > each line into an array, but this files was created in macintosh!! so > the file() can't recognize the end line and only outputs 1 element in > array!! How can I solve it. I tried to fread() the file and > eregi_replace the line breaks, it worked, but now I don't know how to > use this to create the array! > > Thank's in advance > > Rodrigo > > > -- > 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] Web hoster solution?
Good day, A friend of mine has been asked to set up a simple website for a third party, which will be used by visitors to order products. She has been programming for a little while now, but, she doesn't have much experience with other web hosting companies (and neither do I, really). I know that some hosters provide "shopping cart" programs with their packages, which would probably make things much easier. She's also willing to try to install something PHP-ish (or even in ASP) if that's not an option. The site wouldn't have a lot of visitors- 1000 a month, tops, so there isn't much need for a lot of bandwidth. And, other than this purchasing interface, their needs are pretty basic, so a low cost is probably the most important thing. What would people here recommend? I know that this question has been asked before, but her needs are a little bit simpler than the average PHP'er on this list. =) Thanks, Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Skinning Problem
Can some one please tell me why this PHP command brings back an Undefined variable: QUERY_STRING on line 1. The script is below, by the way it is PHP on windows not unix. Also can some one please tell me why this is bringing back a problem on a windows server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies
Hi, i want to use a cookie to set a skin for a site but when i go to the site when there is no cookie set then it will display no images background colors ect... So what i need to do is have a command that will set other images background ect. as default if there is no cookie there. How can i acheave this. (The cookie gets set when the user selects the skin that they want not when they enter the site) Please some one help me out with this. Thanks. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Cookies
Hi, i want to use a cookie to set a skin for a site but when i go to the site when there is no cookie set then it will display no images background colors ect... So what i need to do is have a command that will set other images background ect. as default if there is no cookie there. How can i acheave this. (The cookie gets set when the user selects the skin that they want not when they enter the site) Please some one help me out with this. Thanks. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Learning PHP
hi ppl i am learning PHP and was wondering if there is a good book or web site that i could learn ALOT from. Not PHP.net coz the documentation is just too complex there for a beginner. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] including functions on every php page in a site
Hello, I have about 10 function definitions that I want included on every page in my website. Instead of calling: on every page, I'd prefer to have the functions automatically loaded into memory when a user visits any page of my site. I was thinking that there may be some what to do this with a root-level .htaccess file, but I'm not sure. Can anyone offer a solution? Thanks, Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Entering password on a command line
Good day, I have a command-line PHP script that connects to an LDAP database and does some queries. To increase security, I would like to not put the bind password into the program, and instead have the user type it in. But, I'd like to have this done so that the password is not echo'd to the screen. Lots of searching has shown that people have done something similar in C and Perl by closing the stdout channel. But, I haven't found anything similar in PHP (and I would need to reopen the channel again somehow afterwards anyway). Does anyone have a suggestion on how this might be accomplished? In the meantime I'll just put the password in the program, but, I'd like to learn how this could be done. Thanks in advance, ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Undefined variables
Good day, Just to clarify, Perl will, in fact, complain if you have undefined variables (or variables that you use once) if you have warnings and/or strict mode in effect. Using at least one is strongly recommended. In PHP, the method you're using for getting form data is deprecated. You should use $HTTP_POST_VARS or $_POST, depending on your version. Check the docco for more info on those. If you really have to check variables using this method, use isset() to see if the variables ... have been set. =) Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: Crane, Christopher [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 30, 2002 3:07 PM > To: '[EMAIL PROTECTED]' > Subject: [PHP] Undefined variables > > > I have an annoying problem, that I know is my own ignorance > to PHP. I came > from PERL and this was not a problem there but is with PHP. > > Here's the issue. > I have a number of scripts that use a "index.php?Task='some > sort of task > name'", for example, http://www.foo.com/index.php?Task=ShowVersion > <http://www.foo.com/index.php?Task=ShowVersion> . Then I use > an if/else > statement to tell the script what to do if it sees the > ShowVersion variable. > In the ShowVersion example, I would call a function that displays the > version information I defined in the script. As a back up, I > always provide > an else statement to catch variables I have no functions for. > > If I have a ShowVersion function, GetData function and a CreateImage > function and the Task variable is empty or a variable that > does not exists > comes in like http://www.foo.com/index.php?Task=SomethingDumb > <http://www.foo.com/index.php?Task=SomethingDumb> it would go to the > default function of something by using the ELSE part of the if/else > statements. > > I hope I am describing this correctly.now here is the > problem. If I have > warnings turned on, or if I have a log written for warnings, > the log fills > up if someone goes to http://www.foo.com/index.php > <http://www.foo.com/index.php> or http://www.foo.com <http://www.foo.com> will error messages like undefine variable TASK on line 255. I understand the reason, that PHP was expecting the variable Task when it got to the if/else statements. So I put in something like if(!($Task)) { function Something(); } but it still is looking for the variable so it still errors. In Perl, it would simply be ignored. What do I do here. Here is a simple example of the code. if ($Task == "ShowVersion") { function ShowVersion(); } elseif ($Task == "GetData") { function GetData(); print "$DataOutput"; } elseif ($Task == "CreateImage") { function CreateImage(); } else { print "Incorrect Variable or no Variable Supplies"; } Christopher J. Crane Network Operations Manager IKON Office Solutions 860.659.6464 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gd project question
Good day, Wow, a high school math question. You should use asin() and acos() of the angle to get the y and x differentials, respectively. Multiply the result by the size of the needle. This assumes that your guage is oriented horizontally, and the needle sweeps from right to left, pointing upwards. Adjust the sign or switch the functions around if your gauge is different. Note that the functions operate in radians (2*pi radians == 360 degrees). Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: Michael Geier [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 31, 2002 9:18 AM > To: Php-General > Subject: [PHP] gd project question > > > I have the following issue: > > I am making a "gas guage" based on a percentage. > ie. > - a 180 degree arc is created > - the range will be 0 to n (undetermined ammount) > - there will be x number of entries > - the needle will pount to a a percentage > for (int)floor((x / n) * 100) > > The issue is, I have the starting pt for the needle > (imagefilledarc > needs the center of the 'circle' as the starting pt, > which is where > the needle will start too), but how would I get the x|y > coordinates > for the end of the needle based on a perentage of a half-circle > (180 degree arc)? > > Appreciate any clues or ideas. > > --- > Michael Geier > > > -- > 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] Undefined variables
Good day, I don't have a piece of code off the top of my head, but you'll get lots of results and examples if you enter those variables into www.php.net 's search field and search the online documentation (which is very, very good, I should add). Hope that helps. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 > -Original Message- > From: Christopher J. Crane [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 30, 2002 8:06 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Undefined variables > > > Darren, > Thanks for the tip on direction to head in. Could you provide > an example of > what you are referring to? > > > "Darren Gamble" <[EMAIL PROTECTED]> wrote in message > 078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02">news:078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02... > > Good day, > > > > Just to clarify, Perl will, in fact, complain if you have undefined > > variables (or variables that you use once) if you have > warnings and/or > > strict mode in effect. Using at least one is strongly recommended. > > > > In PHP, the method you're using for getting form data is > deprecated. You > > should use $HTTP_POST_VARS or $_POST, depending on your > version. Check > the > > docco for more info on those. > > > > If you really have to check variables using this method, > use isset() to > see > > if the variables ... have been set. =) > > > > > > Darren Gamble > > Planner, Regional Services > > Shaw Cablesystems GP > > 630 - 3rd Avenue SW > > Calgary, Alberta, Canada > > T2P 4L4 > > (403) 781-4948 > > > > > > > -Original Message- > > > From: Crane, Christopher [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, May 30, 2002 3:07 PM > > > To: '[EMAIL PROTECTED]' > > > Subject: [PHP] Undefined variables > > > > > > > > > I have an annoying problem, that I know is my own ignorance > > > to PHP. I came > > > from PERL and this was not a problem there but is with PHP. > > > > > > Here's the issue. > > > I have a number of scripts that use a "index.php?Task='some > > > sort of task > > > name'", for example, http://www.foo.com/index.php?Task=ShowVersion > > > <http://www.foo.com/index.php?Task=ShowVersion> . Then I use > > > an if/else > > > statement to tell the script what to do if it sees the > > > ShowVersion variable. > > > In the ShowVersion example, I would call a function that > displays the > > > version information I defined in the script. As a back up, I > > > always provide > > > an else statement to catch variables I have no functions for. > > > > > > If I have a ShowVersion function, GetData function and a > CreateImage > > > function and the Task variable is empty or a variable that > > > does not exists > > > comes in like http://www.foo.com/index.php?Task=SomethingDumb > > > <http://www.foo.com/index.php?Task=SomethingDumb> it > would go to the > > > default function of something by using the ELSE part of > the if/else > > > statements. > > > > > > I hope I am describing this correctly.now here is the > > > problem. If I have > > > warnings turned on, or if I have a log written for warnings, > > > the log fills > > > up if someone goes to http://www.foo.com/index.php > > > <http://www.foo.com/index.php> or http://www.foo.com > > <http://www.foo.com> > > will error messages like undefine variable TASK on line > 255. I understand > > the reason, that PHP was expecting the variable Task when > it got to the > > if/else statements. So I put in something like if(!($Task)) > { function > > Something(); } but it still is looking for the variable so it still > errors. > > > > In Perl, it would simply be ignored. What do I do here. > > > > Here is a simple example of the code. > > > > if ($Task == "ShowVersion") { function ShowVersion(); } > > elseif ($Task == "GetData") { function GetData(); print > "$DataOutput"; } > > elseif ($Task == "CreateImage") { function CreateImage(); } > > else { print "Incorrect Variable or no Variable Supplies"; } > > > > > > > > > > > > Christopher J. Crane > > Network Operations Manager > > > > IKON Office Solutions > > 860.659.6464 > > > > > > > > -- > 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] Next and Preview Row
Good day, It should be pointed out that even with this syntax, the database will still scour all of the rows in the table. The only savings is that the database won't return all of these rows due to the limit statement. It might be more efficient to use min and max to determine which row in the database is before and after the desired row, and then only fetch those rows. This can easily done with subselects, but since MySQL does not support them one will have to use multiple queries to piece it together. Of course, if your table is small then this is mostly irrelevant anyway. It might also be worthwhile to note that this code can be made into one query with the UNION statement. However, MySQL doesn't support that part of SQL either (although the documentation says that it's provided in version 4.X ). ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Fournier Jocelyn [Presence-PC] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 1:24 PM To: Chris Boget; Raymond Gubala; Mark Lo; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Next and Preview Row Yes, but how to get ONLY the 3 records you need ? Because often in an application, you don't care about the other records. In this case AFAIK, there is no other solution than issuing at least two queries : SELECT * FROM table WHERE field<='ID00025' ORDER BY field DESC LIMIT 2 SELECT * FROM table WHERE field>'ID00025' ORDER BY field ASC LIMIT 1 - Original Message - From: "Chris Boget" <[EMAIL PROTECTED]> To: "Fournier Jocelyn [Presence-PC]" <[EMAIL PROTECTED]>; "Raymond Gubala" <[EMAIL PROTECTED]>; "Mark Lo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, February 22, 2002 9:17 PM Subject: Re: [PHP] Next and Preview Row > > It seems worst to me because in your case mysql has to retrieve all the > > rows. If it's a table with 1 million records or more, this should hurt ;) > > As I said, it was pseudo code. Now, imagine that you were just > getting the records for a particular user? a particular application? > Where there won't be millions and millions of rows? > > Chris > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.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] using a mysql temporary table.
Good day, I would have to dig around to find the appropriate note in the documentation, however I seem to recall reading that PHP's MySQL wrappers intentially prohibit a user from using semicolons- basically to prevent one's database from being hacked due to a poorly constructed query using user input. I can't immediately find a reference to this, though. As a workaround, you could execute two separate queries and store all of the results in a 2-D array in memory. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jeff Bearer [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: [PHP] using a mysql temporary table. Hello, I'm trying to use a temporary table in mySQL with PHP. First I tried to create a temporary table and then query it in the same script. But the table didn't persist to the second query in the PHP script. I found this knowledge base entry: http://www.faqts.com/knowledge_base/view.phtml/aid/445 Where it shows to do all the querying in one swoop. The problem I'm having now is that PHP is throwing an error at the first semi-colon. It appears that it doesn't want to run multiple query statements in 1 query function. I'm using the mySQL pear class in my application, I wouldn't think that it would have any effect on the problem. Here is an example of the query I'm attempting. CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM events; INSERT INTO tmp_events SELECT event_id, event_title FROM special_events; SELECT event_id, event_title FROM tmp_events ORDER BY event_title; But I get an error like: 1064: You have an error in your SQL syntax near '; INSERT INTO tmp_events' If I echo my SQL statement and paste it into mySQL the query works fine. Any suggestions that you can offer would be great. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- 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] Using SSL - slightly OT
Good day, I'm trying to set up a site that will use SSL for all of its web and control transactions. Currently I get an error when Apache is started up with PHP and SSL compiled together (on FreeBSD). There's a bug report on it, so it's just a matter of waiting. In the meantime, I'd like to set up Apache with SSL. I note that there are two packages- modssl and Apache-ssl, which appear to be two completely different packages. Has anyone here tried both of these packages, or has a recommendation on which to use? I'm curious as to what everyone would recommend for someone new to SSL. Thanks, ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: time limit ?
Good day, That won't submit the form, unfortunately. It'll just redirect the user to the page without submitting the contents of the form. If the browser supports it, one can use javascript to submit the form after a certain amount of seconds have elapsed. ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: George Whiffen [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 12:16 PM To: [EMAIL PROTECTED]; Ác¬P Subject: [PHP] Re: time limit ? ÁC¬P wrote: > How can I set a time limit for a form made by PHP (i.e.the value will auto > transfer after a certain time) > -- > Ác¬P¤u§@«Ç > http://fansing.hk.st/ > ACG¤¬°Ê°Ï°ì(¤j®a¦h¨Ç¨Ó¶K¹Ï§a!) > http://acgzone.hk.st/ HTML forms execute in the client's browser, which does not care at all whether the form came from static html file, php, Perl, whatever. The simplest way to get a browser to time out is with a refresh html tag in the part of your page e.g. http://www.mysite.com/too_long.html";>. This would automatically redirect to the too_long.html page after 15 seconds. George -- 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] php, text file, and mysql
Good day, This isn't really on the topic of PHP. But, to answer your question- yes, MySQL will let you do lots of neat things with those large text fields, like looking for substrings and such. If you want to store some text information, even that which might have special characters, line feeds and so forth, the "TEXT" field is definately the way to go. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 4:10 PM To: gregory hernandez Cc: PHP NEWS Subject: Re: [PHP] php, text file, and mysql On Thursday, March 7, 2002, at 07:16 PM, gregory hernandez wrote: > can i insert the actual file (i.e. "document.txt", of course with it > contents) into a mysql? > > in other words, i don't want to read the contents of the file and > insert the > contents into a field in mysql. i want to insert the actual file into > the > database. is this possible? Yes you can, though it might be an inefficient way of doing it unless you have some reason to do it this way. Look into the column type "BLOB" (binary large object), it lets you store binary large objects, such as images or files or anything, really. Why inefficient? Well, for one thing, BLOBs don't retrieve as quickly as regular fields, for reasons I don't altogether know. Also, you won't be able to form a query to search for any characteristics of a BLOB, since MySQL will treat the BLOB as a BLOB and doesn't try to imagine what's inside it -- as opposed to, say, a VARCHAR column. There is also a TEXT column type for very long text strings, and I forget whether or not the contents of these can be used in queries -- can someone please confirm this? But basically, almost any other column type is valid subject matter for forming queries. But for storing images and PDFs or other binary data, there's no other way. Note that many MySQL wizards will recommend that instead of storing binary data in a database, use a filesystem to store the data and then use the database to create a sort of "directory" for quickly locating those files in the filesystem, remembering the path to the file or something. I think this is how a lot of web sites incorporate graphic content in with their database (text) content (including mine). Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] Netscape vs. IE/Mozilla
Good day, A 10-second search on Google comes up with: http://www.omninet.net.au/~kg/docs/demyst9.html Personally, I can tell you that the biggest difference between the two browsers is the way that Netscape 4.X uses styles. In particular, it generally doesn't "inherit" styles from other elements. So, if you use a stylesheet and say that you want text to be green, you need to specify that is green, is green, etc. A bigger explanation of the differences would be outside the scope of this list. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Vlad Kulchitski [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 8:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Netscape vs. IE/Mozilla Hi guys, I know it's a wrong place to ask about this, but I am sure someone here faced the same problem. I am trying to get the site to look consistent in Netscape Navigator and it's giving me hard times. Either tables or/and cell background doesn't show up or spacing between two tables is not what it is supposed to be. If anyone can give me suggestion about where to look for some hints online that would be appreciated. Thanks, Vlad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Driving me nuts, need one second of your time
Good day, You get this message because the mysql_db_query statement failed, and that your code didn't check to see that it did or not before proceeding to the next statement. And, this statement fails because you have not even connected to the database yet. At the risk of sounding condescending, I would request that you look at PHP's documentation on how to use the MySQL wrapper functions ( http://www.php.net/manual/en/ref.mysql.php ). There you can find good documentation and a number of useful examples (the two best things a coder could ask for). Your error message is also in PHPs FAQ list. http://www.php.net/manual/en/faq.databases.php . Hope this helps, ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: cosmin laslau [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 4:14 PM To: [EMAIL PROTECTED] Subject: [PHP] Driving me nuts, need one second of your time "; } ?> Can someone PLEASE tell me why the coding above gives the following error: Warning: Supplied argument is not a valid MySQL result resource in /var/web/somesite.com/html/index.php on line 5 It's absurd. It's driving me nuts. I'm about to introduce my computer to the pavement 40 feet below. Thanks in advance for whoever sees what I am sure is a glaring and obvious flaw in the coding. I've been looking at it for an hours and just can't get anything from where I'm standing, maybe a different perpective will help. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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] How to get the IP of a visitor
Good day, You'll need to check the documentation of your web server for that (or post on the appropriate list). You can use the phpinfo() function to see all of the environment values that PHP sees. Off the top of my head, I think Apache stores it in REMOTE_IP . Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Ulrik Witschass [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 9:57 AM To: [EMAIL PROTECTED] Subject: [PHP] How to get the IP of a visitor Hi, I am new to this list and to PHP, so please excuse any newbie questions :) Want I need to know is how to get either the ISP or the IP of the visitor of a page. I guess this is a environment variable, but I don't know which. Any help is greatly appreciated :) Thanx! Ulrik -- 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] Parse Error Suggestions?
Good day, It's not really possible to have an error reporting function on a parse error. If there is a parse error, then the program can not be run, period. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Mike At Spy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Parse Error Suggestions? Anyone have any suggestions for getting better reporting on a generic Parse Error? Code is falling to the end of the script, and I can't find a problem anywhere. I looked on the PHP site for error reporting functions, but apparently they do not handle Parse Errors. Thanks, -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Two easy HTML/CSS questions
Good day, Just to clarify, yes, you can set the size of a text field, as well as its color, text font, border, and so on. This is also done with css and is outside the scope of this mailing list. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Hunter, Ray [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 11:31 AM To: 'Phil Schwarzmann'; [EMAIL PROTECTED] Subject: RE: [PHP] Two easy HTML/CSS questions Answers: 1. Yes you can do it with css. http://www.w3schools.com/css/default.asp 2. The text field area is defined by the browse...You cannot change the size of the actual box that is the text field... Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: [PHP] Two easy HTML/CSS questions I know I shouldn't be asking these questions on this mailing list but you guys are ALWAYS EXTREMELY helpful... 1) I want a a text link to change color when the mouse is hovering over top of it. How do I do this? Im sure it's some CSS thingy. 2) Is it possible to make a "text field" smaller when using forms. Let's say I'm using font size 1, I want the text field to be just as small as the rest of text. Thanks again -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strlen() gives a wrong count
Good day, Could you post this mystery string so that we could help you? Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Gil Disatnik [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 1:12 PM To: [EMAIL PROTECTED] Subject: [PHP] strlen() gives a wrong count Hello there, I have a 98 characters string (including spaces), wc -c says it's 98 characters and a file containing this string is 98 bytes as well. For some reason - strlen() says it's more... it says it's a 104 characters strings, when I removed the spaces (using sed on the shell and using str_replace on php) - wc said it's 83 characters and strlen() said it's 89... How could that be? is there another way to get the exact number of characters in a string? Thanks. Regards Gil Disatnik UNIX system/security administrator. GibsonLP@EFnet _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ "Windows NT has detected mouse movement, you MUST restart your computer before the new settings will take effect, [ OK ]" Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating system, written for a 4 bit processor by a 2 bit company which can not stand 1 bit of competition. -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- -- 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] cron with php as apache module
Good day, Most Linux packages also install the php binary as part of the distribution (I know Redhat does). Look in /usr/local/bin (or other common places) to see if the executable "php" has been installed. If it is, you're set. Just run the script as if it were a .cgi . Instructions are on php's site. On a sour note, FreeBSD's package does not include the executable.. >=( ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Paul Roberts [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: [PHP] cron with php as apache module I want to run a php script via a crontab, (i can set up the crontab etc). this is a Linux server and php is installed as an apache module, is there any way to run the php script via cron. the build details are Configure Command './configure' '--with-apxs=/usr/sbin/apxs' '--with-mysql' '--enable-track-vars' '--enable-versioning' '--enable-bcmath' Paul Roberts [EMAIL PROTECTED] -- 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] what's "undefined index" ?
Good day, The error message refers to the "KundeRemark" in $val["KundeRemark"], not "$KundeRemark" which you are trying to assign the result to. The former is (if it existed) an index, the latter is a variable. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Kai Schaetzl [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 9:31 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] what's "undefined index" ? Your message of Mon, 25 Mar 2002 11:35:57 +1100: > "undefined variable" is when you try to use a variable before you set it, eg > $foobar > "undefined index" is when you try to reference an array index before you set > it, eg $foobar[10] > Hi, thank you both for the explanation. It's clear why I get the "undefined", these variables *are* for various reasons undefined at the moment. However, there are NO arrays involved, f.i. "KundeRemark" is NOT an array it's a simple string variable created by $KundeRemark = stripslashes($val["KundeRemark"]); which is a field from a SQL result which currently doesn't exist because I changed the connection to a different db where this field is named differently. So, it's undefined, fine. But why is it called "undefined index" where it should be "undefined variable" ? > Warning: Undefined index: KundeRemark in > > C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line > > 138 > Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de & http://msie.winware.org -- 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] undefined variable when using if ($var) {}
Good day. What is this message that you get, that you don't want? A cursory glance of the code reveals two "else" statements attached to the same "if" statement. You should address that. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Martha S [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: [PHP] undefined variable when using if ($var) {} I'm rather new to PHP, so this should be fairly easy to answer. I checked the manual and FAQ already. I'm using the following code, and I get the following message if $id has nothing in the var (i have it set to a default of type int, not null in mysql). Is there a way around this or something I'm missing? Thanks :) -- code--- if ($id) { $result = mysql_query("SELECT * FROM entries WHERE id=$id",$db); $myrow = mysql_fetch_array($result); printf("\n"); printf("%s", $myrow["title"]); printf("%s | ", $myrow["id"]); printf("%s", $myrow["posted"]); printf("%s\n", $myrow["post"]); printf("\n"); printf("all"); } else { do { printf("%s %s\n", $myrow["id"], $PHP_SELF, $myrow["id"], $myrow["title"], $myrow["post"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } -- 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] Regular Expressions? Help!
Good day, exec() isn't very good at capturing output. It will only return the last line of output, which is designed mostly to capture error conditions. You would be best off using popen() and attaching a pipe to the output, and then just read from the pipe. More information can be found about popen() with PHP's documentation. Try that instead. ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 12:26 PM To: '[EMAIL PROTECTED]' Subject: [PHP] Regular Expressions? Help! I am trying to do a match for an expression and it to a variable from the output of a command: How can look through $output to set the information returned as different variables the output would look like: variable1:"some information" variable2:"some information" I want to set each variable to a string and write it to a file. Thank You for you help. Roy ** PLEASE NOTE ** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. -- 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] OT - number of chars in querystring
Good day, The RFC says that there is no limit on the size of the request. But, I remember reading that the "real world" maximum is 2048 characters, which I believe is a hard limit on some clients. I also recall reading that there is an RFC that suggests limiting the request to 255 characters. It appears that you might be submitting a lot of data. If that's the case, you should really have your application determine the information to be submitted and then store/create them as hidden values in a form. That way, not only will you have no problems with length, but you don't have to worry about the client caching it. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 9:41 AM To: [EMAIL PROTECTED] Subject: [PHP] OT - number of chars in querystring Sorry for this quick OT question -- I'm skimming thru the HTTP spec but can't find anything that defines the character limit in GET requests. I'm writing a form that uses GET to send data to my PHP script, but I'm afraid that if the user enters too many characters then some will get cut off. Does anyone know the actual limit? If not, is there a generally-accepted maximum that is used (to assure compatibility with most user agents and servers)? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] sorting data from a field
Good day. You can do this using the "ORDER" clause in SQL. Please consult your particular database's documentation for more information. Alternately, you can load all of the unsorted results into an associative array, and use PHP's native sorting functions (such as ksort() ) to sort the results. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Chuck Barnett [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 03, 2002 1:50 PM To: PHP General List Subject: [PHP] sorting data from a field Hello again :) I have a db field that holds the first and last name of a person. Is there a way to sort by the last name in that field? The whole reason for this is to populate a select box sorted by last name. I don't want to go back and create a separate field if I don't have to. Any help is appreciated. Thanks, Chuck -- 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] sorting data from a field
Good day, Sorry, I didn't read your request as clearly as I should have. =) If you have a single field, the best way would be to load all of the results, and then have PHP split() the results by whitespace. Then store the results by associative array and use ksort() to sort them. The best way would be to have a first name and last name field. This addresses situations where people have their family name first and their given name second. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Darren Gamble [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 2:13 PM To: 'Chuck Barnett'; PHP General List Subject: RE: [PHP] sorting data from a field Good day. You can do this using the "ORDER" clause in SQL. Please consult your particular database's documentation for more information. Alternately, you can load all of the unsorted results into an associative array, and use PHP's native sorting functions (such as ksort() ) to sort the results. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Chuck Barnett [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 03, 2002 1:50 PM To: PHP General List Subject: [PHP] sorting data from a field Hello again :) I have a db field that holds the first and last name of a person. Is there a way to sort by the last name in that field? The whole reason for this is to populate a select box sorted by last name. I don't want to go back and create a separate field if I don't have to. Any help is appreciated. Thanks, Chuck -- 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] syntax
Good day. I believe that one would have to use the eval() statement to construct that syntax. You probably would be much better off using an array to store this information. If you are trying to read form data, then construct your form names so that the results will be put into an array by PHP. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: John Fishworld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 10:55 AM To: Php-General-List (E-mail) Subject: [PHP] syntax Can someone please remind me what the correct syntax for this is ! in a loop and want individual $ned_1_city = blah $ned_2_city = blur I've been trying this but its wrong $ned_.$i._city = $ned_city ; thanks john -- 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] syntax
Good day, In this situation, you should use an array to store the results. Please check PHP's documentation for more information on how to use arrays. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: John Fishworld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 11:09 AM To: Darren Gamble; Php-General-List (E-mail) Subject: Re: [PHP] syntax Sorry I think I've badly explained this ! I'm getting results from mysql in a while loop but I need the results outside of the loops and so what I want to do is take the first variable from the db and rename it as variable 1 and then before the end of the while loop have a $i++; so i want $newvar_$i = result 1 $newvar_$i = result 2 so I can use them outside the loops as $newvar_1 and $newvar_2 hope that makes more sense ! > > > Can someone please remind me what the correct syntax for this is ! > in a loop > and want individual > > $ned_1_city = blah > $ned_2_city = blur > > I've been trying this but its wrong > > $ned_.$i._city = $ned_city ; > > thanks > john > > > > > -- > 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] Nevermind I figured it out
Good day. As you may have guessed by now, the .= operator does what you want. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: David Johansen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 12:13 PM To: [EMAIL PROTECTED] Subject: [PHP] Nevermind I figured it out I just user $message = $message . "Some text"; But is there a "better" way to do this with something like the += operator? Dave "David Johansen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I was just wondering if there was a way to add new text to the end of > strings. I tried doing > $message += "Some text here"; > but that just set $message to 0. I'm sure it's something simple but I > couldn't find anything on it in the documentation. > Dave > > -- 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] preventing "back" button usage?
Good day, This can be accomplished in a few ways. The easiest way is to tell the client not to cache the page. And yep, you do this via headers. In PHP (attempting to hit as many types of browsers as possible): header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); You can also do some fancy redirection with Location headers. As a failsafe, you should have the processing page make sure that the user isn't submitting the same thing more than once. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: [PHP] preventing "back" button usage? Sorry to plague this list with questions today, but I was hoping someone could help me understand a fundamental thing about how browsers work -- how can I achieve the effect that many ecommerce sites (such as Amazon) use to prevent the user from going "back" in their history? For obvious reasons, I would like to avoid JavaScript to achieve this feat. I have some multi-part forms that I do not wish users to be able to repeat accidentally. I believe it has something to do with a header and the browser's cache, but I really don't know anything about it. TIA, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] How is code in PHP interpreted,from 1st line to last? i do nt think so
Good day, Please keep this conversation on the list. As my message says, no, in HTML you don't have text and images together. The image is retrieved from the server by the client in a completely different request. The "main" request basically says "An image goes here. Go ask over there to go get that image." ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Moschitz Martin [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 8:58 AM To: 'Darren Gamble' Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to last? i do nt think so But the problem with include tag is, that I can´t display images and text together, or can i? thx martin -Ursprüngliche Nachricht- Von: Darren Gamble [mailto:[EMAIL PROTECTED]] Gesendet am: Donnerstag, 28. März 2002 16:49 An: 'Moschitz Martin'; [EMAIL PROTECTED] Betreff: RE: [PHP] How is code in PHP interpreted, from 1st line to last? i do nt think so Good day. If you want some php code to execute another file of php code and the continue afterwards, use the "include()" statement. Please note that with the example you've listed there, the code isn't executed the way that you might think. The client will receive all of the html from the PHP script first. Then, the client will look at the tag and figured out that it has to request graf.php, which is does (which will be executed separately). Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Moschitz Martin [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 8:46 AM To: [EMAIL PROTECTED] Subject: [PHP] How is code in PHP interpreted, from 1st line to last? i do nt think so How can I say php to execute graf.php until it´s finished and then move on to the rest of the code? echo "
RE: [PHP] How is code in PHP interpreted,from 1st line to last? i do nt think so
Good day, No, there is no real way in HTML to have this work. You would be best off looking at WHY you need the image to be done first, and change your programming appropriately to take into account how HTML works. A very messy solution would be to have an "include" statement that generates an image someplace, referenced by your main program. This will cause the image to be generated before the rest of the code is executed. But, then you'll have to worry about cleaning it up later. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Moschitz Martin [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 9:06 AM To: 'Darren Gamble'; Moschitz Martin Cc: Php Subject: AW: [PHP] How is code in PHP interpreted, from 1st line to last? i do nt think so >As my message says, no, in HTML you don't have text and images together. >The image is retrieved from the server by the client in a completely >different request. >The "main" request basically says "An image goes here. Go ask over there to >go get that image." so, do you have any solution for me, how i can get the image processed first? include doesn´t work... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] running commands as root from a script
Good day, A bit off topic, but you can run a Perl script setuid. You have to pass a flag to Perl to let it know that it's OK, though (it's -U, I believe) which would appear in your first "she-bang" line. I've never had to run a PHP script setuid. I would imagine that one would have to write it CGI-like instead of via the server module. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Ken Nagorski [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 10:37 AM To: [EMAIL PROTECTED] Subject: [PHP] running commands as root from a script Hi there, I have a little problem. I need to run a few commands for Courier from a script. What I have is a php based application that makes it easy to create and manage virtual domains and the addresses for them from the web. However when You "Apply the changes" everything is written to /tmp dir and the a little perl script parses the file and moves things where they need to go and then runs couriers makealiases command. Now you can't run a perl script SUID so I wrote a C program that just calls system() and runs the script and it is SUID. This doens't work however. No matter what I do. It is like Courier ignores this. I can't imagine there isn't anyone who has not run into the problem of automating things via PHP and not had to run a system command as root at some point in time. I am wondering what the different approaches to this problem are. Thanks Ken -- 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] Loading Images
Good day, Yep, this is possible all right. I use this to display my rrdtool images. Just have the php program as the target for the image, and then supply the right header. For a gif image: header("Cache-control: private, no-cache"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Past date header("Pragma: no-cache"); header("Content-type: image/gif"); Then, just output the raw data. If you gather it with a shell command, use passthru() . There isn't anything to stop the user from saving the image, although the above headers will request that the user's client not cache it. You can make it more difficult for the user by supplying a Javascript "override" function to be executed when the user uses their right-mouse button over the image. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Omland Christopher m [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 12:47 PM To: Chris Cc: [EMAIL PROTECTED] Subject: [PHP] Loading Images I don't have any code for this, but I'm hoping someone can point me in the right direction. I want to load images or navigation menus dynamically. Is it possible to build a database of images and then use php to display them? Or something along these lines. I know this must be possible, becuase I see sites that do something like this, and I cant seem to right click the image and save it. Does this make any sense? Thanks. -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
RE: [PHP] XSLT; XML => PHP code
Good day, To have PHP evaluate string contents as an expression, use eval(). The usual disclaimer comes with this function... be careful. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 2:47 PM To: [EMAIL PROTECTED] Subject: [PHP] XSLT; XML => PHP code I am using XSLT functions in PHP to transform a string (whose data is a string of XML) into another string. Ideally, the second string will consist of PHP code. I would like this outputted PHP code to be executed within the same script as the that which performs this transformation. Here is what I am wondering -- will I be able to evaluate the variable containing the new string somehow? In other words, I will have PHP code trapped in a variable, which I will need to have evaluated in order to have the code inside executed. How can I take a variable containing PHP code and have it get executed along with the rest of the script? In other words, $php_code_in_here = 'echo "hi there";'; // PHP code in a variable Will this variable just be evaluated by the script as it is parsed?? Forgive me if the answer is staring me in the face, I'm just not seeing it. Thanks, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] XSLT; XML => PHP code
Good day, eval() is a very powerful function. You should be careful that users can't find some way to execute arbitrary code by providing input that your program did not expect. Also, if your string doesn't have the correct syntax, your program will terminate. ======== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 3:20 PM To: Darren Gamble Cc: [EMAIL PROTECTED] Subject: Re: [PHP] XSLT; XML => PHP code On Thursday, March 28, 2002, at 04:52 PM, Darren Gamble wrote: > Good day, > > To have PHP evaluate string contents as an expression, use eval(). Thanks for the pointer, I have never used this function before. I'm not sure what it means by "as with any function that outputs directly to the browser", since in their example it just shows an evaluation of a simple variable assignment (which I'm guessing doesn't get output to the browser). I will have to experiment with this and make sure it works right. > The usual disclaimer comes with this function... be careful. (... of what?) Thanks again Darren, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Really slow include
Good day, The include/require path is relative to the filesystem as seen by the web system user, not the web root. It's designed this way so that you can put your include files someplace where users can't fetch them, which is a recommended practice. So, if your web root is /usr/local/www on your filesystem , then you could say: require("/usr/local/www/header/html"). If you don't put in a leading slash, it will look in the current directory. What you were doing in your second example is asking PHP to look in the file under your root directory. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: anti-blank [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 2:38 PM To: [EMAIL PROTECTED] Subject: [PHP] Really slow include I have a header section for my website and I'd like to include it into each page. Since this is where I'm housing all of my navagation. Here is my problem though. I have the header tables sitting in a page header.htm. I'm calling it as so: This works fine as long as I stay in the main folder /htdocs where the header.htm file is. The problem lies when I go any deeper. I tried replacing the link with: Hoping that would put it back to the /htdocs folder as it works for my standard links. Instead I get this: Fatal error: Failed opening required '/header.htm' (include_path='.:/usr/local/lib/php') in /www/foo/htdocs/foo/index_test.php on line 82 I've tried correcting it by including the full path: http://www.foo.com/header.htm";) ?> This does work but it's so amazingly slow. Even on my cable connection it will take 20-30 seconds to load this. I've switched back and forth between require and include with no change in speed. Anyone have a suggestion or an idea on why my load time is suffering so much? I hope all of that was clear enough. Thanks anti-blank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Exit();
Good day, As the documentation says, exit() will end your script. http://www.php.net/manual/en/function.exit.php Use return() to end a function. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Mauricio Cuenca [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Exit(); Hello, I'm using recursive functions and call a function from inside another one. The problem is that when I call the Exit(); function the whole program is aborted. How can I quit just the current function, not the whole program ? Function One() { If (!$var) { Exit(); } } Function Two(); { One();//This line kills the program Print("Hello"); //This is not printed =( } TIA, __ Mauricio Cuenca -- 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] chown ..opperation not permitted
Good day. As you've probably surmised, chown needs to be run as the root user, even if the file or directory in question is owned by the user wanting to make the change. Setting up sudo access should work properly. Ensure that the service is actually running as "nobody" and not another unprivileged user. However, it should be mentioned that this is a very, very insecure method! The chown operator was designed more for PHP command-line scripts that would be run as another user. You may want to re-evaluate why you are changing ownerships of directories from a web page, and determine if there is a safer, more secure way of doing what you want. ==== Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: John Weez [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 11:55 AM To: [EMAIL PROTECTED] Subject: [PHP] chown ..opperation not permitted Hi all, My config is Apache 1.3 with PhP4 loaded as a module. I have a script which makes a directory. This directory is owned by nobody.nobody because that is what apache runs as. But, I want this directory to be owned by a differrent user. So, After making the directory i use the php command chown to change the directory ownership. Now, I get an error saying opperation not permitted. I figured this is because of some security problems... So i try dropping in to the shell using teh backtick operator and by also setting up sudo to give access to the chown command to user nobodythis does not work from my php script BUT, it does work fine if i enter it on a shell line... There must be a simple way that I can implement the chown function in php? Any ideas??? John -- 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] Displaying content on the fly
Good day, I've been using both Perl and PHP for some time now for dynamic content. I'm presently running PHP4 as an apache module. One difference that I've noticed is that PHP doesn't produce any output until the script is complete, whereas with Perl one could print "doing this... " , perform something, "done." messages when performing long tasks. Is there any way to have this enabled? It would be quite appreciated, as I have a few web pages that perform very heavy database work and I would like to make the output "hot" so that I can print out statements as it progresses- and if there is a problem, the user will be able to identify where it failed. There doesn't appear to be a php.ini directive that does this, though... Thanks in advance, Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]