[PHP] need help with a chat code problem
Im building a chat with php/mySQL but I dont want my database to be filled up with messages upon messages, what I want to do is make it start deleting rows after lets say 100 rows (which hold the messages)(each individual row holds one chat message), is there a way of doing this through deleting the smallest numberID rows in that table? as each one I want to delete will be the smallest ID number (as it grows with each message added to it). If tried to figure this out but so far no luck. If anyone can help me with this Id greatly appreciate it. Thanks in advance Deadsam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SESSION ARRAY
What is the proper syntax for storing an array in a session? is it $_SESSION[BILLARRAY]=$ARRAY? Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION ARRAY
What is the proper syntax for storing an array in a session? is it $_SESSION[BILLARRAY]=$ARRAY? Yep, providing youre using session_start() and session_register(_SESSION) you can assign any type of data, just like a regular hash. Todd. - Original Message - From: Randy Johnson [EMAIL PROTECTED] To: phplist [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, August 30, 2002 9:08 AM Subject: [PHP] SESSION ARRAY What is the proper syntax for storing an array in a session? is it $_SESSION[BILLARRAY]=$ARRAY? Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I strip the code from HTML pages to extract thecontents of a HTML page.
I was looking into stripping HTML files that contain alot of links. I was trying to avoid the manual way of data entry. The contents i need are the name of the link (plain text which sits out side the HTML code) and all the a href tags. I would like the a href (ie.the hyperlink) tags to be displayed on the HTML output as plain text. All other HTML tags would be kept in place. The reason why I am doing this is that I am placing a link's name and the http:// link in to flat files, where they can be updated just by appending to them. The srcipt that I have does the rest. I have looked into the functions suggested but do find the concepts and use of the opperators to strip the HTML involved esoteric and tricky. ¬¬Chuck¬¬ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: wish list for my host's new compile
Hi Philip, There's definitely MySQL support in there, and I think FTP is enabled (FTP Support: enabled). What are the options for fonts in GD without freetype? The GD site doesn't have any sample images... I assume it means you can't use TTF, and you can't get anti-aliasing. GD2 is in Beta, so that won't happen :( Thanks, Justin on 30/08/02 3:06 AM, Philip Hallstrom ([EMAIL PROTECTED]) wrote: On Thu, 29 Aug 2002, Justin French wrote: Hi all, My host is putting together a new linux box at the moment for hosting, and I want to make sure that they include a few things that I've needed, but weren't available on the current server. I've got about 15 domains with them, so it's not particularly easy to change hosts. A few things I've wanted so far: - enable_trans_sid - mcrypt (encypting credit cards, etc) - GD library w/JPEG PNG - PDFlib - XML I'd try and get GD 2 instead of 1.8.x, freetype2 could be useful, ftp, imap (for webmail), database support (mysql, postgres)... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I strip the code from HTML pages to extract thecontents of a HTML page.
Hi Charles, Not sure exactly what you are after, but function displayLinks ($pagecontents) { $search = '/a (.*?)href=(.*?)(.*?)\/a/im'; $replace = 'a $1href=recordstep.php?clientid=$clientidtestid=$testidlink=$2$3/a'; return (preg_replace ($search, $replace, $pagecontents)); } For me, that takes all the links in $pagecontents and modifies the links for a recorder I am building. You could do something simular with it, although if you need the name, you might want... $search '/a (.*?)href=(.*?)(.*?)(.*?)\/a/im'; And $4 would be your name. I hope this helps. Todd. - Original Message - From: Charles Fowler [EMAIL PROTECTED] To: Justin French [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, August 30, 2002 10:14 AM Subject: Re: [PHP] How can I strip the code from HTML pages to extract thecontents of a HTML page. I was looking into stripping HTML files that contain alot of links. I was trying to avoid the manual way of data entry. The contents i need are the name of the link (plain text which sits out side the HTML code) and all the a href tags. I would like the a href (ie.the hyperlink) tags to be displayed on the HTML output as plain text. All other HTML tags would be kept in place. The reason why I am doing this is that I am placing a link's name and the http:// link in to flat files, where they can be updated just by appending to them. The srcipt that I have does the rest. I have looked into the functions suggested but do find the concepts and use of the opperators to strip the HTML involved esoteric and tricky. ¬¬Chuck¬¬ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] and or statement
PHP and MYSQL Web Development manual by Welling and Thompson states that logical operators are as follows: ___ Operator Name Use Result ___ ! NOT !$b Returns true if $b is false and vice versa AND $a $b Returns true if both $ a and $b are true; otherwise false | | OR $a | | $b Returns true if either $ a or $b are true; otherwise false and AND $a and $b Same as but with lower precedence or OR $a or $b Same as | | but with lower precedence ___ Just wanted to touch on the matter of the little fact that " and " and " or " can be used in PHP but the order of precedence. Hope this is helpful Chuck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Average Number For Math Functions
Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John
[PHP] PHP Toolbar for Homesite...
I made a php toolbar for Homesite v5. It's currently at v1.0 right now, but I'm looking for any suggestions anyone might have for the next version. http://zurnet.com/dl/hsphptb/ -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2002 - 5th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] Re: credit card auth using curl function
Thanks for the help. I made the change as follows, as I don't mind it be transient data... but I still get the string outputted on the web page. I can parse the string all I want, but the following code still prints out the annoying string on the webpage. Any ideas where I am going wrong? Stan Here's the code I used based on suggestion: htmlbody ?php // // A very simple PHP example that sends a HTTP POST to a remote site // $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,reqtype=authorizeaccount=107036password=amount=12 ); curl_setopt($ch, RETURNTRANSFER, 1); $return_data = curl_exec($ch); curl_close ($ch); ? /body/html -- -Original Message- From: phplist [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 7:32 PM To: [EMAIL PROTECTED] Subject: FW: [PHP] Re: credit card auth using curl function -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 5:45 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: credit card auth using curl function Absolutely. Your best bet, leaving the most visible way of tracing the steps on any authorization, would be to save the returned string to a file. Open the file and pass the handle to CURL_SETOPT like curl_setopt($ch, CURLOPT_FILE, $return_data_fp); Then have your script parse the data and output to the user appropriately. Alternately, you can set RETURNTRANSFER and put the string in a variable, like curl_setopt($ch, RETURNTRANSFER, 1); $return_data = curl_exec($ch); but then the variable is transient and you have no record of the transaction. By using the first option you can retrace the steps of any transaction if you ever need to. HTH, Mike Phplist [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I am using the CURL command to post credit card info to a gateway .exe program on a secure server. The code below works fine to produce the comma delimitted credit card authorization information to the browser page (for example: declined,Invalid form data posted,8/29/2002,18:07,0,0 ), but I need to capture the credit card gateway authorization string so that I can take action within my PHP code, versus the user receiving the auth code returned on the browser page. Here is the code I am using: htmlbody ?php // // A very simple PHP example that sends a HTTP POST to a remote site // $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, reqtype=authorizeaccount=107036password=amount=12); curl_exec ($ch); curl_close ($ch); ? /body/html It produces: declined,Invalid form data posted,8/29/2002,18:07,0,0 at the browser... It is a valid decline on the credit card, which I am no concerned with, but I don't have this return to the user, want to parse the string and produce my own php output based on accepted or declined status. Any ideas? Stan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: credit card auth using curl function
Try curl_setopt($ch, CURL_NOBODY, 1); Mike Phplist [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanks for the help. I made the change as follows, as I don't mind it be transient data... but I still get the string outputted on the web page. I can parse the string all I want, but the following code still prints out the annoying string on the webpage. Any ideas where I am going wrong? Stan Here's the code I used based on suggestion: htmlbody ?php // // A very simple PHP example that sends a HTTP POST to a remote site // $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,reqtype=authorizeaccount=107036password=amount=12 ); curl_setopt($ch, RETURNTRANSFER, 1); $return_data = curl_exec($ch); curl_close ($ch); ? /body/html -- -Original Message- From: phplist [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 7:32 PM To: [EMAIL PROTECTED] Subject: FW: [PHP] Re: credit card auth using curl function -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 5:45 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: credit card auth using curl function Absolutely. Your best bet, leaving the most visible way of tracing the steps on any authorization, would be to save the returned string to a file. Open the file and pass the handle to CURL_SETOPT like curl_setopt($ch, CURLOPT_FILE, $return_data_fp); Then have your script parse the data and output to the user appropriately. Alternately, you can set RETURNTRANSFER and put the string in a variable, like curl_setopt($ch, RETURNTRANSFER, 1); $return_data = curl_exec($ch); but then the variable is transient and you have no record of the transaction. By using the first option you can retrace the steps of any transaction if you ever need to. HTH, Mike Phplist [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I am using the CURL command to post credit card info to a gateway .exe program on a secure server. The code below works fine to produce the comma delimitted credit card authorization information to the browser page (for example: declined,Invalid form data posted,8/29/2002,18:07,0,0 ), but I need to capture the credit card gateway authorization string so that I can take action within my PHP code, versus the user receiving the auth code returned on the browser page. Here is the code I am using: htmlbody ?php // // A very simple PHP example that sends a HTTP POST to a remote site // $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, reqtype=authorizeaccount=107036password=amount=12); curl_exec ($ch); curl_close ($ch); ? /body/html It produces: declined,Invalid form data posted,8/29/2002,18:07,0,0 at the browser... It is a valid decline on the credit card, which I am no concerned with, but I don't have this return to the user, want to parse the string and produce my own php output based on accepted or declined status. Any ideas? Stan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Average Number For Math Functions
just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
At 05:55 PM 8/29/02 , JohnP wrote: Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John Nope - you'll have to 'roll your own' by looping though the set, or (if you have version = 4.0.5) you can use array_reduce() in conjunction with the count() function. If these values are coming from a database, most databases have aggregate functions to do sums, averages, etc. -steve ++ | Steve Edberg [EMAIL PROTECTED] | | Database/Programming/SysAdmin(530)754-9127 | | University of California, Davis http://pgfsun.ucdavis.edu/ | +-- Gort, Klaatu barada nikto! --+
Re: [PHP] SESSION ARRAY
$_SESSION is a predefined variable, session_start() session_register('BILLARRAY') should work though :) Keith Vance Vance Consulting LLC www.vanceconsulting.net (206) 355-2399 Try my open source PHP authentication system, Rampart by visiting http://rampart.sourceforge.net/. Commercial support is available at, http://www.vanceconsulting.net/support/. On Fri, 30 Aug 2002, Todd Pasley wrote: What is the proper syntax for storing an array in a session? is it $_SESSION[BILLARRAY]=$ARRAY? Yep, providing youre using session_start() and session_register(_SESSION) you can assign any type of data, just like a regular hash. Todd. - Original Message - From: Randy Johnson [EMAIL PROTECTED] To: phplist [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, August 30, 2002 9:08 AM Subject: [PHP] SESSION ARRAY What is the proper syntax for storing an array in a session? is it $_SESSION[BILLARRAY]=$ARRAY? Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
Can't you just count the elements and then divide the total by the count? It seems pretty obfuscating to consider a function that takes an unknown number of elements, unless it were an array... still, seems pretty easy to count and divide total... doesn't it? -VolVE - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 20:55 Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Average Number For Math Functions
if i remember 4th grade math class correctly... ? $total = 0; $count = 0; // get each of the numbers foreach($array_of_the_numbers as $key = $value) { $total += $array_of_the_numbers[$key]; ++$count; } // wow, that's a toughie! $average = $total / $count; // then you could make it pretty $pretty_average = number_format($average, 1); ? booyah. :) dave -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 5:56 PM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
I can't seem to see a pre-built functions but here is one I just wrote in my email client: function average($numberArray) { $sum = 0; for ($i=0;$icount($numberArray);$i++) $sum += $numberArray[$i]; return $sum / count($numberArray); } echo average(array (1,2,3,4,5)); Hope this helps :) Andrew - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 30, 2002 1:55 AM Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New as of today
Im new to PHP (came from ASP). I'm trying to make pictures (.jpgs) come out of a folder and display on a page. Here is my code so far: ?php $fileLoc = Bid2002/pictures.txt; $zFile = fopen($fileLoc, r); $zContents = fread($zFile, filesize($fileLoc)); fclose($zFile); echo a href=test.php$zContentsbr/a; ? I dont have database support on the server i use (school server). I have all the picture names in a text file and i want to pull out the name of pictures from the text file and make it pull out of the picture folder. Is there an easier way to do this? Or is this the best way. ASP is very because you can loop through the file and I thought I could do it with php but it ends up in one big link. Thanks in advance. Jeff UWG Student [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New as of today
if you have each filename on a new line, then use file() to grab the contents. It returns an array, each line is an element in the array. You can then do what you want with the array HTH Martin -Original Message- From: stu9820 [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 1:08 PM To: [EMAIL PROTECTED] Subject: [PHP] New as of today Im new to PHP (came from ASP). I'm trying to make pictures (.jpgs) come out of a folder and display on a page. Here is my code so far: ?php $fileLoc = Bid2002/pictures.txt; $zFile = fopen($fileLoc, r); $zContents = fread($zFile, filesize($fileLoc)); fclose($zFile); echo a href=test.php$zContentsbr/a; ? I dont have database support on the server i use (school server). I have all the picture names in a text file and i want to pull out the name of pictures from the text file and make it pull out of the picture folder. Is there an easier way to do this? Or is this the best way. ASP is very because you can loop through the file and I thought I could do it with php but it ends up in one big link. Thanks in advance. Jeff UWG Student [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Average Number For Math Functions
Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition If you're doing it on values from a database column then you're probably best off doing it as a part of your database query. If you're using MySQL then consult chapter 6 of the manual for all sorts of useful functions that can be used in a query. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
What database are you using? MySQL has a SUM function which automatically selects the total of a column. -VolVE - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 21:25 Subject: Re: [PHP] Average Number For Math Functions Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Toolbar for Homesite...
Very cool! Here's a few suggestions: cookie should open a dialog box so you can input values similar to mail. ability to enter more than one array value at once maybe the dialog box has a drop down [1-10] which so if you select 4 then 4 fields appear to enter more values mysql functions are quite heavily used, maybe include a few more of these. I would only use the buttons that are going to save time. so a button that prints out something like this would be great. while ($row = mysql_fetch_array($result)) { $value1 = $row['']; $value2 = $row['']; $value3 = $row['']; } olinux --- Matt Zur [EMAIL PROTECTED] wrote: I made a php toolbar for Homesite v5. It's currently at v1.0 right now, but I'm looking for any suggestions anyone might have for the next version. http://zurnet.com/dl/hsphptb/ -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2002 - 5th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where is my REMOTE_USER?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... At 06:03 29/8/2002 -0400, David T-G wrote: Frank, et al -- ..and then Frank said... % % Hi, % % when logging in with username and password with the good old Require user % mechanism in Apache I could earlier see the name of the user logging in as % $REMOTE_USER. This sort of thing has come up on the list frequently. You should set register_globals = on in your php.ini file and kick your web server. HTH HAND But! Two things: 1. register_globals were already turned on 2. Surely the PHP designers would not force users to have such a major security advantage turned off for getting a variable that is a true apache-var? So problems remains: Where did the REMOTE_USER go? I am BTW running Apache 2.0 with PHP 4.2.2 as a CGI-module. When it worked last time I was only running Apache 1.3.26. Maybe the Apache-guys changed something?! Could be a RTFM-case... Well, probably I should drop using Apache's old auth-sceme and run all in PHP anyway. Thank you for the input. Best Frank U5com Is this snippet from the docs possibly relevant? Chapter 17. HTTP authentication with PHP The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date from mysql
In article 01ae01c24f4f$51dc7bd0$b50a@web18, [EMAIL PROTECTED] says... i want Y (year format) printed on my php script (looping), i already tried it but i got same Year format (ex 1978) in all row in my table my loop script is: $query = (select * from table); $result = mysql_query($query); while ($row = mysql_fetch_row($result)) $number = mysql_numrows($result); $i = 0; while ($i $number): $date = mysql_result($result, $i,$date); if ($i%2 == 0){ echo b$date/b; if ($i%2 == 0){ echo $date; } $i++; ENDWHILE; If the date is stored in one of MySql's date type fields, you could use the mysql DATE_FORMAT function to format your date. I think the logic of your looping above is a bit suspect?? -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: eregi_replace() problems
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Can anyone tell me why my emoticons arent appearing? Please? Note: $message is a variable set by a web form. The field `pattern` is the string to search for, like :-), and `url` is the relative url to the emoticon. I just get the plain emoticon. Note: this bit is above the INSERT statement in the script. ?php $emotes = mysql_query(SELECT `pattern`,`url` FROM `emoticons`); for ($t = 0; $t mysql_num_rows($emotes); $t ++) { $emotes_array = mysql_fetch_row($emotes); eregi_replace($emotes_array[0], img src=\emoticons/$emotes_array[1]\ alt=\$emotes_array[0]\, $message); } ? Shouldn't you be assigning the result of your eregi_replace to a variable, then do something with it? -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] subject in big5 characters of an email can't be read in Lotus Notes
I have sent an email using mail function in which the subject and email body have charset=big5. Customers with outlook express can read the big5 chinese characters without any trouble. However, people who read their emails from Lotus Notes complain that they cannot read the subject. But, they can read the email body because I have set charset in the header: $mailHeader=From: [EMAIL PROTECTED]\r\nContent-type: text/plain; charset=big5\r\n ; My mail statement looks like the following: mail($mailTo, $mailSubject, $mailBody, $mailHeader) ; where $mailSubject and $mailBody are both big5 char. Is there a way I can set $mailSubject charset=big5? Thanks for your help Ellen __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: subject in big5 characters of an email can't be read in LotusNotes
Hello, On 08/30/2002 01:43 AM, Ellen O'Neal wrote: I have sent an email using mail function in which the subject and email body have charset=big5. Customers with outlook express can read the big5 chinese characters without any trouble. However, people who read their emails from Lotus Notes complain that they cannot read the subject. But, they can read the email body because I have set charset in the header: $mailHeader=From: [EMAIL PROTECTED]\r\nContent-type: text/plain; charset=big5\r\n ; My mail statement looks like the following: mail($mailTo, $mailSubject, $mailBody, $mailHeader) ; where $mailSubject and $mailBody are both big5 char. Is there a way I can set $mailSubject charset=big5? Content-type only specifies the charset for the body. You need to use q encoding in the header values to specify the charset and encode the characters. You may want to try this MIME message composing and sending that among many other things encodes the header with any charset that you specify: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_unregister - but w00t about the back button?
I can logout with session_unregister - but w00t about the back button? This is probably so trivial that it has been discussed before, if anyone has some knowledge or link at hand mind passing it on? Thanks. - Victor www.argilent.com __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
I am still very new to PHP so things are still a little foreign to me - what exactly is the SUM finction - I tried to locate one on both the PHP and MySQL site but found nothing! Thanks ~ John Volve [EMAIL PROTECTED] wrote in message 02d901c24fd5$aba46020$7800a8c0@idiom">news:02d901c24fd5$aba46020$7800a8c0@idiom... What database are you using? MySQL has a SUM function which automatically selects the total of a column. -VolVE - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 21:25 Subject: Re: [PHP] Average Number For Math Functions Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple regexp
Hi, I'm trying to do a simple regexp to validate if a whole string only contains the numbers 0 to 9, Letters a - f and A - F and the character : Why isn't ereg([a-zA-Z0-9:],$string) working? Guidance appreciated. -- Adam Alkins http://www.rasadam.com --
Re: [PHP] subject in big5 characters of an email can't be read in Lotus Notes
I'm not sure if this will help but using mb_send_mail() instead of mail() solved the problems I had with Japanese characters... However, it might be the mail client itself. Check if they had no problem before (when they received similar e-mails from other sources). - E I have sent an email using mail function in which the subject and email body have charset=big5. Customers with outlook express can read the big5 chinese characters without any trouble. However, people who read their emails from Lotus Notes complain that they cannot read the subject. But, they can read the email body because I have set charset in the header: $mailHeader="From: [EMAIL PROTECTED]\r\nContent-type: text/plain; charset=big5\r\n" ; My mail statement looks like the following: mail($mailTo, $mailSubject, $mailBody, $mailHeader) ; where $mailSubject and $mailBody are both big5 char. Is there a way I can set $mailSubject charset=big5? Thanks for your help Ellen __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ $B$-$C$H8+$D$+$k$"$J$?$N?75o!!ITF0;:>pJs$O(B MSN $B=;Bp$G(B http://house.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Average Number For Math Functions
if you have a table called ratings and a field called score in it, then doing this will show you the sum of all the scores: select sum(score) from ratings; eg, if the scores were 5, 2, 5, 8, and 2 then this sql should return 22 (unless I added it wrong... :/ ) -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 3:10 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Average Number For Math Functions I am still very new to PHP so things are still a little foreign to me - what exactly is the SUM finction - I tried to locate one on both the PHP and MySQL site but found nothing! Thanks ~ John Volve [EMAIL PROTECTED] wrote in message 02d901c24fd5$aba46020$7800a8c0@idiom">news:02d901c24fd5$aba46020$7800a8c0@idiom... What database are you using? MySQL has a SUM function which automatically selects the total of a column. -VolVE - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 21:25 Subject: Re: [PHP] Average Number For Math Functions Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Average Number For Math Functions
Hi, Friday, August 30, 2002, 3:10:09 PM, you wrote: J I am still very new to PHP so things are still a little foreign to me - what J exactly is the SUM finction - I tried to locate one on both the PHP and J MySQL site but found nothing! J Thanks ~ John J Volve [EMAIL PROTECTED] wrote in message J 02d901c24fd5$aba46020$7800a8c0@idiom">news:02d901c24fd5$aba46020$7800a8c0@idiom... What database are you using? MySQL has a SUM function which automatically selects the total of a J column. -VolVE - Original Message - From: JohnP [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 21:25 Subject: Re: [PHP] Average Number For Math Functions Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I J need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the inside row addition Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functions for PHP but saw no way of returning the average of a set of numbers - I plan on using this for a rating system - any help? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this replacing field and table as needed $result = mysql_query(SELECT SUM(field) AS fsum, AVG(field) AS favg FROM table WHERE field='whatever'); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple regexp
Hi, you would be better off with preg_match, as its a little quicker apparently. try: preg_match(/^[:0-9a-f]*$/i,$string) or change the * to a + to ensure $string is not null the main problems you had: - not ensuring that only those characters are found by using ^ and $ - not allowing multiple character by using * or + or alternative - having A-Za-Z instead of A-Fa-F I hope this helps Todd. Note: I used /i to be non case dependant, maybe dropping it and having A-F as well would be quicker.. not too sure. - Original Message - From: Adam Alkins [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Sent: Friday, August 30, 2002 3:19 PM Subject: [PHP] Simple regexp Hi, I'm trying to do a simple regexp to validate if a whole string only contains the numbers 0 to 9, Letters a - f and A - F and the character : Why isn't ereg([a-zA-Z0-9:],$string) working? Guidance appreciated. -- Adam Alkins http://www.rasadam.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple regexp
try this ereg(^[a-zA-Z0-9:]*$,$string) all your's is doing is looking for any char in $string that's a-z or A-Z or 0-9 or : instead of all chars, from start to end, being them -Original Message- From: Adam Alkins [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 3:20 PM To: PHP List Subject: [PHP] Simple regexp Hi, I'm trying to do a simple regexp to validate if a whole string only contains the numbers 0 to 9, Letters a - f and A - F and the character : Why isn't ereg([a-zA-Z0-9:],$string) working? Guidance appreciated. -- Adam Alkins http://www.rasadam.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Average Number For Math Functions
I am still very new to PHP so things are still a little foreign to me - what exactly is the SUM finction - I tried to locate one on both the PHP and MySQL site but found nothing! http://www.mysql.com/doc/en/Group_by_functions.html#IDX1364 Well, it's close to "nothing" but if you study how the others are use, you'll get the idea how to use it as well... - E _ $B:G?7$N%U%!%$%J%s%9>pJs$H%i%$%U%W%i%s$N%"%I%P%$%9(B MSN $B%^%M!<(B http://money.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reading from a file using fgets()
Interesting. It's not documented. On Thu, 2002-08-29 at 14:44, Dallas Thunder wrote: Well, this is exactly what function file() does. David Christensen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... When PHP reads from a file using fgets(), does it do it in order? Meaning, when reading STDIN from a file, does it read line1, then line2, line3, and so on until EOF? My purpose is to read each line of file and push it into an array. Thanks for your help, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reading from a file using fgets()
Or, is it? :) http://www.php.net/manual/en/function.file.php - E Interesting. It's not documented. On Thu, 2002-08-29 at 14:44, Dallas Thunder wrote: Well, this is exactly what function file() does. "David Christensen" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... When PHP reads from a file using fgets(), does it do it in order? Meaning, when reading STDIN from a file, does it read line1, then line2, line3, and so on until EOF? My purpose is to read each line of file and push it into an array. Thanks for your help, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ $B:G?7$N%U%!%$%J%s%9>pJs$H%i%$%U%W%i%s$N%"%I%P%$%9(B MSN $B%^%M!<(B http://money.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New as of today
Look at fgets and explode. Depending on the format of your txt file you can use a combination of fgets and explode to get your desired results. http://www.php.net/manual/en/function.fgets.php http://www.php.net/manual/en/function.explode.php If each picture name is on a separate line then the following will work: while (!feof($zFile)){ $buffer = fgets($zFile, 4096); echo a href=test.php$buffer/abr; } Justin Garrett Stu9820 [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Im new to PHP (came from ASP). I'm trying to make pictures (.jpgs) come out of a folder and display on a page. Here is my code so far: ?php $fileLoc = Bid2002/pictures.txt; $zFile = fopen($fileLoc, r); $zContents = fread($zFile, filesize($fileLoc)); fclose($zFile); echo a href=test.php$zContentsbr/a; ? I dont have database support on the server i use (school server). I have all the picture names in a text file and i want to pull out the name of pictures from the text file and make it pull out of the picture folder. Is there an easier way to do this? Or is this the best way. ASP is very because you can loop through the file and I thought I could do it with php but it ends up in one big link. Thanks in advance. Jeff UWG Student [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reading from a file using fgets()
Ok, file() is docuemted, but it doesn't say anything about whether or not it reads data sequentially from top to bottom or if there's an option to read bottom to top or anything in between. Dave On Thu, 2002-08-29 at 22:37, @ Edwin wrote: Or, is it? :) http://www.php.net/manual/en/function.file.php - E Interesting. It's not documented. On Thu, 2002-08-29 at 14:44, Dallas Thunder wrote: Well, this is exactly what function file() does. David Christensen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... When PHP reads from a file using fgets(), does it do it in order? Meaning, when reading STDIN from a file, does it read line1, then line2, line3, and so on until EOF? My purpose is to read each line of file and push it into an array. Thanks for your help, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ 最新のファイナンス情報とライフプランのアドバイス MSN マネー http://money.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using cURL
Dear All, I'm using a shared server hosted by an ISP. I cannot get PHP recompiled with --with-curl. I've read the information about cURL but it appears that I need to be root in order to install it? I cannot do this. Does this mean that I cannot use cURL or CURL at all? If it doesn't what do I need to do so I can start using it? Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php