php-general Digest 1 Apr 2002 17:26:15 -0000 Issue 1261

Topics (messages 90922 through 90978):

Re: return
        90922 by: eric.coleman.zaireweb.com
        90923 by: Jordan
        90924 by: Rasmus Lerdorf
        90925 by: Miguel Cruz
        90926 by: Miguel Cruz
        90931 by: jtjohnston

Getting rid of Web Page has expired
        90927 by: David Johansen

Re: problems trying to use PHP to choose CSS
        90928 by: Timothy J. Luoma

database security - sql injection
        90929 by: Geoff

server side includes
        90930 by: jtjohnston

Re: PHP / cgiwrap - weird problem
        90932 by: jtjohnston

Experiences with vPopmail functions?
        90933 by: Johannes Tyra [BrainData]
        90937 by: Jason Wong

Re: HTML Question
        90934 by: gaukia 345

declaring properties
        90935 by: caspar kennerdale

newbie question: how to recompile PHP?
        90936 by: Bogdan Popescu

Re: Help with nested if statements, is this possible?
        90938 by: martinahingis
        90957 by: Hugh Bothwell

Programming Methodology Question
        90939 by: jon

Problems reading a URL
        90940 by: Stephen Phillips
        90945 by: Jason Wong
        90946 by: Rick Emery
        90947 by: Rick Emery
        90948 by: J. Scott Johnson
        90959 by: Stephen Phillips

Re: FREE HOSTING
        90941 by: martinahingis

Forum with PHP, without using mySQL..
        90942 by: MiXmAsTeR
        90943 by: James Arthur
        90944 by: eric.coleman.zaireweb.com
        90950 by: Andrew Brampton

Re: Processing Code created on the fly
        90949 by: Erik Price

Problem with CGI mode
        90951 by: James Arthur

Using PHP to access an AS 400 database
        90952 by: Rance Hall
        90956 by: Geoff Hankerson

Has anyone looked at phpinfo today?
        90953 by: James Arthur
        90955 by: Tyler Longren

Re: Sql results
        90954 by: Erik Price

Re: register_globals
        90958 by: Erik Price
        90961 by: Rasmus Lerdorf

Re: ask for suggestion about printing
        90960 by: Erik Price
        90962 by: Michael Kimsal

Re: Issues with long SQL inserts
        90963 by: Chris Snyder
        90972 by: Chris Snyder

Re: IMPORTANT question for anyone using XSLT
        90964 by: Erik Price

Recommendation for PHP Shopping Cart
        90965 by: jeremy spielmann
        90967 by: Jason Sheets
        90968 by: Dennis Moore

Please help with code
        90966 by: Denis L. Menezes
        90969 by: Andrew Brampton
        90970 by: Denis L. Menezes
        90971 by: Erik Price
        90973 by: Rick Emery
        90977 by: Harry Yu

tired by linux - recompiling.._PHP SERVER
        90974 by: Septic Flesh
        90975 by: Demitrious S. Kelly

imap crashes
        90976 by: Duncan

Parsing error
        90978 by: news.php.net

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 ---
But to answer your question

The purpose of return, is to "return" a value..

function test($var)
{
     return addslashes($var);
}

$foo = "Yes, I'am Very Awsome";
$foo = test($foo);
echo($foo);
// echo's, Yes I\'am Very Awsome

Understand?

----- Original Message -----
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Gary" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, March 31, 2002 11:43 PM
Subject: Re: [PHP] return


> Nope, that code makes no sense.  $_POST is an array containing the POST
> variables.  You make a copy of that array an put it in $foo thereby
> overwriting the passed in $foo.  Then you return $$foo which actually ends
> up returning a variable named $Array.  It does not look like you have a
> $Array variable in scope, and it is surely not what the misguided coder
> behind this code was trying to achieve.  In short, this is completely
> bogus.
>
> -Rasmus
>
> On Sun, 31 Mar 2002, Gary wrote:
>
> > Can someone explain to me the reason for using return.
> >
> > function _getValue($foo)
> > {
> > $foo = $_POST;
> > return ${$foo};
> > }
> >
> > TIA
> > Gary
> >
> >
> > --
> > 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
>
>
>

--- End Message ---
--- Begin Message ---
Eric,

Isnt there really no need for the 'return' though?

$test ($var)
{
    addslashes($var)
}

$foo = "He's dreaming";
$foo = test($foo);
print($foo);
//should also print He\'s dreaming

Am I incorrect in thinking this?

-Jordan K. Martin
http://www.newimagedesign.com


Eric Coleman <[EMAIL PROTECTED]> wrote in message
018e01c1d93d$cd404be0$0201a8c0@zaireweb">news:018e01c1d93d$cd404be0$0201a8c0@zaireweb...
> But to answer your question
>
> The purpose of return, is to "return" a value..
>
> function test($var)
> {
>      return addslashes($var);
> }
>
> $foo = "Yes, I'am Very Awsome";
> $foo = test($foo);
> echo($foo);
> // echo's, Yes I\'am Very Awsome
>
> Understand?
>
> ----- Original Message -----
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Gary" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Sunday, March 31, 2002 11:43 PM
> Subject: Re: [PHP] return
>
>
> > Nope, that code makes no sense.  $_POST is an array containing the POST
> > variables.  You make a copy of that array an put it in $foo thereby
> > overwriting the passed in $foo.  Then you return $$foo which actually
ends
> > up returning a variable named $Array.  It does not look like you have a
> > $Array variable in scope, and it is surely not what the misguided coder
> > behind this code was trying to achieve.  In short, this is completely
> > bogus.
> >
> > -Rasmus
> >
> > On Sun, 31 Mar 2002, Gary wrote:
> >
> > > Can someone explain to me the reason for using return.
> > >
> > > function _getValue($foo)
> > > {
> > > $foo = $_POST;
> > > return ${$foo};
> > > }
> > >
> > > TIA
> > > Gary
> > >
> > >
> > > --
> > > 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
> >
> >
> >
>


--- End Message ---
--- Begin Message ---
Well, you could do it without a return, but first, addslashes() returns
the modified string, it does not do in-place replacement.  And second, you
would need to pass the string in by reference, like this:

function test (& $var)
{
    $var = addslashes($var)
}

$foo = "He's dreaming";
test($foo);
print($foo);

-Rasmus

On Mon, 1 Apr 2002, Jordan wrote:

> Eric,
>
> Isnt there really no need for the 'return' though?
>
> $test ($var)
> {
>     addslashes($var)
> }
>
> $foo = "He's dreaming";
> $foo = test($foo);
> print($foo);
> //should also print He\'s dreaming
>
> Am I incorrect in thinking this?
>
> -Jordan K. Martin
> http://www.newimagedesign.com
>
>
> Eric Coleman <[EMAIL PROTECTED]> wrote in message
> 018e01c1d93d$cd404be0$0201a8c0@zaireweb">news:018e01c1d93d$cd404be0$0201a8c0@zaireweb...
> > But to answer your question
> >
> > The purpose of return, is to "return" a value..
> >
> > function test($var)
> > {
> >      return addslashes($var);
> > }
> >
> > $foo = "Yes, I'am Very Awsome";
> > $foo = test($foo);
> > echo($foo);
> > // echo's, Yes I\'am Very Awsome
> >
> > Understand?
> >
> > ----- Original Message -----
> > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > To: "Gary" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Sunday, March 31, 2002 11:43 PM
> > Subject: Re: [PHP] return
> >
> >
> > > Nope, that code makes no sense.  $_POST is an array containing the POST
> > > variables.  You make a copy of that array an put it in $foo thereby
> > > overwriting the passed in $foo.  Then you return $$foo which actually
> ends
> > > up returning a variable named $Array.  It does not look like you have a
> > > $Array variable in scope, and it is surely not what the misguided coder
> > > behind this code was trying to achieve.  In short, this is completely
> > > bogus.
> > >
> > > -Rasmus
> > >
> > > On Sun, 31 Mar 2002, Gary wrote:
> > >
> > > > Can someone explain to me the reason for using return.
> > > >
> > > > function _getValue($foo)
> > > > {
> > > > $foo = $_POST;
> > > > return ${$foo};
> > > > }
> > > >
> > > > TIA
> > > > Gary
> > > >
> > > >
> > > > --
> > > > 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
>

--- End Message ---
--- Begin Message ---
On Mon, 1 Apr 2002, Jordan wrote:
> Isnt there really no need for the 'return' though?

Try this program and see what happens:

<?
   function triple1($x) { $x = $x * 3; return $x; }

   function triple2($x) { $x = $x * 3; }

   function triple3($x) { global $x; $x = $x * 3; }

   $x = 5; $x = triple1($x) print '<p>triple1: ' . $x;
   $x = 5; print '<p>triple1 return: ' . triple1($x);
   $x = 5; $x = triple2($x) print '<p>triple2: ' . $x;
   $x = 5; print '<p>triple2 return: ' . triple2($x);
   $x = 5; $x = triple3($x) print '<p>triple3: ' . $x;
   $x = 5; print '<p>triple3 return: ' . triple3($x);
?>

miguel

--- End Message ---
--- Begin Message ---
On Sun, 31 Mar 2002, Miguel Cruz wrote:
> On Mon, 1 Apr 2002, Jordan wrote:
>> Isnt there really no need for the 'return' though?
> 
> Try this program and see what happens:

Ah, Rasmus brings up a good point. Try this one instead.

<?
   function triple1($x) { $x = $x * 3; return $x; }

   function triple2($x) { $x = $x * 3; }

   function triple3($x) { global $x; $x = $x * 3; }

   function triple4(&$x) { $x = $x * 3; }

   $x = 5; $x = triple1($x) print '<p>triple1: ' . $x;
   $x = 5; print '<p>triple1 return: ' . triple1($x);
   $x = 5; $x = triple2($x) print '<p>triple2: ' . $x;
   $x = 5; print '<p>triple2 return: ' . triple2($x);
   $x = 5; $x = triple3($x) print '<p>triple3: ' . $x;
   $x = 5; print '<p>triple3 return: ' . triple3($x);
   $x = 5; $x = triple4($x) print '<p>triple4: ' . $x;
   $x = 5; print '<p>triple4 return: ' . triple4($x);
?>

miguel

--- End Message ---
--- Begin Message ---
Gary,
To add to the conversation ...

You created a function to pass something through it, to process something and
now you want to get something back, right? That's what return does. It gets
something back for your effort.

You could simply:

echo addslashes($var);

But let's say you do it a hundred times in the course of a script. You don't
want to take up a hundred lines of code doing:

echo addslashes($var);

... so you create a function like Eric has below, which takes up 3 or 4 lines of
code, but has the capacity to repeat the same line of code 100 times.

John

> The purpose of return, is to "return" a value..
> function test($var)
> {
>      return addslashes($var);
> }
>
> $foo = "Yes, I'am Very Awsome";
> $foo = test($foo);
> echo($foo);
> // echo's, Yes I\'am Very Awsome

--- End Message ---
--- Begin Message ---
I was just wondering what I had to do to get rid of the Web Page has expired
thing when my php page is calling itself and the user hits back. It only
does it on the last page for some reason. Thanks,
Dave


--- End Message ---
--- Begin Message ---
On Sat, 30 Mar 2002, Hugh Bothwell wrote:

Thanks to Hugh for his help... his PHP code was perfect... it was exactly
what it took to get it done.

Just a few minor notes:

I was able to keep the echo <<< EOD statements which I prefer for this
particular implementation, and I kept

        <form action="$PHP_SELF" method='post'>

so that it would pass validation... (missing an 'action' was causing an
error).


That said, it was Hugh's PHP code that took this from being a thought I
had to actually working.  My thanks to him.

Reverting to lurk&learn mode for the time being :-)

        TjL


-- 
Site: www.tntluoma.com                       mailto:[EMAIL PROTECTED]
Info: Apache/1.3.19 (Unix) with PHP/4.0.6


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

I've been testing the security of some of my forms, and did find some nasty
holes in regards to the forms not being validated properly (and sometimes
not at all).  Referring to the webpage;
http://www.php.net/manual/en/security.database.php#security.database.sql-inj
ection  I should be able to create a valid query statement from the posted
form data, but it seems that my SQL server (MySQL) isn't accepting the
second (malicious) query that is prefixed with a semi-colon.

Example PHP code :

$query = "SELECT * FROM usertable WHERE uname = '$uname' AND upass =
'$password';

In my form password box, I type in this :

    '; insert into user set uname ='geoff', upass='cracked'; /*

Since the connected user has insert privileges, I expect to see a new row in
the table, but instead see this error message :

You have an error in your SQL syntax near '; insert into usertable set uname
='geoff', upass='cracked'; /*' at line 10

The $query resulted in this :
SELECT * FROM usertable WHERE uname = '' AND uspass = ''; insert into
usertable set uname ='geoff', upass='cracked'; /*'.

It simply doesn't like the semi-colon in the query - I've written a
hard-wired php script, and this proves that the semi-colon is the culprit :

 $query  = "select * from updates order by `updated` desc LIMIT $mylimit;\n
select 1+1 as `updated`";

Again, the error :
  You have an error in your SQL syntax near '; select 1+1 as `updated`' at
line 1

Naturally I'll be validating those forms, but the curiosity has now set it -
how can I make a valid query work?

Thanks,
Geoff

--- End Message ---
--- Begin Message ---
I guess what I'm getting at is that a php server acts like a server side
includes server, right?

On webrings they use something like: <script
scr="http://foo.com/test.php";></script>

test.php would have to spit out javascript like this:

http://ss.webring.com/navbar?f=j;y=tombeaudreau;u=10035307

document.write("<table border=0 cellpadding=0 cellspacing=0 width=250
align=center><tr><td>blah, blah</td></tr></table>");

I'm thinking NS4.7x and IE 5.5.

Not that I'm going to start a webring, but I have loftier ideas?

John

--- End Message ---
--- Begin Message ---
Why are you using cgiwrap? seriously?

Are you using an old httpd server and not apache?

CGIWRAp from my perling experiences was good for firewalling, keeping users out
of areas of your server.

But cgiwrap is a pain in the ass for your users. If you have your/their
permissions set up right, why bother?

Seriously, I'm curious. Why use cgiwrap at all?

John

Frank wrote:

> Dear List,
>
> I have been using cgiwrap for many years, always with the .php extension
> added like an AddType like this.
>
> httpd.conf:
>      Action application/php-script       /cgi-bin/php.cgi
>      AddHandler application/php-script  .php4 .php3 .php
>
> Works perfectly.
>
> But in this case I don't want to serve the .php-extension in general. I
> have also moved the executable binary php out of the web tree, compiled it
> with "--enable-discard-path" and added #!/usr/local/bin/php in the scripts.
>
> So instead of above, httpd.conf has
>
>   ScriptAlias /cgi-bin/ "/usr/home/httpd/bin/"
>
> and scripts can be invoked in the browser like:
>
> http://www.myname.com/myscript1.cgi
>
> E.g. "myscript1.cgi" could be
>
> #/usr/local/bin/php
> <?php  phpinfo() ?>
>
> This works fine.
>
> And cgiwrap works fine. I can call other scripts as intended - e.g. I can
> call this script
>
> #!/bin/sh
> echo "Content-type: text/html\n\n"
> ls /
>
> or Perl
>
> #!/usr/bin/perl
> print("Content-type: text/html\n\n");
> print("Hello, World!");
>
> as http://www.myname.com/cgi-bin/cgiwrapd/frank/myscript2.cgi
>
> So everything as expected.
>
> But with PHP something very strange happen: The above script
> "myscript1.php" seems to output the cgi-wrap's code when I load it in the
> browser as
>
> http://www.myname.com/cgi-bin/cgiwrapd/frank/myscript1.cgi
>
> and not info about PHP.
>
> Why is that?  Since scripts with #!/bin/sh worked I have even tried to call
> php from such a script and output the result to a file:
>
> #/bin/sh
> /usr/local/bin/php /somepath/testphp.php > /somepath/testphp.htm
> ls /
>
> Same result.  testphp.htm contains nice phpinfo when the script is called
> from the command line - and lots of binary code when the script called by
> cgiwrap. But the result of "ls /" reaches the browser correctly!
>
> What is special about PHP in combination with cgiwrap here? What can
> cgiwrap "do" to php to make it output unintended code where sh and Perl
> behaves normally? Is something missing in the environment when called from
> cgiwrap? If so what?
>
> I am completely clueless, despite spending 10 hours on the problem.
>
> Oh. and one more thing: When PHP is compiled wrongly for this purpose -
> like with "--enable-force-cgi-redirect" - then there's suddenly nothing
> strange - the script correctly outputs an error-message from PHP, also when
> called over cgiwrap!
>
> If anyone can point me in the right direction or suggest some good things
> to try I'd me more than grateful - I'd be impressed! :-)
>
> Best regards
>
> Frank

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

has anybody experiences with the vpopmail functions in php?

If I use these functions (I´m sure there are compiled correctly into php) I
get errors over errors.
(Unable to change into /vpopmail/domains/domain dir etc)

Thanx a lot...


--
Mit freundlichem Gruß,

| Johannes Tyra
| ---------------------------------------
| BrainData - InterNet Services
| ---------------------------------------
| www.BrainData.de
| [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Monday 01 April 2002 15:35, Johannes Tyra [BrainData] wrote:
> Hi,
>
> has anybody experiences with the vpopmail functions in php?
>
> If I use these functions (I´m sure there are compiled correctly into php) I
> get errors over errors.
> (Unable to change into /vpopmail/domains/domain dir etc)

It's probably a permissions problem. Your php script is running as the user 
which runs your webserver. To get into the vpopmail directories it needs to 
be run as your vpopmail user.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Often statistics are used as a drunken man uses lampposts -- for support
rather than illumination.
*/
--- End Message ---
--- Begin Message ---
Iframe is supposed to work with browsers compliant with W3C HTML 4.01 and 
above. If you're developing for newer browsers, no problem. But if you want 
backward compatibility, why not just use FRAME?

Gaukia

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

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

Is declaring properties at the beginning of a class imperative or good
programming practice.

All the documentation I have seen states that you must do this,however if
the properties I am setting in each function are listede in the parenthesis
i.e
function test($var1,$var2){
}

then my classes still work.

Am I destined for trouble art later stages?

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

      I hope my newbie question don't bother you
      too much.

      I've downloaded the latest PHP for windows
      but when I try to use it I get a message
      that I have to re-compile it.

("You may disable this restriction by recompiling the PHP binary
with the --disable-force-cgi-redirect switch.")

      Can anybody tell me how to recompile PHP?
      I suppose I need the sources and a compiler,
      where from I can get them?

-- 
Many thanks in advance,
Bogdan                          mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
if ($payment_status = "Completed")
if you do this your if statement is invalid
You should do

if ($payment_status == "Completed")
I mean you should use double '=' inorder to say 'equals'.

"Jim Hankins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Here is a portion of a work in progress, I tested by sending the script
with
> a payment status of incomplete yet it still executed other portions of the
> code. Should it not have jumped out.  Or is my nested if invalid for some
> reason?
>
> if ($payment_status = "Completed")
> {
> echo "1st if is passed<br>";
> // check that txn_id has not been previously processed
>
> $db_conn = mysql_connect("localhost:/var/lib/mysql/mysql.sock", "apache",
> "xxx");
>   mysql_select_db("telnetlabs", $db_conn);
>   $query = "select pp_txn_id from orders "
>            ."where pp_txn_id ='.$txn_id.' ";
>   $result = mysql_query($query, $db_conn);
>   echo "This is the result of 1st query<br>";
>   echo $result;
>   echo "<br>";
>   $num_results = mysql_num_rows($result);
>   echo $num_results;
>
> if ($num_results)
> {
> }
> else {
>
>   echo "2nd if is passed<br>";
>   $query = "select cust_email from customers "
>            ."where cust_email = '$payer_mail' ";
>   $result = mysql_query($query, $db_conn);
>   $num_results = mysql_num_rows($result);
>
> if ($num_results)
> {
> }
> else
> {
> echo "3rd if is passed<br>";
> $item_name=addslashes($item_name);
> $receiver_email=addslashes($receiver_email);
> $item_number=addslashes($item_number);
> $invoice=addslashes($invoice);
> $payment_status=addslashes($payment_status);
> $payment_gross=addslashes($payment_gross);
> $txn_id=addslashes($txn_id);
> $payer_email=addslashes($payer_email);
> $payer_status=addslashes($payer_status);
> $first_name=addslashes($first_name);
> $last_name=addslashes($last_name);
> $address_status=addslashes($address_status);
> $address_street=addslashes($address_street);
> $address_city=addslashes($address_city);
> $address_state=addslashes($address_state);
> $address_country=addslashes($address_country);
> echo $first_name;
> echo $last_name;
> echo $address_street;
> echo $address_city;
> echo $address_state;
> echo $address_status;
> echo $address_zip;
> echo $payer_status;
> echo $item_name;
> echo $receiver_email;
> echo $item_number;
> echo $invoice;
> echo $payment_status;
> echo $address_country;
>
> //$query = "insert into customers values ('"null"', '".$first_name."',
> '".$last_name."', '".$address_street."', '".$address_city."' ,
> '".$address_state."', '".$address_status."', '".$payer_email."' ,
> '".$payer_status."', '".$payer_email."' , '".$txn_id."', '"1"')";
> // check that receiver_email is an email address in your PayPal account
> // check that payer_email doesn't already exist in customer database
> // if exist, increment customer.balanace by 1
> // if not exist, create user and increment balance by 1
> // then send schedule email with userid and password
> // process payment
> // first stab does none of the processes above, just emails the customer
and
> us for testing
> mail ("[EMAIL PROTECTED]", "order info", trim($mailcontent), "From:
> [EMAIL PROTECTED]", "[EMAIL PROTECTED]");
> mail ($payer_email, "Your Order", $custconfirmation, "From:
> [EMAIL PROTECTED]", "[EMAIL PROTECTED]");
> }
> }
> }
> ?>
>
>


--- End Message ---
--- Begin Message ---
... an old C trick: when comparing a variable to a
constant, put the constant first, ie

    if ("Completed" == $payment_status) {
    }

that way, if you accidentally use 'assignment-equals'
instead of 'equivalence-equals', you get a syntax error.


"Martinahingis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if ($payment_status = "Completed")
> if you do this your if statement is invalid
> You should do



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

I have a question for ya'll.

I'm writing a fairly substantial program which allows listing of items like
real estate, car ads, etc... on the web. Overall, it looks like it'll be
around 5-7000 lines long.

I was thinking about putting the main guts of it into one big include file
to make it easier to upgrade when we release new versions. Is that
problematic, to have a php file that large? (I mean, I know it's not THAT
big.) Should I break it into separate files, maybe just make a folder
replaceable?

Thanks,
        -- jon



-----------------
jon roig
jon at jonroig.com
project manager, OpenListings
http://jonroig.com


--- End Message ---
--- Begin Message ---
Hi,
    I'm working on a script to read in the results from a search engine and find out a 
website's position in the results.  I've run into some problems trying to read the 
results in from google, it seems no matter how I try to open the page in php it still 
won't read the results.  I've tried using different functions to read the page, but 
all with no luck, it seems that php thinks the page doesn't exist.  If anyone has any 
experience of a similar problem reading a file, or has any idea's on how to get it to 
read (maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp = @fopen("http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N","r";);
if ($fp)
{ print"The file exists!";

$contents = fread ($fp,"100000");

echo $contents;

 }
else
{ print"The file does not exist"; }

example 2

$contents = @join ('', file 
('http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo "The file does not exist";
}

I've avoided using functions like readfile, and fpassthru since they dump the file to 
output imediately, and I want to get the page as a string I can search.  Hope somone 
has some idea's on this,

Thanks,

Steve.

--- End Message ---
--- Begin Message ---
On Monday 01 April 2002 21:22, Stephen Phillips wrote:
> Hi,
>     I'm working on a script to read in the results from a search engine and
> find out a website's position in the results.  I've run into some problems
> trying to read the results in from google, it seems no matter how I try to
> open the page in php it still won't read the results.  I've tried using
> different functions to read the page, but all with no luck, it seems that
> php thinks the page doesn't exist.  If anyone has any experience of a
> similar problem reading a file, or has any idea's on how to get it to read
> (maybe I missed something obvious), please let me know,
>
> Here's some examples of what I've tried so far,
>
> example 1
>
> $fp =
> @fopen("http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N";
>,"r"); if ($fp)
> { print"The file exists!";

Google is probably trying to give you a cookie. You can verify this by trying 
various sites that are known to send cookies and then again with sites that 
don't.

You may need to use something more sophisticated like curl, or write your own 
function(s) based on fsockopen().


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Men take only their needs into consideration -- never their abilities.
                -- Napoleon Bonaparte
*/
--- End Message ---
--- Begin Message ---
You want Snoopy:  http://snoopy.sourceforge.com


-----Original Message-----
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
    I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen("http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N";,
"r");
if ($fp)
{ print"The file exists!";

$contents = fread ($fp,"100000");

echo $contents;

 }
else
{ print"The file does not exist"; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo "The file does not exist";
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.

--- End Message ---
--- Begin Message ---
It's been moved:  http://sourceforge.net/projects/snoopy/

-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 8:08 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


You want Snoopy:  http://snoopy.sourceforge.com


-----Original Message-----
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
    I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen("http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N";,
"r");
if ($fp)
{ print"The file exists!";

$contents = fread ($fp,"100000");

echo $contents;

 }
else
{ print"The file does not exist"; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo "The file does not exist";
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Just as an aside, sourceforge seems to have changed the url.  Its now:

http://sourceforge.net/projects/snoopy/

(I was interested too).

Scott

-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 9:12 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


It's been moved:  http://sourceforge.net/projects/snoopy/

-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 8:08 AM
To: 'Stephen Phillips'; [EMAIL PROTECTED]
Subject: RE: [PHP] Problems reading a URL


You want Snoopy:  http://snoopy.sourceforge.com


-----Original Message-----
From: Stephen Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 7:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Problems reading a URL


Hi,
    I'm working on a script to read in the results from a search engine and
find out a website's position in the results.  I've run into some problems
trying to read the results in from google, it seems no matter how I try to
open the page in php it still won't read the results.  I've tried using
different functions to read the page, but all with no luck, it seems that
php thinks the page doesn't exist.  If anyone has any experience of a
similar problem reading a file, or has any idea's on how to get it to read
(maybe I missed something obvious), please let me know,

Here's some examples of what I've tried so far,

example 1

$fp =
@fopen("http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N";,
"r");
if ($fp)
{ print"The file exists!";

$contents = fread ($fp,"100000");

echo $contents;

 }
else
{ print"The file does not exist"; }

example 2

$contents = @join ('', file
('http://www.google.com/search?q=$keywords&num=10&hl=en&start=1&sa=N'));
if(isset($contents)){
echo $contents;
}
else{
echo "The file does not exist";
}

I've avoided using functions like readfile, and fpassthru since they dump
the file to output imediately, and I want to get the page as a string I can
search.  Hope somone has some idea's on this,

Thanks,

Steve.


--
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


--- End Message ---
--- Begin Message ---
Thanks everyone,
    Snoopy looks just like what I need to use, if only I'd known about this sooner, I 
could have saved myself alot of time :)

Steve.
--- End Message ---
--- Begin Message ---
try http://free-php.cjb.net there is a list of free php, mysql hosts and
analysises of them

"Dani" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I'm just wondering if anybody know if there is a free web hosting with
> MYSQL and PHP. I don't need a hugh space. mya be I need only 50Meg (for
> practise my PHP)
>
> thanks!
>
> regards,
> Dani
>


--- End Message ---
--- Begin Message ---
Hi, I run a Sports site.

And need a forum, in php, that dosen't use mySQL.

Anyone know any good, without any advertice, exept some from the one who
made it ?

From

Kjetil Tveit


--- End Message ---
--- Begin Message ---
On Monday 01 Apr 2002 12:44, MiXmAsTeR wrote:
> Hi, I run a Sports site.
>
> And need a forum, in php, that dosen't use mySQL.
>
> Anyone know any good, without any advertice, exept some from the one who
> made it ?

PHPBB v2.x and OpenBB can run on top of PostgreSQL 7.x

--jaa
--- End Message ---
--- Begin Message ---
phpBB v2.x can run on alot of db's

MS Access
MS SQL Server...
MySQL
DB2
Postgre

And a few others i think...

----- Original Message -----
From: "James Arthur" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 8:58 AM
Subject: Re: [PHP] Forum with PHP, without using mySQL..


> On Monday 01 Apr 2002 12:44, MiXmAsTeR wrote:
> > Hi, I run a Sports site.
> >
> > And need a forum, in php, that dosen't use mySQL.
> >
> > Anyone know any good, without any advertice, exept some from the one who
> > made it ?
>
> PHPBB v2.x and OpenBB can run on top of PostgreSQL 7.x
>
> --jaa
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
If you can use CGI there are 100s of perl ones, like UBB which don't use a
database engine

Andrew
----- Original Message -----
From: "MiXmAsTeR" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 12:44 PM
Subject: [PHP] Forum with PHP, without using mySQL..


> Hi, I run a Sports site.
>
> And need a forum, in php, that dosen't use mySQL.
>
> Anyone know any good, without any advertice, exept some from the one who
> made it ?
>
> From
>
> Kjetil Tveit
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

On Friday, March 29, 2002, at 11:39  PM, Jonathan Duncan wrote:

> I have read the page for eval on php.net
> several times as well as the very helpful examples, but whenever I use 
> eval,
> it just prints out the same stuff.  By same stuff I mean wether I use 
> eval
> or just the variable by itself it just prints out the contents of the
> variable.  In the web page source it looks as if the contents were 
> merely
> echoed because it still has the $'s and variable names.  Any other 
> ideas or
> examples on how to implement eval on this?

eval() can let your variable contain PHP code in addition to simple text 
or HTML.  That's what makes it different from just "echoing back the 
text".  So you could do

$print_statement = "print('test');";

eval($print_statement);
// the output is "test", not "print('test');"

I just learned this function myself.


HTH,

Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

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

I need to run some pages on my site in CGI mode for security reasons.

I've put #!/usr/local/bin/php at the top of the script in question, and given 
it the .cgi extension so that apache treats it as a CGI. The script works, 
but the first thing it does is print out #!/usr/local/bin/php, because that's 
the first line of the script. If I remove that line, I get an internal server 
error, because apache doesn't know where php is located.

Does anyone have any ideas?

--jaa
--- End Message ---
--- Begin Message ---
I'd like to find a way to get my PHP driven web site to connect to an AS 400 database

The machine that is running php does have client access to the AS 400.

I'm trying to port some old MS Excel spreadsheets over to our intranet..

any thoughts much appreciated.

Rance

Rance Hall
308.238.2455
Internal Office Extensions: 2455 or 6655
PC Programmer, The Buckle, Inc.
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Any way to use ODBC?? Just a thought
----- Original Message -----
From: "Rance Hall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 8:37 AM
Subject: [PHP] Using PHP to access an AS 400 database


> I'd like to find a way to get my PHP driven web site to connect to an AS
400 database
>
> The machine that is running php does have client access to the AS 400.
>
> I'm trying to port some old MS Excel spreadsheets over to our intranet..
>
> any thoughts much appreciated.
>
> Rance
>
> Rance Hall
> 308.238.2455
> Internal Office Extensions: 2455 or 6655
> PC Programmer, The Buckle, Inc.
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
<? phpinfo(); ?>

Notice anything different?

--jaa
--- End Message ---
--- Begin Message ---
hmmmmm.  I've seen that before by appending something to the end of the url
(not sure what though).

Tyler

----- Original Message -----
From: "James Arthur" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 8:46 AM
Subject: [PHP] Has anyone looked at phpinfo today?


> <? phpinfo(); ?>
>
> Notice anything different?
>
> --jaa
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

On Saturday, March 30, 2002, at 06:29  PM, Alberto Wagner wrote:

> $Sql_Query_Login = Mysql_Query("SELECT Nome FROM users WHERE User = 
> 'Anyone'")
>
> There isn't a user if name Anyone...
>
> Why
>
> If (!$Sql_Query_Login) {
>    Echo "Ninguem";
> }
>
> Is returning False?

The query is succeeding, it's just returning an empty set.  Try

if (!$Sql_Query_Login) {
   echo "query failed";
} else {
   if ($sql_Query_Login == "") {
     echo "empty result set";
   } else {
     // do what you want with the results
   }
}


Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

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

On Sunday, March 31, 2002, at 04:05  AM, Liam wrote:

> at the moment I have register_globals set to "on"
> Is there any reason I should turn it off?
>
> What are the security risks of having them on?

I once asked this exact question, and here is the response I got -- I 
found it very helpful:

> Give this a read first, then come back if you still have questions ;)
>
> http://www.securereality.com.au/studyinscarlet.txt
>
> Kirk


Erik


----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
You would be better off reading the security chapter in the PHP
documentation.  It is much better informed than that study-in-scarlet
thing.

On Mon, 1 Apr 2002, Erik Price wrote:

>
> On Sunday, March 31, 2002, at 04:05  AM, Liam wrote:
>
> > at the moment I have register_globals set to "on"
> > Is there any reason I should turn it off?
> >
> > What are the security risks of having them on?
>
> I once asked this exact question, and here is the response I got -- I
> found it very helpful:
>
> > Give this a read first, then come back if you still have questions ;)
> >
> > http://www.securereality.com.au/studyinscarlet.txt
> >
> > Kirk
>
>
> Erik
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

On Sunday, March 31, 2002, at 02:02  PM, [EMAIL PROTECTED] wrote:

> We are choosing some tools for building applications. Php is a very 
> good tools to
> build web applications, but we don't know if it can generate printable
> reports. "Printable reports" mean the report you can print what you see 
> on screen
> (like winword).
>
> We are asking if at here, there are good solutions to generate reports. 
> Simply
> generate html files and print them are not good solutions to us, 
> becuase you have
> to remove header / footer of html files, and html files seems not to be 
> used for
> printing.
>
> We know we can use pdflib to generate pdf files, but it is very 
> expensive.... (at
> least US $1,000) .
>
> If there are no other ways, we will be forced to use the old 
> client-server approach
> again because printing report is very important to us.

If you use XML instead of HTML, you could perform one XSLT process to 
create HTML for the online version and another XSLT process to create a 
file in any other format to create the print version.


Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Eric Coleman wrote:
> This can be done easily...
> 
> And since when does PDFLIB cost money? I thought it was free...


PDFLIB isn't free.

A commercial PDFlib license is required for all uses of the software 
which are not explicitely covered by the Aladdin Free Public License 
(see bottom), for example:

? shipping a commercial product which contains PDFlib
? distributing (free or commercial) software based on PDFlib when the 
source code is not made available
? implementing commercial Web services with PDFlib




? you may develop free software with PDFlib, provided you make all of 
your own source code publicly available
? you may develop software for your own use with PDFlib as long as you 
don't sell it
? you may redistribute PDFlib non-commercially
? you may redistribute PDFlib on digital media for a fee if the complete 
contents of the media are freely redistributable.


It's fine for some situations, but it's not *free* for all uses.
There are actually quite a number of scenarios I come across
where PDFLIB isn't a 'free' package, but requires someone to pay.
"implementing commercial Web services with PDFlib" is pretty wide
open, imo.


Michael Kimsal
http://www.phphelpdesk.com
PHP support when you need it
734-480-9961

--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Monday 01 April 2002 07:22, Chris Snyder wrote:
> 
> 
> 
>>I altered the add.php script to print the query to screen instead of
>>sending it to MySQL to try this.  It still acted the same, regardless of
>>whether it was sending it to the MySQL server or printing it.  In fact,
>>it even had the same reaction when I commented out the print command as
>>well.  This appears to be something in the form-handling of PHP.  Any
>>ideas now?  Thanks for all your help.
> 
> 
> Are you using POST or GET for your form? Both have a limit on how much data 
> you can send with GET having a lower limit than POST. So if you were using 
> GET then try using POST. Both limits are, I think, browser dependent.
> 
> 

I'm using POST.  I'm using Mozilla 0.9.9 - maybe it has a low limit or 
something?  I'll search their bug database and see if anything turns up.

--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Monday 01 April 2002 07:22, Chris Snyder wrote:
> 
> 
> 
>>I altered the add.php script to print the query to screen instead of
>>sending it to MySQL to try this.  It still acted the same, regardless of
>>whether it was sending it to the MySQL server or printing it.  In fact,
>>it even had the same reaction when I commented out the print command as
>>well.  This appears to be something in the form-handling of PHP.  Any
>>ideas now?  Thanks for all your help.
> 
> 
> Are you using POST or GET for your form? Both have a limit on how much data 
> you can send with GET having a lower limit than POST. So if you were using 
> GET then try using POST. Both limits are, I think, browser dependent.
> 
> 

I tried VNCing over to my WinNT server and using IE on there - it worked 
fine.  This must be a Mozilla issue.  Now I get to have fun over with 
their support channels.<g>  Thanks for all your help.

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

On Friday, March 29, 2002, at 01:56  PM, Erik Price wrote:

> My, there have been a lot of questions about XSLT in the past 24 hrs... 
> admittedly most of them coming from me.  In addition to my first 
> question (repeated below for clarity), I have a second one -- how do I 
> perform an XSLT transformation on multiple XML documents?  Do I need to 
> perform a separate XSLT transformation on each one?  The reason I ask 
> is b/c I am pulling my XML from a DB, so there may be more than one 
> based on the results from the query.  If anyone can answer this, that'd 
> be great.

I did discover over the weekend that it is possible to use a single XSLT 
stylesheet to perform a transformation on multiple XML documents, but 
this requires that each XML document have its own URI to do so -- 
obviously this won't work in my case, since I'm pulling the XML 
documents as multiple results from a database query.  So that option is 
out.

I have thought about this problem and the answer is simple -- no, there 
is no way to perform a single XSLT transformation on multiple 
concatenated XML documents if those documents contain XML declarations 
at the top of them.  Why?  Because multiple concatenated XML documents 
with XML declarations != a well-formed XML document, which is a 
prerequisite for the XSLT processor.  (Essentially, the processor didn't 
like encountering a second XML declaration in the concatenated string, 
since a rule of well-formedness is that if there are any XML 
declarations, there can be only one and there cannot be any characters 
before that declaration in the document.)

So that leaves me with this question -- (A) should I run the XSLT 
process on each individual result that comes from the query?  (B) Or 
should I concatenate the XML documents as I have, use substr_replace() 
to change all XML declarations to "", and then prepend a single XML 
declaration to the beginning of the string and perform the 
transformation on this new string?


Much thanks to Sean Scanlon for showing me how to create HTML attributes 
from XML with XSLT.



Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

> From: Erik Price <[EMAIL PROTECTED]>
> Date: Fri Mar 29, 2002  01:56:55  PM US/Eastern
> To: [EMAIL PROTECTED]
> Subject: [PHP] IMPORTANT question for anyone using XSLT
>
> My, there have been a lot of questions about XSLT in the past 24 hrs... 
> admittedly most of them coming from me.  In addition to my first 
> question (repeated below for clarity), I have a second one -- how do I 
> perform an XSLT transformation on multiple XML documents?  Do I need to 
> perform a separate XSLT transformation on each one?  The reason I ask 
> is b/c I am pulling my XML from a DB, so there may be more than one 
> based on the results from the query.  If anyone can answer this, that'd 
> be great.
>
> If not, perhaps you can help with this situation, which I believe will 
> probably plague just about any PHP programmer who will ever use XSLT 
> with PHP (or possibly any other language):
>
> I am still unsure of the best way to mix PHP & [X]HTML together in an 
> XSLT stylesheet, because regardless of whether you specify the output 
> method as "text" or "xml", if you are using HTML tags they must be 
> well-formed, because Sablotron or expat (not sure which) will want the 
> XSLT stylesheet to be a well-formed document.  Only, we often interrupt 
> our HTML code when using PHP, like this:
>
> $output_to_browser = "<a href='index.php'>Go";
> $output_to_browser .= "home</a>";
>
> (of course, the output to the browser will by a hyperlink to index.php 
> that says "Go home".)
>
> The above looks fine as PHP code, but if you try to manipulate the data 
> from an XSLT process in this fashion, you won't be able to use HTML 
> tags -- the greater-than and less-than symbols can't be used, since an 
> XSLT sheet is technically an XML document and these are not well-formed 
> tags.  In the XSLT sheet, the above might look like:
>
> <xsl:template match="location">
>  <a href="<xsl:value-of select="php_document" />">Go Home</a>
> </xsl:template>
>
> I thought that perhaps if I specified text as the output method, then 
> the greater-than and less-than signs wouldn't be parsed, so I could use 
> them as such:
>
> <xsl:output method="text" />
>
> <xsl:template match="location">
>  <xsl:text>
>    <a href="
>  </xsl:text>
>     <xsl:value-of select="php_document" />
>  <xsl:text>
>    ">Go Home</a>
>  </xsl:text>
> </xsl:template match="location">
>
> See what's happening in the above?  I thought I had "escaped" my <a> 
> tags by placing them within the <xsl:text> tags, but this is not so -- 
> they are parsed, and the document is then interpreted as not being 
> well-formed.
>
>
> So unless you want to do a straight XML-to-XML or XML-to-XHTML 
> transformation, OR you don't want to use ANY XML or XHTML tags in your 
> output document, you're kind of up a river.  Unless someone on this 
> list can help me find a way to "escape" the HTML tags when creating PHP 
> code.
>
> And the only way I can think of doing it (which I still haven't tested, 
> but might have to use) is to use variables to represent the HTML tags 
> so that instead of
>
> <a href="    and     ">Go Home</a>
>
> I could use
>
> $astartag = "<a href='";
> $aendtag = "'>Go Home</a>";
>
> and then make the style sheet like this:
>
> <xsl:output method="text" />
>
> <xsl:template match="location">
>  <xsl:text>
>    $astartag
>  </xsl:text>
>     <xsl:value-of select="php_document" />
>  <xsl:text>
>    $aendtag
>  </xsl:text>
> </xsl:template match="location">
>
>
> That should work in theory.  But it's incredibly crude.
>
>
> What do you all think?
>
>
>
>
>
> Erik
>
>
>
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> -- PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I'm looking for an off the shelf shopping cart that has been developed in PHP.  Please 
send me the link and the cost of the software.

I would develop my own, but time is an issue.

Thanks!

Jeremy
--- End Message ---
--- Begin Message ---
look at www.hotscripts.com

they are a pretty good resource of scripts.

Jason
----- Original Message -----
From: "jeremy spielmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 9:13 AM
Subject: [PHP] Recommendation for PHP Shopping Cart


> I'm looking for an off the shelf shopping cart that has been developed in
PHP.  Please send me the link and the cost of the software.
>
> I would develop my own, but time is an issue.
>
> Thanks!
>
> Jeremy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Take a look at  OSCommerce at http://www.oscommerce.org.

/dkm

----- Original Message -----
From: "jeremy spielmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 11:13 AM
Subject: [PHP] Recommendation for PHP Shopping Cart


> I'm looking for an off the shelf shopping cart that has been developed in
PHP.  Please send me the link and the cost of the software.
>
> I would develop my own, but time is an issue.
>
> Thanks!
>
> Jeremy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

can someone tell me what is wrong with this code :


<form name="form1" method="post" action="">
  <p>
    <input type="text" name="newsid">
  </p>
  <p> 
    <input type="text" name="title">
  </p>
  <p> 
    <input type="text" name="author">
  </p>
  <p>
    <input type="text" name="body">
  </p>
  <p> 
    <input type="submit" name="Submit" value="Submit">
  </p>
  </form>
</body>
<?php
$link=mysql_connect("localhost","myid","mypassword");
if ($link){
print "link id is $link";
} else {
print "error connecting to database";
}
$posted=time();
$query="INSERT INTO news (newsid,title, author, body, posted)
         VALUES($newsid,$title, $author, $body, UNIX_TIMESTAMP())";
IF (mysql_query($query)){
  print "Row added to table";
  } else {
  print "error adding row";
  }
?>


It gives the link ID. But then gives "error adding row"

Thanks in advance

Denis

--- End Message ---
--- Begin Message ---
You are not actually posting the form to a page with your PHP on... so its
trying to insert that form into your DB before u actually fill it out.
either check if the form has been posted before running your PHP, or split
this into 2 pages

Andrew
----- Original Message -----
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 5:08 PM
Subject: [PHP] Please help with code


> Hello friends,
>
> can someone tell me what is wrong with this code :
>
>
> <form name="form1" method="post" action="">
>   <p>
>     <input type="text" name="newsid">
>   </p>
>   <p>
>     <input type="text" name="title">
>   </p>
>   <p>
>     <input type="text" name="author">
>   </p>
>   <p>
>     <input type="text" name="body">
>   </p>
>   <p>
>     <input type="submit" name="Submit" value="Submit">
>   </p>
>   </form>
> </body>
> <?php
> $link=mysql_connect("localhost","myid","mypassword");
> if ($link){
> print "link id is $link";
> } else {
> print "error connecting to database";
> }
> $posted=time();
> $query="INSERT INTO news (newsid,title, author, body, posted)
>          VALUES($newsid,$title, $author, $body, UNIX_TIMESTAMP())";
> IF (mysql_query($query)){
>   print "Row added to table";
>   } else {
>   print "error adding row";
>   }
> ?>
>
>
> It gives the link ID. But then gives "error adding row"
>
> Thanks in advance
>
> Denis
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Should I change the position of the php code?

Thanks
denis
----- Original Message -----
From: "Andrew Brampton" <[EMAIL PROTECTED]>
To: "Denis L. Menezes" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 12:31 AM
Subject: Re: [PHP] Please help with code


> You are not actually posting the form to a page with your PHP on... so its
> trying to insert that form into your DB before u actually fill it out.
> either check if the form has been posted before running your PHP, or split
> this into 2 pages
>
> Andrew
> ----- Original Message -----
> From: "Denis L. Menezes" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 01, 2002 5:08 PM
> Subject: [PHP] Please help with code
>
>
> > Hello friends,
> >
> > can someone tell me what is wrong with this code :
> >
> >
> > <form name="form1" method="post" action="">
> >   <p>
> >     <input type="text" name="newsid">
> >   </p>
> >   <p>
> >     <input type="text" name="title">
> >   </p>
> >   <p>
> >     <input type="text" name="author">
> >   </p>
> >   <p>
> >     <input type="text" name="body">
> >   </p>
> >   <p>
> >     <input type="submit" name="Submit" value="Submit">
> >   </p>
> >   </form>
> > </body>
> > <?php
> > $link=mysql_connect("localhost","myid","mypassword");
> > if ($link){
> > print "link id is $link";
> > } else {
> > print "error connecting to database";
> > }
> > $posted=time();
> > $query="INSERT INTO news (newsid,title, author, body, posted)
> >          VALUES($newsid,$title, $author, $body, UNIX_TIMESTAMP())";
> > IF (mysql_query($query)){
> >   print "Row added to table";
> >   } else {
> >   print "error adding row";
> >   }
> > ?>
> >
> >
> > It gives the link ID. But then gives "error adding row"
> >
> > Thanks in advance
> >
> > Denis
> >
> >
> > --
> > 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

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

On Monday, April 1, 2002, at 11:08  AM, Denis L. Menezes wrote:

> $query="INSERT INTO news (newsid,title, author, body, posted)
>          VALUES($newsid,$title, $author, $body, UNIX_TIMESTAMP())";
> IF (mysql_query($query)){
>   print "Row added to table";
>   } else {
>   print "error adding row";
>   }
> ?>
>
>
> It gives the link ID. But then gives "error adding row"

If you are inserting a value into a string-type column, then it must be 
quoted.  I recommend you change your query to look like this:

$query = "INSERT INTO news (newsid,
                             title,
                             author,
                             body,
                             posted)
                  VALUES    ($newsid,
                             '$title',
                             '$author',
                             '$body',
                             UNIX_TIMESTAMP()
                            )";

I've made the (possibly incorrect) assumption that your newsid column is 
not a string-type column, so I didn't quote the variable -- but you 
could, and it should still insert as normal.

And yes, you can structure your query this way for legibility since 
whitespace is ignored (if you want).


Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
You CANNOT execute the PHP script until the form is submitted.  You are
attempting to do both at the same time.
Second, ALL your text fields muse be surrounded by quotes in your INSERT
statement.
Third, use NULL, not UNIX_TIMESTAMP() to insert a timestamp field.

In the following, assume the name of your script is "thisscript.php".

<?php
if isset($submit)
{
$link=mysql_connect("localhost","myid","mypassword");
if ($link){
print "link id is $link";
} else {
print "error connecting to database";
}
$query="INSERT INTO news (newsid,title, author, body, posted)
         VALUES(\"$newsid\",\"$title\", \"$author\", \"$body\", NULL)";
IF (mysql_query($query)){
  print "Row added to table";
  } else {
  print "error adding row";
  }
exit;
}
?>
<form name="form1" method="post" action="thisscript.php">
  <p>
    <input type="text" name="newsid">
  </p>
  <p> 
    <input type="text" name="title">
  </p>
  <p> 
    <input type="text" name="author">
  </p>
  <p>
    <input type="text" name="body">
  </p>
  <p> 
    <input type="submit" name="Submit" value="Submit">
  </p>
  </form>
</body>
-----Original Message-----
From: Denis L. Menezes [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Please help with code


Hello friends,

can someone tell me what is wrong with this code :


<form name="form1" method="post" action="">
  <p>
    <input type="text" name="newsid">
  </p>
  <p> 
    <input type="text" name="title">
  </p>
  <p> 
    <input type="text" name="author">
  </p>
  <p>
    <input type="text" name="body">
  </p>
  <p> 
    <input type="submit" name="Submit" value="Submit">
  </p>
  </form>
</body>
<?php
$link=mysql_connect("localhost","myid","mypassword");
if ($link){
print "link id is $link";
} else {
print "error connecting to database";
}
$posted=time();
$query="INSERT INTO news (newsid,title, author, body, posted)
         VALUES($newsid,$title, $author, $body, UNIX_TIMESTAMP())";
IF (mysql_query($query)){
  print "Row added to table";
  } else {
  print "error adding row";
  }
?>


It gives the link ID. But then gives "error adding row"

Thanks in advance

Denis


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You forgot to select the database that you want to
insert.

Ex:

$db = mysql_select_db ( mydatabase );

Hope this helps,
Harry
--- "Denis L. Menezes" <[EMAIL PROTECTED]>
wrote:
> Hello friends,
> 
> can someone tell me what is wrong with this code :
> 
> 
> <form name="form1" method="post" action="">
>   <p>
>     <input type="text" name="newsid">
>   </p>
>   <p> 
>     <input type="text" name="title">
>   </p>
>   <p> 
>     <input type="text" name="author">
>   </p>
>   <p>
>     <input type="text" name="body">
>   </p>
>   <p> 
>     <input type="submit" name="Submit"
> value="Submit">
>   </p>
>   </form>
> </body>
> <?php
>
$link=mysql_connect("localhost","myid","mypassword");
> if ($link){
> print "link id is $link";
> } else {
> print "error connecting to database";
> }
> $posted=time();
> $query="INSERT INTO news (newsid,title, author,
> body, posted)
>          VALUES($newsid,$title, $author, $body,
> UNIX_TIMESTAMP())";
> IF (mysql_query($query)){
>   print "Row added to table";
>   } else {
>   print "error adding row";
>   }
> ?>
> 
> 
> It gives the link ID. But then gives "error adding
> row"
> 
> Thanks in advance
> 
> Denis
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/
--- End Message ---
--- Begin Message ---
anyone found any webserver for linux to support HTML - PHP - SSL without
much/any compiling . .
just the binary to uncompress and run .???

I am really tired by linux......


--
~~~~~~~~~~~~~~~~

Sapilas@/dev/pinkeye

~~~~~~~~~~~~~~~~


--- End Message ---
--- Begin Message ---
I don't know any offhand... but taking the easy road never produced
anything more secure then a bad IIS server...

Try my walkthrough... (ok... not walkthrough, but example)

http://www.apokalyptik.com/lsftgu/Apache-Frontpage-Mod_ASP-Mod_SSL-Mod_P
erl-Php/index.htm

-----Original Message-----
From: Septic Flesh [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 01, 2002 8:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP] tired by linux - recompiling.._PHP SERVER

anyone found any webserver for linux to support HTML - PHP - SSL without
much/any compiling . .
just the binary to uncompress and run .???

I am really tired by linux......


--
~~~~~~~~~~~~~~~~

Sapilas@/dev/pinkeye

~~~~~~~~~~~~~~~~



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



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

i am running php with IMAP extension on my apache Red Hat 7.2 machine, but i always 
have trouble with it.
After a while my script simply crashes:

[Mon Apr  1 17:53:25 2002] [notice] child pid 15338 exit signal Segmentation fault (11)

I thought it may be related to too many open imap_open() connections?
...but every imap_open() also has an imap_close(), so no open connections.
Everything works just perfect after a reboot again, but restarting apache doesn't help 
a thing :(

...maybe someone encountered similar problems or has an idea to share,

regards,
Duncan
--- End Message ---
--- Begin Message ---
Hi,

I'm real new in php and trying to read a txt file

this is my code :

<?php
 $row = 1;
 $fp = fopen ("lecteurs.txt","r");
  while ($data = fgetcsv ($fp, 1000, ";"))
  {
    $num = count ($data);
    $row++;
    for ($c=0; $c<$num; $c++)
    switch ($row)
     {
     case 1 :
      {
      $vignette = $data[$c];
      }
     case 2 :
   {
   $photo= $data[$c];
   }
   case 3 :
   {
   $marque= $data[$c];
   }
  case 4 :
   {
   $nom = $data[$c];
   }
  case 5 :
   {
   $pdfproduit= $data[$c];
   }
  case 6 :
   {
   $commprod = $data[$c];
   }
    }
  fclose ($fp);
  echo $vignette;
  echo $photo;
  echo $marque;
  echo $nom;
  echo $pdfproduit;
  echo $commprod;
?>

and when i run it i get : Parse error: parse error in essai.php on line 45

here' my txt file (just 1 line for probe)

petitimage;photo;marque;Nom;lepdf;commproduit

Can someone help me to go thru

TIA

Hubert




--- End Message ---

Reply via email to