php-general Digest 19 Dec 2002 13:01:52 -0000 Issue 1772

Topics (messages 128790 through 128849):

Re: *OK, more eval for today
        128790 by: Martin Towell
        128847 by: Ford, Mike               [LSS]

Re: $_SERVER['DOCUMENT_ROOT'] on localhost
        128791 by: DL Neil

Re: *Premature end of script headers
        128792 by: Dave [Hawk-Systems]
        128829 by: Alexey Lysenkov

is there php equiv left() and right() functions?
        128793 by: Jeff Bluemel
        128795 by: Matthew Gray
        128796 by: Philip Olson
        128797 by: Jeff Bluemel
        128798 by: Jeff Bluemel

Re: creating objects by reference?
        128794 by: Matthew Gray
        128814 by: Bastian Vogt

recommendation needed for dedicated server hosting
        128799 by: Taek Kwon
        128801 by: Jason Sheets
        128802 by: Tom Rogers
        128803 by: Kyle Gibson

PHP and MySQL queries
        128800 by: Beauford.2002
        128810 by: John W. Holmes
        128834 by: Rich Gray

repeat region
        128804 by: Bruce Levick
        128806 by: Jeff
        128808 by: Justin French
        128816 by: John Taylor-Johnston
        128817 by: Bastian Vogt

Re: PHP question
        128805 by: gamin

Re: checking bounce email
        128807 by: See kok Boon
        128840 by: Chris Hewitt

Re: URL parsing
        128809 by: gamin

Re: XML + XSL
        128811 by: Hristina

php + xsl + xsm
        128812 by: Hristina

Re: flush output error
        128813 by: electroteque
        128848 by: Ford, Mike               [LSS]

problem with sending pages directly from browser
        128815 by: Kocnár Peter

speet testing (was URL parsing)
        128818 by: Sean Burlington

display edited field in table
        128819 by: Lightfirst
        128821 by: Lightfirst
        128824 by: Jason Wong
        128841 by: Chris Hewitt

delete() and unlink()
        128820 by: . Nilaab
        128823 by: Jason Wong

AddType application/x-httpd-source .phps
        128822 by: Freaky

Displaying first 20 characters of a comment
        128825 by: Kevin Meredith
        128828 by: Quentin Bennett
        128832 by: Jon Haworth

sending AND recieving XML
        128826 by: K.C.P. van Zijl
        128830 by: Quentin Bennett
        128831 by: K.C.P. van Zijl

JavaScript or browser detection
        128827 by: Steve Vernon
        128835 by: fragmonster
        128839 by: Chris Hewitt

Check Uploaded File
        128833 by: shaun
        128836 by: Rich Gray

Looping needs to re-open parm file
        128837 by: Jacob van Zanen
        128838 by: Wico de Leeuw
        128842 by: Wico de Leeuw

RegExpres Prob
        128843 by: John Wards
        128844 by: Wico de Leeuw
        128845 by: John Wards
        128849 by: Wico de Leeuw

Inserting tab delimited textfiles into mysql
        128846 by: Thomas Goeminne

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 ---
argh! eval()
try this instead: $temp = ${"php_q3_$i"};
to get it directly from $HTTP_POST_VARS: $temp =
$HTTP_POST_VARS["php_q3_$i"];
simple

HTH
Martin

-----Original Message-----
From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 6:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] *OK, more eval for today


I know, it's eval = evil, but I don't see any other way I can check for 120
variables submitted via post, without making a temp variable, assigning a
value of the posted Var and checking for it (and deciding on the further run
of the script). Anyways, I took a classical eval thing and am doing fine
with it. It looks like this:

$temp = "\$php_q3_".$i; // $i is a loop index
eval ("\$temp = \"$temp\";");

works alright. Now, how do I eval directly from the $HTTP_POST_VARS?

I am trying to do this:

$tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
  eval("\$tempVar1=\"$tempVar1\";");

and am obviously failing. If you know any other way to validate 120-150
variables in a loop and then rewrite the values into the fields (checkboxes,
radios and selects) - should an error had been made - let me know.

Best Regards,
Alex

p.s. you do help! :)
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Alexey Lysenkov [mailto:[EMAIL PROTECTED]]
> Sent: 18 December 2002 19:08
> 
> 
> I am trying to do this:
> 
> $tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
>   eval("\$tempVar1=\"$tempVar1\";");
> 

Well, you have the answer right there in front of you -- why not just take the 
statement you build and eval(), and write it directly in the PHP thus:

   $tempVar1 = $HTTP_POST_VARS['q4_'.$i];

or

   $tempVar1 = $HTTP_POST_VARS["q4_$i"];

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


--- End Message ---
--- Begin Message ---
Rolf,

> > the document_root just doesn't show up in my phpinfo();
> >
> > do windows machines have one anyway?
> > I have used this var before, just not testing it locally.
> >
> > It normally shows up when I use phpifno on the server.


Please check/compare the entries for doc_root = in the two PHP.INI files.
Are they the same/given a value. NB:

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
;doc_root =;;;;;;

Regards,
=dn

--- End Message ---
--- Begin Message ---
>Guys? The support guy says that my php-script brings his php interpreter to
>crash. I am astonished (wow-what a powerful man I am :) ) - no, but really,
>it doesn't crash MY server? He also said, it happens just right after the
>file is being asked for, that is, as I suspect, somewhere in the first lines
>of my php code.

Interesting...

>I run 4.2.0, he runs 4.0.5 . Both Safe-mode "on", both, as I suspect, on
>Windows, mySQL as well.

you suspect he is on winodws or know he is? (No experience with the windows
platform and PHP myself)

>What could in these first lines of the code, which follows, bring his
>machine to death? Please, someone - it's so urgent, really...
>
>
><?php
^^^^^^
is there a space above this line?  For perl etc cgi scripts, having a space
above the hash causes this error...  might be something to check especially when
you are expecting to set cookie, session and other header related stuff, maybe
he is running as a CGI or something and causing this.

Barring that, try eliminating/commenting out chunks of code until you get the
page to at least load in some state, then start putting back untlil you narrow
down where the problem is.  Perhaps increase your error reporting...  stabbing
here.

Dave


--- End Message ---
--- Begin Message ---
I've found it! It's session thing.
Why? It stops at session_start, and moreover, I overslept this morning. Two
minutes ago it had to be ready, shit!..

I'm sorry.
At the other machine it runs as .exe not as mod, the guy said, version
4.0.5.
I can use only $HTTP_SESSION_VARS array, but I don't know how to get (and
not to set!) the session_id. I cannot think, please help.

-Alex


--- End Message ---
--- Begin Message ---
I have a string that will look like the following;

data1|data2

now - I need to put data1 in a variable, and data2 in another variable.
I've found the functions strlen, and strpos, but I can't figure how to grab
this data.

thanks,

Jeff


--- End Message ---
--- Begin Message ---
Jeff Bluemel wrote:

> I have a string that will look like the following;
> 
> data1|data2
> 
> now - I need to put data1 in a variable, and data2 in another variable.
> I've found the functions strlen, and strpos, but I can't figure how to
> grab this data.
> 
> thanks,
> 
> Jeff

Try

list($var1, $var2) = explode('|', 'data1|data2');

Matt
--- End Message ---
--- Begin Message ---
You want explode(), something like:

  list($a, $b) = explode('|', $string);


Regards,
Philip Olson


On Wed, 18 Dec 2002, Jeff Bluemel wrote:

> I have a string that will look like the following;
> 
> data1|data2
> 
> now - I need to put data1 in a variable, and data2 in another variable.
> I've found the functions strlen, and strpos, but I can't figure how to grab
> this data.
> 
> thanks,
> 
> Jeff
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
thanks...

Jeff
"Matthew Gray" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Jeff Bluemel wrote:
>
> > I have a string that will look like the following;
> >
> > data1|data2
> >
> > now - I need to put data1 in a variable, and data2 in another variable.
> > I've found the functions strlen, and strpos, but I can't figure how to
> > grab this data.
> >
> > thanks,
> >
> > Jeff
>
> Try
>
> list($var1, $var2) = explode('|', 'data1|data2');
>
> Matt


--- End Message ---
--- Begin Message ---
works great

thanks,

Jeff
"Philip Olson" <[EMAIL PROTECTED]> wrote in message
Pine.BSF.4.10.10212190240490.68100-100000@localhost">news:Pine.BSF.4.10.10212190240490.68100-100000@localhost...
>
> You want explode(), something like:
>
>   list($a, $b) = explode('|', $string);
>
>
> Regards,
> Philip Olson
>
>
> On Wed, 18 Dec 2002, Jeff Bluemel wrote:
>
> > I have a string that will look like the following;
> >
> > data1|data2
> >
> > now - I need to put data1 in a variable, and data2 in another variable.
> > I've found the functions strlen, and strpos, but I can't figure how to
grab
> > this data.
> >
> > thanks,
> >
> > Jeff
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
Jonathan Sharp wrote:

> Is it better to do:
> $obj = &new object();
> 
> verses:
> $obj = new object();
> 
> thanks,
> -js

If you are looking to the future: I don't believe the ability to return 
objects by reference will be an option in Zend Engine 2.

Matt

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

if you're interested in the future of object handling, I suppose you to
look at this: http://www.zend.com/engine2/ZendEngine-2.0.pdf

Regards,
Bastian


> If you are looking to the future: I don't believe the ability to return
> objects by reference will be an option in Zend Engine 2.
>
> Matt

--- End Message ---
--- Begin Message ---
Hi,
I recently went through a horrendous experience with two different hosting
providers.  I'd like some recommendations on excellent hosting providers if
anybody has some.

My key priorities in order are:
1) around-the-clock, technically competent TELEPHONE support (webchat
support, message boards, email based support etc. will not do!)
2) reasonable hosting fees (no more than 300/month) for a dedicated server
3) services for the following - backup, OS upgrades/patching, security

If anybody has been with a company that they're happy with for at least a
year please leave some feedback.  Thanks!




--- End Message ---
--- Begin Message ---
For server colocation or dedicated leased servers I would recommend
Hurricane Electric, they have an excellent backbone, excellent technical
support and friendly sales staff.  Their website is at
http://www.he.net.

For shared hosting I recommend pair networks ( http://www.pair.com ) or
Fidelity Hosting.

I have personally used all of these providers and have found them to be
excellent and worth recommending.

Jason

On Wed, 2002-12-18 at 21:30, Taek Kwon wrote:
> Hi,
> I recently went through a horrendous experience with two different hosting
> providers.  I'd like some recommendations on excellent hosting providers if
> anybody has some.
> 
> My key priorities in order are:
> 1) around-the-clock, technically competent TELEPHONE support (webchat
> support, message boards, email based support etc. will not do!)
> 2) reasonable hosting fees (no more than 300/month) for a dedicated server
> 3) services for the following - backup, OS upgrades/patching, security
> 
> If anybody has been with a company that they're happy with for at least a
> year please leave some feedback.  Thanks!
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Thursday, December 19, 2002, 2:30:44 PM, you wrote:
TK> Hi,
TK> I recently went through a horrendous experience with two different hosting
TK> providers.  I'd like some recommendations on excellent hosting providers if
TK> anybody has some.

TK> My key priorities in order are:
TK> 1) around-the-clock, technically competent TELEPHONE support (webchat
TK> support, message boards, email based support etc. will not do!)
TK> 2) reasonable hosting fees (no more than 300/month) for a dedicated server
TK> 3) services for the following - backup, OS upgrades/patching, security

TK> If anybody has been with a company that they're happy with for at least a
TK> year please leave some feedback.  Thanks!

I have been using http://candidhosting.com
They are very helpful, even installing my favourite linux distro (crux) and the
pricing and bandwidth are good value.
They have 24h telephone support but I have always got a good response on ICQ which is a
lot cheaper for me than a call to the US :)

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hi,
I recently went through a horrendous experience with two different hosting
providers.  I'd like some recommendations on excellent hosting providers if
anybody has some.

My key priorities in order are:
1) around-the-clock, technically competent TELEPHONE support (webchat
support, message boards, email based support etc. will not do!)
2) reasonable hosting fees (no more than 300/month) for a dedicated server
3) services for the following - backup, OS upgrades/patching, security

If anybody has been with a company that they're happy with for at least a
year please leave some feedback.  Thanks!
I've been with RackShack for a little more than a year now and I and very satisfied with them.

www.rackshack.net

Servers @ $99 per month

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/

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

I am having a real problem with variables in PHP and trying to query my
MySQL database. I have a form that a user inputs information and then that
info is used to query my database, but it's not working. I don't get any
errorrs and it appears every thing worked, but nothing gets displayed (see
code below). I know the info is getting passed from the form as it appears
correct in the address bar of my browser. The query below also works if I
use the command line in MySQL and hard code the information.

Any help is appreciated.

http://etc/etc?FromTrade=TRUE&name=1&from=2

$query = "select tmanager.idn, tmanager.total, troster.idp, user, position,
points from troster join treference
join tmanager where tmanager.idn=treference.idn and
treference.idp=troster.idp and tmanager.name like '$name' and
troster.player like '$from'";

$results = mysql_query($query) or die("Query failed");

while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {

         echo $line[idn];
         echo $line[total];
         echo $line[idp];
         echo $line[position];
         echo $line[points];

This just displays an empty page. So it appears the query found nothing, but
like I said, it works from the command line and there should be one entry
(see below). So I have to assume it is a problem with the variables.

+-----+--------+-----+--------+----------+--------+
| idn | total  | idp | user | position | points |
+-----+--------+-----+--------+----------+--------+
|   1 | 746.75 |   2 | Trevor  | F        |  45.00 |
+-----+--------+-----+--------+----------+--------+



--- End Message ---
--- Begin Message ---
So print out $query before you execute it and see what you're actually
sending to MySQL. You're apparently sending a valid query, but it's not
matching any rows...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 11:28 PM
> To: PHP General
> Subject: [PHP] PHP and MySQL queries
> 
> Hi,
> 
> I am having a real problem with variables in PHP and trying to query
my
> MySQL database. I have a form that a user inputs information and then
that
> info is used to query my database, but it's not working. I don't get
any
> errorrs and it appears every thing worked, but nothing gets displayed
(see
> code below). I know the info is getting passed from the form as it
appears
> correct in the address bar of my browser. The query below also works
if I
> use the command line in MySQL and hard code the information.
> 
> Any help is appreciated.
> 
> http://etc/etc?FromTrade=TRUE&name=1&from=2
> 
> $query = "select tmanager.idn, tmanager.total, troster.idp, user,
> position,
> points from troster join treference
> join tmanager where tmanager.idn=treference.idn and
> treference.idp=troster.idp and tmanager.name like '$name' and
> troster.player like '$from'";
> 
> $results = mysql_query($query) or die("Query failed");
> 
> while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {
> 
>          echo $line[idn];
>          echo $line[total];
>          echo $line[idp];
>          echo $line[position];
>          echo $line[points];
> 
> This just displays an empty page. So it appears the query found
nothing,
> but
> like I said, it works from the command line and there should be one
entry
> (see below). So I have to assume it is a problem with the variables.
> 
> +-----+--------+-----+--------+----------+--------+
> | idn | total  | idp | user | position | points |
> +-----+--------+-----+--------+----------+--------+
> |   1 | 746.75 |   2 | Trevor  | F        |  45.00 |
> +-----+--------+-----+--------+----------+--------+
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Does it work if you put quotes around the array keys as follows...

echo $line['idn'];
echo $line['total'];
echo $line['idp'];
echo $line['position'];
echo $line['points'];

Rich

-----Original Message-----
From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 20:28
To: PHP General
Subject: [PHP] PHP and MySQL queries


Hi,

I am having a real problem with variables in PHP and trying to query my
MySQL database. I have a form that a user inputs information and then that
info is used to query my database, but it's not working. I don't get any
errorrs and it appears every thing worked, but nothing gets displayed (see
code below). I know the info is getting passed from the form as it appears
correct in the address bar of my browser. The query below also works if I
use the command line in MySQL and hard code the information.

Any help is appreciated.

http://etc/etc?FromTrade=TRUE&name=1&from=2

$query = "select tmanager.idn, tmanager.total, troster.idp, user, position,
points from troster join treference
join tmanager where tmanager.idn=treference.idn and
treference.idp=troster.idp and tmanager.name like '$name' and
troster.player like '$from'";

$results = mysql_query($query) or die("Query failed");

while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {

         echo $line[idn];
         echo $line[total];
         echo $line[idp];
         echo $line[position];
         echo $line[points];

This just displays an empty page. So it appears the query found nothing, but
like I said, it works from the command line and there should be one entry
(see below). So I have to assume it is a problem with the variables.

+-----+--------+-----+--------+----------+--------+
| idn | total  | idp | user | position | points |
+-----+--------+-----+--------+----------+--------+
|   1 | 746.75 |   2 | Trevor  | F        |  45.00 |
+-----+--------+-----+--------+----------+--------+

--- End Message ---
--- Begin Message ---
Hi php'ers,
I have learnt alot in the last week in regards to php and listing the
rows of a table set.

I need help with a small challenge. I can retrieve rows from a database
table and list the results in HTML <tr> cell successfully. My challenge
is this.

I want to list the I.D (auto increment id number) of a data base table
in html to display 7 columns accross and then drop down to the next row
and another 7 columns accross.

So the result would list numbers .1-7 then drop down and list 8-14
underneath and so in until the end of the results.

Is this at all possible?? Difficult??

Is there a project or a tutorial with an example I can draw from.??

Cheers
--- End Message ---
--- Begin Message ---
$idx=1;
echo(<TR>)
while(fetch_rows) {
  printf("<TD>%s</TD>, ID);
  if($idx%7=0) {echo('</TR><TR>'}
  ++$idx;
}


"Bruce Levick" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi php'ers,
I have learnt alot in the last week in regards to php and listing the
rows of a table set.

I need help with a small challenge. I can retrieve rows from a database
table and list the results in HTML <tr> cell successfully. My challenge
is this.

I want to list the I.D (auto increment id number) of a data base table
in html to display 7 columns accross and then drop down to the next row
and another 7 columns accross.

So the result would list numbers .1-7 then drop down and list 8-14
underneath and so in until the end of the results.

Is this at all possible?? Difficult??

Is there a project or a tutorial with an example I can draw from.??

Cheers


--- End Message ---
--- Begin Message ---
Hi, what you want to do is only echo the <tr> and </tr> every 7 loops
through the records.

Untested example:

<table>
<?
$i = 0;
$sql = "SELECT id FROM table name";
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
    {
    $i++;
    if($i == 1) { echo "<tr>"; }
    echo "<td>{$myrow['id']}</td>";
    if($i == 7) { echo "</tr>"; $i = 0; }
    }
?>
</table>


Justin


on 19/12/02 4:27 PM, Bruce Levick ([EMAIL PROTECTED]) wrote:

> Hi php'ers,
> I have learnt alot in the last week in regards to php and listing the
> rows of a table set.
> 
> I need help with a small challenge. I can retrieve rows from a database
> table and list the results in HTML <tr> cell successfully. My challenge
> is this.
> 
> I want to list the I.D (auto increment id number) of a data base table
> in html to display 7 columns accross and then drop down to the next row
> and another 7 columns accross.
> 
> So the result would list numbers .1-7 then drop down and list 8-14
> underneath and so in until the end of the results.
> 
> Is this at all possible?? Difficult??
> 
> Is there a project or a tutorial with an example I can draw from.??
> 
> Cheers
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Jeff or anyone,

Ok, I'll bight. What are you doing with the % and %7 ?


> $idx=1;
> echo(<TR>)
> while(fetch_rows) {
>   printf("<TD>%s</TD>, ID);
>   if($idx%7=0) {echo('</TR><TR>'}
>   ++$idx;

--- End Message ---
--- Begin Message ---
>From the manual:
  example: $a % $b
  name: Modulus
  value: Remainder of $a divided by $b.

Not from the manual:
  example2: 47 % 5
  value2: 2

HTH,
Bastian



> Jeff or anyone,
>
> Ok, I'll bight. What are you doing with the % and %7 ?
>
> > $idx=1;
> > echo(<TR>)
> > while(fetch_rows) {
> >   printf("<TD>%s</TD>, ID);
> >   if($idx%7=0) {echo('</TR><TR>'}
> >   ++$idx;

--- End Message ---
--- Begin Message ---
Have a look at suexec

HTH
gamin


"Tom Ray" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are PHP script supposed to run as the user or as the web server?
> Currently I'm running Red Hat 7.3 with apache 1.3.x and all my PHP
> scripts run as apache, not as the user. I'm wonder if I can run the
> scripts as the user and how do I fix this?
>
> Any help would be great!
>


--- End Message ---
--- Begin Message ---
 

Hi,

 

Can someone kindly teach me how to check for bounced emails when I use
mail() to send emails?

 

OR

 

Tell me whether there are other mail functions which can accomplish
that.

 

Thanks in advance

 

kokboon

--- End Message ---
--- Begin Message ---
See kok Boon wrote:

Can someone kindly teach me how to check for bounced emails when I use
mail() to send emails?

Its the "Return-To" smtp field that has the address that bounces are to be notified to. Using mail() I think this can be set with the last parameter.

I'm being a bit vague here as I don't have this set in my use of mail(). Where I need it I've used the smtp class from Manuel Lemos on www.phpclasses.org.

HTH
Chris

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

  if your URL is going to have this format consistently try this

$data = explode("/",$URL);
$user = $data[3];

HTH (untested code)

gamin.


"Mako Shark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've got a URL like this:
>
> http://www.naturalist.com/~fungae/index.php
>
> which is stored in $http_referer (as parse_url from
> $HTTP_REFERER).
>
> I'm trying to extract the username (~fungae). I've
> read the docs on parse_url(), and have tried to get
> $http_referer[user], but it comes up with zilch. I've
> also tried to print_r $http_referer, but I only get
> scheme, host, path, and query. Any ideas?
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com




--- End Message ---
--- Begin Message ---
hello!
I have the following problem:
<table border="1">
 <xsl:for-each select="manifactures/man">
      <xsl:if test="(position() mod 6) = 1">
      <TR>
        <TD>
             <xsl:value-of select="."/></TD>
        <TD>
                <xsl:value-of
select="following-sibling::man[position()=1]"/>
           </TD>
         <TD><xsl:value-of
select="following-sibling::man[position()=2]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=3]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=4]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=5]"/></TD>
      </TR>
    </xsl:if>

      </xsl:for-each>
     </table>

I want to display text from nodes in xsm file, but after every text to put
picture with link.
The rows above dispay the text correctly in a table with 6 columns. But how
to put the pucture
and to display it only in cells where there is text?

Thanks a lot





--- End Message ---
--- Begin Message ---
hello!
I have the following problem:
<table border="1">
 <xsl:for-each select="manifactures/man">
      <xsl:if test="(position() mod 6) = 1">
      <TR>
        <TD>
             <xsl:value-of select="."/></TD>
        <TD>
                <xsl:value-of
select="following-sibling::man[position()=1]"/>
           </TD>
         <TD><xsl:value-of
select="following-sibling::man[position()=2]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=3]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=4]"/></TD>
  <TD><xsl:value-of select="following-sibling::man[position()=5]"/></TD>
      </TR>
    </xsl:if>

      </xsl:for-each>
     </table>

I want to display text from nodes in xsm file, but after every text to put
picture with link.
The rows above dispay the text correctly in a table with 6 columns. But how
to put the pucture
and to display it only in cells where there is text?

Thanks a lot





--- End Message ---
--- Begin Message ---
sorry about the false alarm , if you go here u will see a working example

http://galleries.dyndns.org:1023/progress.php

i had to add both flush functions together to work , obviosuly flsuh is not
emptying the buffer within a loop, is this still a bug ?

flush();
 ob_flush();

"Wico De Leeuw" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 20:41 18-12-02 +1100, you wrote:
> >hi guys i have a little problem with flushing the buffer output, in this
> >loop it should be downloading a file and changing the progress of a
progress
> >bar, although it waits until the shell_exec of all the files are done and
> >then flushes the buffer which will start @ 95% , so it wont start until
> >shell_exec is finished , is this a bug ?
>
> php can't multitask, so it's not a bug
> what you can try:
>
> page1: (start process)
> put an ignore_user_abort on it
> put a header location on it to page2
> start the command and let it write to a file where it is
>
> page 2 :
> read the file and display a processbar
> (with javascript or meta refresh)
> when done goto page3
>
> page3:
> continue
>
>
>
> >foreach ($filename as $file){
> >      shell_exec("curl -O ".$url.$file);
> >      //shell_exec("wget ".$url.$file);
> >      //echo $file;
> >
>
>$bar->progressbar_percentage($i,$filename,'NewWin','Percentage','Downloadin
g
> >'.$file);
> >      $i++;
> >   }
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: electroteque [mailto:[EMAIL PROTECTED]]
> Sent: 19 December 2002 07:52
> 
> sorry about the false alarm , if you go here u will see a 
> working example
> 
> http://galleries.dyndns.org:1023/progress.php
> 
> i had to add both flush functions together to work , 
> obviosuly flsuh is not
> emptying the buffer within a loop, is this still a bug ?
> 
> flush();
>  ob_flush();

Well, if you use PHP's output buffering, you actually have two buffers: the "output 
buffer" which can be manipulated and accessed from within your script using the ob_*() 
functions, and what might be called the "connection buffer" which exists in the 
general PHP environment and is not accessible to your script, but can be flushed with 
the flush() function or by setting implicit_flush to on.

When you do ob_flush(), this flushes the output buffer to the connection buffer; 
flush() flushes the connection buffer, via the HTTP connection, to your browser.  (The 
browser may then buffer it itself, e.g. whilst waiting for a </table> tag to show up, 
but that's another matter!)  So, yes, if you have output buffering on you need both 
ob_flush() and flush() (in that order!) to flush all pending output to the browser.

For your application, I would question whether you need output buffering on -- it 
seems to be causing you problems rather than solving them!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
I have problem with sending pages directly(by Send->Page
by E-mail...) from browser(ie6) with Outlook 2002. It
tells:"The current document type can not be sent as
mail.Would you like to send a Short cut instead?". The
pages use php sessions and it is https with 128 bit
encryption. I found that it is caused by the combination
of https and php session. Is there a solution?
Thanks in advance.
Peter


--- End Message ---
--- Begin Message ---
1LT John W. Holmes wrote:

Assuming $url is what you have above:

$tilde = strpos($url,"~");
$slash = strpos($url,"/",$tilde);
$length = $slash - $tilde;

$username = substr($url,$tilde,$length);

Or you can use a regular expression, but the above is probably faster.

preg_match("!(~[^/]*)/!",$url,$match);
or
preg_match("!(~.*)/!U",$url,$match);

In my tests, the first solution (using strpos) was the fastest by 35%.

---John Holmes...


Hi John,
Ive been very interested to note that you seem to have a very keen idea of the relative speed of different functions.

I wonder if you could pass on some pointers for speed testing.

thanks

--

Sean

--- End Message ---
--- Begin Message ---
I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result-display the table along with the
updated field. What am I doing wrong? He is my code:

<?php

include "./common_db.inc"; //sets up databse stuff

db_connect("test");

GLOBAL $PHP_SELF;

?>

<html>

<?php

if ($id){

$query = "UPDATE questions SET answer = '$a' Where q_id = '$id'";

$result = mysql_query($query);

if (!$result) error_message(sql_error());

}

$query = "SELECT * FROM questions";

$result = mysql_query($query);

if (!result) error_message (sql_error());

?>

<table width=75% border=1>

<?php while($query_data = mysql_fetch_array($result)) { ?>

<form name="update" method="post" action="<?php echo $PHP_SELF?>">

<TR>

<? $id = $query_data ["q_id"];

$q = $query_data ["question"];

$a = $query_data ["answer"]; ?>

<TD WIDTH=5% ALIGN=CENTER> <?php echo"$id"; ?> </TD>

<TD WIDTH=70% ALIGN=CENTER> <?php echo"$q"; ?> </TD>

<TD WIDTH=15% ALIGN=CENTER> <input type="text" name="textfield" value="<?php
echo"$a"; ?>"> </TD>

<TD WIDTH=10% ALIGN=CENTER> <input type="submit" name="input"
value="Update">

</form>

</TD>

</TR>

<?php }?>

</table>

</html>

-Thanks.



--- End Message ---
--- Begin Message ---
I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result- display the table along with the
updated field. What am I doing wrong? He is my code:

<?php

include "./common_db.inc"; file://sets up databse stuff

db_connect("test");

GLOBAL $PHP_SELF;

?>

<html>

<?php

if ($id){

$query = "UPDATE questions SET answer = '$a' Where q_id = '$id'";

$result = mysql_query($query);

if (!$result) error_message(sql_error());

}

$query = "SELECT * FROM questions";

$result = mysql_query($query);

if (!result) error_message (sql_error());

?>

<table width=75% border=1>

<?php while($query_data = mysql_fetch_array($result)) { ?>

<form name="update" method="post" action="<?php echo $PHP_SELF?>">

<TR>

<? $id = $query_data ["q_id"];

$q = $query_data ["question"];

$a = $query_data ["answer"]; ?>

<TD WIDTH=5% ALIGN=CENTER> <?php echo"$id"; ?> </TD>

<TD WIDTH=70% ALIGN=CENTER> <?php echo"$q"; ?> </TD>

<TD WIDTH=15% ALIGN=CENTER> <input type="text" name="textfield" value="<?php
echo"$a"; ?>"> </TD>

<TD WIDTH=10% ALIGN=CENTER> <input type="submit" name="input"
value="Update">

</form>

</TD>

</TR>

<?php }?>

</table>

</html>

-Thanks.



--- End Message ---
--- Begin Message ---
On Thursday 19 December 2002 17:44, Lightfirst wrote:
> I am using Php/MySql and I am trying to display a table and have one of the
> fields (answer) editable. What I would like is to have the user edit the
> field and then click update. The result- display the table along with the
> updated field. What am I doing wrong? He is my code:

We won't know what you're doing wrong if you don't tell us what the problem 
is. __What happens__ when you run your code? Does the monitor blow up or 
what?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Q:      How was Thomas J. Watson buried?
A:      9 edge down.
*/

--- End Message ---
--- Begin Message ---
Lightfirst wrote:

I am using Php/MySql and I am trying to display a table and have one of the
fields (answer) editable. What I would like is to have the user edit the
field and then click update. The result-display the table along with the
updated field. What am I doing wrong? He is my code:

I think it would be helpful if you mentioned exactly what error/problem you are getting, that is, how does it not work?

HTH
Chris

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

I'm using a test server on Windows XP. I have the following function (which
I got from the comment notes on php.net) that works wonders when deleting
directories that are not empty on a Windows system. But, I'm a bit confused.
I searched for the delete() function on php.net and it said that delete()
was not a real function, but a dummy manual entry for those who are actually
looking for the unlink() function. So then why does the delete() function
work in my script? I tried using the unlink() function in place of the
delete() function, but unlink() gave me many errors (possibly because of
permissions). Is there an error in the manual or is it just me? Is there a
difference in the two functions? Does the delete() function not care about
permissions as opposed to the unlink() function? This is really bugging me.
Can someone clear the air?

$c_dir = "$DOCUMENT_ROOT/world/admin/backup2";  // current directory

function delete($dir) {
 if (file_exists($dir)) {
    umask(0);
    chmod($dir,0777);
   if (is_dir($dir)) {
     $handle = opendir($dir);
     while($dirname = readdir($handle)) {
       if ($dirname != "." && $dirname != "..") {
        delete($dir."/".$dirname);
       }
     }
    closedir($handle);
     rmdir($dir);
   } else {
    unlink($dir);
   }
 }
}

delete ($c_dir);

--- End Message ---
--- Begin Message ---
On Thursday 19 December 2002 17:39, [EMAIL PROTECTED] wrote:
> Hello Everyone,
>
> I'm using a test server on Windows XP. I have the following function (which
> I got from the comment notes on php.net) that works wonders when deleting
> directories that are not empty on a Windows system.

Good.

> But, I'm a bit
> confused. I searched for the delete() function on php.net and it said that
> delete() was not a real function, but a dummy manual entry for those who
> are actually looking for the unlink() function. 

delete() is a dummy entry in the manual so people looking for said function 
will be directed to unlink() which is the correct function to use.

> So then why does the
> delete() function work in my script? 

delete() is undefined in php, that is why you can define your own function 
called delete().

> I tried using the unlink() function in
> place of the delete() function, but unlink() gave me many errors (possibly
> because of permissions).

unlink() can only remove/delete directories that are empty.

> Is there an error in the manual or is it just me?

There's no error in the manual (with regards to this subject). Probably a 
misunderstanding on your part.

> Is there a difference in the two functions? Does the delete() function not
> care about permissions as opposed to the unlink() function? This is really
> bugging me. Can someone clear the air?

The delete() function as defined below is recursive and will automatically go 
inside non-empty directories and empty them first.

> $c_dir = "$DOCUMENT_ROOT/world/admin/backup2";  // current directory
>
> function delete($dir) {
>  if (file_exists($dir)) {
>     umask(0);
>     chmod($dir,0777);
>    if (is_dir($dir)) {
>      $handle = opendir($dir);
>      while($dirname = readdir($handle)) {
>        if ($dirname != "." && $dirname != "..") {
>         delete($dir."/".$dirname);
>        }
>      }
>     closedir($handle);
>      rmdir($dir);
>    } else {
>     unlink($dir);
>    }
>  }
> }
>
> delete ($c_dir);

To summarise -- there is no delete() function in php, the delete() function 
you're using is a user-defined function and as such will do whatever you can 
make it do.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Garbage In -- Gospel Out.
*/

--- End Message ---
--- Begin Message ---
Hey there,

I'm trying to get .phps served in full color but it doesn't seem to
work.. I added AddType application/x-httpd-php-source .phps right under
the line for the application/x-httpd-php .php and I know the server sees
it because when I browse to myserver/myphpscript.phps netscape says
receiving file of type application/x-httpd-php-source open/save.

Last time I used this feature was several years ago with PHP3. This
function is still in the INSTALL file that came with my PHP 4.2.3 tho'.

Was this function removed or something?

Regards



--- End Message ---
--- Begin Message ---
Hi.

I am trying to find out what the best way is to display only the first 20 or
so characters of a comment.  The comments which are entered separately by
users are stored in a MySql database.  I am displaying a list of the last 5
entries on the home page and then linking them to the relevant comments and
details.  However the comments are to long so I want to display only the
first portion, kind of like a intro for users to get an idea and then read
further.

I am not sure if it is best to do it with the select statement or format it
with the PHP.  Either way I am not sure how.

many thanks
Kevin

--- End Message ---
--- Begin Message ---
 
 The information contained in this email is privileged and confidential and intended for the addressee only. If you are not the intended recipient, you are asked to respect that confidentiality and not disclose, copy or make use of its contents. If received in error you are asked to destroy this email and contact the sender immediately. Your assistance is appreciated.
select left(myfield,20) from mytable;
-----Original Message-----
From: Kevin Meredith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 December 2002 11:03 p.m.
To: PHP
Subject: [PHP] Displaying first 20 characters of a comment


Hi.

I am trying to find out what the best way is to display only the first 20 or
so characters of a comment.  The comments which are entered separately by
users are stored in a MySql database.  I am displaying a list of the last 5
entries on the home page and then linking them to the relevant comments and
details.  However the comments are to long so I want to display only the
first portion, kind of like a intro for users to get an idea and then read
further.

I am not sure if it is best to do it with the select statement or format it
with the PHP.  Either way I am not sure how.

many thanks
Kevin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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

> I am trying to find out what the best way is to display only
> the first 20 or so characters of a comment.  
[...]
> I am not sure if it is best to do it with the select statement 
> or format it with the PHP.  Either way I am not sure how.

If you only want the first 20 characters, and that's all you ever want, it's
probably best to do it with the select statement, because then you're not
spending time and bandwidth getting data you don't need from your database.

"SELECT LEFT(someField, 20) FROM someTable" will get you the first 20
characters.

Of course, you now have a problem with words splitting :-)

You can get around this either by grabbing the whole comment and splitting
it on spaces, or by having a separate "synopsis" field in your database
(this is how I do it).

Cheers
Jon


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

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I’ve installed the
curl RPM package)? 

2. Or perhaps “fsockeropen()” could do the job.

 

In both cases I don’t have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel

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

We are doing the exact same thing using a simple HTTP Post - the receiving PHP 
receives the XML, processes it, and sends back an XML answer.

Works great.

Hope this helps.

Quentin

-----Original Message-----
From: K.C.P. van Zijl [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 December 2002 10:52 a.m.
To: [EMAIL PROTECTED]
Subject: [PHP] sending AND recieving XML


Hello,

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I've installed the
curl RPM package)? 

2. Or perhaps "fsockeropen()" could do the job.

 

In both cases I don't have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel

The information contained in this email is privileged and confidential and
intended for the addressee only. If you are not the intended recipient, you 
are asked to respect that confidentiality and not disclose, copy or make use 
of its contents. If received in error you are asked to destroy this email 
and contact the sender immediately. Your assistance is appreciated.
--- End Message ---
--- Begin Message ---
Hello,

 

I'm building this web application that has to communicate with some
other web servers. This communication is done by sending and receiving
XML. I discovered I don't have curl support compiled in PHP and was
wondering if there are other ways to send and receive XML? 

 

1. Perhaps I can communicate with curl by using exec (I’ve installed the
curl RPM package)? 

2. Or perhaps “fsockeropen()” could do the job.

 

In both cases I don’t have any experience with any of these 2 functions.
Does anyone have an example for me?

 

Thanks,

Karel

--- End Message ---
--- Begin Message ---
Hiya,
    I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!

    I have a script that adds nice features to my webpage, but if JavaScript
is off the site still can be used. Basically the script does not work in
Netscape 4.08 but works above that, so either I could bracket out and check
the code, but in this case I cannot as it is code I am not allowed to alter,
and I include it, it is not in my HTML file.

    So I need a way to say in PHP this is a bad web browser for JavaScript,
so ignore this bit of the file.

    Thanks,

    Steve

--- End Message ---
--- Begin Message --- Hope it helps you: http://developer.netscape.com/docs/examples/javascript/browser_type_oo.html

Steve Vernon wrote:
Hiya,
    I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!

    I have a script that adds nice features to my webpage, but if JavaScript
is off the site still can be used. Basically the script does not work in
Netscape 4.08 but works above that, so either I could bracket out and check
the code, but in this case I cannot as it is code I am not allowed to alter,
and I include it, it is not in my HTML file.

    So I need a way to say in PHP this is a bad web browser for JavaScript,
so ignore this bit of the file.

    Thanks,

    Steve


--- End Message ---
--- Begin Message ---
Steve Vernon wrote:

I know it is probably out there somewhere, but I cannot find out a
script to detect the browser. I have seen it, and I sorta remember how to do
it, but I just can't find it!

From memory, a full script was posted to this list in the last few days.

HTH
Chris

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

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help


--- End Message ---
--- Begin Message ---
Shaun

Run getimagesize() on the uploaded file - if a valid jpeg the returned
array[2] will be set to 2...

http://www.php.net/manual/en/function.getimagesize.php

HTH
Rich

-----Original Message-----
From: shaun [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 02:24
To: [EMAIL PROTECTED]
Subject: [PHP] Check Uploaded File


Hi,

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


<?

if (!($FileContent = file("d:\MyPhp\\test.ora")))
{
 Print ("File could not be opened");
 exit;
}
while (list ($LineNum, $Line) = each ($FileContent))
{
 // Open an ini file
 if (!($IniContent = file("d:\MyPhp\initORA.ini")))
 {
  Print ("File could not be opened");
  exit;
 }
 while (list($KeyNum, $IniParm) = each($IniContent))
 {
  if (strstr($Line,rtrim($IniParm)))
     {
      print ("$Line<BR>\n");
     }
 }
}
?>


--- End Message ---
--- Begin Message ---
Did you look at:
http://www.php.net/manual/en/function.file.php
Puts all lines in an array

Gr,

At 12:00 19-12-02 +0100, Jacob van Zanen wrote:
Hi All,

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


<?

if (!($FileContent = file("d:\MyPhp\\test.ora")))
{
 Print ("File could not be opened");
 exit;
}
while (list ($LineNum, $Line) = each ($FileContent))
{
 // Open an ini file
 if (!($IniContent = file("d:\MyPhp\initORA.ini")))
 {
  Print ("File could not be opened");
  exit;
 }
 while (list($KeyNum, $IniParm) = each($IniContent))
 {
  if (strstr($Line,rtrim($IniParm)))
     {
      print ("$Line<BR>\n");
     }
 }
}
?>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Hiya

something like this
<?
if ($FileContent = file("d:\MyPhp\\test.ora") AND $IniContent = file("d:\MyPhp\initORA.ini")) {
foreach($FileContent AS $line) {
if (in_array($line, $iniContent)) {
echo "$Line<BR>\n";
}
}
}
?>

At 12:00 19-12-02 +0100, Jacob van Zanen wrote:
Hi All,

I'm reading a paramter file and a text file.
Per line of the text file I want to check if there is a word in there from
the parameter file.
However I need to open and read the parameter file for each line in the text
file. How can I change this?

Followin is the code I have.


<?

if (!($FileContent = file("d:\MyPhp\\test.ora")))
{
 Print ("File could not be opened");
 exit;
}
while (list ($LineNum, $Line) = each ($FileContent))
{
 // Open an ini file
 if (!($IniContent = file("d:\MyPhp\initORA.ini")))
 {
  Print ("File could not be opened");
  exit;
 }
 while (list($KeyNum, $IniParm) = each($IniContent))
 {
  if (strstr($Line,rtrim($IniParm)))
     {
      print ("$Line<BR>\n");
     }
 }
}
?>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I have a regexp problem

I want to go through some HTML and where <img src="path/to/image.jpg"> I want 
to change it to this <img src="http://www.domain.com/path/to/image.jpg";>

BUT

if the image tag is like this 

<img src="http://www.domain.com/path/to/image.jpg";>

already I don't want anything to happen........

I thought this would do it:

ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string);

but it didn't...............

Argh...

Cheers
John Wards
--- End Message ---
--- Begin Message ---
At 11:18 19-12-02 +0000, John Wards wrote:
I have a regexp problem

I want to go through some HTML and where <img src="path/to/image.jpg"> I want
to change it to this <img src="http://www.domain.com/path/to/image.jpg";>

BUT

if the image tag is like this

<img src="http://www.domain.com/path/to/image.jpg";>

already I don't want anything to happen........

I thought this would do it:

ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string);
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);



but it didn't...............

Argh...

Cheers
John Wards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote:
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);

Ha! Ta........

I am all for quick fixes but I am new to RegExpresions...so could someone 
explain what its all doing for me.....

Cheers
John

--- End Message ---
--- Begin Message ---
At 11:27 19-12-02 +0000, John Wards wrote:
On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote:
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);

1. find src="
2. look forward if next chars are http://
i=not case sensitive
S=optimize pattern because we going to use is many times

You should add also a check if it starts with <img and check for single qoutes
like this:

Preg_Replace('~(<img\s+(.*?)(?!\s)src=["']?)(?!http://)~iS', '\1http://www.domain.com/', $string);


Gr,


Ha! Ta........

I am all for quick fixes but I am new to RegExpresions...so could someone
explain what its all doing for me.....

Cheers
John

--- End Message ---
--- Begin Message ---
I got a tab delimited file which looks like this:

let us call it items.txt

Type    Catalog Number    Item Description    Side B    Producer
12     AAA502     Afu Ra-D&D Soundclash Mic Stance, Premeir,Curt Cazall
12     AC725     Roc Raida/Wayne-O - Gong     Show Burn That Ass     Roc
Raida

I want to take all this info and insert it into my mysql dbase. The type is
in a table named categories. The rest should go into the table named items.
With also the id number off the categorie in it.

I have been looking for info on how to do this but I can't find a decent
article about it. First off I dump all the records which were already in the
dbase. And then it needs to get filled up with the new items.txt

I would appreciate your help
greets
--
Thomas Goeminne


--- End Message ---

Reply via email to