Re: [PHP] php help for project!!
hi, check the PHP Manual about MySQL functions: http://www.php.net/manual/en/ref.mysql.php you can also check for HTML forms (including checkboxes) here: http://www.w3schools.com/html/html_forms.asp and tables (for the reports): http://www.w3schools.com/html/html_tables.asp if you face a particular problem, send here again khalid _ Unlimited Internet access for only $21.95/month. Try MSN! http://resourcecenter.msn.com/access/plans/2monthsfree.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HELP COOKIES !
Hi Grtz Erwin, let me tell you wat i need to do. 1.) I have a login page - if the user logs in correctly i create session(with session_start()) , a cookie is written to client + session file to server. 2.)When the user logs off - i call the logOff.php page . The contents are as follows : ?php session_start(); setcookie(session_name(),-3600); session_unset(); session_destroy(); ect. ? Now , when the user logs in again , i want a NEW COOKIE to be sent with a new id , to the client! This does not happen as the first cookie was never deleted. So when the user logs in again the same cookie is used ! why ? That's weird indeed. OK, try this instead: ? $name = session_name(); session_unset(); session_destroy(); setcookie( $name, '', '', '/' ); ? Regards Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Php Ready-to-go
Hello Paul, Monday, November 04, 2002, 10:00:15 PM, you wrote: PN http://pear.php.net/bcompiler ? PN ~Paul super! thnx a lot I will try it -- Best regards, Alexander Kuznetsov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Interfacing with Perl Modules
Hey guys I have a weird question. We are building a set of Perl modules to edit system configuration and I've been given the job of writing a PHP interface for it. Here's the situation: Users.pm has all the functionality needed to safely add users to the system. There are modules for dns, apache, etc, etc... The frontend should interface with these modules, calling their functions when needed. Does anyone have any ideas how I can do this? Derek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/extensions directory
I would like know the use of the following directory : /usr/lib/php/extensions/no-debug-non-zts-20010901 Thanks for your help. Pierre Vaudrey email [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] general cookies
hi When is create a session , and the browser refuses cookie i display an error the the user. There was no cookie created on the clients pc (i know this) but there is still a session file created on the server. When i use session_destroy() the session was not deleted , why ? Thanks Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HELP COOKIES !
Erwin [EMAIL PROTECTED] wrote in message news:20021105082624.74531.qmail;pb1.pair.com... Hi Grtz Erwin, let me tell you wat i need to do. 1.) I have a login page - if the user logs in correctly i create session(with session_start()) , a cookie is written to client + session file to server. 2.)When the user logs off - i call the logOff.php page . The contents are as follows : ?php session_start(); setcookie(session_name(),-3600); session_unset(); session_destroy(); ect. ? Now , when the user logs in again , i want a NEW COOKIE to be sent with a new id , to the client! This does not happen as the first cookie was never deleted. So when the user logs in again the same cookie is used ! why ? That's weird indeed. OK, try this instead: ? $name = session_name(); session_unset(); session_destroy(); setcookie( $name, '', '', '/' ); ? Regards Erwin hi , Still not working ! After i run the commands above i do the [print phpinfo(); ] statement , when i go down to php variable and look at cookies , there are now two identical named cookies eg. PHPSESSID = 2%C something and PHPSESSID = 234313414837418374813748dfaj (long id number) Instead of deleting the damn cookie , i create a new one it seems ! wat is there to do ? Thanks Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange error!
I have heard about a bug in this version that also included some first 4 characters loss. Try searching Daniele Baroncelli wrote: Hi guys, I have very weird problem. I have installed the PHP version 4.2.3 on the LINUX virtual server of my web project. Previously I had the PHP version 4.0.6. The error I get is very weird. When I insert a record with the phpMyAdmin, the first 4 characters of each field don't get saved. Same thing happened with some data entry interfaces I coded! The only difference I can see in the two installation (provided the php.ini file is in the same location): The old version 4.0.6 was installed by the server provider and my virtual server space I can only see the .so file. The new version 4.2.3 is actually inside my virtual server space. Hence, the path I provided in the php configuration is different (I don't have idea if this can influence something). NEW VERSION (4.2.3) configuration run by me './configure' '--with-apxs=/usr/local/apache/1.3/bin/apxs' '--prefix=/usr/home/rockit/usr/local' '--with-mysql=/usr/home/rockit/usr/local/mysql' '--with-xml' '--enable-xslt' '--with-xslt-sablot=/usr/home/rockit/usr/local' '--with-regex=system' '--with-expat-dir=/usr/home/rockit/usr/local' '--with-iconv=/usr/home/rockit/usr/local' '--enable-inline-optimization' '--disable-debug' '--enable-memory-limit' '--enable-sigchild' '--without-pear' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-gdbm=/usr/local' '--enable-sockets' '--enable-versioning' '--with-ttf=/usr/local' '--enable-ftp' '--with-gd=/usr/local' '--with-zlib' '--enable-gd-native-ttf' OLD VERSION (4.0.6) configuration run by the server provider './configure' '--enable-inline-optimization' '--with-apxs=/usr/local/apache/1.3/bin/apxs' '--with-config-file-path=/usr/local/lib' '--disable-debug' '--enable-memory-limit' '--enable-sigchild' '--with-gettext' '--without-pear' '--with-regex=system' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-iconv=/usr/local' '--with-gdbm=/usr/local' '--with-dbm=/usr/local' '--enable-sockets' '--enable-versioning' '--with-freetype-dir=/usr/local' '--with-ttf=/usr/local' '--enable-ftp' '--with-curl=/usr/local/curl' '--with-openssl=/usr/local/openssl' '--with-gd=/usr/local' '--with-freetype-dir=/usr/local' '--with-ttf=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-t1lib=/usr/local' '--with-zlib' '--enable-gd-native-ttf' '--with-imap' '--with-mcrypt=/usr/local' '--with-mhash=/usr/local' '--with-dom=/usr/local' '--with-mysql=/usr/local/mysql' '--with-zlib' '--with-zlib' I must admit that I didn't not include all parameter as the old installation, as I didn't know most options and thought is not needed. In the new installation I instead provided additional XML parameter (after installing the correspond modules, which all seem to work fine). Hints on problem are very well welcome! Daniele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calendar script - help
Your better off writing it from scratch than taking some pre-existing calendar/events code. Break the problem up into two seperate pieces and solve for each - the creation of a calendar view and the creation of a events view. I am a calendar and I know how to: Show a monthly view of myself Move forward one month Move backward one month When a day is clicked I ask the events viewer to show an event I am a events viewer and I know how to: Show a event Add a event Edit a event Delete a event Create two classes, Calendar (calendar.php) and Events (events.php) that do the above. The schema of the mySQL database is simple: create table CalendarEvents ( eventId int unsigned NOT NULL auto_increment primary key, title varchar(64) NOT NULL, eventDateStart DATE default '-00-00', eventDateEnd DATE default '-00-00', event text NOT NULL ); Instead of entering in a date, why not click on the calendar's day to take you to a form that will let you enter in the information. Here's some functions to helpin generating the calendar, which is nothing more than a 6 row by 7 column table. Figure out the start of the first day in the month via the FirstDayofMonth() function below. Create blank cells up to that day, then generate the numbered days, along with numbered day hyperlinks that when clicked, contain the month, day, year (e.g. hyperlink for the day contains Events.php?m=11d=5y=2002). This will create your context for the day. You will be able to $_GET the params from within Events.php. This will allow you to insert/delete/edit the record for that day in the database. function IsLeapYear($year) { return(date(L, mktime(0,0,0,1,1,$year))); } function FirstDayofMonth($month, $year) { // 0 - Sunday 6 - Saturday return(date(w, mktime(0,0,0,$month,1,$year))); } function DaysInMonth($month, $year) { return(date(t, mktime(0,0,0,$month,1,$year))); } Good luck, Kerry Kobashi Kobashi Computing - Ray Healy ) [EMAIL PROTECTED] wrote in message news:001a01c2835e$f9234d40$601786d9;mainserver... Dear All I spent days and days on this little project but still cannot get it to work (new to PHP as you might guess). I have a script which is a combination of tutorial scripts and free code to display a calendar with colour coded cells for the events on each day. The only way to enter events is to enter them one at a time. What I want to do is to be able to enter either a start date and end date or start date and the number of days. This will then enter a new line in the mySQL database for each day. There would only ever be one vent per day. I have the following fields at present in the database and would probably need another field (say number of days) id int (auto_increment) - eventdate date ('-00-00') - title (varchar) - event (blob) Can anyone help me as I have searched them web and mail lists to no avail. Everything that is available is excellent but does too much for what I need. Summary:- a calendar that can colour code the background cells if there is an event title in the mySQL database and to be able to enter the event for multiple days. Any help would be very much appreciated. Thanks for your time Ray
Re: [PHP] PHP driven frame
Did you get a request for a two part form, or for a form on 2 pages? The problem I see is with browsers without javascript (either turned of or not implemented) Chris Rehm wrote: I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this. I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form. Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame. I'd appreciate any feedback regarding this. Is this something I should be using PHP for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fw: [PHP-DEV] When my PHP file opens, I want it to automaticallysubmit
body onload=yourForm.submit() form name=yourForm action=mailto:address;server.net input type=hidden name=ip value=?= $_SERVER['REMOTE_ADDR'] ? /form /body is this what you want? This is too complicated, why not sending it from the server? Chris Shiflett wrote: This type of question should be addressed to [EMAIL PROTECTED] I am forwarding it there. Also, please correct your reply-to address. Chris Luke wrote: Hello, On my website, I have a php form which submits the global Ip address of the computer its on to a specific email address, I want it to automatically click the submit button on the website without questions, it already has an email address specified in it, but you have to open the document and click submit.. any ideas? Thanks, Luke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] general cookies
Because the client did not supply you with the session id, so session_destroy() doesn't know what file to erase Shaun wrote: hi When is create a session , and the browser refuses cookie i display an error the the user. There was no cookie created on the clients pc (i know this) but there is still a session file created on the server. When i use session_destroy() the session was not deleted , why ? Thanks Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to get all HTTP CONTENT?
hi, who knows how to get all contents when i use javascript to get bookmark of IE ex: window.external.ImportExportFavoritesfalse,http://localhost/test.php;); because i use $_POST to get that data,but it can't get all data. if it has 27593 bytes ,then only get 7XXX bytes. that means so many data was not geted. i got some informations when use $HTTP_SERVER_VARS, then data is [key=COMSPEC]=value[C:\\WINDOWS\\COMMAND.COM] [key=CONTENT_LENGTH]=value[27593] [key=CONTENT_TYPE]=value[application/x-www-form-urlencoded] [key=DOCUMENT_ROOT]=value[c:/windows/desktop/web] [key=HTTP_CACHE_CONTROL]=value[no-cache] [key=HTTP_CONNECTION]=value[Keep-Alive] [key=HTTP_HOST]=value[localhost] [key=HTTP_USER_AGENT]=value[PostFavorites] [key=PATH]=value[C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\PROGRA~1\\SSHCOM~1\\SS HSEC~1;C:\\PROGRA~1\\MICROS~4\\80\\TOOLS\\BINN;C:\\PROGRA~1\\ULTRAE~1;C:\\PR OGRA~1\\BORLAND\\DELPHI5\\BIN;C:\\PROGRA~1\\BORLAND\\VBROKER\\BIN;C:\\PROGRA ~1\\BORLAND\\VBROKER\\JRE\\BIN;C:\\PROGRA~1\\BORLAND\\DELPHI5\\PROJECTS\\BPL ;C:\\PROGRA~1\\ULTRAE~1] [key=REMOTE_ADDR]=value[127.0.0.1] [key=REMOTE_PORT]=value[1755] [key=SCRIPT_FILENAME]=value[c:/windows/desktop/web/test.php] [key=SERVER_ADDR]=value[127.0.0.1] [key=SERVER_ADMIN]=value[[EMAIL PROTECTED]] [key=SERVER_NAME]=value[211.22.80.5] [key=SERVER_PORT]=value[80] [key=SERVER_SIGNATURE]=value[ADDRESSApache/1.3.24 Server at 211.22.80.5 Port 80/ADDRESS ] [key=SERVER_SOFTWARE]=value[Apache/1.3.24 (Win32) PHP/4.2.2] [key=WINDIR]=value[C:\\WINDOWS] [key=GATEWAY_INTERFACE]=value[CGI/1.1] [key=SERVER_PROTOCOL]=value[HTTP/1.1] [key=REQUEST_METHOD]=value[POST] [key=QUERY_STRING]=value[] [key=REQUEST_URI]=value[/test.php] [key=SCRIPT_NAME]=value[/test.php] [key=PATH_TRANSLATED]=value[c:/windows/desktop/web/test.php] [key=PHP_SELF]=value[/test.php] [key=argv]=value[Array] [key=argc]=value[0] so i know the content length is 27593 who can tell me how to get all data but not use $_POST variables. thanks a lot..^^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable Value 2 Session Name
I'm trying to create what I believe should be a simple script to help with logging users into my site. My problem is that at the top of my script I set a variable with it's value and then at later script I cannot appear to access it. Extract of my code is as follows and fails: $IDField = loginemail; $SessionUser = $row['.$IDFeild.']; session_register('SessionUser'); However if I change the second line to $SessionUser = $row['loginemail']; It works great. Any help would be really appreciated as I think it's just me missing some basics. Thanks Stephen
[PHP] Spawning a background process
Allo, Basically, my question is.. how do I do this? I am actually (for various .. and probably stupid... reasons) trying to spawn a php process to run in the background. This process I know will take a couple of hours to run (mailing list stuff). I have been playing around with system to try to get it to run in the background but I can't seem to work out how to do it. Any pointers would be a great help Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Authentication with PHP and HTTP
very true :) thx - I will keep that in mind... Chris Shiflett [EMAIL PROTECTED] schrieb im Newsbeitrag news:3DC71CBE.2050703;php.net... You can hide URLs by fetching them with one of your own PHP scripts: base href=www.site.com ? readfile(http://user:password;www.site.com/); ? I think it might be at least better than frames. :-) Chris silver wrote: you could use this URL syntax: http://user:password;www.site.com to automatically log your user in to the htaccess protected area. the bad thing about it is that user / password show up in the URL, but you could hide this information with using frames... are PHP/MySQL usernames + passwords the same like in Apache/HTTP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fw: [PHP-DEV] When my PHP file opens, I want it toautomatically submit
Are you just interested in getting the IP address of the visitor? IF so, this info is already added to the website's apache log, so you actually only need to go look through the log, or, if you want to make it a bit more surgical, you can write the 'REMOTE_ADDR' variable straight into a mysql table, without the added trouble of mailing , specially with using mailto: ; this actually opens up a new message window on the client's side's e-mail program, and the user has to click on send, if he doesn't, you won't get the mail So, if it's crucial stuff, don't rely on the client ( that's actually the golden rule for all apps...) On Tue, 2002-11-05 at 13:05, Marek Kilimajer wrote: body onload=yourForm.submit() form name=yourForm action=mailto:address;server.net input type=hidden name=ip value=?= $_SERVER['REMOTE_ADDR'] ? /form /body is this what you want? This is too complicated, why not sending it from the server? Chris Shiflett wrote: This type of question should be addressed to [EMAIL PROTECTED] I am forwarding it there. Also, please correct your reply-to address. Chris Luke wrote: Hello, On my website, I have a php form which submits the global Ip address of the computer its on to a specific email address, I want it to automatically click the submit button on the website without questions, it already has an email address specified in it, but you have to open the document and click submit.. any ideas? Thanks, Luke -- 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] general cookies
Marek Kilimajer [EMAIL PROTECTED] wrote in message news:3DC7A6C3.7030105;webglobe.sk... Because the client did not supply you with the session id, so session_destroy() doesn't know what file to erase Shaun wrote: hi When is create a session , and the browser refuses cookie i display an error the the user. There was no cookie created on the clients pc (i know this) but there is still a session file created on the server. When i use session_destroy() the session was not deleted , why ? Thanks Shaun in this case , how do i remove the session from the server then , withour deleting it of course ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Variable Value 2 Session Name
well - as far as I understand - this line... $SessionUser = $row['.$IDFeild.']; ...should read: $SessionUser = $row[$IDField]; so - in my eyes just a syntax error. I hope I'm right in case you have session_autostart disabled in yout php.ini you first have to start the session with the session_start() command. _andi Stephen Of Blank Canvas Group [EMAIL PROTECTED] schrieb im Newsbeitrag news:003401c284bc$c4a76ce0$0101a8c0;abstractinternet.net... I'm trying to create what I believe should be a simple script to help with logging users into my site. My problem is that at the top of my script I set a variable with it's value and then at later script I cannot appear to access it. Extract of my code is as follows and fails: $IDField = loginemail; $SessionUser = $row['.$IDFeild.']; session_register('SessionUser'); However if I change the second line to $SessionUser = $row['loginemail']; It works great. Any help would be really appreciated as I think it's just me missing some basics. Thanks Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Spawning a background process
Basically, my question is.. how do I do this? I am actually (for various .. and probably stupid... reasons) trying to spawn a php process to run in the background. This process I know will take a couple of hours to run (mailing list stuff). I have been playing around with system to try to get it to run in the background but I can't seem to work out how to do it. A process which generates output (or can generate output) will make the system or exec call in blocking. That means that the PHP script will wait until your script is finished. This can be simply fooled by adding /dev/null to your commandline (if you're running on a *nix based machine of course). I have a simple background process, which forks itself and then immediately returns (only the parent process, the child keeps on running). Even then the exec function was blocking, until I added /dev/null to the commandline. If you're background process doesn't spawn it's own child, I think you'll have to add an ampersand () also, to make the program run in background. HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Format Currency
Hello, How i format a number in currency ? Try find it on php.net but i did not see nothing. Anyone know this? Augusto Flavio __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] general cookies
No way, you have to wait till garbage collector erases it Shaun wrote: Marek Kilimajer [EMAIL PROTECTED] wrote in message news:3DC7A6C3.7030105;webglobe.sk... Because the client did not supply you with the session id, so session_destroy() doesn't know what file to erase Shaun wrote: hi When is create a session , and the browser refuses cookie i display an error the the user. There was no cookie created on the clients pc (i know this) but there is still a session file created on the server. When i use session_destroy() the session was not deleted , why ? Thanks Shaun in this case , how do i remove the session from the server then , withour deleting it of course ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Format Currency
Hi, try this function: number_format -- Format a number with grouped thousands Description string number_format ( float number [, int decimals [, string dec_point [, string thousands_sep]]]) Petr Tomenendal On Tue, 2002-11-05 at 12:55, dark rotter wrote: Hello, How i format a number in currency ? Try find it on php.net but i did not see nothing. Anyone know this? Augusto Flavio __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.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: Authentication with PHP and HTTP
I've tried both methods without success. header(Location: http://(user):(pass)www.mysite.com); does the transfer but I still get prompted for a username and password by Apache readfile(http://(user):(pass)www.mysite.com); brings a warning message. Warning: readfile(http://...;www.mysite.com/) - Success in redirect.php on line 2 It's a warning but says Success? Ed On Mon, 4 Nov 2002, Chris Shiflett wrote: You can hide URLs by fetching them with one of your own PHP scripts: base href=www.site.com ? readfile(http://user:password;www.site.com/); ? I think it might be at least better than frames. :-) Chris silver wrote: you could use this URL syntax: http://user:password;www.site.com to automatically log your user in to the htaccess protected area. the bad thing about it is that user / password show up in the URL, but you could hide this information with using frames... are PHP/MySQL usernames + passwords the same like in Apache/HTTP? -- 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] Format Currency
http://www.php.net/manual/en/function.sprintf.php Example 6 shows you how. Rudolf Visagie Principal Software Developer Digital Healthcare Solutions mailto:rudolf;dhsolutions.co.za Tel: 011 6901019 Cell: 082 895 1598 -Original Message- From: dark rotter [mailto:darkrotter;yahoo.com] Sent: Tuesday, November 05, 2002 1:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Format Currency Hello, How i format a number in currency ? Try find it on php.net but i did not see nothing. Anyone know this? Augusto Flavio __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.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
[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. HTML HEADTITLEStore binary data into SQL Database/TITLE/HEAD BODY ?php // code that will be executed if the form has been submitted: if ($submit) { // connect to the database require_once('../../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $data = addslashes(fread(fopen($form_data, r), filesize($form_data))); $result=MYSQL_QUERY(INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) . VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')); $id= mysql_insert_id(); print pThis file has the following Database ID: b$id/b; MYSQL_CLOSE(); } else { // else show the form to submit new data: ? form method=post action=?php echo $PHP_SELF; ? enctype=multipart/form-data INPUT TYPE=hidden name=MAX_FILE_SIZE value=100 brFile to upload/store in database:br input type=file name=form_data size=40 pinput type=submit name=submit value=submit /form ?php } ? /BODY /HTML Here is the code to display the image:- ?php if($id) { require_once('../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $query = select image_thumbnail,image_thumbnail_type from master_products where item_id=$id; $result = 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
Re: [PHP] PHP driven frame
Yuk. I'll admit I don't like frames at the best of times, but is there any reason why the two-part form can't be two *pages* rather than two *frames*? The way I usually do that stuff is get them to fill in part a, then part b: 1) validates part a 2) decides what the part b form should look like 3) includes the contents of part a as hidden fields But if you *have* to have the form split into two frames, then javascript would submit the first form contents to the second frame, which would then act like part b as above. You would need to ask a javascript list about that tho :) Justin on 05/11/02 5:18 PM, Chris Rehm ([EMAIL PROTECTED]) wrote: I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this. I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form. Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame. I'd appreciate any feedback regarding this. Is this something I should be using PHP for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP driven frame
Just store the results of the first page into the session, get the results from the second page, and then process everything. Or serialize $_POST from the first page and pass it through the second page in a hidden field. I'd advise against using frames, just use two pages to get your results. ---John Holmes... -Original Message- From: Chris Rehm [mailto:chris;javadisciple.com] Sent: Tuesday, November 05, 2002 2:18 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP driven frame I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this. I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form. Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame. I'd appreciate any feedback regarding this. Is this something I should be using PHP for? -- Chris Rehm [EMAIL PROTECTED] For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself. Gal. 5: 14 -- 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 Digest 5 Nov 2002 12:35:31 -0000 Issue 1686
php-general Digest 5 Nov 2002 12:35:31 - Issue 1686 Topics (messages 122719 through 122766): Re: Authentication with PHP and HTTP 122719 by: silver 122722 by: Chris Shiflett 122754 by: silver 122762 by: ed.home.homes2see.com Re: [PHP-DEV] When my PHP file opens, I want it to automatically submit 122720 by: Chris Shiflett 122749 by: Marek Kilimajer 122755 by: Petre Agenbag Radiator PHP 122721 by: Chris Kay Upload permission on a web_user space... 122723 by: Benjamin Trépanier 122728 by: rija Re: Battling with highlighting search criteria 122724 by: Michael Sims Re: 4.2.3 compile problem on OSX 122725 by: Adam Atlas about @ in php 122726 by: Alex 122727 by: John Nichel Re: Cookies disabled, new session ID each click! 122729 by: Jason Wong checkboxes and selection lists 122730 by: marco_bleeker.hetnet.nl 122731 by: John Nichel 122732 by: rija 122734 by: Brendon G php help for project!! 122733 by: Karl James 122739 by: Khalid El-Kary Re: php / ldap 122735 by: Stig Venaas Re: HELP COOKIES ! 122736 by: Shaun 122738 by: Shaun 122740 by: Erwin 122745 by: Shaun PHP driven frame 122737 by: Chris Rehm 122748 by: Marek Kilimajer 122765 by: Justin French 122766 by: John W. Holmes Re: Php Ready-to-go 122741 by: Alexander Kuznetsov Interfacing with Perl Modules 122742 by: Derek Belrose php/extensions directory 122743 by: Pierre Vaudrey general cookies 122744 by: Shaun 122750 by: Marek Kilimajer 122756 by: Shaun 122760 by: Marek Kilimajer Re: Strange error! 122746 by: Marek Kilimajer Re: Calendar script - help 122747 by: Kerry Kobashi how to get all HTTP CONTENT? 122751 by: nice_boy Variable Value 2 Session Name 122752 by: Stephen of Blank Canvas Group 122757 by: silver Spawning a background process 122753 by: kevin 122758 by: Erwin Format Currency 122759 by: dark rotter 122761 by: Petr Tomenendál 122763 by: Rudolf Visagie MYSQL and PHP Storing and retrieving images getting corrupted 122764 by: Darren McPhee Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- hi - I'm not quite sure if this will help you, but lets give it a try: you could use this URL syntax: http://user:password;www.site.com to automatically log your user in to the htaccess protected area. the bad thing about it is that user / password show up in the URL, but you could hide this information with using frames... are PHP/MySQL usernames + passwords the same like in Apache/HTTP? greets, _andi Phillip Erskine [EMAIL PROTECTED] schrieb im Newsbeitrag news:F13i7M4BAyxJMXehYSo4e46;hotmail.com... I have a site that uses PHP/MySQL authentication for one section and Apache/HTTP authentication for another. Eventually I would like to use only PHP and MySQL for authenticating users, but in the meantime, I have to use both. First, users will log in to the main section of the site and I will use PHP session variables to maintain state for that section. What I would like to be able to do is allow users to click a link that would redirect them to the other section of the site and automatically log them in. The section of the site that users will be redirected to uses .htaccess and .htpassword files to enforce HTTP authentication. Is this possible? If so, how? = http://www.pverskine.com/ _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 ---End Message--- ---BeginMessage--- You can hide URLs by fetching them with one of your own PHP scripts: base href=www.site.com ? readfile(http://user:password;www.site.com/); ? I think it might be at least better than frames. :-) Chris silver wrote: you could use this URL syntax: http://user:password;www.site.com to automatically log your user in to the htaccess protected area. the bad thing about it is that user / password show up in the URL, but you could hide this information with using frames... are PHP/MySQL usernames + passwords the same like in Apache/HTTP? ---End Message--- ---BeginMessage--- very true :) thx - I will keep that in mind... Chris Shiflett [EMAIL PROTECTED] schrieb im Newsbeitrag news:3DC71CBE.2050703;php.net... You can hide URLs by fetching them with one of your own PHP scripts: base href=www.site.com ? readfile(http://user:password;www.site.com/); ? I think
Re: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted
Try adding header('Content-length: ' .strlen($data)); header Darren McPhee wrote: 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. HTML HEADTITLEStore binary data into SQL Database/TITLE/HEAD BODY ?php // code that will be executed if the form has been submitted: if ($submit) { // connect to the database require_once('../../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $data = addslashes(fread(fopen($form_data, r), filesize($form_data))); $result=MYSQL_QUERY(INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) . VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')); $id= mysql_insert_id(); print pThis file has the following Database ID: b$id/b; MYSQL_CLOSE(); } else { // else show the form to submit new data: ? form method=post action=?php echo $PHP_SELF; ? enctype=multipart/form-data INPUT TYPE=hidden name=MAX_FILE_SIZE value=100 brFile to upload/store in database:br input type=file name=form_data size=40 pinput type=submit name=submit value=submit /form ?php } ? /BODY /HTML Here is the code to display the image:- ?php if($id) { require_once('../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $query = select image_thumbnail,image_thumbnail_type from master_products where item_id=$id; $result = 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
Re: [PHP] Bizzare mime-type header() problem
Your pseudocode is incomplete, because you do not show us where you call this mysterious function that validates using $PHPSESSID. The call is in the location where I have it defined. Also, if that is really all your switch consists of, you're not really gaining anything over using a simple if construct: No, it consists of a few others but none that are related to the problem. Also, it provides for future functionality (actions) so that I don't have to rewrite that section of the code. In any case, I figured out what the problem was and posted a follow up that posed it's own questions. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] special print function
Hello there! I am really new to PHP and in good old copy/paste tradition i was looking for a script that would serve my needs - unfortunately without success. Perhaps some of you could help me? I am looking for a special print function: I have three coloumns on the page. Under each there is a printer icon. When i press the printer icon underneath the left coloumn i only want a print version of that left coloumn. same goes for the middle and right coloumn. Has anyone ever seen a script that can do that? Many thanks for your help! Ines -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] randomly select file
Thanks guys gals, for clueing me in. rija [EMAIL PROTECTED] 11/04/02 05:31PM Why don't you cope with opendir / readdir () and array_rand () I tried it and I look ok- But, I wonder if there are noble another way to do it? - Original Message - From: ROBERT MCPEAK [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 8:40 AM Subject: [PHP] randomly select file Could someone suggest some php for randomly selecting a file from a directory and then displaying the contents of the file? Thanks in advance! -- 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] Re: PHP driven frame
Why do you nee to use frames? Wouldn't it be asier to set hidden fields in the second form and submit the values of the first form to these hidden fields. Personally I would submit the form into the same page Chris Rehm [EMAIL PROTECTED] wrote in message news:3DC770B4.9060502;javadisciple.com... I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this. I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form. Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame. I'd appreciate any feedback regarding this. Is this something I should be using PHP for? -- Chris Rehm [EMAIL PROTECTED] For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself. Gal. 5: 14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating and ftp text file
HI I need to create a text file that is in a specific format from a mysql query, and then ftp that file to another server. The format will be something like this: Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Reference: 123456 Notify: 0 Validity: 2h text message As you can probably deduct, this is for sending SMS message. The x are the numbers that I will be getting from a mysql query, I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] special print function
hi ines, surely ther are several possibilities to solve this problem. i would do it like this: put your values in three arrays suggesting your icons represents links, put a variable after each link. with the 'switch; case' command you can evaluate the get variables, and generate the pages with the content you wish. the rest is a little javascript, that calls the system print dialog. hope that helps a little regards martin -Ursprüngliche Nachricht- Von: Ines [mailto:ines;comprehend.de] Gesendet: Dienstag, 5. November 2002 14:33 An: [EMAIL PROTECTED] Betreff: [PHP] special print function Hello there! I am really new to PHP and in good old copy/paste tradition i was looking for a script that would serve my needs - unfortunately without success. Perhaps some of you could help me? I am looking for a special print function: I have three coloumns on the page. Under each there is a printer icon. When i press the printer icon underneath the left coloumn i only want a print version of that left coloumn. same goes for the middle and right coloumn. Has anyone ever seen a script that can do that? Many thanks for your help! Ines -- 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] special print function
There is nothing special about such function... Simply pass a different GET variable (site.com/page.php?getvariable=value) value for each column and have an if/else logic in your PHP code. -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // PHP for Beginners www.maxim.cx // my Home // my Wish List: ( Get me something! ) http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3 Ines [EMAIL PROTECTED] wrote... : Hello there! I am really new to PHP and in good old copy/paste tradition i was looking for a script that would serve my needs - unfortunately without success. Perhaps some of you could help me? I am looking for a special print function: I have three coloumns on the page. Under each there is a printer icon. When i press the printer icon underneath the left coloumn i only want a print version of that left coloumn. same goes for the middle and right coloumn. Has anyone ever seen a script that can do that? Many thanks for your help! Ines -- 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] Spawning a background process
Try learning about PHP CLI, it can solve some of your problems. -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // PHP for Beginners www.maxim.cx // my Home // my Wish List: ( Get me something! ) http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3 kevin [EMAIL PROTECTED] wrote... : Allo, Basically, my question is.. how do I do this? I am actually (for various .. and probably stupid... reasons) trying to spawn a php process to run in the background. This process I know will take a couple of hours to run (mailing list stuff). I have been playing around with system to try to get it to run in the background but I can't seem to work out how to do it. Any pointers would be a great help Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me learn! with an explanation of these two functions.
Can someone run over these functions I have written to explain if my logic is correct. I'm still new to PHP and am trying to get my head round it! This first function is to collect a list of order numbers from my database where checked = no. Am I correct in assuming that the variable $orderid will be an array of results returned? How can I check this? function get_live_orders() { $conn = db_connect(); $query = select orderid from email where checked='no'; $result = @mysql_query($query); if(mysql_numrows($result)0) $orderid = @mysql_fetch_array($result); return $orderid; } This second function is to take these order numbers and compare them to order numbers in a second table and return the result of that. So if order number 11 is in the first array from the above function and there is a number 11 in the second query result I want to take all the data in that row and return it. function get_order_details() { $orderid = get_live_orders(); $conn = db_connect(); $query = select * from orders where orderid='$orderid'; $result = @mysql_query($query); if (!$result) return false; $result = mysql_result($result, 0, orderid); return $result; } I haven't actually run this yet but I'd like someone to explain to me what these functions will do so I am not just copy pasting code and hoping to get it right eventually! Probably I have written this wrong anyway and would like help before I actually attempt to do what I am after. I'll look back on this tomorrow so any help will be greatly appreciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me learn! with an explanation of these two functions.
$orderid WILL NOT contain all the rows. mysql_fetch_array() returns only one row each time it is called. Upon fetching last row, it returns NULL/FALSE/0. Therefore, as you fetch each row, you will then execute your second function to pull all the data for that particular order number. Finally, when executing mysql_query(), ALWAYS execute it in conjuction with die(mysql_error()) in order to get error messages concerning failures. Execute mysql_connect() and mysql_db_connect() only ONCE per script. function get_live_orders() { $query = select orderid from email where checked='no'; $result = mysql_query($query) or die(Error: cannot select orderidBR$queryBR.mysql_error()); while( $row = mysql_fetch_array($result)) { extract($row); $query2 = SELECT * FROM orders WHERE orderid=\$orderid\; $result2 = mysql_query()) or die(Error: cannot fetch orderBR$query2BR.mysql_error()); extract(mysql_fetch_array($result2)); } - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 8:50 AM Subject: [PHP] Help me learn! with an explanation of these two functions. Can someone run over these functions I have written to explain if my logic is correct. I'm still new to PHP and am trying to get my head round it! This first function is to collect a list of order numbers from my database where checked = no. Am I correct in assuming that the variable $orderid will be an array of results returned? How can I check this? function get_live_orders() { $conn = db_connect(); $query = select orderid from email where checked='no'; $result = @mysql_query($query); if(mysql_numrows($result)0) $orderid = @mysql_fetch_array($result); return $orderid; } This second function is to take these order numbers and compare them to order numbers in a second table and return the result of that. So if order number 11 is in the first array from the above function and there is a number 11 in the second query result I want to take all the data in that row and return it. function get_order_details() { $orderid = get_live_orders(); $conn = db_connect(); $query = select * from orders where orderid='$orderid'; $result = @mysql_query($query); if (!$result) return false; $result = mysql_result($result, 0, orderid); return $result; } I haven't actually run this yet but I'd like someone to explain to me what these functions will do so I am not just copy pasting code and hoping to get it right eventually! Probably I have written this wrong anyway and would like help before I actually attempt to do what I am after. I'll look back on this tomorrow so any help will be greatly appreciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me learn! with an explanation of these two functions.
Your first function is only going to return one row of 'checked=no' records. The second function will only return one column of the result. What you want is a JOIN. You can do all of this with a single query. Without knowing the format of your tables exactly, I can't give you the syntax, though. Check the MySQL manual and read the chapter on JOINs. ---John Holmes... - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 9:50 AM Subject: [PHP] Help me learn! with an explanation of these two functions. Can someone run over these functions I have written to explain if my logic is correct. I'm still new to PHP and am trying to get my head round it! This first function is to collect a list of order numbers from my database where checked = no. Am I correct in assuming that the variable $orderid will be an array of results returned? How can I check this? function get_live_orders() { $conn = db_connect(); $query = select orderid from email where checked='no'; $result = @mysql_query($query); if(mysql_numrows($result)0) $orderid = @mysql_fetch_array($result); return $orderid; } This second function is to take these order numbers and compare them to order numbers in a second table and return the result of that. So if order number 11 is in the first array from the above function and there is a number 11 in the second query result I want to take all the data in that row and return it. function get_order_details() { $orderid = get_live_orders(); $conn = db_connect(); $query = select * from orders where orderid='$orderid'; $result = @mysql_query($query); if (!$result) return false; $result = mysql_result($result, 0, orderid); return $result; } I haven't actually run this yet but I'd like someone to explain to me what these functions will do so I am not just copy pasting code and hoping to get it right eventually! Probably I have written this wrong anyway and would like help before I actually attempt to do what I am after. I'll look back on this tomorrow so any help will be greatly appreciated. Kind regards, Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $a=1.2; // $a is rounded to 1 Why?
Hi, double variables are rounded as integer but GetType is 'double' $a=10.2; echo get_cfg_var('precision'); // print 14 echo ini_get('precision'); // print 14 echo GetType($a); // print double echo $a; // print 10 I use php 4.1.2 / apache 1.3.24 but I have tried to upgrade to 4.2.3 without success some weeks ago. Jean-Pierre ___ Do You Yahoo!? -- Une adresse yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: creating and ftp text file
I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? In fact, it is...just open the file on the ftp directly ? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ? You can then write directly to that filepointer: ? fwrite( $fp, 'some text' ); ? Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that) ? fclose( $fp ); ? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. You'll have to loop trough the resultset ? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . \n; } $content .= 'Reference: ' . $reference . \n; $content .= 'Notify: ' . $notify . \n; // And add everything else to the $content variable which needs to be written $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ? HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble maintaining a session
Hey all, I was wondering if anyone could explain to me why I can't seem to maintain a session using PHP 4.1.2 on my NT4 server. I am don't have any problems on my W2K/IIS5 or Linux machine. What I am doing is allowing my users to log on to the site at any time, and then being returned to the page that they logged in from. This isn't the problem. The problem is on the NT4/PHP4.1.2 machine when I click on a link to go to another page their login information is lost, almost as if they logged out. Here is the validation code that I am currently using: [auth.inc] ?php function validateUser() { $users = file(includes/users.txt); if(!isset($_SESSION['logged_in'])) $_SESSION['logged_in'] = FALSE; if(!isset($_SESSION['log_attempt'])) $_SESSION['log_attempt'] = FALSE; if(!isset($_SESSION['valid_user'])) $_SESSION['valid_user'] = ; if(!isset($_SESSION['email'])) $_SESSION['email'] = ; if(!isset($_REQUEST['phpsessid'])) { if(empty($_POST['email']) || empty($_POST['passwd'])) { $email = ; $pass = ; } else { $email = $_POST['email']; $pass = $_POST['passwd']; $_SESSION['log_attempt'] = TRUE; } // replace with SQL query when db is instated foreach($users as $login) { list($user,$passwd,$fname,$lname) = explode(|,$login); if($user==$email $passwd==md5($pass)) { $_SESSION['logged_in'] = TRUE; $_SESSION['valid_user'] = $fname. .trim($lname); $_SESSION['email'] = $email; } } } return($_SESSION['logged_in']); } ? Once again, it works fine on the W2K/IIS5 and Linux box, so that is why I am having problems isolating the problem. Maybe it's just my logic and a fresh pair of eyes would help looking at this. Thanks for all your help, _ / Joshua Minnie\ ++---+ | Wild Web Technology| | Independent Web Consultant/Developer | | [EMAIL PROTECTED] | || | Tel : 616.890.1566 | ++
[PHP] PHP/MySql Array problem (newbie)
Hi there, I am trying to send an array to a database and visualize it again. Alltough this sounds simple, for me hours! I create the arry from a form, serialize it, urlencode it and send it to a row in mysql. So far all ok, However, in mysqlfront (I suppose in every prog.) the cell in the table that contains the array, does not give the contents, it only displays Array. I dont know if I go wrong here allready? Well, if that sounds right, the problem is on getting it out. I unserialize, urldecode, but the only output I can create is Array(). How can I get the information (ordered) from the database. I would realy apreciate some help! Tnx Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] addslashes/stripslashes
Hey, I am trying to develop a search for my database. I used addslashes when entering the data, and then use addslashes with the search but nothing comes up: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine. What gives? Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem unsolve! :-(
Here I'm trying to explain my problem with better details... I have a web server that I'm using to share file with my clients. So my client are not using a ftp client software. Client have their own web_user directory on my server example: ip. 202.202.020.1/adq is muy client adq... Clients are login from their own browser, ie most of the time... With my old server people was able to upload file from the ie windows with a simple upload field. I think it's a question of upload permission but, When I'm trying to set my upload permission that bring me an error...like: server response: SITE_umask not supported So im in trouble! :-) If you can help me thanks, I was looking for an alternative in php but, dont know if it's usefull like the other way... Because user must upload in any folder of his own directory... Thanks Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] addslashes/stripslashes
Don't know which database you're using but in Oracle you would use: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o''mallies%' ) Escape(\) is only used in PHP syntax, not SQL. Regards -Original Message- From: Paul Dionne [mailto:PDionne;Speakeasy.net] Sent: Tuesday, November 05, 2002 5:26 PM To: [EMAIL PROTECTED] Subject: [PHP] addslashes/stripslashes Hey, I am trying to develop a search for my database. I used addslashes when entering the data, and then use addslashes with the search but nothing comes up: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine. What gives? Thanks Paul -- 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
Fw: [PHP] PHP/MySql Array problem (newbie)
show us your code...we can't read your mind - Original Message - From: alex koppie [EMAIL PROTECTED] To: Sent: Monday, November 04, 2002 4:58 AM Subject: [PHP] PHP/MySql Array problem (newbie) Hi there, I am trying to send an array to a database and visualize it again. Alltough this sounds simple, for me hours! I create the arry from a form, serialize it, urlencode it and send it to a row in mysql. So far all ok, However, in mysqlfront (I suppose in every prog.) the cell in the table that contains the array, does not give the contents, it only displays Array. I dont know if I go wrong here allready? Well, if that sounds right, the problem is on getting it out. I unserialize, urldecode, but the only output I can create is Array(). How can I get the information (ordered) from the database. I would realy apreciate some help! Tnx Alex -- 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] addslashes/stripslashes
what happens when you type: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) at the mysql command line? - Original Message - From: Paul Dionne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 9:25 AM Subject: [PHP] addslashes/stripslashes Hey, I am trying to develop a search for my database. I used addslashes when entering the data, and then use addslashes with the search but nothing comes up: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine. What gives? Thanks Paul -- 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] function()
Hi to all, I have a problem with function() and some variables. The issue is this I declare the function, suppose: function test_func($param1) { echo $param1; } when I call the function like; ?php test_func(123)? works OK! But if I try something like this: ?php test_func(123); echo $param; ? This doesn't work. I need to get some variables values out of the function. Is there a way to make te variables defined in the function 'global' ? So I can use them after the function call. Thanks in advance!! regards, f.
[PHP] Re: addslashes/stripslashes
Paul Dionne wrote: Hey, I am trying to develop a search for my database. I used addslashes when entering the data, and then use addslashes with the search but nothing comes up: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) I think your query goes wrong, because MySQL uses two single quotes instead of backslash quote. So, try using Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE %o\'mallies% ). I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine. Because the data is save with the \ and with the ', you'll probably have to change your search to LIKE %o\\''mallies% ). Try using mysql_escape_string instead of addslashes to store the o'mallies as is, without the \. HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function()
First of all, you can't echo that variable in the manner you are trying. Try this instead: [lib.inc] function test_func($param1) { return $param1; } [main.php] ?php // option 1 $num = test_func(123); echo $num; // option 2 echo test_func(123); ? HTH _ / Joshua Minnie\ ++---+ | Wild Web Technology| | Independent Web Consultant/Developer | | [EMAIL PROTECTED] | || | Tel : 616.890.1566 | ++ Francisco Vaucher [EMAIL PROTECTED] wrote: | Hi to all, | | I have a problem with function() and some variables. | | The issue is this | | I declare the function, suppose: | | function test_func($param1) { | echo $param1; | } | | when I call the function like; | | ?php test_func(123)? | | works OK! | | But if I try something like this: | | ?php | | test_func(123); | echo $param; | | ? | | This doesn't work. I need to get some variables values out of the function. | Is there a way to make te variables defined in the function 'global' ? So I | can use them after the function call. | | Thanks in advance!! | | regards, | | f. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please Help: PHP Cookies Problem on localhost
Hi there, the php.net site said I should email you with problems. The basic issue is that I have a user logon screen which works on a remote server but not when developing on the same machine that is a local server. I hold the username and passwords on mysql and ask the user for their username and password which gets sent to another .php page which first of all sets the following cookies setcookie(email,$email,time()+1800); setcookie (password,$password,time()+1800); Then verifies this against the database and if succesfull redirects to the 'members area' where the cookies are set again otherwise it redirects to a logout page. [Which is where i get sent on the local machine] I have tried the following formats for the setcookie and all combinations including setting the expiry time to 8000. setcookie(email,$_POST[email],time()+1800); setcookie (password,$_POST[password],time()+1800); setcookie(email,$email,time()+1800); setcookie (password,$password,time()+1800); The database authentication is being succeful, it is just that the cookies are not being set on the local machine, as when I hit the members area I set the email value to another variable, set the cooies as before, then alert() the old value [before the $email was reset by the new setcookie() command. I have the following lines set in my php.ini register_globals = On variables_order = EGPCS Do you have any idea why my local machine is not setting the cookies??? Please help _ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] *.PHP save-as dialog
Hi there, I posted this message yesterday: -- I recently upgraded from PHP version 4.0-ish to 4.2.3 on my Linux/Apache machine. AFAIK, Apache is setup correctly (it serves HTML) and PHP works, but only from the command line. If I type php -q php.php test.html the output of phpinfo() is stored in test.html. When I try and look at test.html running on localhost it displays fine, but when I try and view php.php, as save as window pops up. I am not too familiar with Linux. If it was a Windows installation then I would make sure the Action application (path to php.exe) line was correct, but I can't find this in the Linux httpd.conf. Does this issue sound familiar to anyone. Could anyone point me in the right direction? - I am still having the same problem. It is obviously a problem with my httpd.conf file. PHP is installed as a CGI, and the AddHandler application/x-httpd-php .php is present. Can anyone offer any other suggestions? Below is my httpd.conf file. My apologies for inserting so many lines, but this is an extremely niggling problem, and I... just... can't... figure... it... out /shatner. If anyone could have a quick look to try and identify the problem, I would really appreciate it! Thanks. - Best regards, Lee Reilly -- ## httpd.conf - configuration for the Apache web server # # Generated automatically... if you edit manually, the changes will be lost # the next time you run apacheconfig. # # What we listen to # ServerType StandAlone ServerRoot /etc/httpd/ # We don't handle this yet... # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Please read the file README.DSO in the Apache 1.3 distribution for more # details about the DSO mechanism and run `httpd -l' for the list of already # built-in (statically linked and thus always available) modules in your httpd # binary. # # Note: The order is which modules are loaded is important. Don't change # the order below without expert advice. # # Example: # LoadModule foo_module modules/mod_foo.so #LoadModule mmap_static_module modules/mod_mmap_static.so LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule env_module modules/mod_env.so LoadModule config_log_module modules/mod_log_config.so LoadModule agent_log_module modules/mod_log_agent.so LoadModule referer_log_module modules/mod_log_referer.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule mime_modulemodules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule status_module modules/mod_status.so LoadModule info_modulemodules/mod_info.so LoadModule includes_modulemodules/mod_include.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule dir_module modules/mod_dir.so LoadModule cgi_module modules/mod_cgi.so LoadModule asis_modulemodules/mod_asis.so LoadModule imap_modulemodules/mod_imap.so LoadModule action_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule access_module modules/mod_access.so LoadModule auth_modulemodules/mod_auth.so LoadModule anon_auth_module modules/mod_auth_anon.so LoadModule db_auth_module modules/mod_auth_db.so #LoadModule digest_module modules/mod_digest.so #LoadModule proxy_module modules/libproxy.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule example_module modules/mod_example.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_modulemodules/mod_setenvif.so #LoadModule bandwidth_module modules/mod_bandwidth.so #LoadModule put_modulemodules/mod_put.so IfDefine HAVE_PERL LoadModule perl_modulemodules/libperl.so /IfDefine IfDefine HAVE_PHP LoadModule php_module modules/mod_php.so /IfDefine IfDefine HAVE_PHP3 LoadModule php3_modulemodules/libphp3.so /IfDefine IfDefine HAVE_PHP4 LoadModule php4_modulemodules/libphp4.so /IfDefine IfDefine HAVE_DAV LoadModule dav_module modules/libdav.so /IfDefine IfDefine HAVE_ROAMING LoadModule roaming_module modules/mod_roaming.so /IfDefine IfDefine HAVE_SSL LoadModule ssl_module modules/libssl.so /IfDefine # Reconstruction of the complete module list from all available modules # (static and shared ones) to achieve correct module execution order. # [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO] ClearModuleList
RE: [PHP] Problem with is_dir function
On Saturday, November 02, 2002 11:07 AM, I wrote * I'm having a problem with the is_dir function, or maybe I don't understand how it supposed to work. I'm using the following code to check whether or not a directory called $user_dir exists. If it exists, I am returned the proper message. But if it doesn't exist, I get the following error message that says that it doesn't exist. (I already knew that!) ERROR Number=8 Description=Error: quot;stat failed for /home/sites/home/users/demodocs/web/userforum/user (errno=2 - No such file or directory)quot; on line 175 of /home/sites/home/users/demo/web/user_forum/messages.php./ Can someone please explain what I am doing wrong here, and how to return a usable value if the directory doesn't exist. $test = is_dir($user_dir); if($test){echo You have a user directory. It is $user_dir;} else{echo Your user directory doesn't exist; return;} Thanks a lot. Roger Lewis This is a follow-up to my original posting. * I did not get an answer as to why is_dir does not return a false value; however, file_exists does the job nicely. Thanks for all the suggestions. * Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function()
On Tuesday 05 November 2002 23:56, Francisco Vaucher wrote: This doesn't work. I need to get some variables values out of the function. Is there a way to make te variables defined in the function 'global' ? So I can use them after the function call. Declare them as global: ? doo(123); echo $dah; function doo($param) { global $dah; $dah = $param * $param; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: creating and ftp text file
Erwin Thanks a million. That's actually much simpler than I thought it would be... I'm gonna give it a go just now, but I'm sure it will work! Thanks again! On Tue, 2002-11-05 at 17:09, Erwin wrote: I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? In fact, it is...just open the file on the ftp directly ? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ? You can then write directly to that filepointer: ? fwrite( $fp, 'some text' ); ? Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that) ? fclose( $fp ); ? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. You'll have to loop trough the resultset ? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . \n; } $content .= 'Reference: ' . $reference . \n; $content .= 'Notify: ' . $notify . \n; // And add everything else to the $content variable which needs to be written $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ? HTH Erwin -- 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] search and callback with preg
Hi I'm building an parser for my own project called vibrant. i need a file to be parsed, but I can't seem to get the right expression please please help; $src = vibrant application=application 1 1vibrant application=application 2 2br /vibrant /vibrant vibrant application=application 3 3 /vibrant ; preg_match_all( /((vibrant+)[^]*)(.*)(\/vibrant)/i, $src, $matches ); print_r($matches); what i need is a good solution to the greedy problem. when greedy it gets the wrong closing tag and therefore the wrong content. When greedy is disabled I get the first close tag which actually belongs to the second opening tag I in the dark here, help is apriciated very much. so the vibrant tags in the contentpart do not need to be found, since they will be iterated the next time round. thx thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finding HTML
I'm about to undergo a creation of a Link Exchange script for my site. One of the requirements is to have them have my button on their site in return for a button on mine. This is required and I don't want cheating. The only way I can think of doing this is checking their source code and making sure the code is still intact on their website about once a month. If not, then their button is removed from my site. Instead of doing this manually, I want to do it in PHP. This brings me to my question. How can I, without using FTP since I don't collect usernames or passwords, check their source code for my block of code? Then if it's not there, delete their entry from a table in MySQL? Any help would be great. Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying your favorite item you received from the person you love most. -- www.melchior.us
[PHP] Display only so many characters
I've seen this on a lot of news sites and such. How can I display only so many characters, then put a ... to show that it's continued? Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying your favorite item you received from the person you love most. -- www.melchior.us
Re: [PHP] Finding HTML
$f = fopen($url_with_button,r); $data = fread($f,100); fclose($f); if(substr_count($data,$your_homepage_link) == 0) mysql_query(DELETE FROM users WHERE thereurl = '$url_with_button';); or something like that. On Tue, 2002-11-05 at 12:20, Stephen wrote: I'm about to undergo a creation of a Link Exchange script for my site. One of the requirements is to have them have my button on their site in return for a button on mine. This is required and I don't want cheating. The only way I can think of doing this is checking their source code and making sure the code is still intact on their website about once a month. If not, then their button is removed from my site. Instead of doing this manually, I want to do it in PHP. This brings me to my question. How can I, without using FTP since I don't collect usernames or passwords, check their source code for my block of code? Then if it's not there, delete their entry from a table in MySQL? Any help would be great. Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying your favorite item you received from the person you love most. -- www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Display only so many characters
Hi Stephen, I've seen this on a lot of news sites and such. How can I display only so many characters, then put a ... to show that it's continued? ?php $story = a really really really really long string; $limit = 10; // how many chars to display echo substr($story, 0, $limit). ...; ? Read all about it at http://php.net/substr Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating SSL Connection to Accept Credit Cards
My credit card processor requires that I create an SSL connection in order to generate a transaction key. How would I go about writing a script to do so. Please point me in the right direction. The tech support says that it can only be done in ASP, but I find that hard to believe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get Entire URL for Current Page
Is it possible to get the entire url of the current page? I am particularly interested in getting the username:password part. http://username:password;www.mysite.com/path/to/file.php _ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating SSL Connection to Accept Credit Cards
Like: $f = fopen(https://whatever.com,r;) ? On Tue, 2002-11-05 at 12:31, [EMAIL PROTECTED] wrote: My credit card processor requires that I create an SSL connection in order to generate a transaction key. How would I go about writing a script to do so. Please point me in the right direction. The tech support says that it can only be done in ASP, but I find that hard to believe. -- 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] Get Entire URL for Current Page
On Wednesday 06 November 2002 01:32, Phillip Erskine wrote: Is it possible to get the entire url of the current page? I am particularly interested in getting the username:password part. http://username:password;www.mysite.com/path/to/file.php print_r($_SERVER); -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Your lover will never wish to leave you. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] *.PHP save-as dialog
Did you try getting rid of the IfDefine HAVE_PHP4 stuff? Lee Philip Reilly wrote: Hi there, I posted this message yesterday: -- I recently upgraded from PHP version 4.0-ish to 4.2.3 on my Linux/Apache machine. AFAIK, Apache is setup correctly (it serves HTML) and PHP works, but only from the command line. If I type php -q php.php test.html the output of phpinfo() is stored in test.html. When I try and look at test.html running on localhost it displays fine, but when I try and view php.php, as save as window pops up. I am not too familiar with Linux. If it was a Windows installation then I would make sure the Action application (path to php.exe) line was correct, but I can't find this in the Linux httpd.conf. Does this issue sound familiar to anyone. Could anyone point me in the right direction? - I am still having the same problem. It is obviously a problem with my httpd.conf file. PHP is installed as a CGI, and the AddHandler application/x-httpd-php .php is present. Can anyone offer any other suggestions? Below is my httpd.conf file. My apologies for inserting so many lines, but this is an extremely niggling problem, and I... just... can't... figure... it... out /shatner. If anyone could have a quick look to try and identify the problem, I would really appreciate it! Thanks. - Best regards, Lee Reilly -- ## httpd.conf - configuration for the Apache web server # # Generated automatically... if you edit manually, the changes will be lost # the next time you run apacheconfig. # # What we listen to # ServerType StandAlone ServerRoot /etc/httpd/ # We don't handle this yet... # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Please read the file README.DSO in the Apache 1.3 distribution for more # details about the DSO mechanism and run `httpd -l' for the list of already # built-in (statically linked and thus always available) modules in your httpd # binary. # # Note: The order is which modules are loaded is important. Don't change # the order below without expert advice. # # Example: # LoadModule foo_module modules/mod_foo.so #LoadModule mmap_static_module modules/mod_mmap_static.so LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule env_module modules/mod_env.so LoadModule config_log_module modules/mod_log_config.so LoadModule agent_log_module modules/mod_log_agent.so LoadModule referer_log_module modules/mod_log_referer.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule mime_modulemodules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule status_module modules/mod_status.so LoadModule info_modulemodules/mod_info.so LoadModule includes_modulemodules/mod_include.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule dir_module modules/mod_dir.so LoadModule cgi_module modules/mod_cgi.so LoadModule asis_modulemodules/mod_asis.so LoadModule imap_modulemodules/mod_imap.so LoadModule action_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule access_module modules/mod_access.so LoadModule auth_modulemodules/mod_auth.so LoadModule anon_auth_module modules/mod_auth_anon.so LoadModule db_auth_module modules/mod_auth_db.so #LoadModule digest_module modules/mod_digest.so #LoadModule proxy_module modules/libproxy.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule example_module modules/mod_example.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_modulemodules/mod_setenvif.so #LoadModule bandwidth_module modules/mod_bandwidth.so #LoadModule put_modulemodules/mod_put.so IfDefine HAVE_PERL LoadModule perl_modulemodules/libperl.so /IfDefine IfDefine HAVE_PHP LoadModule php_module modules/mod_php.so /IfDefine IfDefine HAVE_PHP3 LoadModule php3_modulemodules/libphp3.so /IfDefine IfDefine HAVE_PHP4 LoadModule php4_modulemodules/libphp4.so /IfDefine IfDefine HAVE_DAV LoadModule dav_module modules/libdav.so /IfDefine IfDefine HAVE_ROAMING LoadModule roaming_module modules/mod_roaming.so /IfDefine IfDefine HAVE_SSL LoadModule ssl_module modules/libssl.so /IfDefine # Reconstruction of the complete module list from all available modules # (static and shared ones) to achieve correct module execution order. #
Re: [PHP] Display only so many characters
Hi, Wednesday, November 6, 2002, 3:21:03 AM, you wrote: S I've seen this on a lot of news sites and such. How can I display only so many characters, then put a ... to show that it's continued? S Thanks, S Stephen Craton S http://www.melchior.us S Life is a gift from God. Wasting it is like destroying your favorite item you received from the person you love most. -- www.melchior.us Here is one way that cuts at a space ? $maxchar = 30; $text = I've seen this on a lot of news sites and such. How can I display only so many characters; $len = strlen($text); if($len $maxchar){ $t = substr($text,0,$maxchar); $lspace = strrpos($t,' '); if(!($lspace === false) $lspace 0){ $t = substr($t,0,$lspace); for($x=$lspace;$x ($maxchar+2);$x++){ $t .= '.'; } } $text = $t; } echo $text.'br'; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] *.PHP save-as dialog
Thanks for your reply. I took out the following lines, and restarted Apache, but I still have the same problem... /IfDefine IfDefine HAVE_PHP LoadModule php_module modules/mod_php.so /IfDefine IfDefine HAVE_PHP3 LoadModule php3_modulemodules/libphp3.so /IfDefine IfDefine HAVE_PHP4 LoadModule php4_modulemodules/libphp4.so /IfDefine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Entire URL for Current Page
print $_SERVER['REQUEST_URI']; -- Maxim Maletsky [EMAIL PROTECTED] Phillip Erskine [EMAIL PROTECTED] wrote... : Is it possible to get the entire url of the current page? I am particularly interested in getting the username:password part. http://username:password;www.mysite.com/path/to/file.php _ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.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] Get Entire URL for Current Page
With print_r($_SERVER); I can get the server name and script path, but how do you detect if username and password are in the url as in the example below? On Wednesday 06 November 2002 01:32, Phillip Erskine wrote: Is it possible to get the entire url of the current page? I am particularly interested in getting the username:password part. http://username:password;www.mysite.com/path/to/file.php print_r($_SERVER); -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Your lover will never wish to leave you. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards
I am not sure if that is what they want. I will try it and get back. Good suggestion. From: Adam Voigt [EMAIL PROTECTED] Date: 2002/11/05 Tue PM 12:33:00 EST To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) ? On Tue, 2002-11-05 at 12:31, [EMAIL PROTECTED] wrote: My credit card processor requires that I create an SSL connection in order to generate a transaction key. How would I go about writing a script to do so. Please point me in the right direction. The tech support says that it can only be done in ASP, but I find that hard to believe. -- 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] Creating SSL Connection to Accept Credit Cards
I thought that using fopen to create an SSL connection was not yet supported in PHP. I would suggest the CURL functions for this. -- JR -Original Message- From: Adam Voigt [mailto:adam;cryptocomm.com] Sent: Tuesday, November 05, 2002 12:33 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) ? On Tue, 2002-11-05 at 12:31, [EMAIL PROTECTED] wrote: My credit card processor requires that I create an SSL connection in order to generate a transaction key. How would I go about writing a script to do so. Please point me in the right direction. The tech support says that it can only be done in ASP, but I find that hard to believe. -- 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] array()
Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f.
RE: [PHP] Creating SSL Connection to Accept Credit Cards
I quote, from the comments on the fopen page: Playing with fopen(https://xxx;, r) it seems that HTTPS is only supported with OpenSSL AND PHP 4.3 . Older versions of PHP don't seem to be able to do this. So 4.3 or higher should work. On Tue, 2002-11-05 at 13:01, Jonathan Rosenberg (Tabby's Place) wrote: I thought that using fopen to create an SSL connection was not yet supported in PHP. I would suggest the CURL functions for this. -- JR -Original Message- From: Adam Voigt [mailto:adam;cryptocomm.com] Sent: Tuesday, November 05, 2002 12:33 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) ? On Tue, 2002-11-05 at 12:31, [EMAIL PROTECTED] wrote: My credit card processor requires that I create an SSL connection in order to generate a transaction key. How would I go about writing a script to do so. Please point me in the right direction. The tech support says that it can only be done in ASP, but I find that hard to believe. -- 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] array()
Try this... $test_arr = test_func( $param1, $param2 ) echo $test_arr; On Tue, 2002-11-05 at 18:01, Francisco Vaucher wrote: Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f. -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array()
hi, this one worked well, but to print the array you must use print_r() instead of echo print_r($test); khalid _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array()
Ugh. Read the in the manual about variable scope, and how to call a function. It's all there. To get you started... print_r ( test_func() ); Francisco Vaucher wrote: Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading an image in binary
I'm having trouble with a script to upload images, which is baffling me because a similar script has worked fine on other occasions. I can get the image file uploaded to the correct directory, but it is uploading in ASCII and I obviously need it in binary. The file name on the form is like this: input type=file name=add_imgthumb then the code on the php script looks like this: $uploadpath = 'path/images/'; $source = $_FILES['add_imgthumb']['tmp_name']; $name = $_FILES['add_imgthumb']['name']; $dest = $uploadpath.$name; copy($source, $dest); simple, i know, but that's the way i want it. What do I have to do to get the image to be uploaded in binary? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array()
sorry ... big said the right, but you must use print_r() if you want to print the array _ Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] Creating SSL Connection to Accept Credit Cards
Except that https:// doesn't work with fopen until PHP 4.3.0. Suggestions are only good if they work with a current version of PHP. :) (No, I don't consider 4.3.0 current until it's at *least* released) Regardless, until then, CURL support is probably the way to go. Assuming you have curl support, it's fairly straightforward: --- $ch = curl_init(https://somesite.com;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $authorization_data); $result = curl_exec($ch); $errorstr = curl_error($ch); curl_close($ch); --- $result contains the data received and $errorstr contains the error message (if any) if it was unsuccessful. Translating $result depends on how they return the data. With the above example, you'll need to have $authorization_data in POST format, which really is nothing more than the GET format string. (Secure transaction APIs typically don't allow GET) var=somevaluevar2=somevalue2var3=anothervalue -Original Message- From: Ben C. [mailto:benc;cox.net] Sent: Tuesday, November 05, 2002 11:55 AM To: Adam Voigt Cc: [EMAIL PROTECTED] Subject: Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards I am not sure if that is what they want. I will try it and get back. Good suggestion. From: Adam Voigt [EMAIL PROTECTED] Date: 2002/11/05 Tue PM 12:33:00 EST To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] Creating SSL Connection to Accept Credit Cards
Duh dude, it's clear they only work in 4.3.0. I already said that in a previous message, pay attention. On Tue, 2002-11-05 at 13:09, Jaime Bozza wrote: Except that https:// doesn't work with fopen until PHP 4.3.0. Suggestions are only good if they work with a current version of PHP. :) (No, I don't consider 4.3.0 current until it's at *least* released) Regardless, until then, CURL support is probably the way to go. Assuming you have curl support, it's fairly straightforward: --- $ch = curl_init(https://somesite.com;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $authorization_data); $result = curl_exec($ch); $errorstr = curl_error($ch); curl_close($ch); --- $result contains the data received and $errorstr contains the error message (if any) if it was unsuccessful. Translating $result depends on how they return the data. With the above example, you'll need to have $authorization_data in POST format, which really is nothing more than the GET format string. (Secure transaction APIs typically don't allow GET) var=somevaluevar2=somevalue2var3=anothervalue -Original Message- From: Ben C. [mailto:benc;cox.net] Sent: Tuesday, November 05, 2002 11:55 AM To: Adam Voigt Cc: [EMAIL PROTECTED] Subject: Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards I am not sure if that is what they want. I will try it and get back. Good suggestion. From: Adam Voigt [EMAIL PROTECTED] Date: 2002/11/05 Tue PM 12:33:00 EST To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array()
Part of the ugh thing is because I'm having a crappy day. However, the main part of the ugh thing is because of people not doing any research before posting a question here. It has nothing to do with my wanting to answer the question or not, I enjoy helping out here, and I have gotten answers to many of my questions, but the people on this list don't come here to hold your hand. The answer to your question is WELL documented in the manual. Francisco Vaucher wrote: hey, don't answer if you don't want to... leave the 'ugh' thing... John Nichel wrote: Ugh. Read the in the manual about variable scope, and how to call a function. It's all there. To get you started... print_r ( test_func() ); Francisco Vaucher wrote: Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to do check boxes correclty?
Good Afternoon People I am trying to create a site where you can add/delete players From a roster So what I need help is how to automatically format the check Boxes to appear in every row And to know how to do the add/delete part If anyone can come online with me and talk to me that would Be tremendous if they have any free time on there hands. Thanks Karl james
Re: [PHP] uploading an image in binar
What is your form tag like... try form action=somefile enctype=multipart/form-data method=somemethod On Tue, 2002-11-05 at 18:08, drparker wrote: I'm having trouble with a script to upload images, which is baffling me because a similar script has worked fine on other occasions. I can get the image file uploaded to the correct directory, but it is uploading in ASCII and I obviously need it in binary. The file name on the form is like this: input type=file name=add_imgthumb then the code on the php script looks like this: $uploadpath = 'path/images/'; $source = $_FILES['add_imgthumb']['tmp_name']; $name = $_FILES['add_imgthumb']['name']; $dest = $uploadpath.$name; copy($source, $dest); simple, i know, but that's the way i want it. What do I have to do to get the image to be uploaded in binary? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] Creating SSL Connection to Accept Credit Cards
Is there anything else that I can do. I am running PHP 4.1.2 so the fopen() doesn't work and I donot have support for CURL. Any other suggestions? From: Jaime Bozza [EMAIL PROTECTED] Date: 2002/11/05 Tue PM 01:09:37 EST To: 'Ben C.' [EMAIL PROTECTED], 'Adam Voigt' [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: RE: Re: [PHP] Creating SSL Connection to Accept Credit Cards Except that https:// doesn't work with fopen until PHP 4.3.0. Suggestions are only good if they work with a current version of PHP. :) (No, I don't consider 4.3.0 current until it's at *least* released) Regardless, until then, CURL support is probably the way to go. Assuming you have curl support, it's fairly straightforward: --- $ch = curl_init(https://somesite.com;); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $authorization_data); $result = curl_exec($ch); $errorstr = curl_error($ch); curl_close($ch); --- $result contains the data received and $errorstr contains the error message (if any) if it was unsuccessful. Translating $result depends on how they return the data. With the above example, you'll need to have $authorization_data in POST format, which really is nothing more than the GET format string. (Secure transaction APIs typically don't allow GET) var=somevaluevar2=somevalue2var3=anothervalue -Original Message- From: Ben C. [mailto:benc;cox.net] Sent: Tuesday, November 05, 2002 11:55 AM To: Adam Voigt Cc: [EMAIL PROTECTED] Subject: Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards I am not sure if that is what they want. I will try it and get back. Good suggestion. From: Adam Voigt [EMAIL PROTECTED] Date: 2002/11/05 Tue PM 12:33:00 EST To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards Like: $f = fopen(https://whatever.com,r;) -- 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] arrays
Ok, very basic question, how do I am going through a loop 5 times, each time, I want to store a value into an array, do I simply set the value of $picture=array($mypics); and each time it loops it will take the current value of $picture and then I can get out each value by $mypics[0], $mypics[1], etc? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array()
Yeah, whatever, I looked o_O in the manual and i didn't find the answer. I wrote here and also didn't find the answer... Sorry if we aren't all perfect, and dedicated as you are... Have a 'crappy day' Francisco M. Vaucher Departamento IT Tyco / ADT Security Services Buenos Aires - Argentina mailto:fvaucher;tycoint.com -Mensaje original- De: John Nichel [mailto:jnichel;by-tor.com] Enviado el: martes, 05 de noviembre de 2002 15:20 Para: Francisco Vaucher CC: [EMAIL PROTECTED] Asunto: Re: [PHP] array() Part of the ugh thing is because I'm having a crappy day. However, the main part of the ugh thing is because of people not doing any research before posting a question here. It has nothing to do with my wanting to answer the question or not, I enjoy helping out here, and I have gotten answers to many of my questions, but the people on this list don't come here to hold your hand. The answer to your question is WELL documented in the manual. Francisco Vaucher wrote: hey, don't answer if you don't want to... leave the 'ugh' thing... John Nichel wrote: Ugh. Read the in the manual about variable scope, and how to call a function. It's all there. To get you started... print_r ( test_func() ); Francisco Vaucher wrote: Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Entire URL for Current Page
On Wednesday 06 November 2002 01:54, Phillip Erskine wrote: With print_r($_SERVER); I can get the server name and script path, but how do you detect if username and password are in the url as in the example below? Basically if you don't see it when you do print_r($_SERVER) then you can't have it -- it's not there, there's nothing you can do about it. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Davis's Dictum: Problems that go away by themselves, come back by themselves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array()
It's really not that hard Returning values from functions http://www.php.net/manual/en/functions.returning-values.php Variable scope http://www.php.net/manual/en/language.variables.scope.php It's not on the main page, you actually have to look beyond there. Francisco Vaucher wrote: Yeah, whatever, I looked o_O in the manual and i didn't find the answer. I wrote here and also didn't find the answer... Sorry if we aren't all perfect, and dedicated as you are... Have a 'crappy day' Francisco M. Vaucher Departamento IT Tyco / ADT Security Services Buenos Aires - Argentina mailto:fvaucher;tycoint.com -Mensaje original- De: John Nichel [mailto:jnichel;by-tor.com] Enviado el: martes, 05 de noviembre de 2002 15:20 Para: Francisco Vaucher CC: [EMAIL PROTECTED] Asunto: Re: [PHP] array() Part of the ugh thing is because I'm having a crappy day. However, the main part of the ugh thing is because of people not doing any research before posting a question here. It has nothing to do with my wanting to answer the question or not, I enjoy helping out here, and I have gotten answers to many of my questions, but the people on this list don't come here to hold your hand. The answer to your question is WELL documented in the manual. Francisco Vaucher wrote: hey, don't answer if you don't want to... leave the 'ugh' thing... John Nichel wrote: Ugh. Read the in the manual about variable scope, and how to call a function. It's all there. To get you started... print_r ( test_func() ); Francisco Vaucher wrote: Hi people, is there a way to retrieve an array from a function ? like: ?php test_func($param1, $param2) { //code $test = array (ASD = Test1, ASDF = Test2); return $test; } //outiside de function echo $test; // - the array ? This doesn't work. So, any clue ? Regards and tks in advance! f. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays
If I understand your question, you are trying to store values into an array: for( $=0; $i5; $i++) { ...get $picture from somewhere... $mypics[] = $picture; } To retrieve: foreach($mypics as $pic) { ...do something with $pic... } - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 12:44 PM Subject: [PHP] arrays Ok, very basic question, how do I am going through a loop 5 times, each time, I want to store a value into an array, do I simply set the value of $picture=array($mypics); and each time it loops it will take the current value of $picture and then I can get out each value by $mypics[0], $mypics[1], etc? Thanks, Eddie -- 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] 4.2.3 compile problem on OSX
Kristopher Yates wrote... I'm trying to compile PHP4.2.3 for Mac OSX 10.2 (Jaguar). Has anyone else had this problem (see below)? Yes, seemingly. You can get 4.2.3 at http://www.entropy.ch/software/ macosx/php/, and this page also comments on build problems and build instructions on the Stepwise site. Mac OS X also comes with PHP pre-installed, although I'm not sure what version. -- Charles Wiltgen PlaybackTime http://PlaybackTime.com/ - Great new QuickTime 6 book - Even pirates need parrots - Nokia's 6 new phones: All color, all MMS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LIKE condition in query
I'm writing an SQL query in a php 4.0 script. The query pulls data from an MS Access '97 database through an ODBC connection. I'm having difficulties creating a condition using LIKE. If I write the following expression, the query works: $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 = '$CriterionRecord' ; But, if I change the Where statement from = to LIKE, the query no longer works, and I can't figure out why. (Could it be punctuation?) Here's an example: $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 LIKE '$CriterionRecord' ; The criterion record is actually chosen in another form and passed through to this script. The criterion record may be a complete record, or it may be a partial record with a wildcard, but the LIKE script is not working in either case. Does anyone have any experience with this they could share with me? Sincerely, Don Hicks Portland, OR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays
hi, the function array is for making a new array. Observe this code and you will get the point (assuming that you won't to loop for five times) $myarr= array() for ($i=0;$i=5;$i++) { $myarr[$i]=$i; } //you can then get the values of the array echo $myarr[0]; echo $myarr[1]; //and like that note that this loop simply assigns a number to every array index, this is not so useful, but you would probably do something with $i to store a particular value. khalid _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LIKE condition in query
I am not up on my MS Access database sql but i would check to see if ms access supports the like condition in the where clause... On Tue, 2002-11-05 at 18:49, Don Hicks wrote: I'm writing an SQL query in a php 4.0 script. The query pulls data from an MS Access '97 database through an ODBC connection. I'm having difficulties creating a condition using LIKE. If I write the following expression, the query works: $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 = '$CriterionRecord' ; But, if I change the Where statement from = to LIKE, the query no longer works, and I can't figure out why. (Could it be punctuation?) Here's an example: $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 LIKE '$CriterionRecord' ; The criterion record is actually chosen in another form and passed through to this script. The criterion record may be a complete record, or it may be a partial record with a wildcard, but the LIKE script is not working in either case. Does anyone have any experience with this they could share with me? Sincerely, Don Hicks Portland, OR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] LIKE condition in query
[snip] $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 LIKE '$CriterionRecord' ; [/SNIP] The LIKE criteria needs to be surrounded by wildcards... WHERE FieldName1 LIKE '%$CriterionRecord%' HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LIKE condition in query
BINGO! That was exactly what I needed! Thanks! Don. === Jay Blanchard [EMAIL PROTECTED] wrote in message news:003801c284fc$4fd8d2b0$8102a8c0;000347D72515... [snip] $Query= SELECT FieldName1, FieldName2 FROM TableName WHERE FieldName1 LIKE '$CriterionRecord' ; [/SNIP] The LIKE criteria needs to be surrounded by wildcards... WHERE FieldName1 LIKE '%$CriterionRecord%' HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] addslashes/stripslashes
I am trying to develop a search for my database. I used addslashes when entering the data, and then use addslashes with the search but nothing comes up: Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE '%o\'mallies%' ) I check in the database and o'mallies is indeed there as o\'mallies. And a search for just mallies works fine. If you see it in the database as o\'mallies, then you are running addslashes() twice on the data you are inserting. If you insert o\'mallies into the database, the \ is only there to tell the database that the following character is escaped. In this case, the ' is not the end of the string, but something that should be included in the data that's put into the database. The actual \ isn't put in the database. So, with that said, you can fix your code and find out where you are addslashes() twice. You can run some queries to replace \' in your database with ', too. Or you can just search for o\\\'mallies in your database, which will search for a literal \ and a literal ' in the data. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySql Array problem (newbie)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 He isn't.I create the arry from a form, serialize it, urlencode it and send it to a row in mysql. Alex: Can you send me some of the code you're using? ~Pauly On Tuesday 05 November 2002 12:09 pm, Maxim Maletsky wrote: You can't send the whole array into on cell. Try doing: echo $array; and you'll see what I mean. You will need to insert each element individually. - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9yBFnDyXNIUN3+UQRAr49AJsHK5rJwUSoaCMe/wgv/0xCZ95RXwCfXCfO /nBS95XhfPyELZcT1wrVKzE= =nd3N -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php