RE: [PHP] Re: max # of characters for links to work in emails?
http://www.isi.edu/in-notes/rfc1034.txt excerpted: To simplify implementations, the total number of octets that represent a domain name (i.e., the sum of all label octets and label lengths) is limited to 255. unless using one of the new extended names..., but I digress Typically URL's work fine up to about 70 chars - your limit is more on the wrapping side - once wrapped different email programs do different things. Outlook for example munges up wrapped urls' - at least in OL98. -Original Message- From: Jerry Verhoef (UGBI) [mailto:[EMAIL PROTECTED]] Sent: December 19, 2001 4:53 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] Re: max # of characters for links to work in emails? There are even more variants possible. But I am trying to get into the minds of the programmers of the Email clients, what THEY would consider the biggest allowed URL. But of course an URL could be bigger (2kb if my memory serves me correctly) And the Question was: max # of characters for links to work in emails? And my answers is: Stay within the 70 chars and you should be safe Jerry Verhoef -Original Message- From: Richard Black [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 9:50 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: max # of characters for links to work in emails? Don't think thats necessarily true - what about news.bbc.co.uk or games.yahoo.com. Neither of them fits into the spec you described there... Richy -Original Message- From: Jerry Verhoef (UGBI) [SMTP:[EMAIL PROTECTED]] Sent: 19 December 2001 08:41 To: 'Chris Lee'; [EMAIL PROTECTED]; '[EMAIL PROTECTED]' Subject:RE: [PHP] Re: max # of characters for links to work in emails? The maximum allowed of characters in a domain name is 3 (www) + 64 (domainname) + 3 (tld) = 70 chars. So if you try to limit it within the 70 chars you should be safe. Jerry -Original Message- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 6:10 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: max # of characters for links to work in emails? a good guess would be every email client does it differnetly. unfort Id have to say try it yourself. Id imagine its long enough that you shouldnt have to worry about it, but I could be wrong. -- Chris Lee [EMAIL PROTECTED] Tom Churm [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi, i'm working on an eCard project and somehow need to find out what the reasonable limit is on characters for urls in email bodies (normal text, not mime). i know that some mail clients will cut off urls that are too long or else throw a line break in the middle of them--thus rendering them 'unclickable'. and this is exactly what i wanna avoid. anyone have any advice to offer in this area? muchos gracias, tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] The information contained in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any form of disclosure, production, distribution or any action taken or refrained from in reliance on it, is prohibited and may be unlawful. Please notify the sender immediately. The content of the email is not legally binding unless confirmed by letter bearing two authorized signatures. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] The information contained in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any form of disclosure, production, distribution or any action taken or refrained from in reliance on it, is prohibited and may be unlawful. Please notify the sender immediately. The content of the email is not legally binding unless confirmed by letter bearing two authorized signatures. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] telneting sockets help..
Have you tried setting socket blocking? Here's what I do... var $connection=0; $host = pericles.ipaustralia.gov.au; $port=23; switch( $connection=fsockopen($host,$port) ) { case -3: return(-3 socket could not be created); case -4: return(-4 dns lookup on host '$host' failed); case -5: return(-5 connection refused or timed out); case -6: return(-6 fdopen() call failed); case -7: return(-7 setvbuf() call failed); default: //let getline do its job bit by bit rather than timeout by timeout ;) set_socket_blocking ($connection,false); } Function GetLine() { global $debug,$connection; $line = fread($connection,128); while(empty($line)){ $line = fread($connection,128); usleep(25); } //If debugging on, force output if ($debug) { print ($line) .br; System(echo ''); flush; } return ($line); } print GetLine(); -Original Message- From: brendan [mailto:[EMAIL PROTECTED]] Sent: December 19, 2001 1:04 PM To: [EMAIL PROTECTED]; James Cox Cc: [EMAIL PROTECTED] Subject: Re: [PHP] telneting sockets help.. hi james, thanks for your reply .. i was able to connect ( i should have written that in the email) its getting the info to flush to the screen that i cant do .. it just hangs.. so if you add something like while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); to the end you get nothing.. ... herein lies my second sleepless day.. i have been tyring to use the sockets() functions which have been added.. but they are badly documented and extremely unfriendly.. how did you manage to interact with your telnet server? cheers brendan James Cox wrote: Hi, I had recent problems like this, and I traced it to firewall issues; however i just checked the destination, and found it is possible to telnet to that port, so it's not a firewall issue on their side. Try using the following code -- and let it run, see what response you get. ?php $host = pericles.ipaustralia.gov.au; $fp = fsockopen($host, 23, $errno, $errstr, 5); if (!($fp)) { echo SOCKET ERROR: $errno - $errstrbr\n; } ? Hope that helps, James Cox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . James Cox :: Senior Support Engineer Wherewithal, Inc. e: [EMAIL PROTECTED] Wherewithal. Capture Creative Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -Original Message- From: brendan [mailto:[EMAIL PROTECTED]] Sent: 19 December 2001 04:12 AM To: [EMAIL PROTECTED] Subject: [PHP] telneting sockets help.. hi i have been trying to write a telnet client to a tn3270 IBM mainframe database ( pericles.ipaustralia.gov.au:23 ) using fsockopen ... i thought it wouldnt be that bad given i have done something similar with usenet .. however i cannot get it to work no matter what I do .. i just get a permanent hang ... has anyone ever attempted this or have any solutions? i know this is rather open ended but i cant offer any code which even kind of works.. it would be much appreciated.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP as a web browser?
you may want to look at the curl functions as a start. thats most of the functionality down already. otherwise you'll have to parse raw data. not too hard, but can be painful to keep stateful info. you'll also have to rewrite code when the interface changes, you'll probably want to look at hotscripts or manuel lemos's script archives for prewritten html parsers. fopen/fread/fwrite is the way to go, but you'll need to interpret that data accordingly. Look at the rfc's on cookies and html if you are interested in going that route. been there done that myself (for a sms autosend script using mtnsms, but its a pia to start from scratch...) Lawrence -Original Message- From: David Yee [mailto:[EMAIL PROTECTED]] Sent: December 17, 2001 3:49 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP as a web browser? Is it possible to have PHP act like a web browser, accept cookies and post data (for login)? I'm not sure exactly where to start- I know you can use fopen/file to retrieve url's but I'm not too sure about the other steps. I would like to write and run such a php script as a cron job and have it do something like log into my web-based email account, retrieve emails, process them, save them locally, and then delete them on the server. Thanks for any help. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql update query
I concur Probably this will work $result = mysql_query(UPDATE table SET value1='$value1',value2='$value2' WHERE id=$id); remember integers id=1 are not strings id='1'; not the same! -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: December 5, 2001 11:37 AM To: 'Tyler Longren'; Greg Sidelinger; [EMAIL PROTECTED] Subject: RE: [PHP] mysql update query are any of the fields of type number/integer/etc? if so, try removing the quotes for that field. -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 2:36 PM To: Greg Sidelinger; [EMAIL PROTECTED] Subject: Re: [PHP] mysql update query Everything looks good to me...try this: $result = mysql_query(UPDATE table SET value1='$value1',value2='$value2' WHERE id='$id'); Although I doubt MySQL cares if certain words are capitalized. Good luck though, Tyler Longren - Original Message - From: Greg Sidelinger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 04, 2001 9:27 PM Subject: [PHP] mysql update query I'm having trouble getting an update query to work Here is what I'm doing $result = mysql_query(update table set value1='$value1', value2='$value2' where id='$id'); It is not updating the database. All the $vars have values and I'm using the correct columns names. Could someone please point me in the correct direction because I have been trying different things for a while but can't seem to get it to work. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Mirroring Website
Webzip is ok too for downloading an entire site onto a local machine, restructuring links, although the non registered version inserts javascript html code into every page header. Its nothing that a quick regex replaces can't fix though ;) www.webzip.com -Original Message- From: Phil Driscoll [mailto:[EMAIL PROTECTED]] Sent: October 3, 2001 5:04 PM To: Jon Shoberg; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Mirroring Website On Wednesday 03 October 2001 5:21 am, Jon Shoberg wrote: Nope, teh pages are actually hosted on a (gasp ...) NT machine. I need something that will suck down and write out a pure static .html mirror of an ASP/PHP driven website. WGET will surely mirror everything but not re-structure the internal links within the pages. Might be time to write my own ... Try httrack - think there are versions for multiple platforms. I've used the windows version to great effect. http://httrack.free.fr -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Dated/Timed actions
cron job. Probably something along the lines of small php code interfacing with a db with dates etc in, and another php script which checks the dates and emails details on that day. A Cron job which runs the script daily would probably do the job. do a search in google for cron job -Original Message- From: Stephane Besnard [mailto:[EMAIL PROTECTED]] Sent: October 2, 2001 4:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Dated/Timed actions Hi, Does anybody know how to generate 'dated/timed actions' with PHP? By this I mean, for instance, automatically sending an email to a group of people when a specific date and time is reached: sending a happy birthday message to a users. Thanks, Stephane. _ Téléchargez MSN Explorer gratuitement à l'adresse http://explorer.msn.fr/intl.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] display query results at random
Return into an array, then loop through the array or shuffle it (easier)?. Note if you have nulls in DB, you will have to do something different. n'est pas? e.g. (untested) mysql_fetch_array ?php mysql_connect ($host, $user, $password); $result = mysql_db_query (database,select user_id, fullname from table); $j=0; while ($row[$j] = mysql_fetch_array ($result)) { $j++; } mysql_free_result ($result); srand ((float)microtime()*100); shuffle ($row); //do output stuff with array ? -Original Message- From: Matthew Delmarter [mailto:[EMAIL PROTECTED]] Sent: September 26, 2001 12:01 PM To: PHP Mailing List Subject: [PHP] display query results at random How do I return a specific record from a db outside of the query? Let's say I select * from table (using mysql_fetch_object) and get 5 results. I want to display the 5 results in different / random places on the page. Place 1 - show details for record 3 Place 2 - show details for record 1 Place 5 - show details for record 5 How do I do this? I know how to loop thru a mysql result - but what if want to display things in a random order around the page? I could have multiple select statements - but this would increase the load on the server and is unnecessary as all the data was returned from the query - it's just a matter of knowing how to get it! Can anyone help? I am sorry if the question is confusing, but I can't think of a better way to explain it at the moment (i'm tired)... Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Mysql check
Another thing to check Are your table(s) corrupted? From the MYSQL Manual Typial typical symptoms for a corrupt table is: You get the error Incorrect key file for table: '...'. Try to repair it while selecting data from the table. Queries doesn't find rows in the table or returns incomplete data. Do a repair table (tablename) or isamchk {table name} ... or isamchk *.ISM For MySQL 3.23.x use myisamchk instead of isamchk If isamchk reports any problems or recommends fixing that table, repeat isamchk with a -r option on that table to repair. During the repair, isamchk will do its best to repair any corruption without losing any data, but there are no guarantees. I would also recommend dumping the data out, and putting into another table to see if it occurs with a fresh table. Lawrence. -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: September 25, 2001 9:00 AM To: Michael George; [EMAIL PROTECTED] Subject: Re: [PHP] Mysql check On Tue, 25 Sep 2001 02:38, Michael George wrote: I think I've discovered a problem with MySQL, but I wanted to check here to see if perhaps there's something I'm doing wrong. I have the following table: mysql show columns from IncomingInvoice; +--+--+--+-+-+- ---+ | Field| Type | Null | Key | Default | Extra | | +--+--+--+-+-+- ---+ | id | int(10) unsigned | | PRI | NULL| | auto_increment | supplier | int(10) unsigned | | | 0 | | | sent | date | YES | | | NULL| | invoiceNumber| int(10) unsigned | | | | 0 | | paymentReference | char(20) | YES | | | NULL| | shipping | float| YES | | | NULL| | taxRate | float| YES | | | NULL| | +--+--+--+-+-+- ---+ 7 rows in set (0.00 sec) and the following data in that table: mysql select * from IncomingInvoice; ++--++-+++- + | id | supplier | sent |invoiceNumber|paymentReference|shipping| | taxRate | ++--++-+++- + | 1 |1 | 2001-09-11 | 156 ||6.9 | | 6 | 5 |1 | 2001-09-17 | 0 || |5 | 6 | 6 |7 | 2001-09-19 | 0 | | | 0 | 0 | 9 |1 | 2001-09-20 | 0 | | | 8 | 6 | 8 | 25 | 2001-09-20 | | 0 || 0 | 0 | 11 |1 | 2001-09-20 | | 0 || 0 | 0 | ++--++-+++- + 6 rows in set (0.00 sec) But when I try to do a select on record 11, I get: mysql select * from IncomingInvoice where id=11; Empty set (0.01 sec) and explain tell me: mysql explain select * from IncomingInvoice where id=11; +-+ | Comment | +-+ | Impossible WHERE noticed after reading const tables | +-+ 1 row in set (0.00 sec) What are the const tables that are indicating that the WHERE is impossible? If I try to use a more flexible query: mysql explain select * from IncomingInvoice where id10; +---+-+-+---+---+--+--+ + | table |type |possible_keys|key|key_len| ref | rows | | Extra | +---+-+-+---+---+--+--+ + |IncomingInvoice|range|PRIMARY |PRIMARY| 4| NULL |1 | | where used | +---+-+-+---+---+--+--+ + 1 row in set (0.00 sec) mysql select * from IncomingInvoice where id10; Empty set (0.00 sec) Could there be something I've done to put the table into an inconsistent state? I *am* doing PHP development, so it's possible... Here's something else I tried: mysql select id, supplier, sent, invoiceNumber, shipping, taxRate - from IncomingInvoice where id 8; ++--++---+--+-+ | id | supplier
RE: [PHP] A simple PHP form not working
You have a blank line before your ?php Any output before a header or cookie is verboten. Delete any blank space, or lines before your ?php and don't output anything until *after* the header( output. Lawrence. -Original Message- From: Tshering Norbu [mailto:[EMAIL PROTECTED]] Sent: September 25, 2001 12:59 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] A simple PHP form not working I did try that before too and here is what I got/get : Warning: Failed to Connect in c:\Program Files\Apache Group\Apache\htdocs/druknet/feedback/feedbacksend.php on line 2 Warning: Cannot add header information - headers already sent by (output started at c:\Program Files\Apache Group\Apache\htdocs/druknet/feedback/feedbacksend.php:2) in c:\Program Files\Apache Group\Apache\htdocs/druknet/feedback/feedbacksend.php on line 3 I am sorry to bother you, Jason. NORBU - Original Message - From: Jason G. [EMAIL PROTECTED] To: Tshering Norbu [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, September 25, 2001 10:35 AM Subject: Re: [PHP] A simple PHP form not working First of all, you need to type header(Location: thankyou.html); exit; Try that... -Jason Garber deltacron.com At 09:26 AM 9/25/2001 +0600, Tshering Norbu wrote: Hi list, I can not get the form (from thesitewizard) working. When I submit the form, I get this error: Warning: Failed to Connect in c:\Program Files\Apache Group\Apache\htdocs/druknet/feedback/feedbacksend.php on line 2. My PHP conf with Apache has no problem. What am I doing wrong? Sorry, I am a beginner in PHP. Here are 2 php files: feedback.html Email: Message: feedbacksend.php ?php mail([EMAIL PROTECTED], Feedback Form Results,$message, From: $email); (Location:thankyou.html); ? Thanks. NORBU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] how to use MYSQL date type string in php?
Not quite what you are looking for, but here are some Chinese sites on PHP to look at, they also have forums in chinese (?) www.phpuser.com www.phpx.com www.php2000.com www.phpease.com www.chinaasp.com/php ??! ??? () -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Going blind? Plz hlp w/ parse error
For a start use 's much easier to read eg $qry_1=select * from cust_info where username=\$username\; should be $qry_1=select * from cust_info where username='$username'; this looks like a guilty line - $qry_2=insert into cust_info (username,password,mother) values ($username,$password,$mother) or die (No query #2!); possibly a change to - $qry_2=insert into cust_info (username,password,mother) values ('$username','$password','$mother'); $result=@mysql_query($qry_2,$connection) or die (No query # 2!); may prove better for you. Lawrence. -Original Message- From: Anthony Rodriguez [mailto:[EMAIL PROTECTED]] Sent: September 20, 2001 12:34 PM To: [EMAIL PROTECTED] Subject: [PHP] Going blind? Plz hlp w/ parse error Please help! There is a parse error in like 10: ?php // file: root/reg/add_2.php, updated: 08/25/01 $connection=@mysql_connect(localhost,afrodriguez,xxx) or die (No connection!); $db=@mysql_select_db(sbwresearch,$connection) or die (No database!); $qry_1=select * from cust_info where username=\$username\; $result=@mysql_query($qry_1,$connection) or die (No query # 1!); $row_1=@mysql_affected_rows(); if ($row_1==0) { $qry_2=insert into cust_info (username,password,mother) values ($username,$password,$mother) or die (No query #2!); $result=@mysql_query($qry_2,$connection); @mysql_free_result($result); @mysql_close($connection); echo html etc. Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] limiting rows and pages like google
How about limiting results? eg limit the return page value after a certain number (say 10) to every 5 pages, then 50 pages a la google. Page 1 2 3 4 5 6 7 8 9 10 ..15 ..20 ..50 ..100 This can be done relatively easily eg (untested) for ($count=1;$count=$pages;$count++) { // loop thru //set modifier for page display if ($count 10)$iMod = 1; elseif ($count 50) $iMod = 5; else $iMod=50; if ($count % $iMod==0) //Are we on an exact iMod boundary? print a href=\$PHP_SELF?offset=$count\$i/a nbsp; \n; } -Original Message- From: Adrian D'Costa [mailto:[EMAIL PROTECTED]] Sent: September 14, 2001 5:57 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; php general list Subject: RE: [PHP] limiting rows and pages like google Hi, Thanks. Instead of using next and previous I am giving the page number at the bottom of the page (see lastminute.vvmm.net/nextweek.php). The problem is that if there are, say 35 pages, the page numbers go off the screen. This is the snippet: if ($nopage=$limit) { echo (centertable border=\0\ width=\100%\ tr tdfont face=\Arial\ size=\1\Pagina/td); for($j=1; $j=($nopage); $j++) { //$next = $limit*($j-1); $xi = ($j-1); echo(tdfont face=\Arial\ size=\1\a href=\$PHP_SELF?npage=$xi\[$page[$j]]/a/font /td); } echo( /tr /table/center); } Adrian On Thu, 13 Sep 2001 [EMAIL PROTECTED] wrote: 2 queries is ok imho, but let the database do all the work ;) The first query should be a select count (*) QUERY for a count. The second query should be the actual QUERY. Eg something cut 'n' pasted from some code of mine (not nice, but hey ;) ) -- $db = mysql_connect($db_domain, $db_user,$db_password); mysql_select_db($db_databasename,$db); $sqlwhere = where CuisineID = $CuisineID ; $numresults=mysql_query( select count(*) from restaurants . $sqlwhere); $numrows=mysql_num_rows($numresults); // get results $sqlstring= select ID, Name,LanguageID from restaurants . $sqlwhere . limit $offset,$limit; $result=@mysql_query($sqlstring,$db); //Do stuff with $result... // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } for ($i=1;$i=$pages;$i++) { // loop thru $newoffset=$limit*($i-1); print a href=\$PHP_SELF?offset=$newoffset\$i/a nbsp; \n; } // check to see if last page if (!(($offset/$limit)==$pages) $pages!=1) { // not last page so give NEXT link $newoffset=$offset+$limit; print a href=\$PHP_SELF?offset=$newoffset\NEXT/ap\n; } -Original Message- From: Julian Wood [mailto:[EMAIL PROTECTED]] Sent: September 14, 2001 1:34 AM To: php general list Subject: Re: [PHP] limiting rows and pages like google It's not too hard to do the next/previous through all your results, as has been shown by several people. What is a little trickier, at least when using mysql and trying to take advantage of the limit clause, is how to display how many results you have (ie 1 to 10 of 107 results). If you use the limit, you can't get the total number of rows, without doing a second search sans limit. It's also harder to do the next link, because you don't necessarily know if there are any more rows (imagine you are displaying 10 rows at a time, you are on page 3 and there are 30 total rows). Conversely, if you do a single query without the limit, then you're doing a slower search (limiting a search is way faster), and I'm not sure of the implications of the full result set residing serverside - maybe higher memory requirements. So what do people do to take advantage of limit? Two queries or a single query? Any other solutions? Any more insights on how limit works? Julian On Wednesday, September 12, 2001, at 10:16 PM, Adrian D'Costa wrote: Hi, I am trying to find out the the best way to do the following: I have a script that select records from a table. The problem is that I need to limit the rows to 20. I know that I can use limit 20. But what I want to do is give the view a link to the next 20 till all the records are shown. What I don't know is how to maintain the search query and I want to use the same script. The logic would be to check if the script is called the first time, then the sql statement would be select travel.*, city.city from travel, city
RE: [PHP] Performance: PHP vs. Visual Basic
It may not be a performance thing based on software in use, it could be coding problems with the current software. If you are having problems with 40 - 50 users, you may want to look at where things are locking up. Table locking because of badly designed update queries can freeze a good system because of contentions. How do you handle concurrent locking - what does your code look like for the initial 20 seconds to load page / slow loading pages? Run some performance monitoring on sql server, it has good tools for this, as does win2k. How much ram do you have? sql server eats ram. (buy more, depending on whether your monitoring tells you its needed - look at paging). There are lots of nt tuning faq's out there. Check what you have before dumping it for something else. I learnt from someone once its better to find out and understand the problem than to avoid it. It may come back and bite you. That said, php is more scalable than vb (flamebait), but its equally easy to write bad code in both. SQL Server is a bit of a behemoth, but feed it nicely (ram), and it generally behaves (*unless you are russian nuclear materials database admins - see slashdot for more.) Regards, Lawrence -Original Message- From: Masami Kawakami [mailto:[EMAIL PROTECTED]] Sent: September 17, 2001 11:43 AM To: php forum Subject: [PHP] Performance: PHP vs. Visual Basic Maybe this is one of FAQ, Please give me a URL of this kind of comparison page, or your experience. A web server program is running in my office. It consists of Visual Basic, IIS, and MS SQL Server on Windows 2000. although the performance is confortable for few users, it is terribly slow for 40-50 users. Once all of them start to use, it takes more than 20 seconds to open a page in client browser. To improve the performance, we have an idea to use, instead of Microsoft, PHP, Apache, and mySQL/ProgreSQL on Linux. How much will be the improvement? We also have plan to enhance the hardware, 1PC for DataBase, 2nd and 3rd for IIS or Apaches. Which has better scalability, VB or PHP? -- Masami Kawakami [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] posted urls
ereg_replace or str_replace perhaps? eg $something= this is a sentence; $something = ereg_replace ( ,+, $something); print $something; -Original Message- From: Egon Schmid [mailto:[EMAIL PROTECTED]] Sent: September 14, 2001 2:20 PM To: Alexander Skwar Cc: murat; [EMAIL PROTECTED] Subject: Re: [PHP] posted urls Alexander Skwar wrote: So sprach »murat« am 2001-09-13 um 14:34:31 +0300 : how can i change variables that has two or more words to variables that has + instead of blanks in that variables. Like this: word1 word2 word3 = word1+word2+word3 $word1 . $word2 . $word3 Read the manual! Alexander, please don't try to educate people with a RTFM. Your solution to the above problem is obviously wrong. -Egon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] limiting rows and pages like google
2 queries is ok imho, but let the database do all the work ;) The first query should be a select count (*) QUERY for a count. The second query should be the actual QUERY. Eg something cut 'n' pasted from some code of mine (not nice, but hey ;) ) -- $db = mysql_connect($db_domain, $db_user,$db_password); mysql_select_db($db_databasename,$db); $sqlwhere = where CuisineID = $CuisineID ; $numresults=mysql_query( select count(*) from restaurants . $sqlwhere); $numrows=mysql_num_rows($numresults); // get results $sqlstring= select ID, Name,LanguageID from restaurants . $sqlwhere . limit $offset,$limit; $result=@mysql_query($sqlstring,$db); //Do stuff with $result... // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } for ($i=1;$i=$pages;$i++) { // loop thru $newoffset=$limit*($i-1); print a href=\$PHP_SELF?offset=$newoffset\$i/a nbsp; \n; } // check to see if last page if (!(($offset/$limit)==$pages) $pages!=1) { // not last page so give NEXT link $newoffset=$offset+$limit; print a href=\$PHP_SELF?offset=$newoffset\NEXT/ap\n; } -Original Message- From: Julian Wood [mailto:[EMAIL PROTECTED]] Sent: September 14, 2001 1:34 AM To: php general list Subject: Re: [PHP] limiting rows and pages like google It's not too hard to do the next/previous through all your results, as has been shown by several people. What is a little trickier, at least when using mysql and trying to take advantage of the limit clause, is how to display how many results you have (ie 1 to 10 of 107 results). If you use the limit, you can't get the total number of rows, without doing a second search sans limit. It's also harder to do the next link, because you don't necessarily know if there are any more rows (imagine you are displaying 10 rows at a time, you are on page 3 and there are 30 total rows). Conversely, if you do a single query without the limit, then you're doing a slower search (limiting a search is way faster), and I'm not sure of the implications of the full result set residing serverside - maybe higher memory requirements. So what do people do to take advantage of limit? Two queries or a single query? Any other solutions? Any more insights on how limit works? Julian On Wednesday, September 12, 2001, at 10:16 PM, Adrian D'Costa wrote: Hi, I am trying to find out the the best way to do the following: I have a script that select records from a table. The problem is that I need to limit the rows to 20. I know that I can use limit 20. But what I want to do is give the view a link to the next 20 till all the records are shown. What I don't know is how to maintain the search query and I want to use the same script. The logic would be to check if the script is called the first time, then the sql statement would be select travel.*, city.city from travel, city where travel.cityid=city.id limit 0,20. The second time or based on what has been selected on the page (1-20, 21-40, etc) add that to the sql statement. My question is how? Can someone guide me or give me some example. TIA Adrian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Julian Wood Programmer/Analyst University of Calgary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Mailing list
Should be relatively easy. Its going to take 2 steps. Send out one of the images with a unique id per mailout, this could be the users email address if you wanted to tie in the data per user (may be illegal in some countries without users permission). eg first mail html bla blah img src=webbug.php?id=1 /html next mail html bla blah img src=webbug.php?id=2 /html ... webbug.php webbug.php will passthrough the image that you want to send - phpbuilder, webmonkey, and hotscripts all have sample code for this kind of thing online. Make the php script pass through the image to the browser (remember to set the relevant content type header), and count the unique id in a database (i think due to image reload, count unique id's returned rather than number of reads) eg if user 1 reads email database should add user, count=count+1 to database for user reply read stats do a select count distinct (user) type sql query. This is called a webbug usually, most spammers use something like this. Remember not everyone reads mail online. So this technique will not work for offline mail readers, and those who don't use html compatible mailers. Also some email program's will autopreview mail, so a returned id, doesn't necessarily mean that the user has read it, only that their mail software has. No code, just theory here, but should be relatively easy to implement. Lawrence -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED]] Sent: September 12, 2001 12:51 PM To: Sheni R. Meledath Cc: [EMAIL PROTECTED] Subject: [PHP] Re: Mailing list You could examine the web-server logs... But you either have to assume people only read it once, or count IPs and ignore AOL/DHCP/Hotmail etc users whose IPs will change more or less at random. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Sheni R. Meledath [EMAIL PROTECTED] Newsgroups: php.general To: PHP Masters [EMAIL PROTECTED] Sent: Sunday, September 09, 2001 10:57 AM Subject: Mailing list Hi, I am using PHP script for a mailing list application. Is there a way to track the no of users opened the email. All the images in this html email are read from the server. In that manner can we call a script from the email that can be used to store the no of counts. If anybody has got any idea on the same please let me know. Thanks Regards Sheni R Meledath [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] hi
It still won't work though. (unless show_source is javascript, which I doubt) You can't embed php in html like that. HTML is for client side, and they aren't running php in their browser. Browsers generally support javascript or vbscript ECMA style scripting on client side. If you wanted to show the source for something you can't write a one line a href, you'll have to make it some code. eg. sourceme.php ?php show_source('source.php'); ? myhtml.html a href=sourceme.phpView Source/abr/br/ -Original Message- From: Seb Frost [mailto:[EMAIL PROTECTED]] Sent: September 10, 2001 5:30 PM To: Balaji Ankem; [EMAIL PROTECTED] Subject: RE: [PHP] hi Fixed: ?php echo a href=\show_source('source.php')\view source/abr/br/; ? - seb -Original Message- From: Balaji Ankem [mailto:[EMAIL PROTECTED]] Sent: 10 September 2001 10:25 To: [EMAIL PROTECTED] Subject: [PHP] hi Hi, what z wrong in this code?? ?php echo a href=\?php show_source('source.php')?\view source/abr/br/; ? I am getting the following error Forbidden You don't have permission to access / on this server. --- - Apache/1.3.20 Server at ankem.wipro.com Port 80 How to rectify this thing?? Thanks in advance Regards -Balaji --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] refer to the same page AGAIN! Please...
Create a file with the following. test.php ?phpinfo();? open a browser and point at test.php Look at the http variables section. Now try adding some variables to it eg : open the browser, and open a url like the following: http://localhost/test.php?x=yfoo=bar Now look at the PHP Variables section. you should see that php_self == test.php, have a look and see what variable holds ?x=yfoo=bar yup, its query_string Got it? Now use something like print a href='$PHP_SELF$?$QUERY_STRING'url link/a; okayla! A better way might be to use sessions. Have a look at php.net or phpbuilder.com for details. Lawrence. -Original Message- From: Ardani Sarjito [mailto:[EMAIL PROTECTED]] Sent: September 4, 2001 9:04 AM To: php_list Subject: [PHP] refer to the same page AGAIN! Please... Hi! I still have the same problem. How Do I write a string on the a page using input from the same page without deleting the previous written string. I'd like to use PHP_SELF. Is it possible? Thank you! Ardani -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Problem with microtime()
You are casting microtimes results as an integer value. It isn't an integer value, hence the 0. From the manual It returns the string the string msec sec where sec is the current time measured in the number of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and msec is the microseconds part. This function is only available on operating systems that support the gettimeofday() system call. Try: for ($i = 0; $i 100; $i++) { $k = microtime(); echo br$k; for ($j = 0; $j 1; $j++) $m = $j *3; } Or look in the http://www.php.net/manual/en/function.microtime.php for examples. -Original Message- From: Rosen [mailto:[EMAIL PROTECTED]] Sent: August 31, 2001 3:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem with microtime() Hi, I'm using the following code: for ($i = 0; $i 100; $i++) { $k = (int) microtime(); echo br$k; for ($j = 0; $j 1; $j++) $m = $j *3; } but it prints me only 0.. Where can be problem ? Thanks, Rosen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: install error
it usually means the apache httpd wasn't found in /usr/bin Some distributions throw things in wierd places do a 'locate httpd' (quicker) or 'find \ -name httpd' (longer) to find out where its situated then configure paths accordingly. Remember if you are going to use dso's apache must be compiled to use them that way. Lawrence -Original Message- From: _lallous [mailto:[EMAIL PROTECTED]] Sent: August 30, 2001 4:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: install error from this line, i guess that Apache is not installed? apxs:Warning: /usr/bin/httpd not found or not executable Joseph Bannon [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What does this mean? make[1]: Entering directory `/home/php-4.0.6' /home/php-4.0.6/build/shtool mkdir -p /usr/lib/apache /usr/sbin/apxs -S LIBEXECDIR=/usr/lib/apache -i -a -n php4 libs/libphp4.so apxs:Warning: /usr/bin/httpd not found or not executable apxs:Warning: Continuing anyway... apxs:Warning: No shared object support for Apache apxs:Warning: available under your platform. Make sure apxs:Warning: the Apache module mod_so is compiled into apxs:Warning: your server binary `/usr/bin/httpd'. apsx:Warning: Continuing anyway... apxs:Error: Unknown option: S Usage: apxs -g -n modname apxs -q query ... apxs -c [-o dsofile] [-D name[=value]] [-I incdir] [-L libdir] [-l libname] [-Wc,flags] [-Wl,flags] files ... apxs -i [-a] [-A] [-n modname] dsofile ... make[1]: *** [install-sapi] Error 1 make[1]: Leaving directory `/home/php-4.0.6' make: *** [install-recursive] Error 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Pulling webpages - may be a weird question :)
Some of us live in countries where these proxy servers are banned. I cannot access anonymiser, safesurf or any of the other open proxies. sometimes accessing cnn is useful, so I wrote some quick and very nasty code to retrieve and view webpages - also encrypts the url as well - China sometimes bans via url contents, so www.someserver.com/proxy/www.cnn.com would be banned as well. (Chinese Government went through a phase a few weeks ago where even google was banned, that was terrible, I rely on google every day!). See code below (it's not good, but it works - text only) I use it on my Shanghai site www.shanghaiguide.com in the proxy page - www.shanghaiguide.com/proxy ?php function ROT ($string,$n=13){ for ($i = 0; $i strlen($string); $i++) { $string[$i] = chr(ord($string[$i]) + $n); } return $string; } if (!isset($URL)) { ? form action=?php print $PHP_SELF;? method=post input name=URL size=50 value= pinput type=submit value=Go /form br No Graphics will be displayed, only a href style links are processed, proxy is alpha version, but hey its better than nothingbr ?php } else { if (isset($ENC)) { $URL =ROT ($URL,-1); } //Check prefix badly if (substr (strtoupper($URL),0,4) == HTTP) { //Probly http } else { $URL=http://.$URL; } if (isset($URLPATH)){ if (strpos ($URLPATH,p://)) { $URL=; //New Site = strip out the http:// and replace //To Do if (substr($URLPATH,-3)=='gif') { Header(Content-type: image/gif); } if (substr($URLPATH,-3)=='jpg') { Header(Content-type: image/jpg); } } //If url ends in / and urlpath starts in / strip url trailing slash. if ((substr($URL,-1) ==/ ) (substr($URLPATH,0,1)==/)) { $URL=substr ($URL,0,strlen($URL)-1); } } else { $URLPATH=; if (substr($URL,-1) !=/){ $URL.=/; } } //$URL =ROT($URL,1); //print Encrypted URL=. $URL; if (!$NOHDR) { print URL =.$URL; //Show Browse Form Again ? form action=?php print $PHP_SELF;? method=post input name=URL size=50 value=?php print $URL;? input type=submit value=Go /form hr ?php } @$up = fopen($URL.$URLPATH,r); if ($up){ while (!feof($up)) { $results.= fread($up, 1024); } fclose($up); unset($URLPATH); } $URL=ROT($URL,1); //$results = str_replace(href=\http://;, href= $scriptpath ?url=$url, $pagedata); $results = eregi_replace (href=\ , href=\$PHP_SELF?ENC=1URL=$URLURLPATH=,$results); $results = eregi_replace (src=\,src=\blank.gif?$PHP_SELF?ENC=1NOHDR=1URL=$URLURLPATH=,$resul ts); print $results; } ? There are better ways to do this, James Marshall wrote CGIProxy, but this is the only one I know that also encrypts urls. -Original Message- From: Dan Harrington [mailto:[EMAIL PROTECTED]] Sent: August 29, 2001 8:52 AM To: daniel james; Jeff Lewis; [EMAIL PROTECTED] Subject: RE: [PHP] Pulling webpages - may be a weird question :) http://www.anonymiser.com -Original Message- From: daniel james [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 28, 2001 12:23 PM To: Jeff Lewis; [EMAIL PROTECTED] Subject: Re: [PHP] Pulling webpages - may be a weird question :) try readfile('http://www.somesite.com/'); it creates a mirror; it might bypass the firewall, depending on how the blocking software is keyed to activate. -dj --- Jeff Lewis [EMAIL PROTECTED] wrote: I was sitting here at work (working of course!) thinking about how some sites are blocked etc from viewing... Is it possible with PHP to do something like this: Have a page where I can create kind of a middle man. I mean the PHP can be hosted on my server, it goes to the site I'd want to view (lets say www.php.net). It then relays it to my browser but as if it is coming from my server. So can it grab the pages, temp write them and server them over to me? I know it seems kind of strange but I am curious about it Jeff __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General
RE: [PHP] mailto function to attach a photo
You're probably going to need a mime class - Manuel Lemos makes a good one, then send as a mime attachment. http://freshmeat.net/projects/mimemessageclass/ Some sample code below that I use (and a mime class). Example.php ? if (!isset($SEND_MIME_LOADED)) { require mimeclass.php; } $mymessage = new Mail(); $mymessage-from = $emailfrom; $mymessage-to = $emailto; $mymessage-subject = $emailfromname sent a picture to you from shanghaiguide.com; $mymessage-headers[Reply-To] = $emailfrom; $mymessage-headers[X-Extra-Header] = Pointless Header v3.0; $mymessage-body = $emailfromname sent you a picture from the ShanghaiGuide.com site\n . \n. http://www.Shanghaiguide.com\n\n;. The Shanghai Guide - The real guide to Shanghai Life\n\nLive Chat, Thousands of Pictures, Classifieds, Message Forum and more...; $mymessage-attachments[0] = $DOCUMENT_ROOT.$pic; $mymessage-Send(); ? mimeclass.php ?php //Abort on re-entry... if ($SEND_MIME_LOADED==1){ exit; } $SEND_MIME_LOADED=1; //Main Code /* Uses sendmail to send the mail, mimencode to do the MIME encoding, and zip to automatically zip attachments. Contacting the author(s): Brought to you by the team at Sequoia Softworks, http://www.sequoiasoft.com Feel free to contact [EMAIL PROTECTED] and tell us how you like it! (Or to complain bitterly, report bugs, or suggest new features.) Known shortcomings/bugs: o guessMIMEType()only knows about a few MIME types. You can expand this as you need. o $mime_boundary in the Send() method should be randomly generated, but it isn't likely to ever hurt anything in its current form Example: require(Mail.phtml); $mymessage = new Mail(); $mymessage-from = [EMAIL PROTECTED]; $mymessage-to = [EMAIL PROTECTED]; $mymessage-subject = This is your lucky day; $mymessage-headers[Reply-To] = [EMAIL PROTECTED]; $mymessage-headers[X-Extra-Header] = Pointless Header v3.0; $mymessage-body = Doesn't it feel good to get mail?\nEspecially with files attached!\n; $mymessage-attachments[0] = tarball.tar.gz; $mymessage-attachments[1] = images/smiling_countenance.gif; $mymessage-attachments[2] = /usr/share/reference/jargondict.html; $mymessage-attachments[3] = ./core; $mymessage-attachments[4] = /etc/passwd; //naughty naughty!! $mymessage-ZipAttachments(your_files.zip); //uncomment this to zip all //the attachments into one big //attachment. $mymessage-Send(); */ class Mail { var $from; //The sender var $to; //The recipient var $subject; //The subject line var $headers; //A hash of additional headers (headername = headervalue) var $zipname; //The name of the file the attachments are zipped into //($zipname == false if attachments are to be sent //individually) var $attachments; //An array of files to attach var $body; //The body text of the message //Mail constructor: initializes vars to default values. 'Nuff said. function Mail() { $this-from = ; $this-to = ; $this-subject = ; $this-headers = array(); $this-zipname = false; $this-attachments = array(); $this-body = ; } //Auxiliary method, used to guess a file's MIME type //based on its extension. Doesn't know about too many //extensions right now function guessMIMEType($filename) { //GUESS MIME TYPE $filename = basename($filename); if(strrchr($filename,.) == false) { return(application/octet-stream); } $ext = strrchr($filename,.); switch($ext) { case .gif: return image/gif; break; case .gz: return application/x-gzip; case .htm: case .html: return text/html; break; case .jpg: return image/jpeg; break; case .tar: return application/x-tar; break; case .txt: return text/plain; break; case .zip: return application/zip; break; default: return application/octet-stream; break; } } //Cute little convenience method. Supply it with a filename to //zip attachments to, or supply it with false if attachments are //sent individually function ZipAttachments($name) { $this-zipname = $name; } //The workhorse method, does the actually
[PHP] Session Problem
I can't get session variables to work I know this has been done to death in the past, but I've looked on php.net, and google for a solution, have tried the suggestions, and seem to fix it. My php session settings are as follows: NameLocal Global settings session.auto_start Off Off session.cache_expire180 180 session.cache_limiter nocache nocache session.cookie_domain no valueno value session.cookie_lifetime 0 0 session.cookie_path / / session.entropy_fileno valueno value session.entropy_length 0 0 session.gc_maxlifetime 14401440 session.gc_probability 1 1 session.namePHPSESSID PHPSESSID session.referer_check no valueno value session.save_handlerfiles files session.save_path /tmp/tmp session.serialize_handler php php session.use_cookies On On The code I'm using to test is as follows: ?php session_start(); echo COUNT{$count}; if (!isset($count)) { echo registering session; session_register($count); $count=1; } else { $count++; echo $count; } ? The output is as follows: COUNTregistering session Refreshing shows the same output My /tmp directory exists and has the following permissions. drwxrwxrwt 3 root root 4096 Aug 24 10:40 tmp What should I be looking for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Session Problem
The simple things... Now I feel stupid. Baaie dankie Rudolf. (I'm an ex Capetownian now in Shanghai,China) Note to self, read manual * C A R E F U L L Y * -Original Message- From: Rudolf Visagie [mailto:[EMAIL PROTECTED]] Sent: August 24, 2001 1:43 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Session Problem Try session_register(count); Rudolf Visagie [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 24 August 2001 04:42 To: [EMAIL PROTECTED] Subject: [PHP] Session Problem I can't get session variables to work I know this has been done to death in the past, but I've looked on php.net, and google for a solution, have tried the suggestions, and seem to fix it. My php session settings are as follows: NameLocal Global settings session.auto_start Off Off session.cache_expire180 180 session.cache_limiter nocache nocache session.cookie_domain no valueno value session.cookie_lifetime 0 0 session.cookie_path / / session.entropy_fileno valueno value session.entropy_length 0 0 session.gc_maxlifetime 14401440 session.gc_probability 1 1 session.namePHPSESSID PHPSESSID session.referer_check no valueno value session.save_handlerfiles files session.save_path /tmp/tmp session.serialize_handler php php session.use_cookies On On The code I'm using to test is as follows: ?php session_start(); echo COUNT{$count}; if (!isset($count)) { echo registering session; session_register($count); $count=1; } else { $count++; echo $count; } ? The output is as follows: COUNTregistering session Refreshing shows the same output My /tmp directory exists and has the following permissions. drwxrwxrwt 3 root root 4096 Aug 24 10:40 tmp What should I be looking for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] charset
Depends on what Chinese charset you want. Simplified Chinese or Traditional. GB or BIG5 Use a meta content type for the charset type for simplified meta http-equiv=content-type content=text/html; charset=gb2312 for traditional META http-equiv=Content-Type content=text/html; charset=big5 eg head titleYahoo! China - NA?¢FOD1u/title meta http-equiv=content-type content=text/html; charset=gb2312 /head ¦n¤F?? Lawrence. -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: August 21, 2001 2:03 PM To: Maxim Maletsky; 'Mark Lo'; [EMAIL PROTECTED] Subject: RE: [PHP] charset P.S: just as in this email :-) Maxim Maletsky -Original Message- From: Maxim Maletsky Sent: Tuesday, August 21, 2001 3:02 PM To: 'Mark Lo'; [EMAIL PROTECTED] Subject: RE: [PHP] charset Chinese charset. Maxim Maletsky -Original Message- From: Mark Lo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 3:03 PM To: [EMAIL PROTECTED] Subject: [PHP] charset Hi, What could be wrong if I don't specific the CHARSET in my webpage. If my webpage will display both chinese and english, then what charset should i use. Thank you Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Strings with Spaces in URLS
$search= urlencode ($search); urlencode - have a look on the php site. -Original Message- From: Chris Aitken [mailto:[EMAIL PROTECTED]] Sent: August 22, 2001 9:05 AM To: [EMAIL PROTECTED] Subject: [PHP] Strings with Spaces in URLS I have come up with a bit of a problem I have a little funky search form on a page, and when I send the search data on as a URL, anything with a space is screwed up example $search = This is a test; echo a href=http://www.blah.com/foo.php?search=$search; and when the link is clicked (or even when the mouse is put over the link), the URL in the browser is - http://www.blah.com/foo.php?search=This leaving out all words after the first space. If I simply throw the while thing using the following header statement header(Location: http://www.blah.com/foo.php?search=$search;); then it brings it up properly in the browser. Any suggestions ? Cheers Chris -- Chris Aitken - Administration/Database Designer - IDEAL Internet email: [EMAIL PROTECTED] phone: +61 2 4628 fax: +61 2 4628 8890 __-__ *** Big Brother *** It just shows that the dull will rule the world. And we will be watching it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Startup
you're startup files are typically in /etc/rc.d/init.d on redhat be *very* careful though! Create a script which starts whatever you need in there. create a text file which starts apache. eg pico startapache #start apache apachectl start save file chmod +x it to make it executable do the same for mysql (I forget the command line at the moment). restart and test. you may need to be root to access /etc/rd.d/init/d depends on your system cheers. Lawrence. -Original Message- From: Roman [mailto:[EMAIL PROTECTED]] Sent: August 17, 2001 2:47 PM To: Php-General Subject: [PHP] Startup I install apache 1.3.20, php 4.0.6 and mysql on Red Hat Linux 7.0 but I must start thei manualy. I want to start this services automatically when starts the linux. How ? roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] hacks we should know about
my 2 cents Anyone with a clue doesn't use /etc/passwd anymore *shadow password file*, so thats kind of depreciated... Your php process should not be running as root - typically you will give apache its own group, and apache + php will only be able to access files which that group has permission for. If you are running IIS on Windows, you are pretty screwed. More holes than a sieve. Change to apache or zeus. .htaccess files or apache.conf can set .inc or other files not to be passed to the webbrowser. You can set it to be restrictive, so only files you specify can get opened in a browser. turn off directory browsing in apache for directories without a default page. any data passed via the browser interface is suspicious. sanitize it for your data. eg if expecting a numeric value, check its numeric and zero it if not. error checking in the code is good, but try not to show too much info about the server. initialise all variables before using them. (in case someone passes something via get/post that may get used). if you use any common scripts, change the default passwords - there are a gazillion sites out there with the default script passwords out there. use an include file for database access passwords. keep this out of the webserver directory if possible. eg (sample example, not a functional one!) website is in /home/website /home is out of webservers directories. db.ini saved in /home ?php $db_pass=my password; $db_user=username; ? myphppage in /home/website ?php require /home/db.ini; mysql_connect ($db_pass,$db_user); ? common sense gets 99% of things. If the usual holes aren't there the script kiddies will go to another site with more holes. Don't forget to also keep up to date with recommended patches for your OS. Bugtraq.com and securityfocus.com are good places to keep up with both ends of the stick. -Original Message- From: Bob [mailto:[EMAIL PROTECTED]] Sent: August 17, 2001 11:43 AM To: [EMAIL PROTECTED] Subject: [PHP] hacks we should know about hi i found it very helpful to know about hacks such as the below list and was wondering if anyone had any more dumb mistakes they could tell us before we make them. 1. http://www.somesite.com/source.php3?url=/etc/passwd 2. http://www.somesite.com?page=../../../../etc/passwd 3. not setting .inc files to be parsed by php 4. setting directory ownership to nobody _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] OT win95/apache/ query
Windows is a little stupid try this from windows start/run/command echo .htaccess you now have a blank .htaccess file, copy it to wherever you need and edit it with whatever contents you need. -Original Message- From: rm [mailto:[EMAIL PROTECTED]] Sent: August 17, 2001 12:27 PM To: List PHP Subject: [PHP] OT win95/apache/ query Couple of months ago my HD died, I replaced it, re-installed win95, reinstalled apache and php. This evening I have to create a .htaccess file for a production web site to generate custom error messages like ErrorDocument 404 /errordocs/404 ErrorDocument 500 /errordocs/500 etc win 95 will not let me create a file called .htaccess, I never had this problem on the win 95 before the old HD died!! Anyone know how to fix this? No win program will let me create this file so I assume this is a win config issue??? any help appreciated. rm __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] hacks we should know about
/ might be a correct path not a hack attempt. here's something normalizes a directory for a given path passed to it. eg /index.txt eg ../../../ will get parsed out. such as in the http://www.somesite.com?page=../../../../etc/passwd Originally written for a directory browse script i use for a /pics directory on www.shanghaiguide.com/pics I used to use realpath, but it started working differently on my box in the 4.0.6 release, so I wrote this function TruePath ($path){ //Not really optimized but it does work. $patharray = explode (/, $path); $path=;$count=count($patharray);//We have multiple count($patharray) so a minor bit faster. for ($i=0;$i$count; $i++){ if ( $patharray[$i] == . || $patharray[$i]== .. || ( (($i+1) $count) ($patharray[$i+1]== ..)) ) { //If the current pos is a . ignore, if pos+1 == .. ignore, lastly if current = .. ignore. } else { $path .= $patharray[$i]./; } } //Trim trailing slash $path = substr($path,0,-1); return ($path); } May or may not be useful for someone. I welcome an optimized one using a regex, this was my non regex attempt ;) Cheers, Lawrence. -Original Message- From: ReDucTor [mailto:[EMAIL PROTECTED]] Sent: August 17, 2001 1:42 PM To: Bob; Rasmus Lerdorf Cc: [EMAIL PROTECTED] Subject: Re: [PHP] hacks we should know about ?php if(ereg(/, $file)) { $file = file(loggedips.txt); $fp = fopen(loggedips.txt, w); fwrite($fp, \r\n.$REMOTE_ADDR. to .$file); for($i=0;$isizeof($file);$i++) fwrite($fp, $file[$i]); fclose($fp); die(Hack attempt...IP Logged); } else showsource($file); ? - Original Message - From: Bob [EMAIL PROTECTED] To: Rasmus Lerdorf [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, August 17, 2001 2:17 PM Subject: Re: [PHP] hacks we should know about rasmus, if password.inc is being parsed by php then how would you get the code??? won't it just be a blank page??? oh i thought up one more ... 4. checking for html tags and php scripting when accepting data from text boxes Rasmus Lerdorf wrote: hi i found it very helpful to know about hacks such as the below list and was wondering if anyone had any more dumb mistakes they could tell us before we make them. 1. http://www.somesite.com/source.php3?url=/etc/passwd 2. http://www.somesite.com?page=../../../../etc/passwd 3. not setting .inc files to be parsed by php This is the wrong solution to securing include files. The correct solution is to block any direct access to .inc files by either putting them outside your document root or by using an Apache deny rule. -Rasmus _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: `pwd` - what does this mean?
pass working directory [or] path to working directory. PWD is a unix command See man pwd for more details. eg http://campuscgi.princeton.edu/man?pwd#toc3 -Original Message- From: Raphael Pirker [mailto:[EMAIL PROTECTED]] Sent: August 15, 2001 2:49 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: `pwd` - what does this mean? my guess would be Parent Working Directory, but i'm not sure... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] a bit off the list but should be easy
Most people do it like this Specify the charset in the document. e.g. Simplified Chinese meta http-equiv=content-type content=text/html; charset=gb2312 Traditional Chinese meta http-equiv=content-type content=text/html; charset=big5 You can also specify the language type in the web server - have a look at your apache settings. Doing it via the charset= method is better though imho. Note that the download font thing is Internet Exploder Specific. Internet Exploder also has a few issues with different charsets. Also note that *all* html documents should have a specified charset - even the plain english ones. Most of the html on the internet is coded wrongly, this does not make it correct. I do a lot of simplified chinese development, being located in Shanghai, China. Cheers, Lawrence. -Original Message- From: Jack [mailto:[EMAIL PROTECTED]] Sent: August 16, 2001 4:21 AM To: [EMAIL PROTECTED] Subject: [PHP] a bit off the list but should be easy Hi people It is about html, that when I go to some sites that ask me to download their font like Japanese or chinese font, in order to read their language, what do they put in the page for that kind of detection? Jack [EMAIL PROTECTED] Love your enemies, it will drive them nuts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] to include php file into html file
Try ?php include /include/adjs.php; ? in your html file to include some php code in there [1]Javascript is a rather sh*tty client side language, it doesn't parse php very well. [2]script language='JavaScript' src='/include/adjs.php/script ^ Warning unterminated tag... Cheers, Lawrence. -Original Message- From: Jack [mailto:[EMAIL PROTECTED]] Sent: August 15, 2001 11:00 PM To: [EMAIL PROTECTED] Subject: [PHP] to include php file into html file Hi people I have tried to include php file into html page using the syntax below and it said syntax error at this part when the page is loaded. What is wrong with calling php file this way? Or is there any other way to call php file from html page? *** html body script language='JavaScript' src='/include/adjs.php/script /body /html *** Jack [EMAIL PROTECTED] Love your enemies, it will drive them nuts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] to include php file into html file
Well, It seems your web server is setup not to parse .html files as php If you are running apache, then add configure it to correctly parse the ?php in all files. php.net has ample doc's about that, as does apache. If you are running IIS or PWS, then get any of the millions of people with root access to fix the extension parsing for you. Or Either rename your html with a .php extension. Do whatever is simpler for you. -Original Message- From: Jack [mailto:[EMAIL PROTECTED]] Sent: August 15, 2001 11:20 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] to include php file into html file I also tried ?php include myphp.php;? into my html page, and it appears that nothing happen at all,. Looks like the html page does not recognize the php tag. Is there any other way that one can include a php file into a html file? Jack [EMAIL PROTECTED] Love your enemies, it will drive them nuts - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, August 14, 2001 10:04 PM Subject: RE: [PHP] to include php file into html file Try ?php include /include/adjs.php; ? in your html file to include some php code in there [1]Javascript is a rather sh*tty client side language, it doesn't parse php very well. [2]script language='JavaScript' src='/include/adjs.php/script ^ Warning unterminated tag... Cheers, Lawrence. -Original Message- From: Jack [mailto:[EMAIL PROTECTED]] Sent: August 15, 2001 11:00 PM To: [EMAIL PROTECTED] Subject: [PHP] to include php file into html file Hi people I have tried to include php file into html page using the syntax below and it said syntax error at this part when the page is loaded. What is wrong with calling php file this way? Or is there any other way to call php file from html page? *** html body script language='JavaScript' src='/include/adjs.php/script /body /html *** Jack [EMAIL PROTECTED] Love your enemies, it will drive them nuts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] caching and IE 5
Try this head META Http-Equiv=Cache-Control Content=no-cache META Http-Equiv=Pragma Content=no-cache META Http-Equiv=Expires Content=0 /head works for me - try loading www.shanghaiguide.com/main/index.php3 - should do time, and display a different image every time. cheers, lawrence. -Original Message- From: Karl Phillipson [mailto:[EMAIL PROTECTED]] Sent: August 9, 2001 5:21 PM To: '[EMAIL PROTECTED]' Subject: [PHP] caching and IE 5 Is anyone else having fun and games with IE 5.0 and caching? I have the no-cache code (below) before anything else in my index file. Following that an include file is pulled in that has a form with a text input field that echos the date and time. Whenever I refresh the page the time does not update to reflect the current time, it sticks with the time that was displayed when the page was first loaded. Even when I close the browser and reopen it the time remains the same. Any pointers on this issue? ?php header (Expires: Mon, 14 Jul 1963 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); ? input type=text name=search_name value=?php echo SEARCH .date(F jS Y G:m A) ? Thx in advance. Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ----- BEING AN ASS CLICK HERE NOT ABOVE!!!!!
Kyle, Apache runs as a background program. When you've installed apache, and php, you don't actually run them from the commmand line. What you have to do is open up a browser window, and point it to your computer. Open up Internet Explorer (you're running windows it looks like), and type in http://127.0.0.1 or http://localhost This should bring up a screen saying you've installed apache correctly. If apache is installed in the default directories, then most likely you'll need to put some webpages into c:\apache\htdocs I would recommend making a file called test.php with the following lines in ?php phpinfo(); ? Save it into c:\apache\htdocs now go to your webbrowser, and go to http://localhost/test.php If php shows the phpinfo screen then you've installed everything correctly. If it doesn't work, we'll need to look at your apache settings and php settings. Try the stuff above first, then tell me what happens. Cheers, Lawrence. -Original Message- From: Kyle Smith [mailto:[EMAIL PROTECTED]] Sent: August 3, 2001 1:46 AM To: [EMAIL PROTECTED] Subject: [PHP] - BEING AN ASS CLICK HERE NOT ABOVE! (the damn thing took my attatchement off!!!) Ok I have installed PHPTriad, when i run apache (gulp) dos opens, all fine BUT when i run PHP.exe well look down http://www.stupeedstudios.f2s.com/probs.gif -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Adopt A Newbie (ME)
He's young. Impatience is a documented feature of the youth of today (hmmm, am I old now ;( ) I've was helping him offlist with php/mysql yesterday - he seems to have it installed now. All he needs to do now is learn php, and mysql, and courtesy. Shouldn't take more than another thousand or two messages on the list... -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: August 3, 2001 8:54 AM To: Tim; [EMAIL PROTECTED] Subject: Re: [PHP] Adopt A Newbie (ME) On Thu, 2 Aug 2001 23:53, Tim wrote: I hereby nominate Kyle as the official George W. Bush of the PHP General mailing list. Anyone second it? - Tim On 02 Aug 2001 15:07:49 -0700, Kyle Smith wrote: zillion is actually a number? i just downloaded a program which reads out text for you cause it just gets really boring reading the text, so now its goinfg to be like having a techer in the room... you got a gun? -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 Not only do I second it, but I've decided to give him first place in my procmailrc :-) -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA One if by LAN, two if by C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] MySql help #1
Sounds like a strange request, what are you trying to do? I don't think you can do this directly in mysql, but you could build an array of results in php. eg something like (crappy code below) //Grab results $db = mysql_connect($db_domain, $db_user,$db_password); mysql_select_db($db_databasename,$db); $sqlquery=select ID from table1 where condition1; $result = mysql_query ($sqlstring,$db); $count=0; while ($resultset = mysql_fetch_array ($result)) { $array[$count]=$resultset [ID]; $count++; } for ($count=0;$count2;$count++){ update table1 set field='VALUE' WHERE ID=.$array[$count]; $result = mysql_query ($sqlstring,$db) or die (mysql_error()); } -Original Message- From: elias [mailto:[EMAIL PROTECTED]] Sent: August 2, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: [PHP] MySql help #1 How can I update only N fields from the database? usually we do: UPDATE table1 SET field='VALUE' WHERE condition1 now I want to update fields with a certain condition but only X fields out N total fields. ie: id value --- --- 1a 2b 3c 4d 5e how can i update such like: UPDATE table1 SET {only 2 records} value='aa' so I have any two fields now have the 'aa' value -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] MySql help #1
Have you thought about your database design carefully? You might want to create a column for item count eg id, item name, items in stock 1, frog, 7 if, say a customer orders 3 frogs, decrement the items in stock by 3. Just an idea... Do you know about database normalization? How is the database designed? -Original Message- From: elias [mailto:[EMAIL PROTECTED]] Sent: August 2, 2001 6:32 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] MySql help #1 Someone purchased items from my site let's say 3 items out of 5 total. All items are the same. I just want to update 3 items status to Reserved. When he buy he just tell how many and not which ones. Lawrence Sheed [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED] ... Sounds like a strange request, what are you trying to do? I don't think you can do this directly in mysql, but you could build an array of results in php. eg something like (crappy code below) //Grab results $db = mysql_connect($db_domain, $db_user,$db_password); mysql_select_db($db_databasename,$db); $sqlquery=select ID from table1 where condition1; $result = mysql_query ($sqlstring,$db); $count=0; while ($resultset = mysql_fetch_array ($result)) { $array[$count]=$resultset [ID]; $count++; } for ($count=0;$count2;$count++){ update table1 set field='VALUE' WHERE ID=.$array[$count]; $result = mysql_query ($sqlstring,$db) or die (mysql_error()); } -Original Message- From: elias [mailto:[EMAIL PROTECTED]] Sent: August 2, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: [PHP] MySql help #1 How can I update only N fields from the database? usually we do: UPDATE table1 SET field='VALUE' WHERE condition1 now I want to update fields with a certain condition but only X fields out N total fields. ie: id value --- --- 1a 2b 3c 4d 5e how can i update such like: UPDATE table1 SET {only 2 records} value='aa' so I have any two fields now have the 'aa' value -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ----- BEING AN ASS CLICK HERE NOT ABOVE!!!!!
Oops, Correction - You'll need to run apache first, leave it running, and then try the below. not enough coffee today... -Original Message- From: Sheed, Lawrence -SHNGI -AG Sent: August 2, 2001 5:51 PM To: 'Kyle Smith'; [EMAIL PROTECTED] Subject: RE: [PHP] - BEING AN ASS CLICK HERE NOT ABOVE! Kyle, Apache runs as a background program. When you've installed apache, and php, you don't actually run them from the commmand line. What you have to do is open up a browser window, and point it to your computer. Open up Internet Explorer (you're running windows it looks like), and type in http://127.0.0.1 or http://localhost This should bring up a screen saying you've installed apache correctly. If apache is installed in the default directories, then most likely you'll need to put some webpages into c:\apache\htdocs I would recommend making a file called test.php with the following lines in ?php phpinfo(); ? Save it into c:\apache\htdocs now go to your webbrowser, and go to http://localhost/test.php If php shows the phpinfo screen then you've installed everything correctly. If it doesn't work, we'll need to look at your apache settings and php settings. Try the stuff above first, then tell me what happens. Cheers, Lawrence. -Original Message- From: Kyle Smith [mailto:[EMAIL PROTECTED]] Sent: August 3, 2001 1:46 AM To: [EMAIL PROTECTED] Subject: [PHP] - BEING AN ASS CLICK HERE NOT ABOVE! (the damn thing took my attatchement off!!!) Ok I have installed PHPTriad, when i run apache (gulp) dos opens, all fine BUT when i run PHP.exe well look down http://www.stupeedstudios.f2s.com/probs.gif -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Hmmm?
I presume you mean code layout Its there to make code easier to read. eg some silly code for ($x=1;$x100;$x++) { while ($i50) { print $i; } } This is more legible than for ($x=1;$x100;$x++) { while ($i50) { print $i; } } Indentation makes it easier to spot where your code constructs - if ,switch, while etc start and end. Hope that explains it a little. Do a search for code layout in google, and read up on it, and check out a few examples. There are a number of coding styles, find one that you like, and be consistent. Remember to also comment your code, as well as making it presentable. If you look back at old code in a few years time you'll be grateful you did. Cheers, Lawrence. -Original Message- From: Kyle Smith [mailto:[EMAIL PROTECTED]] Sent: August 1, 2001 11:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Hmmm? Whenever i get a php script off a website why is it that most of the main parts in the script have a space from the left border. eg ?php echospazzz; ? -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP]Getting rows in a db...
Bear in mind that you don't want to be doing queries like that generally. Use count(*) to get the number of rows - using mysql_num_rows is slower. eg $query=select count(*) from tablename where cat='band'; $result = mysql_query($query,$conn); etc. -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: August 2, 2001 2:13 PM To: Chris Cocuzzo; [EMAIL PROTECTED] Subject: Re: [PHP]Getting rows in a db... On Thu, 2 Aug 2001 14:57, Chris Cocuzzo wrote: hey- if I do this: $query = SELECT user FROM table WHERE cat='band'; $result = mysql_query($query,$conn); $rows = mysql_num_rows($result); will I get something back from the $rows variable, or am I using the mysql_num_rows() function incorrectly. What I'm trying to do is get the number of rows returned as a result of that specific sql statement and query. thanks chris That should show the number of rows returned by the query, providing there is a successful result. Try it! -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Shotgun wedding: a case of wife or death. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] fopen not opening url
Are you still having problems? Things to try: 1. Try and open the url directly in a browser. eg http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml Does it return data (you may need to change the o=xml to o=html though). Some countries (like the one I'm in China, have moreover access banned via some providers) 2. socket blocking - you may need to enable or disable this dependant on your server settings: set_socket_blocking ($connection,false); function LoadFile ($filename,$block=false){ $fd = fopen( $filename, r ); if ($block) set_socket_blocking ($fd,true); $contents = fread( $fd, filesize( $filename ) ); fclose( $fd ); return ($contents); } Without socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml;); With socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml,true ); 3. I use something like this for reads on difficult servers (some china mail servers are a p.i.a to get at sometimes). Function GetLine() { $timeout=30; $iStartTime = time(); set_socket_blocking($this-connection, false); $line = fread($this-connection,128); while(empty($line)){ $line = fread($this-connection,128); usleep(25); } if ($debug) { print ($line) .br; System(echo ''); flush; } return ($line); } Let me know how you do. Lawrence. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: July 31, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url here's the code i'm using below to try and open up the url.. :) thanks! jay $fp = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; , r); $length = filesize($fp); $content = fread($fp,$length); fclose($fp); echo $content; - Original Message - From: Jack Dempsey [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED] Sent: Monday, July 30, 2001 1:52 PM Subject: RE: [PHP] fopen not opening url Hi jay, I've done the exact thing you're trying, and it works...paste in some code so we can see where its going wrong... jack -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso= xml ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Avoiding repost
Set a flag either cookie, or db based. in your submit code, set the flag, fairly simple if ($submitted) { //error i've been posted already } else { //do form submit stuff. $submitted=1; //SetCookie or session variable... } -Original Message- From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 4:02 PM To: PHP-General List Subject: [PHP] Avoiding repost I have a card system that will ask for the required information, and one hits a 'Send' button to send the card. This will submit all the information to a database and send the viewer to a 'Thank You' page. The problem is, if they hit reload on that (Thank You) page, (and answer 'yes' to the 'Repost Data' question), a second card will get submitted - with the same information as the first. Needless to say, someone can sit at that screen, and hit 'reload' several times and send the same card over and over again, flooding the recipient's mailbox. How can I avoid this? -- H | Hi, I'm currently out of my mind. Please leave a message. BP! + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 Director of Internet Operations / SysAdmin. 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] URGENT: function mail()
Have a look at the internet - google is good for this http://www.imc.org/mail-i18n.html#MIME Internationalized text and names appear in both parts of Internet mail messages: in the headers, and in the body of the message. RFC 2047 covers how to use international characters in some parts of non-MIME headers, such as addresses and subject headers. RFC 2231 extends the concepts in RFC 2047 to cover MIME parameter values, and also specifies a method for using language tagging for international characters in these headers. RFC 2046 describes how to specify the charset for each part of the body of the message so, you're looking for RFC2047 http://www.imc.org/rfc2047 In that it describes how to do it something like =?iso-8859-2q?this is some text?= would probably work for you, but you'll need to encode the characters correctly according to the rfc. cheers, Lawrence. -Original Message- From: Gernot [mailto:[EMAIL PROTECTED]] Sent: July 25, 2001 4:53 PM To: [EMAIL PROTECTED] Subject: [PHP] URGENT: function mail() i've the following problem i know how to set the charset in the header of a mail using the php mail-function. but i also need to set it for the subject (iso-8859-2) i hope someone can help me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] URGENT: function mail()
Feeling a little guilty for not being that helpful (rfc's aren't that easy to use sometimes) From the top of my head Two types of encoding based on the RFC B (Base64) Q (Quoted?) so for funky foreign text, non ascii would be something like $subject= base64_encode ($subject); $subject= =?ISO-8859-2?B?. $subject. =?=; for normal ascii range //Replace space with =20 $subject = ereg_replace ( , =20, $subject); $subject = =?ISO-8859-2?Q?. $subject .=?=; As i've said off the top of my head, read the spec carefully for exact output. you should get the general idea from the above though. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: July 25, 2001 5:45 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] URGENT: function mail() Have a look at the internet - google is good for this http://www.imc.org/mail-i18n.html#MIME Internationalized text and names appear in both parts of Internet mail messages: in the headers, and in the body of the message. RFC 2047 covers how to use international characters in some parts of non-MIME headers, such as addresses and subject headers. RFC 2231 extends the concepts in RFC 2047 to cover MIME parameter values, and also specifies a method for using language tagging for international characters in these headers. RFC 2046 describes how to specify the charset for each part of the body of the message so, you're looking for RFC2047 http://www.imc.org/rfc2047 In that it describes how to do it something like =?iso-8859-2q?this is some text?= would probably work for you, but you'll need to encode the characters correctly according to the rfc. cheers, Lawrence. -Original Message- From: Gernot [mailto:[EMAIL PROTECTED]] Sent: July 25, 2001 4:53 PM To: [EMAIL PROTECTED] Subject: [PHP] URGENT: function mail() i've the following problem i know how to set the charset in the header of a mail using the php mail-function. but i also need to set it for the subject (iso-8859-2) i hope someone can help me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] html form question
I use the following Looks a bit unwieldy to call, but does everything I need. eg, say I have a table called foo with ID, Name print OptionCreate (ID,returnID, foo order by Name, ,Name); will create me a drop down print OptionCreate (ID,returnID, foo order by Name, 1,Name); will create me a drop down with item 1 selected. Hope this helps. //OptionName = field to list, passedname=option Select name //tablename= table name , selected value = option select selected value if found //NOTE THAT THE DB open MUST have been already made in the calling routine!!! //eg$db = mysql_connect($db_domain, $db_user,$db_password); // mysql_select_db($db_databasename,$db); function OptionCreate ($optionname,$passedname, $tablename, $selectedvalue=,$optiontext=) { if ($optiontext==) $sqlstring = select $optionname from $tablename; else $sqlstring = select $optionname, $optiontext from $tablename; global $db; $result=mysql_query($sqlstring,$db); $rows = mysql_num_rows ($result); $tmpOut = select name=\$passedname\ size=1; for ($count=0;$count $rows; $count++) { $tmpOut = $tmpOut . option value=\ . MYSQL_RESULT($result,$count,$optionname) . \; //Select item if passed variable is found if ($selectedvalue == MYSQL_RESULT($result,$count,$optionname)) $tmpOut=$tmpOut . selected; if ($optiontext==) $tmpOut = $tmpOut . . MYSQL_RESULT($result,$count,$optionname) . /option; else $tmpOut = $tmpOut . . MYSQL_RESULT($result,$count,$optiontext) . /option; } $tmpOut = $tmpOut . /select; return ($tmpOut); } -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 9:02 AM To: CGI GUY; [EMAIL PROTECTED] Subject: Re: [PHP] html form question On Thu, 26 Jul 2001 10:27, CGI GUY wrote: What's the method for populating any number of html form option.../option tags with query results? I've seen lots of php-embedded examples for CHECKBOX, RADIO and even SELECT, but I can't seem to figure out how to create a simple drop-down menu. HELP!!! You only need to loop through the query result in the usual fashion and echo the results within option tags. Here's a function I wrote to to useful things with SELECT: ?php /* formDropDown - create an HTML SELECT * vars: $name - the form variable NAME * $value - the SELECTED option which may be an array for multiple selected items * $labels - assoc. array, list of values=labels * $multiple - if non-empty, select multiple * $size - number of rows to show if multiple * returns: string, HTML (i.e. for use in echo or print statement) */ function formDropDown($name,$value,$labels,$multiple = '',$size ='') { $html = 'SELECT NAME=' .$name . ''; if(!empty($multiple)) { $html .= ' MULTIPLE'; } if(!empty($size)) { $html .= ' SIZE=' . $size; } $html .= \n; $key = key($labels); while($key != ) { /* Check if the current value is in the $value variable */ if(is_array($value)) { if(in_array($key,$value)) { $selected = ' SELECTED'; } else { $selected = ''; } } else { if ($key == $value) { $selected = ' SELECTED'; } else { $selected = ''; } } $html .= OPTION VALUE=\$key\$selected$labels[$key]\n; next($labels); $key = key($labels); } $html .= /SELECT\n; return $html; } ? 4ÈÑ4 -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Why build a wall round a cemetery when no-one wants to get in? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] OT--PHP, MySQL, WML and GPS Tracking
I'm of the opinion you cannot do this totally in PHP. You are going to need some client side, and some server side software - server side can be php of course. Client side ie (gps/wap device)- One possibility - write a wap browser that interfaces with your gps device and returns co-ords in header variables or cookies. (or post variables possible). you are either going to have to licence a web browser (or write on yourself, add in some extra headers in the software), for your gps/pda. This is most probably going to be an embedded system written in C or similar. 1.Its not as hard as it seems, there are open sourced browsers you can base it on. 2.It is possible inhouse, but from what you describe, but probable you want to outsource it. let me know if you need some more answers - i used to do embedded systems design in another life back in the good old daysgrin. -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 7:22 AM To: [EMAIL PROTECTED] Subject: [PHP] OT--PHP, MySQL, WML and GPS Tracking Hello everyone, This is slightly off topic, but I'm sure you guys are the best group to answer this. I have a client who needs a wireless website, that interacts with PHP and MySQL. In addition to that, the client wants to be able to track the geographical location, of the user--who will access the site with a cell phone and/or PDA device. Basically, if someone from, say Los Angeles, access the website, we want to be able to (automatically) capture his/her location. This is for internal uses, so the PDA device will be uniformed. That means, I will need to integrate a GPS system/function in the wireless pages. Once the connection is made, I can use php and mysql to handle the rest. My problem is with the GPS functions. I've never worked with any GPS system, so I'm looking for advices, references, and general directions. 1) How do I track a user's PDA device (geographical location)? **- I know some of the WAP enabled phones (like the i1000 by Nextel) doesn't let you do that** **- I think there some legality issues around that, but am not sure. 2) Where can I read up on that? 3) Has anyone work with something on that level? If so, then please help. At this point, the PDA device has not been chosen. We are still in the research stage. As far as I know, Trucking Companies, uses this type of system to track their trucks and drivers. And, off course, any car with a Navigation System is using the same concept. Where can I get some information on this? Has anyone programmed anything related to Global Positioning Systems? If so, then I would appreciate any information that you can share. Any help would be greatly appreciated. Thanks in advance! __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com The world is waiting, are you ready? -+___+- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Why doesn't this simple query work?
how about $location = addslashes($location); $query = select shoodID from shoots where location = '$location'; or $query = select shoodID from shoots where location = '. addslashes($location) .'; Both are \'clean\' :) -Original Message- From: Moriyoshi Koizumi [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 4:59 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Why doesn't this simple query work? IMHO $query = SELECT shoodID FROM shoots WHERE location=\$location\; and even $query = SELECT shoodID FROM shoots WHERE location='$location'; sometimes cause SQL Syntax Error, because the variable $location may contain quote characters (')()... since i experienced the same thing i've been doing like this... (the reason is just that i did with 2 byte japanese characters?) $query = sprintf( 'SELECT shootID FROM shoots WHERE location=%s', AddSlashes( $location ) ); going well, but is this code too ugry? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Syntax Eyes
Almost, but not quite. You also need to prepend a Header before any output your data to tell the browser its content type. Eg ?php Header(Content-type: image/jpg); ...rest of output code ? -Original Message- From: Mark Roedel [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 12:02 AM To: Clayton Dukes; Php-General Subject: RE: [PHP] Syntax Eyes -Original Message- From: Clayton Dukes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 25, 2001 10:42 AM To: Mark Roedel; Php-General Subject: Re: [PHP] Syntax Eyes I have a row in sql that is binary data (a jpeg) I need to echo that data to a table on the web page in the form of the original jepg, when I echo it now, I just get the actual data stream. How can I fix this? ?php echo tdimg src=\/path/to/script/that/outputs.jpeg\/td; ? --- Mark Roedel ([EMAIL PROTECTED]) || There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full. LeTourneau University ||-- Henry Kissinger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] how do you write queries in php codes? (was Re: [PHP] Why doesn't this simple query work?)
Its however you prefer it (or whatever is easier to type usually). sprintf is usable, depends on if you have a c or perl background, and its second nature. For me, I use editplus on windows which gives color coding (www.editplus.com), if I do $query = select abc,def,ghi from table1,table2. $another_table . where abc='. $a .'; I can immediately see the $another_table, and $a are variables. Use a color coded editor - it makes life a lot easier. Lawrence. -Original Message- From: Moriyoshi Koizumi [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] how do you write queries in php codes? (was Re: [PHP] Why doesn't this simple query work?) yes, both of yours make the same result too, and are clean :-) and i wonder what the best way is, to put queries into php code... there's a more complicated sample, $a=addslashes($a); $b=addslashes($b); $c=addslashes($c); if( $another_table ) { $another_table=','.$another_table; } $query = select abc,def,ghi from table1,table2 $another_table where abc='$a' and def='$b' and ghi='$c' ; and i prefer because i often confuse php variables with columns if( $another_table ) { $another_table=','.$another_table; } $query = sprintf( 'select abc,def,ghi from table1,table2 %s where abc=%s and def=%s and ghi=%s', $another_table, addslashes($a), addslashes($b), addslashes($c) ); but i think the latter loses some good php features... then, does anyone have good idea? [EMAIL PROTECTED] wrote: how about $location = addslashes($location); $query = select shoodID from shoots where location = '$location'; or $query = select shoodID from shoots where location = '. addslashes($location) .'; Both are \'clean\' :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] OT--PHP, MySQL, WML and GPS Tracking
Probably necessary to have a customised browser or other solution - i haven't seen any that explicitly interface to a gps device for lat/long co-ords. You cannot triangulate position using wap - the phone company does it by triangulating the position of the cellphone (Very simplified explanation here) GSM cellphones transmit a 'i am here' signal every few seconds, minutes etc (dependant on phone settings) It waits for a response from a cell tower, the strongest one to respond is used. On some nokia phones (and motorolas) you can turn on the engineering menu to have a look yourself. The phone company can look at the celltower stats and work out from response times what cell you are in. By using triangulation they can pinpoint you down. This is not available for the general public though. I haven't worked with GPS devices so I can't really point you at any people - garmin is a big name though. I do know some gps devices have serial inputs for reporting position, you could write code interface to that and use some method to transmit that info back. WML is not the only solution. CDPD is also available in most countries. I use that here in China for internet on the go. For low bandwidth solutions, its not too bad. You could possibly end up with a iPaq or similar, a GPS module for that, and a wireless modem for your solution. Would be expensive though, and does incur monthly costs. Not sure what your application is, or volume though. Cheers, Lawrence. -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 11:51 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] OT--PHP, MySQL, WML and GPS Tracking Thanks for the reply, Lawrence. The embedded C option sounds tempting. Question: Is it necessary to have a customized browser? I know that most WAP browsers (like the UP.SDK browser) pass certain parameters to the server. Like, phone numbers, software version, and other values. Any chance that one these parameters could be the Lat/Long coordinates? (I don't think I've ever noticed that). How does the phone company triangular a cell pone user? Is anyone aware of a customizable GPS system? Or, any suggestions on GPS developers? I've noticed quite a few companies, but most of them focus on automobiles, and other large devices. The GPS device is too large for our purposes. I am familiar with Embedded C...with the right direction, I can probably put the browser together. But, I'll research the option of a third party browser, or outsourcing a customized browser. Thanks for the info. -john __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com The world is waiting, are you ready? -+___+- On Wed, 25 Jul 2001 [EMAIL PROTECTED] wrote: I'm of the opinion you cannot do this totally in PHP. You are going to need some client side, and some server side software - server side can be php of course. Client side ie (gps/wap device)- One possibility - write a wap browser that interfaces with your gps device and returns co-ords in header variables or cookies. (or post variables possible). you are either going to have to licence a web browser (or write on yourself, add in some extra headers in the software), for your gps/pda. This is most probably going to be an embedded system written in C or similar. 1.Its not as hard as it seems, there are open sourced browsers you can base it on. 2.It is possible inhouse, but from what you describe, but probable you want to outsource it. let me know if you need some more answers - i used to do embedded systems design in another life back in the good old daysgrin. -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 7:22 AM To: [EMAIL PROTECTED] Subject: [PHP] OT--PHP, MySQL, WML and GPS Tracking Hello everyone, This is slightly off topic, but I'm sure you guys are the best group to answer this. I have a client who needs a wireless website, that interacts with PHP and MySQL. In addition to that, the client wants to be able to track the geographical location, of the user--who will access the site with a cell phone and/or PDA device. Basically, if someone from, say Los Angeles, access the website, we want to be able to (automatically) capture his/her location. This is for internal uses, so the PDA device will be uniformed. That means, I will need to integrate a GPS system/function in the wireless pages. Once the connection is made, I can use php and mysql to handle the rest. My problem is with the GPS functions. I've never worked with any GPS system, so I'm looking for advices, references, and general directions. 1) How do I track a user's PDA device (geographical location)? **- I know some of the WAP enabled phones (like the i1000 by Nextel)
RE: [PHP] Headers
To emulate a post you'll have to do something similar to the following header POST /index.php3 HTTP/1.1; header Host: $host; header Content-type: application/x-www-form-urlencoded ; header Content-length: . strlen ($data); header Connection: close\n\n; //may only need one, can't remember if header postpends \n //Now print variables //var1=informationvar2=more //for each var to submit header $$var1=$var1$$var2=$var2; or function PostToHost($host, $path, $data_to_send) { $fp = fsockopen($host,80); fputs($fp, POST $path HTTP/1.1\n); fputs($fp, Host: $host\n); fputs($fp, Content-type: application/x-www-form-urlencoded\n); fputs($fp, Content-length: .strlen($data_to_send).\n); fputs($fp, Connection: close\n\n); fputs($fp, $data_to_send); while(!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } $host = cgiserver.x.com; // target server $path = /cgi-bin/target.cgi; // cgi's name $string = value1=value1value2=value2 ; // There can be more value PostToHost($host,$patha,$string); // call the function Cheers, Lawrence. -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 12:32 PM To: Richard Baskett; PHP General Subject: Re: [PHP] Headers On Wednesday 25 July 2001 15:24, Richard Baskett wrote: What does the header look like when you submit a form using the POST method? I would like to transfer some php variables to another page using the header() function. The Location part I have down no problem, but I don't want to do something like this: header(Location:mypage.html?variable1=total) This shows all the variables in the URL. Is there a way to use a header to POST variables to the Location part of the header? Header () is for altering the HTTP headers sent back to the browser. Read some HTTP intro. Regarding your problem - have a look into sessions. they might be what you want. -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) Error 032: Recursion error - see error 032 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Install
this would seem to be a php list, maybe you should look on a perl list for a complete response, hmm? Activestate make a reasonable perl interpreter for windows, have a look at activestate.com for more details. also try google and search for perl windows apache, maybe you can try reading some of the results of the search. good luck. -Original Message- From: Roman [mailto:[EMAIL PROTECTED]] Sent: July 26, 2001 1:50 PM To: Php-General Subject: [PHP] Install Hello ! I want to install perl under apache in windows, please send me some information how can i install, where I find perl software, where I find some perl editor... Thanks fo all roman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]