RE: [PHP] Re: Auto Incrementing in PHP
On 19-Jan-2003 Don Mc Nair wrote: > Thanks Guys > > I just needed a pointer. I decided to use the database and created two > tables, one for invoice number and one for order number then defined a > function to read the current number and the increment it. > That'll work, but it's not atomic. At high traffic loads you can get duplicates. You might want to consider a table with a auto_increment field. Do a dummy insert, the get the value with : mysql_query('SELECT last_insert_id() as id'); Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Finding out if a table exists
On 21-Jan-2003 Mako Shark wrote: > Is there a way of finding if a table exists with only > one command in MySQL? I've looked through the MySQL > functions, and the closest I've gotten to what I need > is mysql_list_tables or mysql_tablename (I'll have to > check into these a little more), but I was hopefully > looking for something that returns a boolean value, > and to be able to use it like: > > if(mysql_table_exists("tablename")) { > ... > } > > Any ideas, short of creating my own function? > Create your own, or borrow mine: function tableexists($tbl) { $res = @mysql_query("SELECT 1 FROM $tbl LIMIT 1"); return ($res ? true : false); } Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using custom "button" form element instead of standard "submit"?
On 27-Jan-2003 Durwood Gafford wrote: > I can't figure out how to tell which button was pressed by a user when i'm > using a "button" instead of a standard "submit" form element. > > This works: > > > $parent will equal "foo" > > This doesn't work: > > src="icon.gif"> > $parent will equal " NOT "foo" > > How do I get the value of "foo" to be returned in $parent and still use a > graphical icon instead of a standard submit button? > Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating kilobytes
On 14-Feb-2003 joe wrote: > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> On Saturday 15 February 2003 03:17, joe wrote: >> >> > now to the point... >> > i need a script. it should work on safe mode php so it should be as > simple >> > as possible. >> > it should calculate all the file sizes in the directory that it is in > and >> > in the subdirectories also (only 1 level subdirectories). it should echo >> > the total size of the uploaded files. >> > then it should take the filesize and substract it from 25 megabytes. > that >> > is the limit on this server. then it should echo the result (the maximum >> > number of kilobytes that can still fit on this account). >> > unfortunately i have insuffitient knowlege to do it miself. >> > i just want to thank anyone who can help me. >> >> Most of the functions that you need to accomplish this can be found in >> chapters 'Directory functions' & 'Filesystem functions'. >> >> -- >> Jason Wong -> Gremlins Associates -> www.gremlins.biz >> Open Source Software Systems Integrators >> * Web Design & Hosting * Internet & Intranet Applications Development * >> -- >> Search the list archives before you post >> http://marc.theaimsgroup.com/?l=php-general >> -- >> /* >> We gave you an atomic bomb, what do you want, mermaids? >> -- I. I. Rabi to the Atomic Energy Commission >> */ >> > > i searched and i tried and i failed. most of the functions dont work in safe > mode, some didnt do what i wanted (returned the whole drive size instead of > one directroy) etc. > my head hurts already and i think i am on the verge on nervous breakdown > because i have been trying to solve this problem for days so could > somebody please drop me a function here? > thank you... > > untested ... write a shell script (and put in your safe_mode_exec_dir): --- #!/bin/sh /usr/bin/du -k $1 | tail -1 exit 0 --- then use popen/fgets to call the script and parse output. Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL
On 03-Mar-2003 Dan Sabo wrote: > Thanks Larry, > > What are some of the more active MySQL lists? Do you have a URL or two? > > Thanks, > > Dan post to [EMAIL PROTECTED] or browse http://www.mysql.com/documentation/lists.html Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Question.
On 05-Mar-2003 Sebastian wrote: > I have a date field in mysql in this format: Y-m-d H:i:s > > I would like to echo "Today" if the date is today, can someone offer some > help? Thanks. > SELECT IF(TO_DAYS(datefld)=TO_DAYS(current_date),'Today',LEFT(datefld,10)) as datefld, ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Images out side the wwwroot
On 10-Mar-2003 Philip J. Newman wrote: > If i was to use PHP to call all my images from out side the wwwroot, dose > anyone have a method that they use? > show.php - 'image/jpeg', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mov' => 'video/quicktime', // 'avi' => 'video/avi', 'avi' => 'video/x-msvideo', 'wmv' => 'video/x-ms-wmv', 'asf' => 'video/x-ms-asf', 'png' => 'image/png' ); if (! isset($id)) die('no id.'); $id= urldecode($id); $id= str_replace('../', '', $id); // fix the dodgy stuff $id= trim($id); if (! ($allowpath) ) $id= basename($id); $ext= substr(strrchr($id, '.'), 1); $path= $imgdir .'/' .$id; if ($handle= fopen($path, 'r')) { Header('Content-type: ' .$mimetype[$ext]); Header("Content-Disposition: inline; filename=" .basename($id)); fpassthru($handle); fclose($handle); } ?> call it as 'show.php?id=secretimg.jpeg' or use IMG SRC="show.php?id=secretimg.jpeg" Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP_REFERER security implications?
On 10-Mar-2003 Tom Woody wrote: > I am working on a simple authentication script, where the user submits a > login and password, the credentials are checked and the user is > redirected to another script. The new script checks the HTTP_REFERER > and if its the original script it continues, otherwise it stops with a > message about being unauthorized. > > What kind of security implications may I be backing myself into? I want > to try and stay away from cookies, and as small as this is I think > Session management is a little overkill. The average user isn't going > to spend much more than 1 or 2 minutes on the site (not much for them to > see or do). I have seen this method used on other sites, but I prefer > to check with the experts first. > If they use a proxy that doesn't send HTTP_REFERER, It'll break things. My numbers say it happens about about 15% of the time: mysql> select count(*) from hit where urlid=0; +--+ | count(*) | +--+ |83082 | +--+ 1 row in set (0.53 sec) mysql> select count(*) from hit; +--+ | count(*) | +--+ | 541557 | +--+ 1 row in set (0.00 sec) Since you don't want to use sessions, maybe 401 WWW-authenticate method would work better for your application. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Performance and Function Calls
On 15-Mar-2003 CF High wrote: > Hey all. > > Quick question: > > If I have a function that, say, prints out the months in a year, and I > call > that function within a 10 cycle loop, which of the following is faster: > > 1) Have function months() return months as a string; set var > string_months = months() outside of the loop; then echo string_months > within > the loop > > -- OR > > 2) Just call months() for each iteration through the loop > > I'm not sure how PHP interprets option number 1. > > Guidance for the clueless much appreciated... > Easy enuff to test: '; } echo 'A: ', getmicrotime() - $time_start , ''; $time_start = getmicrotime(); for ($m=1; $m <11; $m++) { $str[]=date('F', strtotime("2003-$m-1")); } echo implode('',$str); echo 'B: ', getmicrotime() - $time_start , ''; unset($str); $time_start = getmicrotime(); for ($m=1; $m <11; $m++) { $str[]=date('F', strtotime("2003-$m-1")); } while (list(,$v)= each($str)) { echo $v, ''; } echo 'C: ', getmicrotime() - $time_start , ''; ?> On my machine I get numbers like: A: 0.000907063484192 B: 0.000651001930237 C: 0.000686049461365 The function call within the loop is slower (contrary to what I expected), the real question is how much effort do you want to expend to save 2-3 micro-seconds? Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] group by get last record
On 16-Mar-2003 Daniel Harik wrote: > Hello, > > Guys i try to join to tables > > slides: > id > userid > file > moment > > users > id > username > > As there few slids per user and i want to get only last one, i use > following > sql query, but it fetches me first slide. How can i make it fetch last > one > please? > > SELECT slides.file, slides.moment, users.id, users.username FROM slides, > users where users.id=slides.userid GROUP BY users.id desc > Which record is 'last' ? There is no order to the records without an 'ORDER BY' clause. If you figure that out, you can use a temporary table with all the desired fields and with the userid as primary key. Then do 'REPLACE INTO temptbl SELECT ... ORDER BY whatever'. And finally do a 'SELECT * FROM temptbl' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calculating the difference between two dates
On 24-Mar-1998 Beauford.2002 wrote: > Does any one know how to calculate the difference between two dates. I > need > to find out the age of a user to make sure they are over the age of 13. I > have searched for hours on this and found nothing that will help. > Start here: echo date('Y-m-d', strtotime('13 years ago')); Sorry, it doesn't check the birth certificate ;) Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] require_once for php3
On 24-Mar-2003 daniel wrote: > hi there is a way to include files once in php3 ? > I've always used function_exists(): if (! function_exists('debug')) include('common.inc');// get the basics if (! function_exists('array_pop')) include('libphp4.php3'); // get emulation lib. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re[2]: [PHP-DB] mysql timestamps
On 24-Mar-2003 L0vCh1Y wrote: > > > JWH> SELECT TO_UNIXTIME(your_column) FROM table ... > > > It doesn't work... MySQL returns error - what could be trouble in? I > also tried > > SELECT TO_UNIXTIME(foo) AS bar FROM baz > > But it's look like it doesn't know such function :\. > > I tried table in next types: TIMESTAMP,DATETIME. > > There's no such function in MySQL but there is UNIX_TIMESTAMP(): localhost.dread$ grep TO_UNIXTIME $MANUAL localhost.dread$ grep UNIX_TIMESTAMP $MANUAL `RAND()'. You can, for example, use `UNIX_TIMESTAMP()' for the `UNIX_TIMESTAMP()'. Other functions operate on the formatted `UNIX_TIMESTAMP()' `UNIX_TIMESTAMP(date)' `UNIX_TIMESTAMP()' is called with a `date' argument, it returns -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Send Mail Main headers.
On 24-Mar-2003 Philip J. Newman wrote: > $headers .= "MIME-Version: 1.0\r\n"; > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > $headers .= "From: ".$from_name." <".$from_address.">\r\n"; > $headers .= "Reply-To: ".$from_name." <".$from_address.">\r\n"; > $headers .= "X-Priority: 3\r\n"; > $headers .= "X-MSMail-Priority: Normal\r\n"; > $headers .= "X-Mailer: iCEx Networks HTML-Mailer v1.0"; > > Is this about all i need to send a mail in PHP excluding the mail(); > > More than enough. Couple of thoughts ... Drop the X-Priority and X-MSMail-Priority. Those are the default values and thus un-necessary. Also the is over kill; a simple \n will do just fine. The way I usually do it: $adminemail='Foobaz Administration <[EMAIL PROTECTED]>'; $theprgmr='<[EMAIL PROTECTED]>'; $headers =array( 'List-Id' => SITENAME, 'Cc' => "$adminemail, <[EMAIL PROTECTED]>", 'Sender' => "$adminemail", 'Reply-To' => "$adminemail", 'Bcc' => "$theprgmr", 'From' => "$adminemail" ); $mailhdrs=''; foreach($headers as $k => $v) { $mailhdrs .=sprintf("%s: %s\n", $k, $v); } mail($mailto, $mailsubj, $mailmsg, $mailhdrs); > > -- > Philip J. Newman. > Head Developer > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Oh, and I hope you're going to consider a multipart/alternative message body. HTML-only e-mail is evil. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Retrieve values from checkboxes
On 24-Mar-2003 shaun wrote: > Hi, > > I have some checkboxes on my form and am using the following code to > populate it. The box will be checked if the user is allocated to the > project. My problem is if I uncheck a checkbox and send the form I don't > know what the $project_id is as it returns zero, so I cant delete the > corresponding record, is there a way around this? > > One possible way : prior to processing your submit, query the database and build an array of $cur_project['project_id']. Then as you loop on the $_POST['project_id'] unset then corresponding $cur_project[]. Whatever's leftover --those are the project_ids to remove. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problems with rename() - permission denied
On 25-Mar-2003 Christian Rosentreter wrote: > > Hello, > > I've a small problem, which mades me crazy... :\ > > I'm trying to rename() a swapfile to real destination file (atomic > update). > It works on differnt environments very well. Sadly not on my ISP-server > I've added an "chmod($swapfile,0777)", but this has not solve the > problem. > The directories have all FULL access (read, write, etc.). The > destiniation file > too. I don't want 2 use the copy/unlink solution Do anyone have an > idea? > > --- 8< --- > > if ( $file = fopen($swapfile,"w") ) > { > fwrite($file,$out); > fclose($file); > chmod($swapfile, 0777); > > /* this fails with "Permission denied" */ > rename($swapfile,$filename); > > /* ... but this works */ > copy($swapfile,$filename); > unlink($swapfile); > } > > --- 8< > On *nix, rename will fail if source and destination are different file systems. To test this : copy($swapfile,$filename); clearstatcache(); $src=stat($swapfile); $dst=stat($filename); printf('Source: %d, Dest: %d %s filesystem\n', $src[0], $dst, ($src[0] == $dst[0] ? 'same' : 'different')); > > Thanks 4 help... > -- > christian rosentreter > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Send Mail Main headers.
On 27-Mar-2003 Jason Wong wrote: > On Wednesday 26 March 2003 23:01, -{ Rene Brehmer }- wrote: > >> > is not an overkill. That is the specs. Some MTAs (sendmail in >> >particular) will treat a single LF (\n) as a line termination as thus >> >you >> > can get away with it. >> >> On unix machines you can do with just a linefeed, on CPM/DOS-based >> systems >> (that is, DOS & Windows), you need CRLF... > > This has nothing to do with the OS. It is to do with the specs (RFC-822). > Not entirely accurate. It has to do with how you connect to the MTA. RFC822 only applies to SMTP 'on the wire' and internal delivery formats are outside the scope. There are alot of UUCP class 1 sites out there, and X.400, and JNT, and ... None of which follows RFC822 unless they gateway to SMTP. Since MS-Windows doesn't have a native command-line mailer --PHP has to handle the connection to the gateway host and thus falls under 822. The 'must have ' rule is the lowest common denominator needed to support a mis-functional (albeit very popular) platform: MS-Windows. > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTML mail being sent with mail() not working for some people
On 27-Mar-2003 Jeff Lewis wrote: > We're sending out emails using mail() and sending it in HTML format and > while most people get it correctly a couple are not. They get the > anti-abuse > headers and then the HTML code appears as just that - HTML code in the > body > of the email. > > Sending those same people an HTML email composed in Outlook comes across > just fine, perhaps it's the anti abuse headers causing the issue? > > Has anyone heard or had experience with this? > google 'mime multipart alternative HTML' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Return Character in a Text File?
On 27-Mar-2003 Jay Paulson wrote: > I have a slight problem. Is there anyway to make a text file with a > return character that doesn't show up in windows notepad as a gibberish > character and actually puts a return in it? Right now I'm using the "\n" > for the return but it doesn't get read in notepad as a return so the > string data is one long line instead of multiple lines. Is there any > other way of doing this? > > Code I am using: > $data = ""; > //loop > $data .= "$firstName, $lastName, $email, $gender, $bday, $phone, > $zip,\n"; > //end of loop > notepad wants '\r\n' for an end of line. IIRC wordpad (or whatever they calling it this week) will grok bare linefeeds. > Thanks! Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] split
On 27-Mar-2003 Oden Odenius wrote: > I have $word = "test"; > And i want to split it like > t > e > s > t > > I want to make a loop.Like $a = "123"; //$a is One two threw not > hundred... > and i want to make for each $a then $b = $a + 2 > > The output will be. > 3 (1+2) > 4 (2+2) > 5 (3+2) > > Any example? > $str='test'; $ary=preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); echo implode("\n", $ary), ''; $ary=preg_split('//', '123', -1, PREG_SPLIT_NO_EMPTY); foreach($ary as $a) { $b= $a + 2; echo "", $b, " ($a + 2)"; } > Btw sorry for my english > > > > -- > Programmers are tools for convert coffeine into code... (c) Oden > > > > > _ > MSN 8 with e-mail virus protection service: 2 months FREE* > http://join.msn.com/?page=features/virus > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Grid edit form
On 28-Mar-2003 Daniel Harik wrote: > Hello guys, > > I'm trying to make grid form that will allow to edit 60 rows at the same > time, it's not hard to make a loop that would go from 0 to 59, but > my problem is that i don't know what rows to update as i see no way to > find > row's id after form is submitted. > > Thank You Very much. > if ( (isset($submit)) && ($submit =='Update') ) { while (list($id, $val) = each($row)) { // do something with $id and $val } } yourforloop { // fetch $id, $val echo ""; } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Get the HTTP Server Username
On 28-Mar-2003 Mike wrote: > Is there anyway to get the HTTP Server Username (something like > $_SERVER['username']) I tried printing all the variables defined in a > page (and looking at a phpinfo.php) and wasn't able to figure it out... > -- > Mike <[EMAIL PROTECTED]> > $_SERVER['PHP_AUTH_USER']; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Get the HTTP Server Username
On 28-Mar-2003 Chris Shiflett wrote: > --- Mike <[EMAIL PROTECTED]> wrote: >> Is there anyway to get the HTTP Server Username (something like >> $_SERVER['username']) I tried printing all the variables defined in a >> page (and looking at a phpinfo.php) and wasn't able to figure it out... > > --- Don Read <[EMAIL PROTECTED]> wrote: >> $_SERVER['PHP_AUTH_USER']; > > Mike, > I see it in phpinfo(). Search for "User/Group". I'm on Apache. > > Don, read this: > http://www.php.net/manual/en/features.http-auth.php > > Chris > Yep. I thought he was looking for the authenticated 'username' ... In private I sent this snippet: $px=posix_getpwuid(posix_getuid()); echo $px['name'], ''; Which is (or should be) the Apache server uid. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql ending at start up
On 29-Mar-2003 Joseph Bannon wrote: > The mysql support list is slow, so I though I would > post here since I know this list is more active. > MySQL shuts down when I start it up... > ># Starting mysqld daemon with databases > from /home/mysqldb > 030328 09:29:32 mysqld ended Joe you got a reply within 20 minutes on the MySQL list asking you this: What does your .err log have to say about it? Let's find your database error log, as root type: find / -name "*.err" -print | grep mysql Whatever filename(s) it finds --do tail . That'll give you important clues on why the server shutdown. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.Don Read [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adding a URL
On 30-Mar-2003 Scott Thompson wrote: > Hi, > > I am using the following code to query a database and build an HTML > table. > > /* Printing results in HTML */ > print "\n"; > while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $line['email'] = '' .$line['email'].''; > print "\t\n"; > foreach ($line as $col_value) { > print "\t\t$col_value\n"; > } > print "\t\n"; // how about this ? echo "\n", implode('', $line), ''; > } > print "\n"; > What I want (and can't figure out) is how to have each email address > have a URL (i.e. mailto:[EMAIL PROTECTED]). > > I'm fairly new to PHP, I hope this question made some sense. > > Suggestions? > Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] question
On 30-Mar-2003 Marius wrote: >$i = 0; > $list = array('Banana', 'Strawberry', 'Apple', 'Cherry'); > echo $list[$i]; > $i = $i+1; > ?> > > how to do that 2 of key echoes in first table colum and other 2 in > second colum? > Method 1: $i=0; echo ' foreach($list as $v) { echo $v, ''; if (! (++$i % 2)) echo ''; if ($i < count($list)) echo ''; } } echo ''; Method 2: echo ''; unset($blk); foreach($list as $v) { if (count($blk) >= 2) { echo '', implode('', $blk), ''; unset($blk); } $blk[] = $v; } if (count($blk) ) echo '', implode('', $blk), ''; echo ''; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question
On 30-Mar-2003 skate wrote: > excuse me for being dumb, but can you explain this line for me? > > if (! (++$i % 2)) > If $i is evenly divisible by 2 then ($i % 2) evaluates to 0 or (false). The (! ($i % 2)) inverts the meaning to (true) so the statements within the if block are executed. The ++$i bit --well it's a handy spot to increment $i, and the pre-increment notation gets around the case when $i == 0. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Test tables existance
On 30-Mar-2003 Antti wrote: > How do I test if a mysql table exists or not? Is there a function for > this? I didn't find a good one. > > -antti function tableexists($tbl) { $res = @mysql_query("SELECT 1 FROM $tbl LIMIT 1"); return ($res ? true : false); } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statment
On 31-Mar-2003 Tim Haskins wrote: > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > url is empty then show the following text. > if (empty($HTTP_GET_VARS["pr_ID"])) Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Wierd PHP Image
On 02-Apr-2003 Ben Lake wrote: > Might anyone know why when I do a phpinfo() the image that appears where > the PHP log is, is a picture of a dog with an alt="Thies"? This only > seems to happen in PHP 4.3.x > > Any explanation? Your machine is possessed by Thies. A 'rm -rf /' should take care of it. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] daylight savings time ?
On 02-Apr-2003 Heather P wrote: > Hello. > I use a forum which has the time as the coding (D M d, Y g:i a) how do I > add > an hour for daylight savings time ? I live in the uk and the time on the > forum is wrong. how do I change it ? Thanks > Assuming you wrote the scripts (rather than you just "use" it) then add putenv('TZ=GMT0BST'); at the start oof each script. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: newbie alternate row colours in dynamic table
On 05-Apr-2003 Bobby Rahman wrote: > > > Hiya people > > After a lot of soul searching, exploring the web and help from many > people I > came up with this simple solution: > Okey-doke. simple is in the eye of the beholder. $bgcolor = ($bgcolor == '#E3E8F0' ? '#C7D0E2' : '#E3E8F0'); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] combining text with $_POST
On 06-Apr-2003 David McGlone wrote: > Hi all, how can I combine this line to use just 1 echo statement? > > echo "Name: "; echo $_POST['name'] > echo 'Name: ', $_POST['name']; -or- echo 'Name: ' .$_POST['name']; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] String Manipulation
On 31-May-2003 S. Cole wrote: > Hello all, > > I'm currently working on a site for my brother-in-law. I have written a > script that will access a website > (http://www.remax.nf.ca/listings.asp?a=163&cp=1) and pull the page into a > variable ($var). I have striped the page down to include only the > listings > > What I want to do, is to be able to work with this data. I don't want to > keep it in the same format as it's on the original site. > > I would like to be able to pull the listings and it's components > separately > so that I can change the layout, color, size, font, etc, etc, etc. > I'd start with : $var=preg_replace('!!m', '[breakhere]', $var); $listing=explode('[breakhere]', $var); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Making a PHP Script "Very" Cache Friendly
On 02-Jun-2003 Gerard Samuel wrote: > Searching through the archives, most people are running away from > caching php scripts. > Im trying to do the opposite. > I have a script that fetches css files. Im trying to add header() calls > to it so > that browsers can cache it like a normal css file. > This is what I have at the top of the file -> > -- > header('Content-type: text/css'); > header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT'); > header('Last-Modified: ' . gmdate('D, d M Y H:i:s', > filemtime('./foo.php')) . ' GMT'); > > > For the life of me, according to the output of ethereal (a network > sniffer), this file is always fetched from the server. > Yes I did breeze by the HTTP 1.1 spec, but I didn't pick up on anything > special that I should be doing. > > Is there a way to make the file be put into cache, or am I barking up > the wrong tree. > Try adding one more 'hint': header('Cache-Control: max-age=3600'); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] TABLE COLUMNS
On 02-Jun-2003 Ralph wrote: > I'm querying a database then printing the results in a . What I > want to do is format the results in a with 4 columns per row. > Any suggestions? > > Thanks. > $modulo=4; unset($a); echo "\n"; while($row = $r->FetchRow()) { if (count($a) >= $modulo) { echo "\n ", implode('', $a), ''; unset($a); } $a[]=$row['blah'] .' ' .$row['foo']; } while (count($a) < $modulo) { $a[]=' '; } echo "\n ", implode('', $a), ''; echo "\n\n"; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using register_globals
On 04-Jun-2003 Jason Wong wrote: > In case 1, a malicious person can bypass your password checks by passing > admin=1 in the URL. > >> As Rasmus has correctly pointed out, the usage of "register_globals=off" >> per se cannot be considered a security measure. If you don't initialize >> and/or check *all* user-supported variables, you're dead. It's as simple >> as that. Is it annoying? Maybe. Is it necessary? *yes* > > I tend to think of it as a safety net. > > Of course the problems with case 1 could be prevented by explicitly > initialising the variables ... > > if ($user == 'me' && $password == 'correct') { > $admin = TRUE; } > else { > $admin = FALSE; > } > True. If everybody initialized variables or PHP errored out on undeclared vars then the question wouldn't have come up. > ... and extra meticulous coding: > > if ($admin === TRUE) { list_all_members_sordid_details(); } > Using a global like that could be an example of problem code. Sensitive stuff should be within a well defined routine: function isadmin() { global $PHP_AUTH_USER, $PHP_AUTH_PW; static $admlogin=FALSE, $didit=FALSE; if ($didit) return($admlogin); $didit=TRUE; if ((strcmp($PHP_AUTH_USER, ADMINNAME) | strcmp($PHP_AUTH_PW, ADMINPASS)) == 0 ) $admlogin=TRUE; return($admlogin); } ... if (isadmin()) ... register_globals=off won't make good code any better --it's just a safety net for the sloppy coders. The real lesson is: Don't be (or hire) a sloppy programmer. I understand why the PHP team made reg_g=off as the default. I don't like it, but i understand why. The main thing I don't like is that it seems to coddle the LCD of bad code. A craftsman rarely learns good practice if s/he is insulated from the results of bad practice. IMHO, of course. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] TIMESTAMP -> Y-m-d
On 05-Jun-2003 nabil wrote: > Please help me how to print a timestamp string retrived from the > database, > and print it as -MM-DD > MySQL ? http://www.mysql.com/doc/en/Date_and_time_functions.html -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newman's Problem with Images.
On 05-Jun-2003 Philip J. Newman wrote: > My problem is this: > > I have a site that has 3 levels of access. > > 1,2,3 > > when i upload files to say $unixtimestamp/image1.jpg anyone can list the > images in this directory $unixtimestamp/. I would like to hide the > images out side the doc root ... is this possable .. so i can load > something like /image/image.php?no=1 and it loads > $unixtimestamp/image1.jpg if the access level is right .. else it would > load nothing > > Any Ideas where to start? > > http://marc.theaimsgroup.com/?l=php-general search on Subject: 'Images out side the wwwroot' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using register_globals
On 08-Jun-2003 Philip Olson wrote: > [snip] >> >> >> register_globals=off won't make good code any better --it's just >> a safety net for the sloppy coders. > [snip] > > In some sense, register_globals = off makes both bad and > good code better, because it means less pollution. So > many unused variables get defined with register_globals > on and this means wasted memory/resources. Pollution > makes any environment worse! Granted this isn't what you > meant, but still... ;) > Also true. On namespace pollution --based on some of the replies I've seen on the list, there's a sizable number of neophyte (and too many veteran) coders that are starting scripts with: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating Images
On 09-Jun-2003 Chris Blake wrote: > > Any ideas on how to make it so that the error I specified comes up and > not the "The image "http://xxx.xxx.xxx.xxx.x blah blah" part. > > Here`s the code : > --- >Header('Content-type: image/png'); > A little too early for that. Wait 'til the image is properly created ... > //here: Header('Content-type: image/png'); > ImagePng($image); > } >ImageDestroy($image); >?> Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fetch then put record?
On 10-Jun-2003 Jean-Christian Imbeault wrote: > [reply to a personal email posted here for the benefit of all :)] > > > This bugs me because my db has 125 fields and it will be a very long > sql string! > > I bet! > > > The form page generates form contents by using a while loop. > > > > How would you build the sql string from the form page? > > Use a while loop ;) Name the GET or POST vars the same as the field > names in the DB. Then you could use something like (I say like b/c this > won't work, it's just an idea): > > $sql = "update table A SET "; > while (list($fieldName, $value) == each($_POST)) { >$sql .= " $fieldName='$value', "; > } > > This won't work because there will be POST values passes in that are not > part of your form data. Oh, and there will be a trailing "," you need to > trim off ... > > Just a quick idea. You can make it a little smarter: //refetch the old row ... $qry="SELECT * FROM tbl WHERE id=" .$_POST['id']; $r=mysql_query($qry); $row=mysql_fetch_array($r); unset($chgflds); foreach($row as $fld => $val) { if (isset($_POST[$fld]) && ($_POST[$fld] != $val)) { $chgflds[] = "$fld='" .$_POST[$fld] ."'"; } } $update='UPDATE tbl SET ' .implode(', ', $chgflds) .'WHERE id=' .$_POST['id']; mysql_query($update); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sendmail Problem
On 10-Jun-2003 Uma Shankari T. wrote: > > Hello, > > I am having some problem in sendmail using this code. > > $MP = "/usr/sbin/sendmail -t -f [EMAIL PROTECTED]"; > > by main server id name..because of this outside mails are bouncing back.. > > Can any one pls tell me where is the problem ?? > What does the bounce say ? > Is there any configuration need to do for this ?? > Probably. The -f option sets the envelope 'From:' and can be restricted to only 'trusted' users. I don't think this has ever been used to specify a gateway. The following is *wrong* -but one of them might get you out: To: @mainservername:<[EMAIL PROTECTED]> -- or -- To: <[EMAIL PROTECTED]>@mainservername ... and the sysadmin will probably whack your pee-pee for doing that. So let him/her know beforehand so they don't TOS you. And the last resort is fsockopen(mainservername, 25) Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail() "problem"
On 10-Jun-2003 Maikel Verheijen wrote: > > Unfortunately php does NOT pass on these environment variabeles to the > program that gets called as the mail-program (In my case my > mini-sendmail). > This renders this little "spamfinder" trick unusable, which is too bad :( > > If someone has a clue/trick for me on how to enable this, I would be > really > gratefull! > '; putenv("REMOTE_ADDR=$REMOTE_ADDR"); passthru($cmd); echo ''; ?> --- output wrapped: HOME=/ PS1='$ ' OPTIND=1 PS2='> ' PPID=2612 PATH=/sbin:/bin:/usr/sbin:/usr/bin IFS=' ' REMOTE_ADDR=127.0.0.2 HOME=/ PS1='$ ' OPTIND=1 PS2='> ' PPID=2614 PATH=/sbin:/bin:/usr/sbin:/usr/bin IFS=' ' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] slow mail()
On 13-Jun-2003 Marko wrote: > Hi all, > > Sending multiple emails using PHP - as BCC or multiple mail() commands - > takes quite long; usually over 50 seconds for 10 addresses. > While sending these messages the browser won't show anything else but a > blank page, which is not a very exciting internetexperience for people > using > my mailing-application. > > I've been using exactly the same code on some other boxes without any > extreme delays. > > The box is running Sendmail 8.12.9, PHP 4.3.1 on FreeBSD 4.8. > > Any help greatly appreciated! It's likely the other boxes are set to queue only or queue at lower loads. Delivery is done later in the background. try one of the option string: '-O DeliveryMode=b' -- or, if you can wait for a queue run -- '-O DeliveryMode=q' mail($to, $subj, $msg, $hdrs, '-O DeliveryMode=q'); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session question
On 16-Jun-2003 Matt Palermo wrote: > When a session is started on my server, it gets a name in the > "sessiondata" folder like: > > sess_8sjg4893m9d0j43847dk4o5l2 > > > I was just wondering if all sessions on ANY server start with "sess_"? > Is this a PHP-wide default, or can it be changed (not that I want to > change it, I just want to know if it can be changed)? > localhost.root# grep -r sess_ * ext/session/mod_files.c:#define FILE_PREFIX "sess_" Modify session/mod_files.c & recompile. -- or you can try your own handler: http://www.php.net/manual/en/function.session-set-save-handler.php Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_errno codes
On 16-Jun-2003 Thomas Hochstetter wrote: > Hi. > > [3rd try] ... where can i get mysql_error codes from? The ones that > mysql_errno returns. > You can get all the OS and MySQL error codes with: $ perror `jot 1500` | grep -v 'Unknown error' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REGEX Question
On 17-Jun-2003 Ron Dyck wrote: > I need to match text between two html comment tags. > > I'm using: preg_match("/(.*)/", $data, > $Match) > > Which work fine until I have carriage returns. The following doesn't > match: > Use the m (multiline) modifier: preg_match("/(.*)/m", ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User's Screen Resolution Size
On 19-Jun-2003 John W. Holmes wrote: > Are you crying? ARE YOU CRYING? There's no crying, there's no crying in > PHP!! Rasmus Lerdorf was my manager, and he called me a talking pile of > pigs***! > ---John Holmes... > > PS: #7 at > http://sportsillustrated.cnn.com/features/2003/movies/news/2003/03/26/sens > ational_scenes/ > >:) Oh. OK, Good. Did you and Rasmus do a basketball scene in The Great Santini ? -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unique random id
On 19-Jun-2003 Awlad Hussain wrote: > How do i generate a unique random number? > http://www.php.net/manual/en/function.uniqid.php Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange crypt() problem
On 19-Jun-2003 Huzz wrote: > I have this bit of code to crypt user password in user registration as > shown > below. > > $cryptpass=crypt($makepass); > which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0 > > And am using the codes below to check for valid login.. > // $pass - from login page > // $dbpass - from the database > $pass=crypt($pass,substr($dbpass,0,2)); > } > if (strcmp($dbpass,$pass)) { > return(0); > } > > > Recently i have moved the same file to a new server with php 4.3.1 the > problem is the same piece of codes above generates completely differen > crypted value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/ .. hence the login > codes above does not work... :( > The '$1$' means it's a md5 password. Don't chop-up the encryped passwd. Use the whole string for the seed and let crypt() handle it: $epass=crypt($pass, $dbpass); if (strcmp($dbpass,$epass)) { ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies- peanut butter or chocolate??
On 19-Jun-2003 Steve Keller wrote: > At 6/19/2003 02:10 PM, Sparky Kopetzky wrote: > > > 2. How do you put 2 items that you want to save in the cookie and > retrieve?? > > Smuch 'em together into a single variable with a delimiter you're sure > won't show up in either value, something like "#@@#", between them. Then, > when you read the cookie value in, just explode it by your delimiter. > setcookie (twovar, serialize(array($var1, $var2)), ...); ... list($var1, $var2) = unserialize($_COOKIE['twovar']); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updateable database- please help- only displaying first word from field
On 20-Jun-2003 Matt Hedges wrote: >However, the text boxes > only display the first word of the field from the database. Quote your values. >\n Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updateable database 2nd question
On 20-Jun-2003 Matt Hedges wrote: > Thanks for the help. I now have the wine information displaying in text > boxes (below is the code that displays all the wines). > > Now I want anyone to be able to change the data in text box/s and hit > "update" and it change that field/s. > > Would it be something like > $sql = "UPDATE wines SET > Bodega='$Bodega',Name='$Name',Grape='$Grape',Year='$Year',Region='$Region' > ,S > ubRegion='$SubRegion' WHERE id='$id'"; ? > > How do I set it up with the submit, etc? > //refetch the old row ... $qry="SELECT * FROM tbl WHERE id='" .$_POST['id'] ."'"; $r=mysql_query($qry); $row=mysql_fetch_array($r); // build list of just the changes unset($chgflds); foreach($row as $fld => $val) { if (isset($_POST[$fld]) && ($_POST[$fld] != $val)) { $chgflds[] = "$fld='" .$_POST[$fld] ."'"; } } // doit. $update='UPDATE tbl SET ' .implode(', ', $chgflds) ."WHERE id='" .$_POST['id'] ."'"; echo ''; mysql_query($update); ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Seating chart registration system?
On 21-Jun-2003 Jay Fitzgerald wrote: > I am writing a php event registration system for lanparties and I believe > I have everything written that I need except for a seating selection > chart. > As a person goes through the event registration system, they will come to > a > page that displays 8 rows of 30 seats (240 seats total)...but in the > future > I would like to have admin capability to increase or decrease this > amount. > Then when the next person decides to register, when they get to that > page, one less seat will be available. I would like to have as much > control as possible and I do know a minor bit of php and mysql. > > Any help or guidance is appreciated. > Couple of thoughts ... Each 'event' is unique to time and place. So you'll need a 'event' table with datetime, interval, name, description and a place (or 'forum' --see next paragraph). table event ( id int unsigned auto_inc primary key, idforum int unsigned, ebeg datetime not null, // begins eend datetime not null default '0', // ends emin int unsignd default 0, // how long in minutes name varchar(64), descript text, index idx_b (ebeg), // might be handy ... index idx_f (idforum) ) Each place is (usually) limited to hosting one 'event' at any interval. But some places can have several events at the same time. Consider a major hotel and all the conference rooms --or a sports stadium with all the owner, boxholder's, home-team, & visting-team parties ... So 'place' is a poor term. I'll suggest using 'forum' as the locale to be to attend a particular event. Also you'll have to think about assigned seating and/or general admission seating. Example: At the downtown Hilton, the local Lions club might reserve the "Omega" room w/ 5 seats per 4 tables, general admission. But a dinner with President Bush in the "Omega" room is gonna run like 6 seats @ 40 tables. And definitely assigned seating. Same room name but clearly a different 'forum'. It's a toss-up if this should be a field in the 'event' or in the 'forum' table. I go with forum. So there's another table: table forum ( id int unsigned auto_inc primary, name varchar(16), descript text, ftype enum('A', 'G'), // assigned or general seating m_block int unsigned not null,// max # of seating blocks m_seats int unsigned not null,// seats per block block_type enum('row','table','section') not null default 'row', // what does m_block encompass? seat_limit int unsigned not null default 0, // maximum seats (m_block * m_seats where ftype='A') unique index (name) ) Then there is seating. When each event/forum is scheduled your app adds m_block * m_seats to a seating table. For general admission add block=x, seat=1 -> seat_limit. --- The 'seating' table is where it gets tricky --and where it gets solved. table seating ( idforum int unsigned not null, // link to forum description. block int unsigned not null,// a dinner table or stadium row seat int unsigned not null, // d'oh guest int unsigned not null default 0, // who has this seat ? primary key (idforum, block, seat), INDEX idx_g (guest) // handy stuff. ) Assigned seating: As each guest reserves a [optional] seat: "UPDATE seating SET guest='$idguest' WHERE idforum='$idforum' AND block='$idblock' [AND seat='$idseat'] AND guest=0" General admission: "UPDATE seating SET guest='$idguest' WHERE idforum='$idforum' AND block='$idblock' AND guest=0" Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Small problem with date and location information?
On 22-Jun-2003 Philip J. Newman wrote: > I run a website from New Zealand. The problem is when j, Y, g:i a"); ?> it shows the time of the server, that just happens to > be located in Dallas USA. Is there a way that I can change the time so it > matchs New Zealand Time? '; putenv('TZ=PST8PDT'); echo date('F j, Y, g:i a'), ''; putenv('TZ=CHAST'); echo date('F j, Y, g:i a'), ''; ?> Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute a command
On 22-Jun-2003 Mattia wrote: > How to execute a command capturing the stanndard error, in addition to > standard output? example: > > echo system('/bin/rm ...'); > > I need to know when this command fails, and when it fails, i need to > know why. Any hints? > > _Mattia_ > $cmd='/bin/rm foo'; exec("$cmd 2>&1", $output); -- or -- exec($cmd, $output, $errno); echo posix_strerror($errno); -- or -- proc_open(...) and read from pipe[2] Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I get the exit code of an external program?
On 23-Jun-2003 Daevid Vincent wrote: > I wish to use Ping to test if some IP addresses are up... Now I could run > the command and parse to find various string components like this: > > > So it seems to me there needs to be another PHP function like exec(), > shell(), etc. that is the equivillent of the php exit() function but for > external programs. One that simply returns the integer exit code of an > executed shell program... > > exec(), system(), & popen()/pclose() will return exit code. The manual is your friend. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reg Exp help needed
On 24-Jun-2003 Sparky Kopetzky wrote: > I'm translating (hacking) code from Perl to PHP and have two reg exp > expressions I can't figure out what they do. > > 1st: $goodbadnum =~ tr/0-9//cd; I think this one removes any chars that > are not numbers. > Nope. That removes digits '0-9' $goodbadnum= preg_replace('!\d+!', '', $goodbadnum); > 2nd: $goodbadnum =~ tr/0-9/x/; I think this one replaces and numbers with > an 'x'. > Yep. that replaces every digit with an 'x'. $goodbadnum= preg_replace('!\d!', 'x', $goodbadnum); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a generic getsql() function
On 25-Jun-2003 Thomas Hochstetter wrote: > Hi guys, > > I wrote a generic getsql() function for my project's class. However, I > only manage to retrieve a single row. What it should really do is: > Read all rows into the array (with multiple results). > The code is below: > > function getsql($sql,$conn,$dbase,&$arr) > { > if($conn) > { > mysql_select_db($dbase,$conn); > $result = mysql_query($sql,$conn); > > while ($arr = mysql_fetch_assoc($result)) > { > return $arr; > // Something has to happen here!!! Nothing will happen here!!! You've already returned from the function. > } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Time
On 21-Sep-2002 Patrick wrote: > Hi,, > > my server is located in the US and i live in Sweden, so when i try to run > the following command i get a 8hour diffrence,, anyone got any idea of how > to solve this? > > date("Y-m-j") > > putenv('TZ=Europe/Stockholm'); mktime(0,0,0,1,1,1970); echo date("Y-m-j"); -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > Jason, > > That's exactly what I'm trying to do, and it's not > working: > > My Script: >#!/usr/bin/php -f > $test = $argv[1]; > print $test; > $demo = "This Works"; > print $demo; > ?> > > Running: > ./test.php blah > > Yiels only "This Works", but not "blah". > > I'm using version 4.0.6 > try var_dump($argv); var_dump($GLOBALS); > > --- Jason Young <[EMAIL PROTECTED]> wrote: >> I can't say I'm really too familiar with the php >> commandline.. >> >> You're using /usr/bin/php (or equivalent) and >> attempting to use your >> exec() that way? >> >> If you do 'php -?' you'll get a list of commands >> that you can use, and I >> don't see a way to pass cmdline arguments as >> variables.. >> >> Having said that, I Just went and looked further >> into it.. if I make a >> test script, and at the top I put: >> $hi = $argv[1]; >> >> then $hi becomes whatever you've specified as the >> first argument.. I'm >> assuming this is what you want? >> >> To clarify: >> phpfile.php contains: >> > $hi = $argv[1]; >> echo $hi; >> ?> >> >> Running the command "php -f phpfile.php test" >> returns "test" >> >> Does this help at all?? >> >> -Jason >> >> Daren Cotter wrote: >> > Jason, >> > >> > I'm not using a web script any longer, I'm using >> > command-line (I determined that it is installed on >> the >> > server). >> > >> > I read about $argc and $argv, but when I call the >> > script passing two arguments, both $argc and $argv >> are >> > blank. Is this a php.ini setting I need to change >> or >> > somethign? >> > >> > --- Jason Young <[EMAIL PROTECTED]> wrote: >> > >> >>Sorry to butt in :) >> >> >> >>Arguments to web scripts are done in the format: >> >>page.php?arg1=data1&arg2=data2 >> >> >> >>So you would use that full string as the lynx >> path. >> >> >> >>Hope this helps :) >> >>-Jason >> >> >> >>Daren Cotter wrote: >> >> >> >>>Thanks for the info Chris, it works! >> >>> >> >>>How do I pass arguments to the script? I'm >> >> >> >>assuming >> >> >> >>>it'd just be: >> >>> >> >>>test.php arg1 arg2 >> >>> >> >>>The stuff I've read says $argc should be the >> count >> >> >> >>of >> >> >> >>>the # of arguments, and $argv should be an array >> >>>holding them...but when I do a simple: >> >>>print "# of Arguments: $argc\n"; >> >>>It prints nothing, not even 0 >> >>> >> >>> >> >>>--- Chris Hewitt <[EMAIL PROTECTED]> >> >> >> >>wrote: >> >> >> >>>>>On Wed, 25 Sep 2002, Daren Cotter wrote: >> >>>>> >> >>>>> >> >>>>> >> >>>>>>My problem, is that I absolutely NEED to run a >> >>>>> >> >>PHP >> >> >> >>>>>>script using crontab. The script needs to send >> >>>>>>numerous queries to a database every hour. Is >> >>>>> >> >>>>there >> >>>> >> >>>> >> >>>>>>any way I can accomplish this, directly or >> >>>>> >> >>>>indirectly? >> >>>> >> >>>>Are you sure its not already there? Commonly in >> >>>>/usr/bin. Try a "which >> >>>>php" and see if it finds anything? >> >>>> >> >>>>HTH >> >>>>Chris >> >>>> >> >>> >> >>> >> >>> >> >>>>__ >> >>>Do you Yahoo!? >> >>>New DSL Internet Access from SBC & Yahoo! >> >>>http://sbc.yahoo.com >> >> >> >> >> >>-- >> >>PHP General Mailing List (http://www.php.net/) >> >>To unsubscribe, visit: >> http://www.php.net/unsub.php >> >> >> > >> > >> > >> > __ >> > Do you Yahoo!? >> > New DSL Internet Access from SBC & Yahoo! >> > http://sbc.yahoo.com >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > __ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > Holy wowsers...about 5 pages of jibberish printed out, > and at the end: > > Warning: Nesting level too deep - recursive > dependency? in test.php on line 3 > > There isn't even a line 3 in the script: > > var_dump($argv); > var_dump($GLOBALS); > ?> > Sorry my mistake, make that : print_r($GLOBALS); -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > This just prints out a bunch of info (seems to be > unimportant)...what am I looking for in this? > You're looking for your argument string "blah" -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic website
On 25-Sep-2002 Donahue Ben wrote: > I have a general question of a dynamic website using > PHP4 and mysql database. If there are many, many > users visiting a dynamic website at once, will it > cause the database to be bogged down with so many > users visiting the website? If so, how do you around > this problem. > Yes it could. To get around it : benchmark & optimize your indexes and queries. Check into using persistant connections, it is normally a good idea in general -but watch out that you don't exhaust kernel resources ... Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I do this PERL in PHP?
On 16-Sep-2003 Susan Ator wrote: > I have a text file with the following format: > > name > stuff > > message text > message text > message text > If you're sure the format is exactly that, then ... $pat=array( '', '', ); $marker=''; $data=file_get_contents('dafile.txt'); $msgblks=explode('', $data); foreach($msgblks as $blk) { list($to, $subj, $msg) = explode($marker,preg_replace($pat, $marker, $blk)); ... do__your_stuff($to, $subj, $msg); ... } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] German Date - GMDATE Function
On 22-Oct-2003 Steve Vernon wrote: > Hello, > > When I use the gmdate function, I get the English date, e.g. October. Is > it > possible to get the date in German or another language? I really need the > server setting up so that it can handle different languages. > $locale='de_CH.ISO_8859-1'; // Alternate: 'de_DE.ISO_8859-1' setlocale(LC_TIME, $locale); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email Body
On 22-Oct-2003 micro brew wrote: > I am sending an email using mail() and it works fine. > But the formatting of the body of the email is wrong. > I want to format part of it in columns sort of like > this: > Name Quantity Price > > Can this be done neatly without using an html email? > sprintf("%-25 %2d %9.2f\n", $name, $qty, $price); > Also what is the trick to making line returns display > properly in the email client? I've tried using \r\n > with no luck. I also tried \n. The characters show > in the email but no line breaks. Any suggestions? > double-quotes around your string? Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to remove new line character?
On 02-Nov-2003 Koala Yeung wrote: > Thanks a lot > > I'd like to remove newline only. > Is there any simple way? > rtrim($str, "\r\n"); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
On 19-Nov-2003 Steve Buehler wrote: > > Amazing what I learned today. :) I love this list and its people. > How about one more? (ver 4.1.0): foreach(range('A', 'Z') as $letter) { echo $letter, "\n"; } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] last_insert_id function
On 24-Jan-01 Mark Lipscombe wrote: > Someone jump in here and correct me if I'm wrong, but by the time you > get around to executing the second query, LAST_INSERT_ID() from MySQL > isn't necessarily going to be the desired value, because another record > may well have been inserted in that time? You're wrong; from the manual: " ... The last ID that was generated is maintained in the server on a per-connection basis. It will not be changed by another client. " Regards, -- Don Read[EMAIL PROTECTED] -- The problem with people who have no vices is that you can be sure they're going to have some pretty annoying virtues. -- 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: IE 5.5,authentication,PHP sessions: IE never stops
On 04-Mar-01 Ken wrote: > Thanks for the idea, John. > > I know about the auth logout. Unfortunately, that means that when a user > clicks "logout", he gets a "log in" prompt! And, in IE, he has to > deliberately blank out the password field, THEN hit enter, THEN the prompt > will come again, and he has to hit escape. > Any suggestions? > I'm still playing with this but ... My script handles the authentication against a MySQL table; and this might (probably) have to get tweaked to play well with .htaccess The logout script creates a "mark" (tmpfile, db entry, whatever) then redirects to a non-protected page. On entry to a protected script: function authuser($realm) { global $PHP_AUTH_USER, $PHP_AUTH_PW; if (isset($PHP_AUTH_USER)) { if (markset($PHP_AUTH_USER)) { markunset($PHP_AUTH_USER); // send a 401 to force re-authenticate Header('WWW-authenticate: basic realm="'.$realm .'"'); Header('HTTP/1.0 401 Unauthorized'); echo "\n\n"; echo ''; exit; } if (! (validlogin($PHP_AUTH_USER,$PHP_AUTH_PW, $realm))) { Header('WWW-authenticate: basic realm="'.$realm .'"'); Header('HTTP/1.0 401 Unauthorized'); echo ''; echo 'Failed LoginInvalid name or password'; exit; } } return(true); } Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] anchor "#" not working?
On 04-Mar-01 andrew wrote: > thanks for the feedback, gents, but it's not working :/.. > > I changed to this, as suggested: > >> > actually, here is a snippet of the function I'm using the generate the link: > > ...more > > and the subsequent anchor on the next page > > while ($row = mysql_fetch_row($result)) > { > > $row[2] > $row[3] > } > > I've verifeid that $row[0] is printing the exact same content on both > pages... quite odd that it's not working. maybe faulty memory on my part, but i think I've seen something similar (i.e. "" is flakey inside tables). play with putting within your or tags. Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] Unix-time problem
On 05-Mar-01 Nicklas af Ekenstam wrote: > Hi! > > I wrote this simple function to return the current date minus supplied > number of years: > > function get_birthdate($age_in_years) { > > You, obviously, call it like this: echo get_birthdate(1); > Which would return a datestring that looks like this: 05/03/2000 > > Works nice, but the problem occurs when I try to subtract more than 31 > years which is naturall since, as far as UNIX is concerned, the world > didn't exist then. > (Took me a while to figure this one out though.) > > Any clues on how to fix this so that I can go beyond the past 31 years? > function get_birthdate($age_in_years) { list ($y,$m,$d) =explode('-', date('Y-m-d')); $bdstr=sprintf("%02d/%02d/%04d", $m, $d, $y - $age_in_years); return($bdstr); } Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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: IE 5.5,authentication,PHP sessions: IE never stops
On 05-Mar-01 Ken wrote: > At 04:11 PM 3/5/01 +1300, Simon Garner wrote: >>From: "Ken" <[EMAIL PROTECTED]> >> > Why it's bad is that, if the user clicks "cancel", they are not logged >>out. They have to manually clear the field, THEN OK, then they get prompted >>AGAIN, THEN they hit cancel. That's nuts, and my users aren't going to >>understand that. >> > >> >>Why do they need to be able to log out? > > Because they are on a shared computer. > >>If the user doesn't want their password saved (e.g. they're on a public PC) >>then they just uncheck the "Save password" box when logging in, and then >>they can close the browser and be "logged out". >> >>If they want their password saved then they can check the "Save password" >>box and not worry. > > Nope - with IE5.5, even with that box NOT checked, the user remains logged > in until either a) the computer is restarted, or b) a new > user-authentication header is sent, AND the user clears out the password > field and hits OK. Otherwise the user stays logged in, in spite of the HTTP > spec. > >>It sounds to me like you're trying to implement something that no users are >>actually going to need or want... > > Nope, I'm working with a real client, who has multiple users on the same > machine, and IE5.5 is installed on it, and, lo and behold, though the rest > of the browsers work fine, IE5.5 has this awful bug. > >>However, if you want more control over the authentication process I suggest >>making your own login form and using cookies, instead of HTTP >>authentication. Then you can log users out just by unsetting the cookie(s). > > This is how I will wind up going, EXCEPT the users will be required to click > "logout", since merely closing the browser, in IE5.5, does not seem to clear > the user/password from the browser's memory, NOR does it clear any session > cookie. Again, works fine in other browsers, per spec. > Is this a NT-Domain network ? It's been a few years since i was sysadmining, but the user might have to log off the network domain/workgroup to re-select the credential file (luser.pwl file or whatever Bill & the boys from Redmond call it now). But i'll agree that if IE keeps the authentication after you close the browser, it _is_ borken. Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] Slideshow problem
On 07-Mar-01 Fates wrote: > My problem is the images are displayed all at once instead of one at a > time. So I get 10 images all on one page. How do I make it display one > image at a time like a slideshow instead of all images on one web page? > . The problem seems to be within my loop. I am using latest php4 > version. You are confused on how HTTP works. http://www.acts.eku.edu/web/FASTWEB/HTMLOUCH.HTM (scroll down a couple of paragraphs) Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] Combo Box containing field
On 10-Mar-01 RealGM wrote: > Hi, > > Does anyone know how I can create a combo box in my php file that reads the > options in from a database field? > > I can create combo boxes fine containing values that I enter, but I want it > to read the values from the database into the drop down box for the user to > select. > > Thanks, > Michael. > function selectoption($k, $v, $comp) { printf("%s\n", $k, $comp == $k ? "SELECTED" :"", $v); } $qry="select id,name) from country order by name"; $dbres = @mysql_query($qry); if ($dbres) { echo ''; while ( $row = mysql_fetch_object($dbres)) { selectoption($row->id, $row->name, $usercountry); } echo "\n"; } Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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 name of the main file from external included s
On 12-Mar-01 Aviv Revach wrote: > Hey! > > I already asked this once before, but nobody seems to answer. That's why > I'm re-writing > my question. > > I have a main file named: "main.php3" > It includes an external php3 script named: "ext.php3" > > Inside of the 'ext.php3' script - I need to know the full path > of the file which included it (in this case - > 'http://www.../dir1/dir2/main.php3'). > How could I do that? > Err ... did you look at the output of I'm sure some combination of $SCRIPT_FILENAME, $SERVER_NAME, $PHP_SELF, or REQUEST_URI is what you want. -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] software localization with PHP
On 14-Mar-01 Tao wrote: > Kevin, > > Thanks for the reply. This will not solve my problem. The problem is, for > some > languages the sentence structure may be different. For example, the > sentence > may need to be, > $greeting = "$first_name, welcome!" > as opposed to, > $greeting = "Welcome, $first_name!" > > Or, it can come in a different form, like, > $greeting = "Good morning, $first_name." > > These specificity need to be in the language file, not the scripts. > > Tao > I use a MySQL table to localis(z)e both words & printf formats: +---+--++---+ | catid | lang | strid | strval| +---+--++---+ | | de | Statistics for | Stand vom %s | | | de | Statistics | Statistik | | | sv | Statistics | Statistik | | | en | Statistics for | Statistics for %s | | | en | Statistics | Statistics| | | sv | Statistics for | Statistik för %s | +---+--++---+ +---+--+---++ | catid | lang | strid | strval / +---+--+---++ | | en | Topsignupurls | Top %d signup URL's for %s | | | de | Topsignupurls | Ãbersteigen Sie %d signup URL's für %s | | | sv | Topsignupurls | Topp %d försäljnings URLs för %s | +---+--+---++ If the phrase structure is likely to be different, you store the printf specification as well. example: body_beg(SITENAME.' '.nls('Statistics')); // title & open body ... $ds=formatdate($dte); // localized date string ... printf('' .nls('Statistics for') ."\n", $ds); ... printf(''.nls('Topsignupurls').' ', 30, $ds); Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] Array help
On 15-Mar-01 Chris wrote: > Hi, > Is there a way to do an array_pop with php3? > > unset($dirs[sizeof($dirs)-1]); // php4 array_pop(); Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] include() suggestion
On 17-Mar-01 Steve Wardell wrote: > I didn't know where else to post feature requests so I'll post it here. > Could we get included files to not merely be sucked in to the file that is > including it but still think of it as a distinctive file in terms of getting > debug output for errors. The reasons for this are 2 fold: > > 1) You could see all the files run by a particular page and not have to > trace through files to see all the files which are called during a request > to the server. > 2) For error messages, it would give you the line number of the particular > file that has the error and not the line number of the merged single file. > Errm ... Not sure what you mean by 'the line number of the merged single file.' ? a syntax error will mention the correct file unless you don't close a block. For trace debuging i use (in common.php): function debug($fl, $ln, $msg='') { global $debug; if (! empty($debug)) printf("%s %s:\n%s", $fl , $ln ,$msg); } and used as : $qry="select id, name, contact, email, addr1, addr2, city, state, 1zip, country, left(datesigned,10) as ds from webmaster where id=$qwid"; debug(__FILE__,__LINE__, $qry); $res = mysql_query($qry); if ( $res) { ... just add &debug=1 to the url to trace out execution. Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] include() suggestion
On 18-Mar-01 Steve Wardell wrote: > Say you have index.php and 20 lines into index.php you include file.inc and > there's an error on line 30 of file.inc, but I'm pretty sure PHP would say > there was an error on line 50 of index.php and not like 30 of file.inc. It > doesn't keep track of included files as separate files that are called but > rather sort of merges it in memory into one file to run it seems. > just tried it, hitstats.php -- require('secure.php'); authuser("Statistics"); include('history.php'); include('fpstats.php'); if (isset($lint)) error_reporting(31); ... fpstats.php --- removed a semi-colon. browser output --- Parse error: parse error in fpstats.php on line 130 -- PHP/3.0.18 (maybe a 4.0 thing ?) Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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 i get a variable type?
On 18-Mar-01 phpman wrote: > hello all, > > > and i want to find out if $tmp[1] is a string or an integer (that's really > all I need to determine gettype($foo) ? > so i can put > together an SQL statement that puts single quotes around strings and none > around integers). depending on your SQL engine, you can usually quote integers. Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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/MySQL & Control Structures -> if (mysql_query())
On 21-Mar-01 Mike Gifford wrote: > Hi David, > > I counted the number of rows using mysql_numrows(), but I've been told that > count() is way faster. Unfortunately, I can't seem to get count working.. > Any > ideas? > > echo mysql_numrows(mysql_query("select * FROM phPetition",$db)); > > // This should be faster, but doesn't seem to work > // echo count(mysql_query("select * FROM phPetition",$db)); > ?> > ;) $result= mysql_query("select count(*) as cnt FROM phPetition",$db)); if ($result) { $row = mysql_fetch_object($result); echo 'count: ', $row->cnt, ''; } Regards, -- Don Read [EMAIL PROTECTED] -- If you are going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucrats won't. -- 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] getcwd()
On 15-Apr-01 kenny.hibs wrote: > Is there a php3 alternative to the getcwd() function > try: $cwd=`pwd`; -- or -- $cwd=`/bin/pwd`; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Speed of MySQL connections - Socket vs. Non-Socket
On 16-Apr-01 Alexander Skwar wrote: > Hello! > > In a mysql_connect() it is possible to specify a path to the socket which > should be used for communicating with MySQL. > > Now, when I connect thru a socket, is the datatransfer between PHP and MySQL > faster than when I connect via a (loop-)network? I would assume so, because > with a socket, there's not the network layer in the way which has to be > taken care of. > > Is this correct? > Yes, from my memory of the mysql list; AF_INET is 7% slower then AF_UNIX in data thru-put. Plus you have to add in the connection build & tear-down time. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Tip for cookies
On 17-Apr-01 Pat Hanna wrote: > I found out today after suffering from minor headaches and hair loss that if > you have functions defined in and outside file name 'foo.php', and in those > functions you use cookies, you must pass those cookies to the function > called. I tried using a value from a cookie in a function and it never could > access it unless I passed it. Funny function my_func() { global $cookie; // ? if ($cookie == "thin mint") call_girl_scout(); } BTW, sometimes the hair does grow back. -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] select question
On 17-Apr-01 Matt \"TrollBoy\" Wiseman wrote: > How would I word a query to see what tables exist in a db that begin with > box > > for example include > boxTABLE1 > boxTABLE2 > boxTABLE3 > but exclude > sphereTABLE1 > > I'm basically trying lo populate a list box with the tables beginning with > box in PHP. > mysql> show tables; +-+ | Tables_in_cache | +-+ | admh020 | | ctl | | hs021132| | pending | | signc | | signd | | tmpc| | tmpd| | trnc| | trnd| +-+ 10 rows in set (0.02 sec) mysql> show tables like 'tmp%'; ++ | Tables_in_cache (tmp%) | ++ | tmpc | | tmpd | +----+ 2 rows in set (0.02 sec) Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
Re: [PHP] mySQL Question....
On 18-Apr-01 Jason Caldwell wrote: > Opps. I meant GROUP BY... and it looks like I don't need to include the > COUNT(). > > SELECT email_addr, x GROUP BY email_addr HAVING x = 1; > > Is this the only way to display a listing without duplicates, or is there a > more efficient (faster) way? I don't want to DELETE the duplicates, just > don't want dups to show up in my SELECT queries. > > Thanks. > Jason > > select distinct(email_addr) ... -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
Re: [PHP] IP address enconding
On 19-Apr-01 elias wrote: > No! I can encode IP address to an Integer: > 192.168.0.1 consider as: a.b.c.d > and now the formula goes: > a shl 24 + b shl 16 + c shl 8 + d > > but i was looking for something ready made > PHP3 (returns a float, not an integer): function inet_aton($a) { $inet = 0.0; $t = explode(".", $a); for ($i = 0; $i < 4; $i++) { $inet *= 256.0; $inet += $t[$i]; }; return $inet; } function inet_ntoa($n) { $t=array(0,0,0,0); $msk = 16777216.0; $n += 0.0; if ($n < 1) return(' '); for ($i = 0; $i < 4; $i++) { $k = (int) ($n / $msk); $n -= $msk * $k; $t[$i]= $k; $msk /=256.0; }; $a=join('.', $t); return($a); } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] update form design question.
On 25-Apr-01 Larry Hotchkiss wrote: > Basically I am just trolling for some thoughts on how others may > accomplish this task. > > I have a mysql database. In the database I of course have records. > These records have a date field and after so many days I have a script > to delete old records. Now, there are often times when a user will want > to "refresh" one or more records and also delete one or more as well and > possibly not do anything to other records. > > My initial thought was to have thier records displayed with 2 > checkboxes, one to check to delete the record and one to check to > refresh(renew the record by setting the date field to the current date). > Not checking either will simply do nothing to the record in question. > id int auto_increment not null primary key, ts timestamp not null, valid tinyint not null default 1, uid int not null, ... to "refresh" : update table set valid=valid+1 where id=$id to "delete": update table set valid=0 where id=$id the expire & cleanup script: update table set valid=0 where ts < date_sub(now(), interval 7 day) delete from table where valid=0 > Most users will have anywhere from 50 to 3000 records and 3k records > would be a little unwieldy to display on one page which brought up a > concern for how to handle the processing of the previous page of records > when you head to the next. Should I update the DB as I move to the next > page or perhaps after all pages are viewed? > > Anyways, any thoughts, ideas and or suggestions are all welcome. I'd think a "commit changes" on the last page would be more intuitive for the users, but the programming would get a bit complex ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] the SkyBiz matrix|downline program using PHP & mySQL
On 25-Apr-01 Thomas Edison Jr. wrote: > we're trying to develop an exact replica of the SkyBiz > downline|Matrix system program. But it's getting so > complicated & niether is the logic coming out. we're > in need of help. Anyone familiar with the skybiz > matrix, please help!! > It's a 2 X 2 matrix system where a person can have > only two legs below him - Left & Right = and thus the > chain grows. Each person sponsors 2 people below him. > They can be directly below him or somewhere down the > line. Not a matrix, it's called a Binary Tree (B-Tree); programming 101. also look for "recursion" near-by. N / \ K Q \ S / \ R T func count(x) { if (x == NULL) return(0); cnt=1 + count(x->left) + count(x->right); return(cnt) } > But keeping a count of how many people o one's > right & left is getting impossible logically. > please help! I'd kinda imagine it would. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
Re: [PHP] HTTP authentication : logout!!!
On 07-May-01 Mauricio Souza Lima wrote: > And you have to inform the user to clean the password field, click ok, > then the pop-up will open again, then user click in cancel. > > I just know that way to do. If anyone know another way, Postit! > create a tmp directory logoff.php3: require('secure.php3'); authuser("Logoff"); // validate user (possible Dos attack here) $fname="tmp/$PHP_AUTH_USER"; touch($fname); Header("Location: http://www.mydomain.com/index.html";); - secure.php3: function checklogin($user,$pass='',$realm='') { if (! dbInit()) { echo "\n\n"; die("Unable to contact database server"); } $fname="tmp/$user"; if (file_exists($fname)) { unlink($fname); return(false); } $query="select login from users where login='$user' and password=PASSWORD('$pass')"; // echo $query .''; $result = mysql_query( $query); $row = mysql_fetch_object($result); if ($row) { return(true); } return(false); } function authheader($realm) { Header('WWW-authenticate: basic realm="'.$realm .'"'); Header('HTTP/1.0 401 Unauthorized'); echo "\n\n"; } function authuser($realm='Access') { global $PHP_AUTH_USER, $PHP_AUTH_PW; if (! (isset($PHP_AUTH_USER)) ) { authheader($realm); exit; } if (! (checklogin($PHP_AUTH_USER, $PHP_AUTH_PW, $realm)) ) { authheader($realm); echo 'Failed Login'; exit; } } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Date & Time Formatting ??
On 08-May-01 Jack Sasportas wrote: > > The Goal is to have the Time stamp looking like 12:24 (military time OK) > > and the date 05-08-2001 or even 05-08-01. > > The MySQL db looks like so: > date -00-00 > time 00:00:00 > > I don't seem to really be able to vary the DB format. combine the date & time: mystamp datetime .. select date_format(mystamp,'%m-%d%Y %r') as ts from blah; > > Any examples or links to good docs appreciated find /usr/local -name "manual.txt" -print | grep mysql http://www.mysql.com/manual.php Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
Re: [PHP] HTTP authentication : logout!!!
On 08-May-01 Mauricio Souza Lima wrote: > > Cool, you have found another way! > So the realm make diference? A user loged in a realm isn't the same in > other realm? Very cool... Not quite, the realm is a string to present to the login dialog box it has no effect on the credentials in this example. But you could code such a thing. > Explain better your solution to us. > 'Kay > >> >> logoff.php3: >> >> $fname="tmp/$PHP_AUTH_USER"; >> touch($fname); create a lockfile tmp/loginname >> Header("Location: http://www.mydomain.com/index.html";); & send them to a non-protected page. >> >> secure.php3: >> >> function checklogin($user,$pass='',$realm='') { >> here $realm is some unused glue for orthagonal function() calls >> $fname="tmp/$user"; >> if (file_exists($fname)) { check if tmp/loginname exists >> unlink($fname); // delete it >> return(false); >> } if we got this far, they either 1. didn't hit logoff 2. they did and already got the 401-(Re)Authenticate >> $query="select login from users >> where login='$user' and password=PASSWORD('$pass')"; >> // echo $query .''; >> $result = mysql_query( $query); >> $row = mysql_fetch_object($result); >> if ($row) { >> return(true); >> } >> return(false); >> } >> Basically it's a spin-lock file that is checked on login ... could just as easily be done as a shared semaphore, DB entry, whatever. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Wrapping text to store in the database
On 08-May-01 Romulo Roberto Pereira wrote: > Hello! > > If a user drop a text like this in a textarea: > > --- > > As you can see the text is simple and there are not any html tags. How do I > do to add this elements so the text become something like this below, I mean > how to wrap it up in html tags? > > Ideas? nl2br() Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Default values in MySQL
On 08-May-01 Joseph Bannon wrote: > How do you set Default values in mysql? > CREATE TABLE webmaster ( wmid smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment, pcode char(1) DEFAULT 'S' NOT NULL, grade char(1) DEFAULT 'C' NOT NULL, name varchar(80) DEFAULT '' NOT NULL, contact varchar(80) DEFAULT '' NOT NULL, addr1 varchar(80) DEFAULT '' NOT NULL, addr2 varchar(80), city varchar(80) DEFAULT '' NOT NULL, ... Not that it has anything to do with PHP. http://www.mysql.com/manual.php http://lists.mysql.com/ Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] PHP Mysql query data conversion newbie
On 09-May-01 Jon Haworth wrote: be sure to check for the NULL : if (isset($amyrow["date"])) { >if ($amyrow["date"] == "-00-00 00:00:00") { > echo "no date"; >} else { > echo $amyrow["date"]; >} } else { echo 'pfsst.'; } >echo ""; > } > HTH Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] Newbie... Executing UNIX commands...
On 10-May-01 macky wrote: > im using PHP + APACHE on Linux Box > > i wonder what command in PHP can i use to execute Unix commands $foo=`ls` thats a "back-tick" Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]
RE: [PHP] PHP + GD + FreeBSD
On 10-May-01 Kasper Kristiansson wrote: > When i compile PHP on my FreeBSD with the following confgoptions, i don't > get png support. > > Whats wrong? > > ./configure --with-jpeg-dir=/usr/local/src/jpeg --with-png-dir=/usr/local/sr > c/libpng --with-gd=/usr/local/src/gd > > checking whether to include GD support... yes (static) > checking for compress in -lz... (cached) yes > checking for png_info_init in -lpng... (cached) no ^^^ clue strange, png should be installed (as a dependancy) by gd. try find /usr/local -name "libpng*" -print to see if the libs exists, if not cd /usr/ports/graphics/png make && make install (may want to do gd as well) cd /usr/ports/graphics/gd make deinstall make && make install then build php. Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do 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]