php-general Digest 16 Dec 2001 21:16:17 -0000 Issue 1056

Topics (messages 77860 through 77883):

DOM XML Issues with 4.1.0?
        77860 by: Mark

Re: Web Based Control Panel for Hosting
        77861 by: xk8org

php snmp compile error
        77862 by: kancha

Why don't ...
        77863 by: Yoel Benitez Fonseca
        77875 by: Michael Sims
        77877 by: Rasmus Lerdorf

Still need help with miscount
        77864 by: Daniel Alsén

sytax to remove specifc item in string-indexed array???
        77865 by: Vincent Ma
        77866 by: Michael Sims

CHEEP WEBSPACE OFFERS HERE
        77867 by: Webleycity

PHP script not paring in CGI!!!
        77868 by: Thomas Edison Jr.

now who can help me about cach my query  every certain time:(
        77869 by: Alawi
        77870 by: Jack Dempsey
        77872 by: Manuel Lemos

Re: Webcam on websites? Ugh!!!
        77871 by: Hugh Bothwell

need some help
        77873 by: Melva Garcia

Re: Need high bandwidth provider for my Asian community site
        77874 by: Hugh Bothwell

Language detection and change
        77876 by: Gary Crighton

Problem with Code
        77878 by: Phillip B. Bruce
        77880 by: Jack Dempsey
        77881 by: Attila Strauss

HTML to Plain TXT Parser (RegEx Help Needed)
        77879 by: ISE

problem finding out original filename while using php to upload.
        77882 by: Neil M

Can I do this (how?)?
        77883 by: jtjohnston

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

Hello.

        I developed a pretty cool website whose content is entirely
specified in XML, and use PHP DOM to convert it to HTML (XSL would be
a bit painful).

        Now, with PHP 4.0.6 and libxml2-2.4.7, everything worked fine,
except that there was a huge memory leak somewhere in the PHP or the
XML DOM code in PHP, and after viewing the website for about 10 minutes,
my SuSE linux machine would hang, and my FreeBSD apache server would
need to be restarted.

        So, I tried upgrading to Apache 4.1.0 with libxml2-2.4.12.

        Unfortunately, a lot doesn't work any more -- when I load in my
XML file, I can load it in using xmldocfile(), and I can iterate over
the nodes, but none of them have the name property any more.

        Is there a combination of PHP 4.x and libxml2-2.y that is
known to work reasonably well and not leak memory like mad?

        Thanks!

        mark.



        
--- End Message ---
--- Begin Message ---
I have used Alabanza and also CPanel (cpanel.net).  Wouldn't touch Alabanza
again as it's very expensive.  I think there is a freeware one called webmin
out there somewhere too

Ade
--- i n o v i c a h o s t i n g . c o m ----------

Powerful hosting from www.inovicahosting.com

----------------------------------------------------

> -----Original Message-----
> From: Jeremiah Jester [mailto:[EMAIL PROTECTED]]
> Sent: 15 December 2001 22:11
> To: [EMAIL PROTECTED]
> Subject: [PHP] Web Based Control Panel for Hosting
>
>
> I want to implement a web based control panel for updating email accounts,
> checking account usage for all my hosted clients. Does anybody have any
> experience? Are there PHP freeware packages out there that do
> this? Licensed
> packages? Any recommendations. THanks!
> JJ
>
>
> --
> 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]
>
>

--- End Message ---
--- Begin Message ---
I've downloaded php 4.1.0 and ucd-snmp 4.2.3. I was able to compile snmp 
successfully. Then i tried to compile php with snmp support. Followign is my 
configure parameters

./configure  --with-apxs=/usr/sbin/apxs --enable-calendar --with-pgsql 
--with-snmp --enable-ucd-snmp-hack --enable-wddx --enable-sysvsem 
--with-sysvshm --enable-inline-optimization --enable-ftp --with-gd 
--enable-gd-native-ttf --with-openssl

configure works fine but when i do a make i get following error:

Zend/.libs/libZend.al(default_store.o):/usr/local/ucd-snmp-4.2.3/snmplib/default_store.c:308:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `init_alarm_post_config':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:53: multiple definition of 
`init_alarm_post_config'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:53: 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `set_an_alarm':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:185: multiple definition of 
`set_an_alarm'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:185:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `init_snmp_alarm':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:60: multiple definition of 
`init_snmp_alarm'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:60: 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `sa_update_entry':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:67: multiple definition of 
`sa_update_entry'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:67: 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `snmp_alarm_unregister':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:88: multiple definition of 
`snmp_alarm_unregister'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:88: 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `sa_find_next':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:111: multiple definition of 
`sa_find_next'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:111:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `sa_find_specific':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:120: multiple definition of 
`sa_find_specific'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:120:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `run_alarms':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:131: multiple definition of 
`run_alarms'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:131:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `alarm_handler':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:164: multiple definition of 
`alarm_handler'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:164:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function 
`get_next_alarm_delay_time':/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:170: 
multiple definition of `get_next_alarm_delay_time'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:170:
 
first defined here
/usr/local/lib/libsnmp.a(snmp_alarm.o): In function `snmp_alarm_register':
/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:204: multiple definition of 
`snmp_alarm_register'
Zend/.libs/libZend.al(snmp_alarm.o):/usr/local/ucd-snmp-4.2.3/snmplib/snmp_alarm.c:204:
 
first defined here

--- End Message ---
--- Begin Message ---
Hi!

The following code fragment tries to read a sequence of digits from
a file but it doesn't work, only the first character is read,
Which is my error?.


           $str = "";
           while( ($c = fgetc($this->m_file)) && ereg("[0-9]", $c) ){
               $str .= $c;
           }


Thank you in advance

-- 
Yoel Benitez Fonseca


--- End Message ---
--- Begin Message ---
At 09:14 AM 12/16/2001 -0500, Yoel Benitez Fonseca wrote:
>Hi!
>
>The following code fragment tries to read a sequence of digits from
>a file but it doesn't work, only the first character is read,
>Which is my error?.
>
>
>            $str = "";
>            while( ($c = fgetc($this->m_file)) && ereg("[0-9]", $c) ){
>                $str .= $c;
>            }

What happens when you do just this:

$str = "";
while($c = fgetc($this->m_file)){
         $str .= $c;
}

Does it still only read the first character?

--- End Message ---
--- Begin Message ---
Is your second character perhaps a 0?  That while loop is going to end as 
soon as it gets a character that evaluates to 0.  Write it like this 
instead:

while(!feof($this->m_file)) {
    $c = fgetc($this->m_file);
    if(is_numeric($c)) $str .= $c;
}

-Rasmus

On Sun, 16 Dec 2001, Yoel Benitez Fonseca wrote:

> Hi!
> 
> The following code fragment tries to read a sequence of digits from
> a file but it doesn't work, only the first character is read,
> Which is my error?.
> 
> 
>            $str = "";
>            while( ($c = fgetc($this->m_file)) && ereg("[0-9]", $c) ){
>                $str .= $c;
>            }
> 
> 
> Thank you in advance
> 
> 

--- End Message ---
--- Begin Message ---
Hi,

i still need help with this query:

$t = 7;
$shot_counts = "SELECT COUNT(*) FROM statistik WHERE shooter='$shooter_login' AND 
(shot_one = '$t' OR shot_two = '$t' OR shot_three = '$t' OR shot_four = '$t' OR 
shot_five = '$t')";

It doesn´t return the correct count. I have tried to tweak the syntax around, 
excluding one or more columns to count etc. But it still gives the wrong count. What´s 
wrong?

- Daniel

--- End Message ---
--- Begin Message ---
Hi everyone:

  I would like to know how to specific item in array.  For the add new item
to array, we know just :

   $array += array("$key" => "$value");

How to remove specific item in array???

  I tried -->  $array -= ("$key" => "$value");
 Don't work... >_<.....

Before, i saw some code in other website, they used...

  $array[$index] -= $value <-- to remove???????
 ### i think this just work to number-indexed array....
       not for string-indexed array


Thank for you help

Vincent Ma



--- End Message ---
--- Begin Message ---
At 05:53 PM 12/14/2001 +1100, Vincent Ma wrote:
>Hi everyone:
>
>   I would like to know how to specific item in array.  For the add new item
>to array, we know just :
>
>    $array += array("$key" => "$value");
>
>How to remove specific item in array???

unset(array["specific_item_index"]);

...has always worked for me.

--- End Message ---
--- Begin Message ---
good prices here on
http://www.webleycity.co.uk/offers/index.html


--- End Message ---
--- Begin Message ---
Hi,

I'm running a Solaris OS. I have written a CGO
function to call common header & footer for pages. All
HTML pages are running well with it, however, a PHP3
page is not!! It's contents are not showing up.
Nothing i showing up! What do i do?

T. Edison jr.


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
now who can help me about cach my query every certain time:( 
I mean the first user requst the page and php will run query for this first time 

after that I want other user to have the result that the first user have it !!

untill the ten minutes end I want the query to run again 



this advantge is available in asp and JSP & ColdFusion but not available in PHP why ?

--- End Message ---
--- Begin Message ---
Alawi wrote:

> now who can help me about cach my query every certain time:(
> I mean the first user requst the page and php will run query for this first time
>
> after that I want other user to have the result that the first user have it !!
>
> untill the ten minutes end I want the query to run again
>
> this advantge is available in asp and JSP & ColdFusion but not available in PHP why ?

it is possible...search google for "php cache"

--- End Message ---
--- Begin Message ---
Hello,

Alawi wrote:
> 
> now who can help me about cach my query every certain time:(
> I mean the first user requst the page and php will run query for this first time
> 
> after that I want other user to have the result that the first user have it !!
> 
> untill the ten minutes end I want the query to run again
> 
> this advantge is available in asp and JSP & ColdFusion but not available in PHP why ?

That is a new thing and is not necessarily a good thing.

The reason because it does not exist in PHP is because you need to use a
abstraction layer like JDBC or ODBC so you don't have to provide caching
engines for each type of database.

Anyway, in general it is not a good idea to cache result sets of
arbitrary sizes because the time you take to save and load the cache the
data may not be worth it.

Usually it is better to cache the pages generated with the data from the
query.

Anyway, if you still insist on caching your queries to realize that is
not worthy, I recommend two things:

1) Only cache up to a limited number of initial result set rows (say no
more than 2 pages, ie, 20 rows).

2) Use a cache engine that is atomic, ie, it will not let itself
overwrite the same cached data by multiple concurrent accesses.

You may want to try this generic data cache class that stores cached
data in files and uses locks to prevent cache corruption. It is very
well documented and comes with an example of usage in the documentation
page.

http://phpclasses.upperdesign.com/browse.html/package/313
--- End Message ---
--- Begin Message ---

"Webleycity" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> A client wants a webcam on his site. Does any body know what script is
used
> and how it works.

The camera should come with a prog to take a snapshot.
Write a batch file that takes a snapshot, then uploads it
to your web server.  Write a batch file that calls the first
batch file every 55 seconds, OR make it a timed job via
cron.

Add javascript to the web page to call the new
graphic every 60 seconds and swap it in after it is finished
loading.  The five-second difference is to ensure that
small delays will not cause the same picture to be reloaded
again.

If you have loads of space, you could keep an archive;
otherwise I suggest overwriting the existing image each
time or maybe alternating between two names.


--- End Message ---
--- Begin Message ---
I am looking for a mentor to help me along with
using php and mysql

i am a designer for over 9 years now..and will
in return help you with anything pertaining to
layout and design

i have alot of dumb questions pertianing to
php and mysql dba can someone help me
i would appreciate any help I can get

thanks
Mel 

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---

"Webleycity" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> If one creates a file outside the web space on a server. How doe's one
> connect to this from a HTML or PHP page?
>
> As I understand it. It is not as simple as normal html link.

>From an HTML page, it's just a simple link
(the same goes for generated HTML from a
PHP page).

Calling external files from PHP code depends
first on the security settings and second on the
realization that it will slow things down dramatically;
unless it's absolutely necessary, keep files local.



--- End Message ---
--- Begin Message ---
Hi,

I know the following code displays my page in the language set in the users 
browser.

<?
$lang=substr($HTTP_ACCEPT_LANGUAGE,0,2);
?>

However while I do initially want the page to load in the language of the 
browser setting I also need to be able to allow the user to change the 
language and the above does not allow for this.

Can anyone suggest code samples that might do this and perhaps set a cookie 
to remember the choice for future visits?

I've been dabbling with this a while now and never quite get it right.

All help / advice appreciated as this is new to me.

Cheers,

Gary


--- End Message ---
--- Begin Message ---
Hi,

    I have a couple of questions before I get to my problem.

   1. Is there any documentation that explains the differences between
the versions of PHP?

  2. Does it matter when writing php code that you specifiy the file
name in the following
       manner?  test.php3  test.php4 or whatever.  I'm assumming this is
version specific.

  My Problem:

   I have the following code:

# more headlines*
<?php

include "include_fns.php3";
include "header.php3";

$conn = db_connect();


$pages_sql = "select * from pages order by code";
$pages_result = mysql_query($pages_sql, $conn);

while ($pages = mysql_fetch_array($pages_result)) {

  $story_sql = "select * from stories
                where page = '$pages[code]'
                and published is not null
                order by published desc";
  $story_result = mysql_query($story_sql, $conn);
  if (mysql_num_rows($story_result)) {
    $story = mysql_fetch_array($story_result);
    print "<TABLE BORDER=0 WIDTH=400>";
    print "<TR>";
    print "<TD ROWSPAN=2 WIDTH=100>";
    if ($story[picture])
      print "<IMG SRC=\"resize_image.php?image=$story[picture]\">";
    print "</TD>";
    print "<TD>";
    print "<H3>$pages[description]</H3>";
    print $story[headline];
    print "</TD>";
    print "</TR>";
    print "<TR><TD ALIGN=RIGHT>";
    print "<A HREF=\"page.php3?page=$pages[code]\">";
    print "<FONT SIZE=1>Read more $pages[code] ...</FONT>";
    print "</A>";
    print "</TABLE>";
  }
}

include "footer.php3";
?>
#

I have the following error:


Fatal error: Call to unsupported or undefined function include_once() in
include_fns.php3 on line 7

It seems to me that include_once is a legal function but I can't the
orgination of this funtion other
than that stupid include_fns.php3 file? Any ideas on this.

Configuration:

OS: Solaris 2.8 10/00 on Intel Hardware.
Apache: 1.3.9
PHP: 3.0.15
mysql: 3.23.46

My ISP is running:

OS: Irix 6.4
Apache: 1.3.9
PHP: 3.0.9
mysql: 3.22.23b

I do appreciate any help on this.



--
************************************************************
*** Phillip B. Bruce                                     ***
*** http://pbbruce.home.mindspring.com                   ***
*** [EMAIL PROTECTED]                               ***
***                                                      ***
*** "Have you ever noticed? Anybody going slower than    ***
*** you is an idiot, and anyone going faster than you    ***
*** is a maniac." - George Carlin                        ***
************************************************************



--- End Message ---
--- Begin Message ---
1. http://www.php.net/ChangeLog-4.php

2. and yes, you have to specify the exact filename...your issue is that
include_once is not a function in php3, if that code is infact from a php3
file...

"Phillip B. Bruce" wrote:

> Hi,
>
>     I have a couple of questions before I get to my problem.
>
>    1. Is there any documentation that explains the differences between
> the versions of PHP?
>
>   2. Does it matter when writing php code that you specifiy the file
> name in the following
>        manner?  test.php3  test.php4 or whatever.  I'm assumming this is
> version specific.
>
>   My Problem:
>
>    I have the following code:
>
> # more headlines*
> <?php
>
> include "include_fns.php3";
> include "header.php3";
>
> $conn = db_connect();
>
> $pages_sql = "select * from pages order by code";
> $pages_result = mysql_query($pages_sql, $conn);
>
> while ($pages = mysql_fetch_array($pages_result)) {
>
>   $story_sql = "select * from stories
>                 where page = '$pages[code]'
>                 and published is not null
>                 order by published desc";
>   $story_result = mysql_query($story_sql, $conn);
>   if (mysql_num_rows($story_result)) {
>     $story = mysql_fetch_array($story_result);
>     print "<TABLE BORDER=0 WIDTH=400>";
>     print "<TR>";
>     print "<TD ROWSPAN=2 WIDTH=100>";
>     if ($story[picture])
>       print "<IMG SRC=\"resize_image.php?image=$story[picture]\">";
>     print "</TD>";
>     print "<TD>";
>     print "<H3>$pages[description]</H3>";
>     print $story[headline];
>     print "</TD>";
>     print "</TR>";
>     print "<TR><TD ALIGN=RIGHT>";
>     print "<A HREF=\"page.php3?page=$pages[code]\">";
>     print "<FONT SIZE=1>Read more $pages[code] ...</FONT>";
>     print "</A>";
>     print "</TABLE>";
>   }
> }
>
> include "footer.php3";
> ?>
> #
>
> I have the following error:
>
> Fatal error: Call to unsupported or undefined function include_once() in
> include_fns.php3 on line 7
>
> It seems to me that include_once is a legal function but I can't the
> orgination of this funtion other
> than that stupid include_fns.php3 file? Any ideas on this.
>
> Configuration:
>
> OS: Solaris 2.8 10/00 on Intel Hardware.
> Apache: 1.3.9
> PHP: 3.0.15
> mysql: 3.23.46
>
> My ISP is running:
>
> OS: Irix 6.4
> Apache: 1.3.9
> PHP: 3.0.9
> mysql: 3.22.23b
>
> I do appreciate any help on this.
>
> --
> ************************************************************
> *** Phillip B. Bruce                                     ***
> *** http://pbbruce.home.mindspring.com                   ***
> *** [EMAIL PROTECTED]                               ***
> ***                                                      ***
> *** "Have you ever noticed? Anybody going slower than    ***
> *** you is an idiot, and anyone going faster than you    ***
> *** is a maniac." - George Carlin                        ***
> ************************************************************
>
> --
> 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]

--- End Message ---
--- Begin Message ---
> Hi,
> 
>     I have a couple of questions before I get to my problem.
> 
>    1. Is there any documentation that explains the differences between
> the versions of PHP?
sure. have a look at the changelog
http://www.php.net/ChangeLog-4.php

> 
>   2. Does it matter when writing php code that you specifiy the file
> name in the following
>        manner?  test.php3  test.php4 or whatever.  I'm assumming this is
> version specific.
> 
>   My Problem:
> 
>    I have the following code:

[....]

> 
> I have the following error:
> 
> 
> Fatal error: Call to unsupported or undefined function include_once() in
> include_fns.php3 on line 7
> 
> It seems to me that include_once is a legal function but I can't the
> orgination of this funtion other
> than that stupid include_fns.php3 file? Any ideas on this.
> 
> Configuration:
> 
> OS: Solaris 2.8 10/00 on Intel Hardware.
> Apache: 1.3.9
> PHP: 3.0.15
> mysql: 3.23.46
> 
> My ISP is running:
> 
> OS: Irix 6.4
> Apache: 1.3.9
> PHP: 3.0.9
> mysql: 3.22.23b
> 
> I do appreciate any help on this.
> 

include_once() was added in PHP 4.0.1pl2 

best regards
attila strauss

--- End Message ---
--- Begin Message ---
Hello,

I am working on a a script that reads in an HTML file, and outputs formatted
plain text.  Not a significant task, but one area that I am having
difficulty with is gracefully converting the 'A' element.  The desired
outcome is text that maintains the link reference in brackets:

------------------------------------
$body = "<p><a href=\"mailto:[EMAIL PROTECTED]\";>first link</a></p>
         <p><a href=\"http://www.tao.ca/\";>second link</a></p>
         <p><a href=\"http://www.tao.ca\";>http://www.tao.ca</a></p>
         <p><a href=\"mailto:[EMAIL PROTECTED]\";>[EMAIL PROTECTED]</a>";

// Regex's for dealing with HTML elements here
// Most of them omitted for simplicity
$body = preg_replace ('/<a href="(http:\/\/)(.*)".*>(.*)<\/a>/Usi', "\\3
(\\1\\2)", $body[$el]);
$body = preg_replace ('/<a href="(mailto:)(.*)".*>(.*)<\/a>/Usi', "\\3
(\\2)", $body[$el]);

//---------------//
// output        //
//---------------//

/*

first link ([EMAIL PROTECTED])
second link (http://www.tao.ca/)
http://www.tao.ca (http://www.tao.ca)
[EMAIL PROTECTED] ([EMAIL PROTECTED])

*/

------------------------------------------

The regex above deal fine for the first and second link, but leave redundant
text in the third and fourth.  Ideally, the regex expressions would not
include the text in brackets in the 3rd and 4th lines.  This is what I am
having difficulty with.  How can I incorporate such logic into my regex's?

Thank for your help,


Michael Caplan
Institute for Social Ecology
http://www.social-ecology.org/

1118 Maple Hill Road
Plainfield, VT, 05667 USA

--- End Message ---
--- Begin Message ---
I am using php to upload image files.

heres my code ..

<?
if (is_uploaded_file($photo_file))
{

clearstatcache ();
 $size = filesize ( $photo_file ) ;
 if ( $size > 1024000 )
 {
 print ("<BR> ERROR - File is too big ! File uploads should be below 1024 k
( 1mb ) <BR>"); exit ;
 }
 move_uploaded_file($photo_file, "$upload_path$check_nick->nickname");
}
 else
{
     echo "<BR> ERROR : File upload was not successfull , please try again
!<BR>";
}
?>

------

the problem is that when i look for the original filename ( e.g.
myphoto.gif ) , $photo_file contains a random file name like 383hr93php

As i mentioned , its image files i am uploading , how do i know what type of
image the file was  ? like .jpg , .png etc.

Any help appreciatted , i am really stuck on this ;0)

Thanks

Neil M



--- End Message ---
--- Begin Message ---
Can I do this? Can someone help please?

I have a mess of variables I HTML from a couple of different
scripts, so I combined them into "fields_to_include.inc"

And now, I do this:

          $news = mysql_query('select * from ccl where ... blah blah ...
order by AU asc');

          while ($data = mysql_fetch_object($news))
          {
          include "fields_to_include.inc";
          }

Of course my $data->variables I now call in *.inc do not work. ...
So how do I make "$data->AU" find it's original value using that *.inc?

---This is my fields_to_include.inc file:
------------------------------
<? php
/*
content of fields_to_include.inc
global $personne->AU; #dedfinitely does not work
I have read the FAQ.
*/

  if($data->AU != ""){echo"<tr><td><b>&lt;<a
href=\"javascript:displayHelp('codes.htm#AU');\
">AU</a>&gt;</b></td><td>".$personne->AU."</td></tr>\n";}

  if($data->ST != ""){echo"<tr><td><b>&lt;<a
href=\"javascript:displayHelp('codes.htm#ST');\
">ST</a>&gt;</b></td><td>".$personne->ST."</td></tr>\n";}

  if($data->SD != ""){echo"<tr><td><b>&lt;<a
href=\"javascript:displayHelp('codes.htm#SD');\
">SD</a>&gt;</b></td><td>".$personne->SD."</td></tr>\n";}

  if($personne->SC != ""){echo"<tr><td><b>&lt;<a
href=\"javascript:displayHelp('codes.htm#SC');\
">SC</a>&gt;</b></td><td>".$personne->SC."</td></tr>\n";}

?>



--- End Message ---

Reply via email to