[PHP] update more "same" fields at the same time

2003-01-15 Thread Simon
Hi,

I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.

TNX



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




Re: [PHP] Re: Persistent global data ?

2003-01-15 Thread Mathias Rockel
Hi!

This looks VERY interesting, it seems to be exactly what the Application
Object does for ASP, and thats exactly what I need ... now I just have to
hope that this version is stable enough ...

many thanks !


 mathias rockel



- Original Message -
From: "Tamas Arpad" <[EMAIL PROTECTED]>
To: "Mathias Rockel" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, January 14, 2003 6:11 PM
Subject: Re: [PHP] Re: Persistent global data ?


> > So this is the only way I guess ...
> >
> > Do you propose to serialize() the objects in the tree and write that
data
> > into a shared memory block, and then deserialize them at the beginning
of
> > each script that needs the data back into objects ? I would think that
that
> > would impose the same performance penaltys from creating the objects
again
> > (this seems to be what slows php down), only the reading process ist
sped
> > up ... not exactly what I would like, but seems PHP provides no other
> > functionality ...
> >
> > mathias rockel
> There's another way with srm:
> http://www.vl-srm.net/doc/features.application-vars.php
> But I don't know if it's still maintaned.
>
> Arpi
>


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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Chris Hayes
At 10:07 15-1-03, you wrote:

I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.


One of the many ways to do it:
When writing the form, number the fieldnames with the ID's of the items. 
Separate name and ID with a clear character like '__'




In the receiving page, split the name again.
Then build a query for every record. I'm not sure whether you can string 
multiple queries, separated by a semicolon (;), have a try.

this is a principle code (not working but it shows the idea) for checking 
every incoming variable

 for [each $key, $value in $_POST]
  {if (! strpos('field',$key)==false)
  { $key=explode('__',$key);
 $ID=$key[1];
   mysql_query(UPDATE mytable SET WHERE ID=$ID)
  }
   }


 


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



Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Simon
"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>   for [each $key, $value in $_POST]
>{if (! strpos('field',$key)==false)
>{ $key=explode('__',$key);
>   $ID=$key[1];
> mysql_query(UPDATE mytable SET WHERE ID=$ID)
>}
> }


i cant get this code to work. does anybody have the working code..

tnx



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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Giannis Vrentzos
Simon wrote:

Hi,

I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.

TNX


What do you mean with "update more "same" fields at the same time"?Can 
you give us an example?

Gvre


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



Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Simon
> What do you mean with "update more "same" fields at the same time"?Can
> you give us an example?
>
> Gvre
>























now i want to change values of texfields and update them back to mysql.




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




[PHP] Question about $_GET

2003-01-15 Thread Frank Keessen
Hi All,

Can you please help me with the following problem? I've had code wich was running fine 
with php till i've upgraded to PHP version 4.2.3.

The original code line was:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

but it's not working when you have register_globals=Off
So i've read everywhere to use the $_Get:

So the code looks like this:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

But all i'm getting in my browser is:

parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' 


Can someone please help?

Thanks and regards,

Frank



Re: [PHP] Question about $_GET

2003-01-15 Thread Danny Shepherd
Try

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";

HTH

Danny.
- Original Message -
From: "Frank Keessen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 10:50 AM
Subject: [PHP] Question about $_GET


Hi All,

Can you please help me with the following problem? I've had code wich was
running fine with php till i've upgraded to PHP version 4.2.3.

The original code line was:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
'$id'";

but it's not working when you have register_globals=Off
So i've read everywhere to use the $_Get:

So the code looks like this:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
$_GET['id']";

But all i'm getting in my browser is:

parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'


Can someone please help?

Thanks and regards,

Frank


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




Re: [PHP] Question about $_GET

2003-01-15 Thread Marek Kilimajer
"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";

- removed single quotes


Frank Keessen wrote:


Hi All,

Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3.

The original code line was:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

but it's not working when you have register_globals=Off
So i've read everywhere to use the $_Get:

So the code looks like this:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

But all i'm getting in my browser is:

parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' 


Can someone please help?

Thanks and regards,

Frank

 



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Frank Keessen
Thanks, but not working:

The error message:
Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
. You have an error in your SQL syntax near '' at line 1

Here are both lines:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";


 $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

Regards,

Frank
- Original Message -
From: "Danny Shepherd" <[EMAIL PROTECTED]>
To: "Frank Keessen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 11:54 AM
Subject: Re: [PHP] Question about $_GET


> Try
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> {$_GET['id']}";
>
> HTH
>
> Danny.
> - Original Message -
> From: "Frank Keessen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 15, 2003 10:50 AM
> Subject: [PHP] Question about $_GET
>
>
> Hi All,
>
> Can you please help me with the following problem? I've had code wich was
> running fine with php till i've upgraded to PHP version 4.2.3.
>
> The original code line was:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> '$id'";
>
> but it's not working when you have register_globals=Off
> So i've read everywhere to use the $_Get:
>
> So the code looks like this:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> $_GET['id']";
>
> But all i'm getting in my browser is:
>
> parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
>
>
> Can someone please help?
>
> Thanks and regards,
>
> Frank
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Jason k Larson
$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = 
'$_GET['id']'";

It looks like here that again $_GET['id'] has an empty value;

Jason k Larson


Frank Keessen wrote:

Thanks, but not working:

The error message:
Error in query: SELECT Newsheadline, News, Contact FROM news WHERE 
Newsid =
. You have an error in your SQL syntax near '' at line 1

Here are both lines:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";


 $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

Regards,

Frank
- Original Message -
From: "Danny Shepherd"
To: "Frank Keessen" ;
Sent: Wednesday, January 15, 2003 11:54 AM
Subject: Re: [PHP] Question about $_GET



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Jason k Larson
Forms have two distinct methods.  GET and POST.  if the form has a 
method of POST vars are stored in $_POST, ditto for GET.

Use $_POST['id'] not $_GET['id'] if your form uses the POST method.

HTH,
Jason k Larson


Jason k Larson wrote:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
'$_GET['id']'";

It looks like here that again $_GET['id'] has an empty value;

Jason k Larson


Frank Keessen wrote:

> Thanks, but not working:
>
> The error message:
> Error in query: SELECT Newsheadline, News, Contact FROM news WHERE
> Newsid =
> . You have an error in your SQL syntax near '' at line 1
>
> Here are both lines:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> {$_GET['id']}";
>
>
>  $result = mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());
>
> Regards,
>
> Frank
> - Original Message -
> From: "Danny Shepherd"
> To: "Frank Keessen" ;
> Sent: Wednesday, January 15, 2003 11:54 AM
> Subject: Re: [PHP] Question about $_GET
>



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Chris Hayes
At 11:57 15-1-03, Marek Kilimajer wrote:

"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";

- removed single quotes


I think that that is a really bad advice.

Let me explain.

For one, the single quotes are not in the way here because the query is 
written between double quotes.

Then, leaving out the single quotes like Marek suggests will only work 
because PHP is too programmer-friendly.
But the indexes of such arrays should always be quoted, because they are 
strings, and not the name of 'constant' values. If you do not quote them 
PHP will first try to look up whether you defined id somewhere, as a 
constant (with define ('id','value');). Which you did not, so PHP will fail 
to find it. Only then PHP will gently assume that since there is no 
constant defined with the name id, that you meant 'id'. Valuable processing 
time wasted for no reason.
Set error_reporting to ~E_ALL if you do not believe me.

I would support  the $_POST suggestion by Jason.

Suggested reading: the 'PHP Bible'.



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



Re: [PHP] Question about $_GET

2003-01-15 Thread Marek Kilimajer


Chris Hayes wrote:




Let me explain.

For one, the single quotes are not in the way here because the query 
is written between double quotes.

Then, leaving out the single quotes like Marek suggests will only work 
because PHP is too programmer-friendly.
But the indexes of such arrays should always be quoted, because they 
are strings, and not the name of 'constant' values.

But it is within string (double quotes), so the index evaluates as a 
string, not as a constant.

If you do not quote them PHP will first try to look up whether you 
defined id somewhere, as a constant (with define ('id','value');). 
Which you did not, so PHP will fail to find it. Only then PHP will 
gently assume that since there is no constant defined with the name 
id, that you meant 'id'. Valuable processing time wasted for no reason.
Set error_reporting to ~E_ALL if you do not believe me. 

I believe you, but try it first:
 'Hello world');
echo "$a[id]";
?>

 'Hello world');
echo "$a['id']";
?>

this is *different*:
 'Hello world');
echo $a[id];
?>

 'Hello world');
echo $a['id'];
?>




I would support  the $_POST suggestion by Jason. 

He got error from php and not mysql, 



Suggested reading: the 'PHP Bible'.






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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Giannis Vrentzos
Simon wrote:
>>What do you mean with "update more "same" fields at the same time"?Can
>>you give us an example?
>>
>>Gvre
>>
>
>
> 
>
> 
> $query1 = "SELECT * FROM table where subcat = $_GET[a]";
>
> $result1 = mysql_query($query1);
>
> while($row = mysql_fetch_object($result1))
>
> {
>
> ?>
>
> 
>
> 
>
> 
>
> 
>
> 
> }
>
> ?>
>
> 
>
> 
>
> 
>
> 
>
> now i want to change values of texfields and update them back to mysql.
>
If you want to update all the records that have subcat = $_GET[a] with
the same values then you can do somethink like this:

$subcat = $_POST['a'];
$qsubcat = $_POST['subcat'];

"update tables set
field1=$_POST['textfield'],field2='$_POST['textfield1']'  where
subcat='$qsubcat'"

I don 't know if this query will execute correctly because i don 't know
the datatypes of your table fields.
I prefer writing update and insert php scripts independed from select
pages.It 's easier to read.



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




RE: [PHP] MySQL problem with RedHat 8

2003-01-15 Thread Daniel Elenius
Hi
Again, I already have it! (And it is the one from the distro)

[daniel@p85 daniel]$ rpm -q php-mysql
php-mysql-4.2.2-8.0.5

/daniel


On Wed, 2003-01-15 at 02:19, Larry Brown wrote:
> You need the php-mysql rpm  do rpm -q php-mysql
> Get the one from the distro
> 
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
> 
> -Original Message-
> From: Daniel Elenius [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 14, 2003 5:22 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] MySQL problem with RedHat 8
> 
> Yes, mysql.so is in /usr/lib/php4. The php.ini file has this in it:
> 
> [daniel@p85 etc]$ grep mysql php.ini
> ;extension=php_mysql.dll
> extension=mysql.so
> mysql.allow_persistent = On
> mysql.max_persistent = -1
> mysql.max_links = -1
> ; Default port number for mysql_connect().  If unset, mysql_connect()
> will use
> ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
> mysql.default_port =
> mysql.default_socket =
> ; Default host for mysql_connect() (doesn't apply in safe mode).
> mysql.default_host =
> ; Default user for mysql_connect() (doesn't apply in safe mode).
> mysql.default_user =
> ; Default password for mysql_connect() (doesn't apply in safe mode).
> ; *Any* user with PHP access can run 'echo
> cfg_get_var("mysql.default_password")
> mysql.default_password =
> 
> 
> /daniel
> 
> On Tue, 2003-01-14 at 23:17, Joseph W. Goff wrote:
> > Make sure that the shared module is in the correct directory.
> > Check your php.ini file to make sure but it is most likely at /usr/lib/php4
> > make sure that you have mysql.so
> > - Original Message -
> > From: "Daniel Elenius" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, January 14, 2003 3:58 PM
> > Subject: [PHP] MySQL problem with RedHat 8
> >
> >
> > > Hi!
> > >
> > > I'm trying to connect to my mysql database using something like
> > >
> > >  mysql_connect( 'localhost', 'root', 'thepassword' )
> > > or die ( 'Unable to connect to server.' );
> > >
> > > But I get the error message:
> > > Fatal error: Call to undefined function: mysql_connect() in
> > > /home/daniel/public_html/index.php on line 21
> > >
> > > I have:
> > >
> > > [root@p85 /]# rpm -qa |grep sql
> > > php-mysql-4.2.2-8.0.5
> > > mysql-3.23.52-3
> > > mysql-server-3.23.52-3
> > > mysql-devel-3.23.52-3
> > >
> > > and:
> > >
> > > [root@p85 /]# rpm -q php
> > > php-4.2.2-8.0.5
> > >
> > > Someone mentioned these two settings in php.ini, which I tried with no
> > > success:
> > >
> > > register_globals = On
> > > short_open_tag = On
> > >
> > > phpinfo() says that php was compiled with '--with-mysql=shared,/usr'
> > >
> > > Can someone help me please?
> > >
> > > regards,
> > > --
> > > Daniel Elenius <[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> --
> Daniel Elenius <[EMAIL PROTECTED]>
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
Daniel Elenius <[EMAIL PROTECTED]>


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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Giannis Vrentzos
Simon wrote:
 >>What do you mean with "update more "same" fields at the same time"?Can
 >>you give us an example?
 >>
 >>Gvre
 >>
 >
 >
 > 
 >
 > 
 > $query1 = "SELECT * FROM table where subcat = $_GET[a]";
 >
 > $result1 = mysql_query($query1);
 >
 > while($row = mysql_fetch_object($result1))
 >
 > {
 >
 > ?>
 >
 > 
 >
 > 
 >
 > 
 >
 > 
 >
 > 
 > }
 >
 > ?>
 >
 > 
 >
 > 
 >
 > 
 >
 > 
 >
 > now i want to change values of texfields and update them back to mysql.
 >
If you want to update all the records that have subcat = $_GET[a] with
the same values then you can do somethink like this:

$subcat = $_POST['a'];
$qsubcat = $_POST['subcat'];

"update tables set
field1=$_POST['textfield'],field2='$_POST['textfield1']'  where
subcat='$qsubcat'"

I don 't know if this query will execute correctly because i don 't know
the datatypes of your table fields.
I prefer writing update and insert php scripts independed from select
pages.It 's easier to read.




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




Re: [PHP] Question about $_GET

2003-01-15 Thread TomH
Frank,

This is frustrating because there are several things at work here...

-- firstly --
Page data (POST or GET) is ALWAYS 'character' type when received into your 
script -- whether or not that's how you use it in your application/database

So most times you need to "settype($id, "integer")  in order to use the values 
in the particular case of database queries where the data=type is some numeric type


-- secondly --

MySQL query syntax generally _requires_ character data to be 'single quoted', 
whereas integers should be unquoted

So if your Newsid field in the MySQLK table structure is character type then use 
 the single quotes if integer the _unquotes in the $query

((Your error messages imply that this is
likely one of the probs with the code.))


-- lastly --
For some reason (beyond my grasp) the variable substitution in PHP behaves 
differently for _simple_ vars ($var) as opposed to _complex_ vars like 
$_POST["somevarname"] and  $arrayname["$othervar"]



So the conmbined solution to at least give a try
===

settype($id, "integer");  // assuming that the MySQL field-type is an integer
$id = $_GET['id'];  // change to what I called a _simple_ var ;-)
// then place $id in the query as unquoted
$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $id";


Hope that helps,

Tom Henry






Frank Keessen wrote:
Thanks, but not working:

The error message:
Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
. You have an error in your SQL syntax near '' at line 1

Here are both lines:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";


 $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

Regards,

Frank
- Original Message -
From: "Danny Shepherd" <[EMAIL PROTECTED]>
To: "Frank Keessen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 11:54 AM
Subject: Re: [PHP] Question about $_GET




Try

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";

HTH

Danny.
- Original Message -
From: "Frank Keessen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 10:50 AM
Subject: [PHP] Question about $_GET


Hi All,

Can you please help me with the following problem? I've had code wich was
running fine with php till i've upgraded to PHP version 4.2.3.

The original code line was:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
'$id'";

but it's not working when you have register_globals=Off
So i've read everywhere to use the $_Get:

So the code looks like this:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
$_GET['id']";

But all i'm getting in my browser is:

parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'


Can someone please help?

Thanks and regards,

Frank


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









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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Simon
> If you want to update all the records that have subcat = $_GET[a] with
> the same values then you can do somethink like this:
>
> $subcat = $_POST['a'];
> $qsubcat = $_POST['subcat'];
>
> "update tables set
> field1=$_POST['textfield'],field2='$_POST['textfield1']'  where
> subcat='$qsubcat'"
>
> I don 't know if this query will execute correctly because i don 't know
> the datatypes of your table fields.
> I prefer writing update and insert php scripts independed from select
> pages.It 's easier to read.
>

thing is that i want to update same field 6 times with one mysql query. lets
say i have 6 names in one mysql table. now I wand to update all six of them
with one query.



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Jason Wong
On Wednesday 15 January 2003 18:57, Frank Keessen wrote:
> Thanks, but not working:
>
> The error message:
> Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> . You have an error in your SQL syntax near '' at line 1
>
> Here are both lines:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> {$_GET['id']}";
>
>
>  $result = mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());

Let's put this straight when referring to items in an array inside a 
double-quoted string that is the correct syntax to use. IE:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =  
{$_GET['id']}";

Your problem now is clearly one of SQL syntax as the error states so 
explicitly. 

If Newsid is not numerical type then you need single quotes around the 
expression that it is being compared to. IOW your query should look like:

  $query = "SELECT Newsheadline, 
   News, 
   Contact 
  FROM news 
 WHERE Newsid = '{$_GET['id']}'";

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

/*
If we see the light at the end of the tunnel, it's the light of an
oncoming train.
-- Robert Lowell
*/


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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Giannis Vrentzos
Simon wrote:

If you want to update all the records that have subcat = $_GET[a] with
the same values then you can do somethink like this:

$subcat = $_POST['a'];
$qsubcat = $_POST['subcat'];

"update tables set
field1=$_POST['textfield'],field2='$_POST['textfield1']'  where
subcat='$qsubcat'"

I don 't know if this query will execute correctly because i don 't know
the datatypes of your table fields.
I prefer writing update and insert php scripts independed from select
pages.It 's easier to read.




thing is that i want to update same field 6 times with one mysql query. lets
say i have 6 names in one mysql table. now I wand to update all six of them
with one query.


with the same data or not?



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




Re: [PHP] Question about $_GET

2003-01-15 Thread Rick Emery
Make life easy for yourself:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = ".$_GET['id'];
- Original Message -
From: "Frank Keessen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 4:50 AM
Subject: [PHP] Question about $_GET


Hi All,

Can you please help me with the following problem? I've had code wich was running fine 
with php till
i've upgraded to PHP version 4.2.3.

The original code line was:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'";

but it's not working when you have register_globals=Off
So i've read everywhere to use the $_Get:

So the code looks like this:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']";

But all i'm getting in my browser is:

parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'


Can someone please help?

Thanks and regards,

Frank



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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Simon
> with the same data or not?
>
not with the same data



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




[PHP] dynamic variables in a while loop?

2003-01-15 Thread Philipp Hartmann
Hi everyone.
I am more of an ActionScript person, but I have to do this one in php.
Should
be easy for everyone familiar with php syntax...

Here is what I want to do:
I am getting several variables into a Php Script such as:

help1 = "yes" / "no"
help2 = "yes" / "no"
.
.
.
helpX = "yes" / "no"

I need to check whether the variable is true or false, and according to that
add
1 to a counter variable.

Something like this I'd do in ActionScript, but dont know about php
[CODE]
$i = 0;
While (++$i <= 8) {
if ([help]+$i=="yes"){ // this line produces an error...
$counterYes += counterYes;
}
}
[/CODE]

Do I have to initialize all variables before I can use them in php?

Thank you very, very much for your time and your help!!
Philipp


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




[PHP] Can someone help me with this code please?

2003-01-15 Thread Phil Powell
Following is the code that will do a remote scrape of 
http://www3.brinkster.com/soa/val/profile/display.asp (which sometimes goes down), 
however, it should time out and produce an error after 5 seconds; instead, sometimes, 
the entire page (http://valsignalandet.com) which includes this script below, takes up 
to 90 seconds to load because of the ASP script locking, in spite of my safeguards.  
Can anyone please help; I'm out of ideas.

Thanx

Phil

http://www3.brinkster.com/soa/val/profile/view.asp>Click here or try again 
later";
  } else {
   $httpStr = "POST /soa/val/profile/display.asp?showLeftNavBanner=1 
HTTP/1.0\r\nAccept: text/*\r\nUser-agent: NC_GET_URL\r\nHost: 
www3.brinkster.com:80\r\n\r\n";
   fputs($fp, $httpStr);
   $start = time();
   
   // DOUBLE TIME SETTING: SET FOR BOTH STREAM TIMEOUT AND FOR DATA LOOPING TIMEOUT TO 
   // ENSURE THAT THE WHOLE PROCESS IS 5 SECONDS OR IT QUITS
   
   // STREAM COMMANDS DON'T WORK ON VAL BECAUSE PHP VERSION IS TOO OLD - CRAP!
   list($phpVersion1, $phpVersion2, $phpVersion3) = explode('.', phpversion());
   if ($phpVersion1 >=4 && $phpVersion2 >= 3) {
if (!stream_set_timeout($fp, 5)) echo 'Could not set stream timeout';
if (!stream_set_blocking($fp, 0)) echo 'Could not set stream blocking';
   }

   $now = $start;
   while (!feof($fp) && $now < $start + 5) {
$res .= fgets($fp, 4096);
$now = time();
   }

   fclose($fp);
  }
  if (strlen($res) > 0 && $now < $start + 5) {
   echo trim(substr($res, strpos($res, '<'), strlen(trim($res;
  } else {
   echo "${font}Could not display profiles at this time. http://www3.brinkster.com/soa/val/profile/view.asp>Click here or try again 
later";
  }
?>
  



[PHP] sending array

2003-01-15 Thread Danielle van Gladbach
Hi,

I am trying to send an array from one php to another:

$org["index-A"]=1701;
$org["index-B"]=1209;

print "test2\n";

But if I try to read te array in test2.php, I get "Warning: Variable
passed to each() is not an array ".

Can anyone help me
Danielle



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




Re: [PHP] dynamic variables in a while loop?

2003-01-15 Thread Rick Emery
for($ii=1; $ii<20; $ii++)
{
$helpz = "help$ii";
if(${$helpz} == "yes)
{
}
else
{
}
}
- Original Message - 
From: "Philipp Hartmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 6:50 AM
Subject: [PHP] dynamic variables in a while loop?


Hi everyone.
I am more of an ActionScript person, but I have to do this one in php.
Should
be easy for everyone familiar with php syntax...

Here is what I want to do:
I am getting several variables into a Php Script such as:

help1 = "yes" / "no"
help2 = "yes" / "no"
.
.
.
helpX = "yes" / "no"

I need to check whether the variable is true or false, and according to that
add
1 to a counter variable.

Something like this I'd do in ActionScript, but dont know about php
[CODE]
$i = 0;
While (++$i <= 8) {
if ([help]+$i=="yes"){ // this line produces an error...
$counterYes += counterYes;
}
}
[/CODE]

Do I have to initialize all variables before I can use them in php?

Thank you very, very much for your time and your help!!
Philipp


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




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




Re: [PHP] sending array

2003-01-15 Thread Rick Emery
show us the test1.php code.
show us the test2.php code.
We can't read your mind.
- Original Message - 
From: "Danielle van Gladbach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 6:59 AM
Subject: [PHP] sending array


Hi,

I am trying to send an array from one php to another:

$org["index-A"]=1701;
$org["index-B"]=1209;

print "test2\n";

But if I try to read te array in test2.php, I get "Warning: Variable
passed to each() is not an array ".

Can anyone help me
Danielle



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




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




Re: [PHP] sending array

2003-01-15 Thread Jason Wong
On Wednesday 15 January 2003 20:59, Danielle van Gladbach wrote:

> I am trying to send an array from one php to another:
>
> $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> print "test2\n";
>
> But if I try to read te array in test2.php, I get "Warning: Variable
> passed to each() is not an array ".

You can't pass an array thru the URL. What you need to do is serialize() it 
then urlencode() it (or maybe rawurlencode()). Then you can put the resulting 
string in the URL.

In test2.php you would unserialize() $org ($_GET['org']).

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

/*
E Pluribus Unix
*/


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




RE: [PHP] dynamic variables in a while loop?

2003-01-15 Thread Ford, Mike [LSS]
> -Original Message-
> From: Philipp Hartmann [mailto:[EMAIL PROTECTED]]
> Sent: 15 January 2003 12:50
> 
> Here is what I want to do:
> I am getting several variables into a Php Script such as:
> 
> help1 = "yes" / "no"
> help2 = "yes" / "no"
> .
> .
> .
> helpX = "yes" / "no"
> 
> I need to check whether the variable is true or false, and 
> according to that
> add
> 1 to a counter variable.
> 
> Something like this I'd do in ActionScript, but dont know about php
> [CODE]
> $i = 0;
> While (++$i <= 8) {
> if ([help]+$i=="yes"){ // this line produces an error...

I think you need to read the PHP manual page on variable variables:
http://www.php.net/manual/en/language.variables.variable.php -- and the one
on string operators:
http://www.php.net/manual/en/language.operators.string.php

> $counterYes += counterYes;

I assume this is a typo for $counterYes += 1 ...!
 
> }
> }
> [/CODE]
> 
> Do I have to initialize all variables before I can use them in php?

No -- but, presuming these values are coming from a form, or a query on the
URL, the other thing you need to take account of is the configuration
setting for register_globals.  If it's on, then fine, the above will work
with appropriate amendments to suit PHP syntax; if it's off, then you have
to use the $_POST[] or $_GET[] array as appropriate, and in fact the
variable variables stuff is not relevant because the array index is just the
HelpX string.

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

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




[PHP] Re: sending array

2003-01-15 Thread Foong
I am not sure you can do it way, here is what i suggest

test2.php?org[index-A]=&org[index-B]=..


you need to specify each var in you array in the query path.


Danielle Van Gladbach <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I am trying to send an array from one php to another:
>
> $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> print "test2\n";
>
> But if I try to read te array in test2.php, I get "Warning: Variable
> passed to each() is not an array ".
>
> Can anyone help me
> Danielle
>
>



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




Re: [PHP] sending array

2003-01-15 Thread D.M. van Gladbach
There not much in there because I strip it for testing.

test1.php
test2\n";
?>

test2.php
\n";
 }
?>

Rick Emery wrote:

> show us the test1.php code.
> show us the test2.php code.
> We can't read your mind.
> - Original Message -
> From: "Danielle van Gladbach" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 15, 2003 6:59 AM
> Subject: [PHP] sending array
>
> Hi,
>
> I am trying to send an array from one php to another:
>
> $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> print "test2\n";
>
> But if I try to read te array in test2.php, I get "Warning: Variable
> passed to each() is not an array ".
>
> Can anyone help me
> Danielle
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sending array

2003-01-15 Thread Mark Charette
You know, if you actually looked at the link you've created you'd find your
answer ...

> -Original Message-
> From: D.M. van Gladbach [mailto:[EMAIL PROTECTED]]
>
> There not much in there because I strip it for testing.
>
> test1.php
>  $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> print "test2\n";
> ?>
>
> test2.php
>  while (list ($key, $val) = each($org))
>  {
>  print "key=".$key."val".$val."\n";
>  }
> ?>
>
>>


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




[PHP] php obj -> xml ?

2003-01-15 Thread neko
Just wanted some opinions on the best way to produce well-formed xml from a 
php object. In my case, I was toying with the idea of a generic way to 
product an xml file from a PEAR DataObject - the idea being that a 3rd 
party requests data, I extract from mysql using Pear's DataObjects, then 
tell that objects to produce xml (or pass it to a transformer or 
something).

Links? Ideas? Recommendations from RL experience?

cheers,
neko

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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Giannis Vrentzos
Simon wrote:
>>with the same data or not?
>>
>
> not with the same data
>
You can put your data and the primary keys in  arrays and exec a loop
but the data[0] must be the data for the id[0],
data[1] must be the data for id[1] etc.

The loop should be something like this:

for (int $i=0; $i<=total_records_select_returned -1; $i++)
	update table set field1='$data[$i]' where id=$id[$i];

I 'm not sure for the syntax but the idea is correct.



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




[PHP] PHP/Flash Dynamic Graphs?

2003-01-15 Thread MH
Hi,

I want to create dynamic graphs with PHP and Flash for data that changes
constantly (let's say every 2 seconds).  The graphs must change visibly in
the browser window without refreshing the page.  Is this possible?  I have
read most that I could find on MING and searched the web as well, but didn't
have much luck.  Is PHP/Flash approach the best?

Any info/scripts/url's would be appreciated.

TX
MH



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




Re: [PHP] dynamic variables in a while loop?

2003-01-15 Thread Philipp Hartmann
Thanks everyone!
Works great!
Phil

- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Philipp Hartmann" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 2:03 PM
Subject: Re: [PHP] dynamic variables in a while loop?


> for($ii=1; $ii<20; $ii++)
> {
> $helpz = "help$ii";
> if(${$helpz} == "yes)
> {
> }
> else
> {
> }
> }
> - Original Message -
> From: "Philipp Hartmann" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 15, 2003 6:50 AM
> Subject: [PHP] dynamic variables in a while loop?
>
>
> Hi everyone.
> I am more of an ActionScript person, but I have to do this one in php.
> Should
> be easy for everyone familiar with php syntax...
>
> Here is what I want to do:
> I am getting several variables into a Php Script such as:
>
> help1 = "yes" / "no"
> help2 = "yes" / "no"
> .
> .
> .
> helpX = "yes" / "no"
>
> I need to check whether the variable is true or false, and according to
that
> add
> 1 to a counter variable.
>
> Something like this I'd do in ActionScript, but dont know about php
> [CODE]
> $i = 0;
> While (++$i <= 8) {
> if ([help]+$i=="yes"){ // this line produces an error...
> $counterYes += counterYes;
> }
> }
> [/CODE]
>
> Do I have to initialize all variables before I can use them in php?
>
> Thank you very, very much for your time and your help!!
> Philipp
>
>
> --
> 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 Digest 15 Jan 2003 13:42:26 -0000 Issue 1824

2003-01-15 Thread php-general-digest-help

php-general Digest 15 Jan 2003 13:42:26 - Issue 1824

Topics (messages 131642 through 131700):

Re: Next and Previous
131642 by: Matt
131645 by: Miguel Brás

Re: PHP & RTF
131643 by: [-^-!-%-
131647 by: Jason Reid

Re: emptying hte array??
131644 by: Jason k Larson

Re: attach image with the mail command?
131646 by: Rick Emery
131655 by: Manuel Lemos

Advanced Search
131648 by: rw.xend.net
131650 by: Andrew Brampton
131651 by: Jean-Christian Imbeault

Re: Trapping PHP errors
131649 by: Jean-Christian Imbeault
131656 by: Michael Sims

Gotchas with Php and Postgresql?
131652 by: John Wells
131657 by: Jason k Larson

Setcookie() and header()
131653 by: J. Alden Gillespy
131658 by: Jason k Larson
131660 by: Michael Sims
131661 by: J. Alden Gillespy
131663 by: Michael Sims

Re: Favorite Email validation routine?
131654 by: Daevid Vincent

Calendar problem
131659 by: menezesd

Save Dialog
131662 by: Richard Rojas

update more "same" fields at the same time
131664 by: Simon
131666 by: Chris Hayes
131667 by: Simon
131668 by: Giannis Vrentzos
131669 by: Simon
131678 by: Giannis Vrentzos
131680 by: Giannis Vrentzos
131682 by: Simon
131684 by: Giannis Vrentzos
131686 by: Simon
131698 by: Giannis Vrentzos

Re: Persistent global data ?
131665 by: Mathias Rockel

Question about $_GET
131670 by: Frank Keessen
131671 by: Danny Shepherd
131672 by: Marek Kilimajer
131673 by: Frank Keessen
131674 by: Jason k Larson
131675 by: Jason k Larson
131676 by: Chris Hayes
131677 by: Marek Kilimajer
131681 by: TomH
131683 by: Jason Wong
131685 by: Rick Emery

Re: MySQL problem with RedHat 8
131679 by: Daniel Elenius

dynamic variables in a while loop?
131687 by: Philipp Hartmann
131690 by: Rick Emery
131693 by: Ford, Mike   [LSS]
131700 by: Philipp Hartmann

Can someone help me with this code please?
131688 by: Phil Powell

sending array
131689 by: Danielle van Gladbach
131691 by: Rick Emery
131692 by: Jason Wong
131694 by: Foong
131695 by: Danielle van Gladbach
131696 by: Mark Charette

php obj -> xml ?
131697 by: neko

PHP/Flash Dynamic Graphs?
131699 by: MH

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 ---
>"Miguel Brás" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> That's not the case, I tested it on ID549 and the previous one should be
548 and he still assume -1

Works for me.  Are you adding the ?ID=500 to the url?  If you don't have
that, then the ID is 0, so you get the 1 and -1.



--- End Message ---
--- Begin Message ---
Let's see

i solved thhe problem...
I did  since I was making the select with WHERE ID = '$ID'
so I get the var $ID.,

Thx for the help of all

Miguel
"Matt" <[EMAIL PROTECTED]> escreveu na mensagem
034901c2bc37$41429160$[EMAIL PROTECTED]">news:034901c2bc37$41429160$[EMAIL PROTECTED]...
> >"Miguel Brás" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > That's not the case, I tested it on ID549 and the previous one should be
> 548 and he still assume -1
>
> Works for me.  Are you adding the ?ID=500 to the url?  If you don't have
> that, then the ID is 0, so you get the 1 and -1.
>
>



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

Thanks, Michael. I'll look into it.
-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Michael Hall wrote:

> I don't know how much use this is for your needs, but I have found Openjade and
> DocBook to be excellent tools for creating RTF files  from XML sources. PHP can
> be the scripting language used to tie things together, manipulate HTML/XML etc,
> but basically this solution is "outside" of PHP I suppose.
>
> Mick
>
> Quoting "[-^-!-%-" <[EMAIL PROTECTED]>:
>
> >
> > For those of you with experience in using php for RTF documents.
> >
> > I need help generating RTF Style tags from PHP. I can convert regular text
> > to an RTF document, but the document will
> > display RTF Style tags as regular text (in the RTF document).
> >
> > How do I make the RTF document recognize the RTF Style tags.
> >
> > Any help with code samples, tutorials and/or references, will be greatly
> > appreciated.
> >
> > -john
> >
> > =P e p i e  D e s i g n s
> >  www.pepiedesigns.com

Re: [PHP] emptying hte array??

2003-01-15 Thread Scott Fletcher
It wouldn't be a good idea to undefined the array with 'unset()' if it is to
be re-use.

"Jason K Larson" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> That's not going to 'empty' the array it's going to undefine it.
> Just overwrite the array with a new empty array like:
>
> $a = array();
>
> That keeps the variable an array variable type and is of course empty.
>
> HTH,
> Jason k Larson
>
> Justin French wrote:
>
> > on 15/01/03 7:52 AM, Scott Fletcher ([EMAIL PROTECTED]) wrote:
> >
> >
> > >How to do the proper way of emptying hte array??
> > >
> > >Example...
> > >
> > >$a[0] = "test1";
> > >$a[1] = "test2";
> > >$a[2] = "test3";
> > >$a[3] = "test4";
> > >
> > >$a = "";<-- Is this hte proper way to do it
> >
> >
> > unset($a);
> >
> > http://php.net/unset
> >
> > Justin
>



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




Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Chris Hayes
At 14:29 15-1-03, you wrote:

> not with the same data
>
You can put your data and the primary keys in  arrays and exec a loop
but the data[0] must be the data for the id[0],
data[1] must be the data for id[1] etc.

The loop should be something like this:

for (int $i=0; $i<=total_records_select_returned -1; $i++)
update table set field1='$data[$i]' where id=$id[$i];

I 'm not sure for the syntax but the idea is correct.


That would work good and is shorter than what i did (and accidently mailed 
to myself in stead of to this list):

You split the record ID and value in two form elements while I lump the 
fieldname with the recordID into the form element name.


I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.


The way i understand the question is, you have several records (or rows) in 
one table that you want to edit on the same page.

One of the many ways to do it:
When writing the form, number the fieldnames with the ID's of the items. 
Separate name and ID with a clear character like '__'



So to make this do something like

1. make a query to select the items, select the values you want to show as 
well as the record's ID field, from now I will call that $recordID.
Echo a  tag

2. Loop through the query result with your favourite loop structure and in 
the loop echo each record somehow like this:
  echo ' ';


In the receiving page, split the name again.
Then build a query for every record.


With fieldname 'fieldname':

while (list ($key, $val) = each ($_POST))   //walk 
through all form results, key is form_element_name
//and 
value is value.
  {if (! strpos($key,'fieldname')===false)  //only 
with variables starting with the fieldname
  { $keybits=explode('__',$key);$recordID=$keybits[1];  //split 
the recordID out of the name of the variable

   $query="UPDATE mytable SET fieldname='.$value.'   WHERE 
recordID=$recordID";
mysql_query($query) or die('Problem updating data );
  }
   }




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



[PHP] Re: Windows vs Linux

2003-01-15 Thread Scott Fletcher
The default setting for hte error message is different in Windows and Linux.
I had that problem but reduced it when I configure the error setting in
php.ini.  Window just display more error over things that aren't really an
error, like an undefined variable that haven't been yet used.  In Unix and
Linux, it doesn't display it.


"Beauford.2002" <[EMAIL PROTECTED]> wrote in message
000701c2bc0c$8c20bb60$6401a8c0@p1">news:000701c2bc0c$8c20bb60$6401a8c0@p1...
> Hi
>
> I just installed MySQL and PHP on Windows, and I have found that I am
> getting all sorts of errors (in both) when I try to use some of the same
> commands I use in the Linux versions.  Are their a lot of differences in
the
> two, and where can I find out what these are - I just got used to using
them
> in Linux
>
> TIA
>
>



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




Re: [PHP] sending array

2003-01-15 Thread Danielle van Gladbach
It works thanks

Here is the code, if anyone has the same problem:
test1.php
test2\n";
?>

test2.php
\n";
 }
?>

Jason Wong wrote:

> On Wednesday 15 January 2003 20:59, Danielle van Gladbach wrote:
>
> > I am trying to send an array from one php to another:
> >
> > $org["index-A"]=1701;
> > $org["index-B"]=1209;
> >
> > print "test2\n";
> >
> > But if I try to read te array in test2.php, I get "Warning: Variable
> > passed to each() is not an array ".
>
> You can't pass an array thru the URL. What you need to do is serialize() it
> then urlencode() it (or maybe rawurlencode()). Then you can put the resulting
> string in the URL.
>
> In test2.php you would unserialize() $org ($_GET['org']).
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> E Pluribus Unix
> */


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




[PHP] difference between shared and /usr/bin/mysql

2003-01-15 Thread gamin
Hi,

   When compiling PHP what is the difference between these two :

./configure --with-mysql=shared

./configure --with-mysql=/usr/bin/mysql

What are the advantages/disadvatages of using either.

thx

g



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




[PHP] All Request to the same script

2003-01-15 Thread SLanger
Hello

Is it possible to send all incoming requests to the same script within 
PHP? 
In other words: How can I get http://mysite/script.php to point to the 
same script as http://mysite/anotherscript.php ? And is it possible to do 
send a request like
http://mysite/someextrapathinfo to the same php script?
The background behind it is to create a controler that handles all 
incoming requests and dispatches them to different worker scripts as 
nessecary.

Thanks in advance 

Stefan Langer


[PHP] Re: difference between shared and /usr/bin/mysql

2003-01-15 Thread Leon Mergen

"Gamin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ./configure --with-mysql=shared
> ./configure --with-mysql=/usr/bin/mysql
> What are the advantages/disadvatages of using either.

Somebody correct me if I'm wrong, but from what I know is that when using
shared it is compiled as a shared object and only loaded when needed. This
decreases ram usage (which is good) , but increases load (which is bad) .

If you have a few spare kb's of ram, I wouldn't recommend using shared...



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




[PHP] Re: All Request to the same script

2003-01-15 Thread Leon Mergen

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]..
.
> Is it possible to send all incoming requests to the same script within
> PHP?
> In other words: How can I get http://mysite/script.php to point to the
> same script as http://mysite/anotherscript.php ? And is it possible to do
> send a request like
> http://mysite/someextrapathinfo to the same php script?
> The background behind it is to create a controler that handles all
> incoming requests and dispatches them to different worker scripts as
> nessecary.

If you're using unix, use ln... type "man ln" for a manual...



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




Re: [PHP] Re: difference between shared and /usr/bin/mysql

2003-01-15 Thread Marco Tabini
On Wed, 2003-01-15 at 09:36, Leon Mergen wrote:
> Somebody correct me if I'm wrong, but from what I know is that when using
> shared it is compiled as a shared object and only loaded when needed. This
> decreases ram usage (which is good) , but increases load (which is bad) .

AFAIK, you should use a shared module when you're also using other
Apache modules that interface to MySQL. When you ./configure the PHP
interpreter, you get this info:

| You chose to compile PHP with the built-in MySQL support.  If you  |
| are compiling a server module, and intend to use other server  |
| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
| mod_perl) you must NOT rely on PHP's built-in MySQL support, and   |
| instead build it with your local MySQL support files, by adding|
| --with-mysql=/path/to/mysql to your configure line.|

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Question about $_GET

2003-01-15 Thread Chris Shiflett
--- Frank Keessen <[EMAIL PROTECTED]> wrote:
> So the code looks like this:
> 
> $query = "SELECT Newsheadline, News, Contact FROM news
> WHERE Newsid = $_GET['id']";
> 
> But all i'm getting in my browser is:
> 
> parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING'

I could not tell if your question had been adequately
answered, but there is an easy way to deal with these types
of things without worrying yourself with syntax. Just use
concatenation (.) as follows:

$query = "select newsheadline, news, contact from news
where newsid = '" . $_GET['id'] . "'";

This builds $query using three separate strings. The first
and third strings are double quoted, and the middle string
is your variable. Note another difference is that the value
of $_GET['id'] is going to be surrounded by single quotes
once $query is constructed.

Chris

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




[PHP] fgets and Macs

2003-01-15 Thread Jason Jacobs
Hello all.  I was doing some reading and found that fgets() doesn't work so well with 
a text file created on a mac, and php.net has a fix.  It would be wonderful if my 
php.ini file actually contained the variable "auto_detect_line_endings."  How can I 
solve this problem?  Is my only solution (without upgrading php) to convert the text 
files to unix format?  Or am I looking in the wrong place for that value?  Thanks for 
your help.

-
Jason Jacobs

Support a Constitutional Amendment to protect the Pledge of Allegiance and National 
Motto. Go to www.wepledge.com


Re: [PHP] All Request to the same script

2003-01-15 Thread Chris Hayes
At 15:39 15-1-03, you wrote:

Hello

Is it possible to send all incoming requests to the same script within
PHP?
In other words: How can I get http://mysite/script.php to point to the
same script as http://mysite/anotherscript.php ? And is it possible to do
send a request like
http://mysite/someextrapathinfo to the same php script?
The background behind it is to create a controler that handles all
incoming requests and dispatches them to different worker scripts as
nessecary.


I think to achieve that you need to have a certain amount of rights, so you 
may have problems to get modules in Apache or .htaccess (see below) working 
when your ISP does not want to help you.

I've heard that Apache's mod_rewrite module can be very powerful in doing 
things like you propose.
But I had to find another way and i have now put a .htaccess file in the 
main directory of my website with a redirect in it:

   ErrorDocument 404 /redirect/redirect.php

So this means that when people ask for a directory or file that does not 
exist, they do not get the standard 404 error message, but they are send on 
to the file www.mysite.org/redirect/redirect.php. BUT! it is very important 
that you do not write www.yourdomain.org because then you loose the 
information in the URL.

So then you come to the redirect.php file.

In this file you should see the original URL in $_SERVER['SCRIPT_URL']:

   $path=trim($_SERVER['SCRIPT_URL']);

The way i did is was to use such links (Search Engine friendly!)
www.mysite.org/news/1224
www.mysite.org/researcher/SLanger

I would then split the URL at the slashes like this:

$path_bits=explode('/',$path);

And then i forward to the longer urls i normally use:

switch (strtolower($path_bits[1]))
{
case 'news':
Header("Location: 
http://www.sense.nl/modules.php?op=modload&name=News&file=article&mode=nested&order=0&thold=0&sid=".trim($path_bits[2]) 
);
break;

case 'researcher':
Header("Location: 
http://www.sense.nl/redirect/research.php?".trim($path_bits[2]) );
break;


default:
Header("Location: http://www.sense.nl/redirect/404.html";);

}



404.html would send real 404's to a polite message.




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



Re: [PHP] fgets and Macs

2003-01-15 Thread Chris Shiflett
--- Jason Jacobs <[EMAIL PROTECTED]> wrote:
> It would be wonderful if my php.ini file actually
> contained the variable "auto_detect_line_endings."
>  How can I solve this problem?

Try adding it yourself. Don't let its absence dissuade you
from giving it a shot. :-)

Chris

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




Re: [PHP] sending array

2003-01-15 Thread Gerald Timothy Quimpo
On Wednesday 15 January 2003 08:59 pm, Danielle van Gladbach wrote:
> I am trying to send an array from one php to another:
>
> $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> print "test2\n";
>
> But if I try to read te array in test2.php, I get "Warning: Variable
> passed to each() is not an array ".

others have discussed the particular error and things to try, so i won't 
do that here.  instead i point out that if the array is going to be any
significant length, then you might want to use some method of
sending the array other than sending it in the URI.

the particular limits on URI length are browser and web server (and
sometimes OS dependent), but i'd be conservative about sending
arrays along.  i'd probably completely give up on sending them in
the URI and instead construct some other way.

e.g., you might have a system whereby you encode the array
somehow into something easily parsed, e.g., index->value
pairs separated by a special delimiter, or urlencoded index
and value separated by a space.  save the encoded format
on the disk.  give it a random name.  then pass the name to
the other URL as a GET param.

you would also have a reaper program (maybe running through
crontab if you're on Unix, or some windows scheduler otherwise)
that deletes array files that are more than, say, 5 minutes  old.

tiger

-- 
Gerald Timothy Quimpo  tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph
Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"
   Veritas liberabit vos.
   Doveryai no proveryai.

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




Re: [PHP] All Request to the same script

2003-01-15 Thread Brad Pauly
On Wed, 2003-01-15 at 08:24, Chris Hayes wrote:
> At 15:39 15-1-03, you wrote:
> >Hello
> >
> >Is it possible to send all incoming requests to the same script within
> >PHP?
> >In other words: How can I get http://mysite/script.php to point to the
> >same script as http://mysite/anotherscript.php ? And is it possible to do
> >send a request like
> >http://mysite/someextrapathinfo to the same php script?
> >The background behind it is to create a controler that handles all
> >incoming requests and dispatches them to different worker scripts as
> >nessecary.
> 
> I think to achieve that you need to have a certain amount of rights, so you 
> may have problems to get modules in Apache or .htaccess (see below) working 
> when your ISP does not want to help you.
> 
> I've heard that Apache's mod_rewrite module can be very powerful in doing 
> things like you propose.

Yes. I use mod_rewrite to do this. If you have access to httpd.conf,
that is the best place to put rules. You can also put rules in .htaccess
if that is your only option, however, you take a performance hit for
doing it that way.

http://httpd.apache.org/docs/mod/mod_rewrite.html#InternalAPI

- Brad


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




[PHP] Send email when some action

2003-01-15 Thread Miguel Brás
Hi gents,

i have a script to manage the registered users on my site.
have also a table with id, name, uname, passwrd, email, datejoined, level
and status

my question is...
it there any possibility to inform a member by mail that his (let'say)
current status changed from inactive to active, or from active to inactive?
I mean, whenever a change occur on member's details, a mail is sent to him
telling what was changed. Any posssibility?

Miguel



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




[PHP] phpBB

2003-01-15 Thread Félix García Renedo
Hi,

How could I download phpBB?
I tryed in http://www.phpbb.com/index.php but I couldn't.

Thanks.
Un saludo.

Félix García Renedo ( [EMAIL PROTECTED] )



Re: [PHP] sending array

2003-01-15 Thread Jason Wong
On Thursday 16 January 2003 23:59, Gerald Timothy Quimpo wrote:

> e.g., you might have a system whereby you encode the array
> somehow into something easily parsed, e.g., index->value
> pairs separated by a special delimiter, or urlencoded index
> and value separated by a space.  save the encoded format
> on the disk.  give it a random name.  then pass the name to
> the other URL as a GET param.
>
> you would also have a reaper program (maybe running through
> crontab if you're on Unix, or some windows scheduler otherwise)
> that deletes array files that are more than, say, 5 minutes  old.

IOW use sessions :-)

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

/*
The two oldest professions in the world have been ruined by amateurs.
-- G.B. Shaw
*/


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




Re: [PHP] phpBB

2003-01-15 Thread Maxim Maletsky

http://sf.net/projects/phpbb


--
Maxim Maletsky
[EMAIL PROTECTED]



Félix García Renedo <[EMAIL PROTECTED]> wrote... :

> Hi,
> 
> How could I download phpBB?
> I tryed in http://www.phpbb.com/index.php but I couldn't.
> 
> Thanks.
> Un saludo.
> 
> Félix García Renedo ( [EMAIL PROTECTED] )


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




Re: [PHP] Send email when some action

2003-01-15 Thread Maxim Maletsky

mail() function @ http://php.net/mail


--
Maxim Maletsky
[EMAIL PROTECTED]



"Miguel Brás" <[EMAIL PROTECTED]> wrote... :

> Hi gents,
> 
> i have a script to manage the registered users on my site.
> have also a table with id, name, uname, passwrd, email, datejoined, level
> and status
> 
> my question is...
> it there any possibility to inform a member by mail that his (let'say)
> current status changed from inactive to active, or from active to inactive?
> I mean, whenever a change occur on member's details, a mail is sent to him
> telling what was changed. Any posssibility?
> 
> Miguel
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] Send email when some action

2003-01-15 Thread Jason Wong
On Thursday 16 January 2003 00:54, Miguel Brás wrote:
> Hi gents,
>
> i have a script to manage the registered users on my site.
> have also a table with id, name, uname, passwrd, email, datejoined, level
> and status
>
> my question is...
> it there any possibility to inform a member by mail that his (let'say)
> current status changed from inactive to active, or from active to inactive?
> I mean, whenever a change occur on member's details, a mail is sent to him
> telling what was changed. Any posssibility?

Yes, use the mail() command.

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

/*
The difficult we do today; the impossible takes a little longer.
*/


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




[PHP] Is there a way to substitute HTTP_REFERER for PHPSESSID ???

2003-01-15 Thread Scott Fletcher
My company's website rely heavily on $_SERVER["HTTP_REFERER"] and it use
Session ID also.  Problem is HTTP_REFERER is not reliable because it's data
come from the web browser, just like javascript in a way.  When I use the
Hier Menus or the javascript, 'location.replace', it prevent the
HTTP_REFERER from working and it instead show a blank.

I have been experimenting with a new sway of checking.  Is there a way that
Session ID that can completely replace the HTTP_REFERER?  HTTP_REFERER have
been a lot of help for my company's website because it prevent the direct
access attempt without logging in.  This is pretty important for the credit
bureau.

I'm open to your ideas and what you use...

Thanks,
 Scott F.



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




[PHP] imagecreatefromjpeg crash

2003-01-15 Thread Hitek
Greetings,
I am having a very peculiar problem trying to use imagecreatefromjpeg 
(indeed, ANY of the imagecreatefrom... functions)
under both Windows and FreeBSD.

First off, here are my server specs:
Win: apache 1.3.23, php 4.2.1, GD 2.0 or better
BSD: apache 1.3.26, php 4.2.3, GD 2.0 or better


And now the problem:
I am trying to use imagecreatefromjpg() to load in an image so that I can 
copy parts of it to other images. Here;s the code:
$orig = imagecreatefromjpeg('46880_img.jpg');

// initialize the image parts for the email form
$cell1 = imagecreate (468, 29);
$cell2 = imagecreate (231, 25);
$cell5 = imagecreate (468, 26);

//copy the parts of the original banner to the individual cell images
imagecopy($cell1, $orig, 0,0,0,0,468, 29);
imagecopy($cell2, $orig, 0,0,0,29,231, 25);
imagecopy($cell5, $orig, 0,0,0,54,486, 26);

$c1 = imagejpeg ( $cell1, "cell1_img.jpg",80);
$c2 = imagejpeg ( $cell2, "cell2_img.jpg",80);
$c5 = imagejpeg ( $cell5, "cell5_img.jpg",80);
$c7 = imagejpeg ( $orig, "orig_img.jpg",80);

On windows, I get:
"php.exe has generated errors and will be closed by windows".
The apache error log shows:
"Premature end of script headers: f:/nusphere/apache/php/php.exe"

On BSD, I get:
DNS error in IE
Netscape just waits forever.

If I comment out the imagecreatefromjpeg function, the script behaves as 
expected on both systems:
The imagecopy functions complain that the original image doesn't exist.

Note: I have tried to fopen the image, and use imagecreatefromstring with 
the exact same results.
Is this a problem with GD?
Is there a workaround?

Thanks,
Keith


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



[PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Beauford.2002
Hi,

I asked previously about the differences between the two and the concensus
was any differences are in the operating systems themselves and not with
PHP. Knowing this, how do I get rid of these errors that keep coming up in
Windows, that don't in Linux. One specific one is  "Notice: Undefined
variable: add in E:\IIS Webs\address.php on line 3"

Someone said to turn on register_globals which I have. Another suggestion
was to put a @ sign in from of all variables. This is a real pain. Anyone
have any other suggestions, or is this basically it?

Also, is there anything else that anyone can think of that I may have to
look forward to using PHP under Windows?

TIA




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




[PHP] Re: PHP/Flash Dynamic Graphs?

2003-01-15 Thread Scott Fletcher
I did once read the article on the website about using PHP and Flash.  As we
know, that HTML & Javascript is client side and the PHP is the server side.
The Flash help to bridge that gap by acting as a glue that hold them
together.  So, it is indeed possible for the Flash to contact the PHP server
to get data and display it without having to refresh the web browser.  It's
a really great article on how to do it.

Unfortunately, I don't remember where on the internet.  I found it on Google
in the past.


"Mh" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I want to create dynamic graphs with PHP and Flash for data that changes
> constantly (let's say every 2 seconds).  The graphs must change visibly in
> the browser window without refreshing the page.  Is this possible?  I have
> read most that I could find on MING and searched the web as well, but
didn't
> have much luck.  Is PHP/Flash approach the best?
>
> Any info/scripts/url's would be appreciated.
>
> TX
> MH
>
>



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




[PHP] Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread Jason Lehman
I have a script that turns certain words into links.  That I am having 
no problems with, it is when I want to turn the links back in to plain 
text that I am having the problem.  Below are my examples.  And I know 
my regex is being greedy but I don't know how to stop it from being so 
damn greedy I thought the ? mark would help but it didn't. Any help 
would be appreciated. So here it goes:


The code:

$strStr = "This is USF at Tampa.  This 
is USF at Tampa.";
echo $strStr."\n";
$strStr = preg_replace("/(Tampa)<\/a>/","\\1",$strStr);
echo $strStr."\n";
$strStr = preg_replace("/(USF)<\/a>/","\\1",$strStr);
echo $strStr."\n";

The output:

This is USF at Tampa. This is USF at Tampa.
This is Tampa. This is Tampa.
This is Tampa. This is Tampa.

The expected output:

This is USF at Tampa. This is USF at Tampa.
This is USF at Tampa. This is USF at 
Tampa.
This is USF at Tampa. This is USF at Tampa.


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



[PHP] Re: Windows PHP vs Linux PHP

2003-01-15 Thread Scott Fletcher
global register had nothing to do with it.  It's the configuration in the
PHP.INI.

Look for error_report & display_error in php.ini.  Once you reduced the
error messages on the webpages, then put hte @ in front of the php variable
or function

Windows is not equal to Linux or Unix.  Windows is not even a language
environment like Linux or Unix do.  So, we're gonna have to deal with M$
Window.

"Beauford.2002" <[EMAIL PROTECTED]> wrote in message
000901c2bcbe$d18c34b0$6401a8c0@p1">news:000901c2bcbe$d18c34b0$6401a8c0@p1...
> Hi,
>
> I asked previously about the differences between the two and the concensus
> was any differences are in the operating systems themselves and not with
> PHP. Knowing this, how do I get rid of these errors that keep coming up in
> Windows, that don't in Linux. One specific one is  "Notice: Undefined
> variable: add in E:\IIS Webs\address.php on line 3"
>
> Someone said to turn on register_globals which I have. Another suggestion
> was to put a @ sign in from of all variables. This is a real pain. Anyone
> have any other suggestions, or is this basically it?
>
> Also, is there anything else that anyone can think of that I may have to
> look forward to using PHP under Windows?
>
> TIA
>
>
>



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




Re: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Jeff Lewis
Set your php.ini file and error reporting as such:

error_reporting  =  E_ALL & ~E_NOTICE

See if that helps with the undefined notice.

jeff
- Original Message -
From: "Beauford.2002" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 12:52 PM
Subject: [PHP] Windows PHP vs Linux PHP


> Hi,
>
> I asked previously about the differences between the two and the concensus
> was any differences are in the operating systems themselves and not with
> PHP. Knowing this, how do I get rid of these errors that keep coming up in
> Windows, that don't in Linux. One specific one is  "Notice: Undefined
> variable: add in E:\IIS Webs\address.php on line 3"
>
> Someone said to turn on register_globals which I have. Another suggestion
> was to put a @ sign in from of all variables. This is a real pain. Anyone
> have any other suggestions, or is this basically it?
>
> Also, is there anything else that anyone can think of that I may have to
> look forward to using PHP under Windows?
>
> TIA
>
>
>
>
> --
> 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] DSO or static Module?

2003-01-15 Thread Lic. Carlos A. Triana Torres
Hi all,
   Here is a question that might be too simple to be asked, but I need to know the 
answer: Is there a way to find out if PHP is compiled as a DSO or as a static module?

Thanx



Re: [PHP] DSO or static Module?

2003-01-15 Thread Ray Hunter
phpinfo()

You can review the configuration command and in there view the command
for apache...


static  = --with-apache=../apache_1.3.27
dso = --with-apxs=/path/to/apxs

that should help you out or get you started...you can also verify in
apache which module are built-in...


On Wed, 2003-01-15 at 11:08, Lic. Carlos A. Triana Torres wrote:
> Hi all,
>Here is a question that might be too simple to be asked, but I need to know the 
>answer: Is there a way to find out if PHP is compiled as a DSO or as a static module?
> 
> Thanx
-- 

Ray Hunter
email:  [EMAIL PROTECTED]
www:http://venticon.com


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




Re: [PHP] Authentication programming

2003-01-15 Thread Jordan Elver
Hi Justin,

Thanks for that link, looks pretty interesting. I'll take a closer read later.

Cheers,
Jord
-- 
Jordan Elver
Eagles may soar high, but weasels don't get sucked into jet engines. -- David 
Brent (The Office)


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




RE: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Matt Schroebel
> -Original Message-
> From: Jeff Lewis [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 15, 2003 1:00 PM
> To: Beauford.2002; PHP General
> Subject: Re: [PHP] Windows PHP vs Linux PHP
> 
> 
> Set your php.ini file and error reporting as such:
> 
> error_reporting  =  E_ALL & ~E_NOTICE

Or initialize your variables before using them ...  especially true if
register_globals is on.

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




RE: [PHP] Session wierdness...

2003-01-15 Thread Duncan Abbott
I did what you suggested and I've attached the output - there's no
$_SESSIONS array in there.

But I've managed to register session vars outside of this function I'm
having trouble with so what's going on?

Duncan

-Original Message-
From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]]
Sent: 13 January 2003 10:04
To: 'Duncan Abbott'; [EMAIL PROTECTED]
Subject: RE: [PHP] Session wierdness...


Do this for me:

print_r($GLOBALS);

and see if you have the $_SESSIONS array visible.. you will need to view
the output
in a text editor as the print_r won't look good rendered in the browser.


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Duncan Abbott [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 13 January 2003 1:05 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Session wierdness...
>
>
> I can't seem to be able to set a session var from within a
> function in an include file
>
> I have a call to a function at the top of my doc (but after
> session_start()) and if I write the line:
> $_SESSION['userData'] = test1; in the function body - it does
> nothing...
>
>  but if I put this statement on the line above or below
> the call to the function, it works
>
> I've tried using session_register() instead but the same
> thing happens. The block of code is definitely being executed.
>
> Someone please please help me, I'm going insane. Thanks...
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



Array
(
[HTTP_POST_VARS] => Array
(
)

[_POST] => Array
(
)

[HTTP_GET_VARS] => Array
(
)

[_GET] => Array
(
)

[HTTP_COOKIE_VARS] => Array
(
[PHPSESSID] => 5a5e23228bffd6b823c3bcdb114d6a49
)

[_COOKIE] => Array
(
[PHPSESSID] => 5a5e23228bffd6b823c3bcdb114d6a49
)

[HTTP_SERVER_VARS] => Array
(
[ALLUSERSPROFILE] => C:\\Documents and Settings\\All Users
[CommonProgramFiles] => C:\\Program Files\\Common Files
[COMPUTERNAME] => MUNKEY
[ComSpec] => C:\\WINDOWS\\system32\\cmd.exe
[CONTENT_LENGTH] => 0
[GATEWAY_INTERFACE] => CGI/1.1
[HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
[HTTP_ACCEPT_LANGUAGE] => en-gb
[HTTP_CONNECTION] => Keep-Alive
[HTTP_HOST] => 127.0.0.1
[HTTP_REFERER] => http://127.0.0.1/nomoresocks/admin/
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 
v11b.01)
[HTTP_COOKIE] => PHPSESSID=5a5e23228bffd6b823c3bcdb114d6a49
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTPS] => off
[INSTANCE_ID] => 1
[LOCAL_ADDR] => 127.0.0.1
[NUMBER_OF_PROCESSORS] => 1
[OS] => Windows_NT
[Path] => C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem
[PATH_TRANSLATED] => D:\\Sites\\nomoresocks\\admin\\test.php
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[PROCESSOR_ARCHITECTURE] => x86
[PROCESSOR_IDENTIFIER] => x86 Family 6 Model 7 Stepping 3, GenuineIntel
[PROCESSOR_LEVEL] => 6
[PROCESSOR_REVISION] => 0703
[ProgramFiles] => C:\\Program Files
[REMOTE_ADDR] => 127.0.0.1
[REMOTE_HOST] => 127.0.0.1
[REQUEST_METHOD] => GET
[SCRIPT_NAME] => /nomoresocks/admin/test.php
[SERVER_NAME] => 127.0.0.1
[SERVER_PORT] => 80
[SERVER_PORT_SECURE] => 0
[SERVER_PROTOCOL] => HTTP/1.1
[SERVER_SOFTWARE] => Microsoft-IIS/5.1
[SystemDrive] => C:
[SystemRoot] => C:\\WINDOWS
[TEMP] => C:\\WINDOWS\\TEMP
[TMP] => C:\\WINDOWS\\TEMP
[USERPROFILE] => C:\\Documents and Settings\\LocalService
[windir] => C:\\WINDOWS
[SCRIPT_FILENAME] => D:\\Sites\\nomoresocks\\admin\\test.php
[PHP_SELF] => /nomoresocks/admin/test.php
[argv] => Array
(
)

[argc] => 0
)

[_SERVER] => Array
(
[ALLUSERSPROFILE] => C:\\Documents and Settings\\All Users
[CommonProgramFiles] => C:\\Program Files\\Common Files
[COMPUTERNAME] => MUNKEY
[ComSpec] => C:\\WINDOWS\\system32\\cmd.exe
[CONTENT_LENGTH] => 0
[GATEWAY_INTERFACE] => CGI/1.1
[HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
[HTTP_ACCEPT_LANGUAGE] => en-gb
[HTTP_CONNECTION] => Keep-Alive

[PHP] Re: Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread Jason Lehman
I figured out what I was doing wrong.  My regexp should of looked like 
this /]*>(Tampa)<\/a>/ and that made it more specific and kept it 
to that match.

Jason Lehman wrote:
I have a script that turns certain words into links.  That I am having 
no problems with, it is when I want to turn the links back in to plain 
text that I am having the problem.  Below are my examples.  And I know 
my regex is being greedy but I don't know how to stop it from being so 
damn greedy I thought the ? mark would help but it didn't. Any help 
would be appreciated. So here it goes:


The code:

$strStr = "This is USF at Tampa.  This 
is USF at Tampa.";
echo $strStr."\n";
$strStr = preg_replace("/(Tampa)<\/a>/","\\1",$strStr);
echo $strStr."\n";
$strStr = preg_replace("/(USF)<\/a>/","\\1",$strStr);
echo $strStr."\n";

The output:

This is USF at Tampa. This is USF at Tampa.
This is Tampa. This is Tampa.
This is Tampa. This is Tampa.

The expected output:

This is USF at Tampa. This is USF at Tampa.
This is USF at Tampa. This is USF at 
Tampa.
This is USF at Tampa. This is USF at Tampa.



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




[PHP] OOP

2003-01-15 Thread Jordan Elver
Hi,
I've been doing a little OOP lately and have a few questions.
I want to build an application, there a re lots of elements to the 
application: Authentication, Database, Presentation, Error Handling etc.

Now, I want to code this cleanly and make it reusable. So, a class for each of 
these elements would be a good idea? Say I have an Authentication class. It 
has to run on it own. Should I build database, error methods into each of my 
classes? That seems to defeat the point in the first place?

At the moment I seem to struggling with how to do somthing right and well, 
rather than the actual code :)

Thanks for any advice you can give,
Jord
-- 
Jordan Elver
You don't have to be mad to work here! In fact we ask you to complete a 
medical questionnaire to ensure that you are not. -- David Brent (The Office)


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




Re: [PHP] Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread 1LT John W. Holmes
> I have a script that turns certain words into links.  That I am having
> no problems with, it is when I want to turn the links back in to plain
> text that I am having the problem.  Below are my examples.  And I know
> my regex is being greedy but I don't know how to stop it from being so
> damn greedy I thought the ? mark would help but it didn't. Any help
> would be appreciated. So here it goes:
>
>
> The code:
>
> $strStr = "This is USF at Tampa.  This
> is USF at Tampa.";
> echo $strStr."\n";
> $strStr = preg_replace("/(Tampa)<\/a>/","\\1",$strStr);
> echo $strStr."\n";
> $strStr = preg_replace("/(USF)<\/a>/","\\1",$strStr);
> echo $strStr."\n";
>
> The output:
>
> This is USF at Tampa. This is  href=test>USF at Tampa.
> This is Tampa. This is Tampa.
> This is Tampa. This is Tampa.
>
> The expected output:
>
> This is USF at Tampa. This is  href=test>USF at Tampa.
> This is USF at Tampa. This is USF at
> Tampa.
> This is USF at Tampa. This is USF at Tampa.

Well, a /U at the end of your pattern will make it so the regex isn't
greedy. That may solve  your problem.

Or you could try matching "/]+>(Tampa)<\/a>/"

which will match an , followed by a >.
So it essentially makes it ungreedy.

---John Holmes...


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




[PHP] Re: Windows PHP vs Linux PHP

2003-01-15 Thread Scott Fletcher
Well, beaten to it..

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> global register had nothing to do with it.  It's the configuration in the
> PHP.INI.
>
> Look for error_report & display_error in php.ini.  Once you reduced the
> error messages on the webpages, then put hte @ in front of the php
variable
> or function
>
> Windows is not equal to Linux or Unix.  Windows is not even a language
> environment like Linux or Unix do.  So, we're gonna have to deal with M$
> Window.
>
> "Beauford.2002" <[EMAIL PROTECTED]> wrote in message
> 000901c2bcbe$d18c34b0$6401a8c0@p1">news:000901c2bcbe$d18c34b0$6401a8c0@p1...
> > Hi,
> >
> > I asked previously about the differences between the two and the
concensus
> > was any differences are in the operating systems themselves and not with
> > PHP. Knowing this, how do I get rid of these errors that keep coming up
in
> > Windows, that don't in Linux. One specific one is  "Notice: Undefined
> > variable: add in E:\IIS Webs\address.php on line 3"
> >
> > Someone said to turn on register_globals which I have. Another
suggestion
> > was to put a @ sign in from of all variables. This is a real pain.
Anyone
> > have any other suggestions, or is this basically it?
> >
> > Also, is there anything else that anyone can think of that I may have to
> > look forward to using PHP under Windows?
> >
> > TIA
> >
> >
> >
>
>



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




Re: [PHP] OOP

2003-01-15 Thread 1LT John W. Holmes
> I've been doing a little OOP lately and have a few questions.
> I want to build an application, there a re lots of elements to the
> application: Authentication, Database, Presentation, Error Handling etc.
>
> Now, I want to code this cleanly and make it reusable. So, a class for
each of
> these elements would be a good idea? Say I have an Authentication class.
It
> has to run on it own. Should I build database, error methods into each of
my
> classes? That seems to defeat the point in the first place?
>
> At the moment I seem to struggling with how to do somthing right and well,
> rather than the actual code.

I'd recommend you make a separate database class and error class that each
of your other classes access. That would make it the most modular and
re-usable.

---John Holmes...


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




Re: [PHP] OOP

2003-01-15 Thread Jordan Elver
> I'd recommend you make a separate database class and error class that each
> of your other classes access. That would make it the most modular and
> re-usable.
>
> ---John Holmes...

I was hoping someone would say that :)
How could I code that though. I've only just started with OOP and don't 
understand how I can inherit methods to classes? Is it a good idea to create 
a new object within each class which, for example, needs to do database stuff 
or should I inherit the methods?

I haven't found any clear examples of this kind of OOP, only the real basics 
(which I still need help with by the way :) ).

Thanks for your help,
Jord
-- 
Jordan Elver
Is your work done? Are all pigs fed, watered and ready to fly? -- David 
Brent (The Office)


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




Re: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread 1LT John W. Holmes
>> Set your php.ini file and error reporting as such:
>>
>> error_reporting  =  E_ALL & ~E_NOTICE

>Or initialize your variables before using them ...  especially true if
>register_globals is on.

Yeah, that's the best recommendation. Especially if you plan on distributing
your code for others to use, where you have no idea of the error setting on
their machines. Sure, you can set it with error_reporting() in your script,
but maybe they don't want it changed, regardless if it's just for your
script.

---John Holmes..


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




[PHP] Re: Question about $_GET

2003-01-15 Thread gamin
Frank,

  With so many various suggestions coming your way, i'll add my 2 cents.

I have gone through all this mess. Read the information from the manual
about

strings
constants
arrays (why "$some_array[id]", $some_array[id] are wrong, but would work
sometimes) [unless u have intentionally defined id as a constant]
error_reporting (set this to E_ALL at all times, it advocates cleaner code)

read the posts from tomh and jason wong again, they will make things clear

HTH

g




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




[PHP] Security in included PHP files

2003-01-15 Thread Jacob Copsey
I am beginning work on a new web-based application using PHP and MySQL. I
have been doing a lot of reading about PHP security and web application
security in general to make sure I am up-to-date on what is known in this
area.

My style of PHP is to name all included files with a .php extension and of
course this raises the problem of people accessing these script files
directly. My main question is if all of the code inside an included PHP file
is put inside one or more functions this should prevent anyone from running
any of that code by directly calling that PHP file correct? There is no way
for them to invoke a function just from a URL assuming I have no code at all
outside the functions.

And this leads to another question... if I encapsulate most of my variables
inside one or more classes doesn't this help protect against attacks also?
Is there a way for someone to set a class variable to a value just from a
GET or POST request (or even file or cookie)? As long as I am carefully
validating what information I put into the object variable this seems to be
a way of adding another layer of protection.

Any thoughts or comments regarding this and any other issues I should take
into consideration regarding security are welcome.

Jacob



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




RE: [PHP] Session wierdness...

2003-01-15 Thread Timothy Hitchens \(HiTCHO\)
Now what is the output if you do this outside of the function after
registering a session var??


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]


> -Original Message-
> From: Duncan Abbott [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, 16 January 2003 4:53 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Session wierdness...
> 
> 
> I did what you suggested and I've attached the output - 
> there's no $_SESSIONS array in there.
> 
> But I've managed to register session vars outside of this 
> function I'm having trouble with so what's going on?
> 
> Duncan
> 
> -Original Message-
> From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]]
> Sent: 13 January 2003 10:04
> To: 'Duncan Abbott'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Session wierdness...
> 
> 
> Do this for me:
> 
> print_r($GLOBALS);
> 
> and see if you have the $_SESSIONS array visible.. you will 
> need to view the output in a text editor as the print_r won't 
> look good rendered in the browser.
> 
> 
> Timothy Hitchens (HiTCHO)
> Open Platform Consulting
> e-mail: [EMAIL PROTECTED]
> 
> > -Original Message-
> > From: Duncan Abbott [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 13 January 2003 1:05 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Session wierdness...
> >
> >
> > I can't seem to be able to set a session var from within a 
> function in 
> > an include file
> >
> > I have a call to a function at the top of my doc (but after
> > session_start()) and if I write the line: $_SESSION['userData'] = 
> > test1; in the function body - it does nothing...
> >
> >  but if I put this statement on the line above or below 
> the call 
> > to the function, it works
> >
> > I've tried using session_register() instead but the same thing 
> > happens. The block of code is definitely being executed.
> >
> > Someone please please help me, I'm going insane. Thanks...
> >
> >
> >
> > --
> > 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] HTTP_REFERER work without a problem....

2003-01-15 Thread Scott Fletcher
Here's what I found so interesting

This code, $_SERVER['HTTP_REFERER'] have worked without a problem when I use
the latest Mozilla build.  It even work with the HierMenus,
location.replace('http://whatever.com'), and location.href =
http://whatever.com...

This is a good news for PHP everywhere.

Unfortunately, Internet Explorer still have this bug...



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




Fw: [PHP] Security in included PHP files

2003-01-15 Thread Kevin Stone
Most web accounts have at least one or two directory levels behind the
public directory.  Simply place the files behind the public directory and
call them into your main script from there.  Absolutely no reason those
files need to be publically accessible.
-Kevin


- Original Message -
From: "Jacob Copsey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 1:02 PM
Subject: [PHP] Security in included PHP files


> I am beginning work on a new web-based application using PHP and MySQL. I
> have been doing a lot of reading about PHP security and web application
> security in general to make sure I am up-to-date on what is known in this
> area.
>
> My style of PHP is to name all included files with a .php extension and of
> course this raises the problem of people accessing these script files
> directly. My main question is if all of the code inside an included PHP
file
> is put inside one or more functions this should prevent anyone from
running
> any of that code by directly calling that PHP file correct? There is no
way
> for them to invoke a function just from a URL assuming I have no code at
all
> outside the functions.
>
> And this leads to another question... if I encapsulate most of my
variables
> inside one or more classes doesn't this help protect against attacks also?
> Is there a way for someone to set a class variable to a value just from a
> GET or POST request (or even file or cookie)? As long as I am carefully
> validating what information I put into the object variable this seems to
be
> a way of adding another layer of protection.
>
> Any thoughts or comments regarding this and any other issues I should take
> into consideration regarding security are welcome.
>
> Jacob
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] Security in included PHP files

2003-01-15 Thread Jacob Copsey
True. But let's just call me anal retentive. :-) Let's say I didn't have the
option of doing what you suggested. Are my ideas sound? Also, those ideas
apply to top-level PHP scripts in an application.

Jacob

"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
007801c2bcd4$02d000f0$6601a8c0@kevin">news:007801c2bcd4$02d000f0$6601a8c0@kevin...
> Most web accounts have at least one or two directory levels behind the
> public directory.  Simply place the files behind the public directory and
> call them into your main script from there.  Absolutely no reason those
> files need to be publically accessible.
> -Kevin



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




Re: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Jim Lucas
it has to do with declaring all php variables before using them in the
script.

$var='';

then do something with the variable.

Jim
- Original Message -
From: "Beauford.2002" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 9:52 AM
Subject: [PHP] Windows PHP vs Linux PHP


> Hi,
>
> I asked previously about the differences between the two and the concensus
> was any differences are in the operating systems themselves and not with
> PHP. Knowing this, how do I get rid of these errors that keep coming up in
> Windows, that don't in Linux. One specific one is  "Notice: Undefined
> variable: add in E:\IIS Webs\address.php on line 3"
>
> Someone said to turn on register_globals which I have. Another suggestion
> was to put a @ sign in from of all variables. This is a real pain. Anyone
> have any other suggestions, or is this basically it?
>
> Also, is there anything else that anyone can think of that I may have to
> look forward to using PHP under Windows?
>
> TIA
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] Question about $_GET

2003-01-15 Thread [-^-!-%-


 I agree with Chris, the quote should stay there to prevent confusion.
 Nevertheless, I often run in the same problem. Sometimes, the only way to
fix it is by removing the quotes ($_GET[id]).

I know PHP documents goes against this, but it dosn't always work with the
quotes.

Perhaps the dev team can look more into this.

-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Chris Hayes wrote:

> At 11:57 15-1-03, Marek Kilimajer wrote:
> >"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";
> >
> >- removed single quotes
>
> I think that that is a really bad advice.
>
> Let me explain.
>
> For one, the single quotes are not in the way here because the query is
> written between double quotes.
>
> Then, leaving out the single quotes like Marek suggests will only work
> because PHP is too programmer-friendly.
> But the indexes of such arrays should always be quoted, because they are
> strings, and not the name of 'constant' values. If you do not quote them
> PHP will first try to look up whether you defined id somewhere, as a
> constant (with define ('id','value');). Which you did not, so PHP will fail
> to find it. Only then PHP will gently assume that since there is no
> constant defined with the name id, that you meant 'id'. Valuable processing
> time wasted for no reason.
> Set error_reporting to ~E_ALL if you do not believe me.
>
> I would support  the $_POST suggestion by Jason.
>
> Suggested reading: the 'PHP Bible'.
>
>
>
> --
> 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] File() function and require()

2003-01-15 Thread Mike Tharp
How can I get the file() function to ignore the first three lines of a 
file it is reading in?

I have a site with:


... rest of file



at the top of all the pages to control user logins. The problem is the 
file() function only reads in the contents of that file, not the rest of 
the contents after the require statement.

Is there a way to tell file() to ignore the first three lines?


Re: [PHP] Security in included PHP files

2003-01-15 Thread Chris Shiflett
--- Jacob Copsey <[EMAIL PROTECTED]> wrote:
> My style of PHP is to name all included files with a .php
> extension and of course this raises the problem of people
> accessing these script files directly.

I always name included files *.inc myself, but that's a
personal preference combined with a strong desire to adhere
to strict naming conventions.

It is very easy to make sure people cannot access your
include files directly. There are two common ways to do
this, and I will mention my preference first.

1. Do not store your include files under document root.
This is a very simple and straightforward approach that
negates all of the types of questions you were asking.

2. Deny access to any file with an extension of inc. Of
course, you would have to conform to a naming standard a
bit more for this to work. A quick Google search revealed
this example for Apache:


Order Allow, Deny
Deny from all


Chris

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




Re: [PHP] HTTP_REFERER work without a problem....

2003-01-15 Thread Chris Shiflett
--- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> Here's what I found so interesting
> 
> This code, $_SERVER['HTTP_REFERER'] have worked without a
> problem when I use the latest Mozilla build. It even work
> with the HierMenus,
location.replace('http://whatever.com'),
> and location.href = http://whatever.com...
> 
> This is a good news for PHP everywhere.
> 
> Unfortunately, Internet Explorer still have this
> bug...

What bug is that?

Is there a question here somewhere? I think I am having a
hard time interpreting it.

Chris

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




Re: [PHP] Security in included PHP files

2003-01-15 Thread Jacob Copsey
I agree these are good solutions and I have considered them. However, I am
looking for an all-inclusive solution that is code only within PHP that
allows the admin of the application to copy the files to their server and
not need to do any server specific configuration. That is why I don't name
the included files with .inc. It would require configuration of the server
to prevent downloading of those files and I don't want to require that step
of people who choose to run the app on their server.

Thanks for the input!

Jacob

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Jacob Copsey <[EMAIL PROTECTED]> wrote:
> > My style of PHP is to name all included files with a .php
> > extension and of course this raises the problem of people
> > accessing these script files directly.
>
> I always name included files *.inc myself, but that's a
> personal preference combined with a strong desire to adhere
> to strict naming conventions.
>
> It is very easy to make sure people cannot access your
> include files directly. There are two common ways to do
> this, and I will mention my preference first.
>
> 1. Do not store your include files under document root.
> This is a very simple and straightforward approach that
> negates all of the types of questions you were asking.
>
> 2. Deny access to any file with an extension of inc. Of
> course, you would have to conform to a naming standard a
> bit more for this to work. A quick Google search revealed
> this example for Apache:
>
> 
> Order Allow, Deny
> Deny from all
> 
>
> Chris



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




Re: [PHP] sending array

2003-01-15 Thread [-^-!-%-

 This method seems to have a size limitation (which is very small).
 If your array is (relatively) large, page two will not display the
 passed values.

 I'm not sure the url string became too long or if the problem came from
SERIALIZE(). Just beware.

FYI

-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Danielle van Gladbach wrote:

> It works thanks
>
> Here is the code, if anyone has the same problem:
> test1.php
>  $org["index-A"]=1701;
> $org["index-B"]=1209;
>
> $var=serialize($org);
> $var=urlencode($var);
>
> print "test2\n";
> ?>
>
> test2.php
>  $var=urldecode($var);
> $org=unserialize($var);
>
> while (list ($key, $val) = each($org))
>  {
>  print "key=".$key."val".$val."\n";
>  }
> ?>
>
> Jason Wong wrote:
>
> > On Wednesday 15 January 2003 20:59, Danielle van Gladbach wrote:
> >
> > > I am trying to send an array from one php to another:
> > >
> > > $org["index-A"]=1701;
> > > $org["index-B"]=1209;
> > >
> > > print "test2\n";
> > >
> > > But if I try to read te array in test2.php, I get "Warning: Variable
> > > passed to each() is not an array ".
> >
> > You can't pass an array thru the URL. What you need to do is serialize() it
> > then urlencode() it (or maybe rawurlencode()). Then you can put the resulting
> > string in the URL.
> >
> > In test2.php you would unserialize() $org ($_GET['org']).
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> >
> > /*
> > E Pluribus Unix
> > */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] HTTP_REFERER work without a problem....

2003-01-15 Thread Scott Fletcher
It's not a PHP bug.  Many PHP programmer tried to their best to use
HTTP_REFERER so they can keep track of which webpages on the current website
did the user last visited.  That way, they can keep out the unauthorized
access to the website without first logging in to the website.

Well, my company's website use both SSL and Session ID.  They are good for
starter but they aren't any secure if anyone can make a direct access
without logging in.  That's where I use HTTP_REFERER to see what last page
did he or she visited, if the last page being visited is outside of my
company's website then php moved the end user to the login page.  It is
pretty effective.

The common problem with the browsers is that they aren't compactible so
HTTP_REFERER don't alway work right and sometime return a blank if those
three are being used.  I had been observing it for a few years.  Those three
are  1) HierMenus, 2) location.replace('') and 3) location.href=''.  When
either one of these are in use, some browsers return with a blank in
HTTP_REFERER.

Cheers

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> > Here's what I found so interesting
> >
> > This code, $_SERVER['HTTP_REFERER'] have worked without a
> > problem when I use the latest Mozilla build. It even work
> > with the HierMenus,
> location.replace('http://whatever.com'),
> > and location.href = http://whatever.com...
> >
> > This is a good news for PHP everywhere.
> >
> > Unfortunately, Internet Explorer still have this
> > bug...
>
> What bug is that?
>
> Is there a question here somewhere? I think I am having a
> hard time interpreting it.
>
> Chris



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




Re: [PHP] All Request to the same script

2003-01-15 Thread [-^-!-%-


 have you tried

 ==idex.php===

  switch($op) {
 case "intro":
  include("welcome.php");
  break;
 case "about":
  include("about.php");
  break;
 case "contact":
  incldue("contact.php");
  break;
 default:
  include("welcome.php");
   }

 You would then list your links (in the html pages) as
About us
About us
Back to home


Note: You can substitute 'index.php?op=about' with '?op=about'.
i.e.
   About Us


-john


=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003 [EMAIL PROTECTED] wrote:

> Hello
>
> Is it possible to send all incoming requests to the same script within
> PHP?
> In other words: How can I get http://mysite/script.php to point to the
> same script as http://mysite/anotherscript.php ? And is it possible to do
> send a request like
> http://mysite/someextrapathinfo to the same php script?
> The background behind it is to create a controler that handles all
> incoming requests and dispatches them to different worker scripts as
> nessecary.
>
> Thanks in advance
>
> Stefan Langer


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




Re: [PHP] Security in included PHP files

2003-01-15 Thread [-^-!-%-

Have you thought about moving your include files outside of the web
directory?

i.e.If your site is in ../apache/htdocs/web/mywbsite_folder
then move your include files to ../apache/my_include_folder/  or something
similar.

-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Jacob Copsey wrote:

> I am beginning work on a new web-based application using PHP and MySQL. I
> have been doing a lot of reading about PHP security and web application
> security in general to make sure I am up-to-date on what is known in this
> area.
>
> My style of PHP is to name all included files with a .php extension and of
> course this raises the problem of people accessing these script files
> directly. My main question is if all of the code inside an included PHP file
> is put inside one or more functions this should prevent anyone from running
> any of that code by directly calling that PHP file correct? There is no way
> for them to invoke a function just from a URL assuming I have no code at all
> outside the functions.
>
> And this leads to another question... if I encapsulate most of my variables
> inside one or more classes doesn't this help protect against attacks also?
> Is there a way for someone to set a class variable to a value just from a
> GET or POST request (or even file or cookie)? As long as I am carefully
> validating what information I put into the object variable this seems to be
> a way of adding another layer of protection.
>
> Any thoughts or comments regarding this and any other issues I should take
> into consideration regarding security are welcome.
>
> Jacob
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] HTTP_REFERER work without a problem....

2003-01-15 Thread Paul Roberts
try looking at sessions, 

if they don't have a login session id send them to the login page otherwise they are 
logged in so let them see the page.

works for me

Best Wishes & Happy New Year

Paul Roberts
[EMAIL PROTECTED]

- Original Message - 
From: "Scott Fletcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 9:07 PM
Subject: Re: [PHP] HTTP_REFERER work without a problem


It's not a PHP bug.  Many PHP programmer tried to their best to use
HTTP_REFERER so they can keep track of which webpages on the current website
did the user last visited.  That way, they can keep out the unauthorized
access to the website without first logging in to the website.

Well, my company's website use both SSL and Session ID.  They are good for
starter but they aren't any secure if anyone can make a direct access
without logging in.  That's where I use HTTP_REFERER to see what last page
did he or she visited, if the last page being visited is outside of my
company's website then php moved the end user to the login page.  It is
pretty effective.

The common problem with the browsers is that they aren't compactible so
HTTP_REFERER don't alway work right and sometime return a blank if those
three are being used.  I had been observing it for a few years.  Those three
are  1) HierMenus, 2) location.replace('') and 3) location.href=''.  When
either one of these are in use, some browsers return with a blank in
HTTP_REFERER.

Cheers

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> > Here's what I found so interesting
> >
> > This code, $_SERVER['HTTP_REFERER'] have worked without a
> > problem when I use the latest Mozilla build. It even work
> > with the HierMenus,
> location.replace('http://whatever.com'),
> > and location.href = http://whatever.com...
> >
> > This is a good news for PHP everywhere.
> >
> > Unfortunately, Internet Explorer still have this
> > bug...
>
> What bug is that?
>
> Is there a question here somewhere? I think I am having a
> hard time interpreting it.
>
> Chris



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





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




Re: [PHP] Security in included PHP files

2003-01-15 Thread Chris Shiflett
--- Jacob Copsey <[EMAIL PROTECTED]> wrote:
> I agree these are good solutions and I have considered
> them. However, I am looking for an all-inclusive
> solution that is code only within PHP that allows the
> admin of the application to copy the files to their
> server and not need to do any server specific 
> configuration.

This places a large restriction on your ability to provide
the best solution. However, there are still a couple of
things you might consider, though I'm not sure if you will
be fond of them:

1. Force those who install your software to place include
files outside of document root. I know a few applications
that check this and will output an error with a brief
description of the security hazard if the include files are
found to be under document root. This way, you can be
assured that by the time people get your application to
work, the include files will no longer be under document
root. A similar notion is to combine this with a Web-based
installation program, where your application relocates the
include files during installation.

2. If your users are using Apache, you can include a
.htaccess file in the top-level directory of your
application that denies access to *.inc files.

Maybe something like that will work for you.

Chris

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




Re: [PHP] Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread Jason Lehman
Thanks for the response.  I found this web page 
(http://www.itworld.com/nl/perl/01112001/) right after I submitted my 
question.  It was great for explaining regexp's greediness.

1lt John W. Holmes wrote:
I have a script that turns certain words into links.  That I am having
no problems with, it is when I want to turn the links back in to plain
text that I am having the problem.  Below are my examples.  And I know
my regex is being greedy but I don't know how to stop it from being so
damn greedy I thought the ? mark would help but it didn't. Any help
would be appreciated. So here it goes:


The code:

$strStr = "This is USF at Tampa.  This
is USF at Tampa.";
echo $strStr."\n";
$strStr = preg_replace("/(Tampa)<\/a>/","\\1",$strStr);
echo $strStr."\n";
$strStr = preg_replace("/(USF)<\/a>/","\\1",$strStr);
echo $strStr."\n";

The output:

This is USF at Tampa. This is USF at Tampa.
This is Tampa. This is Tampa.
This is Tampa. This is Tampa.

The expected output:

This is USF at Tampa. This is USF at Tampa.
This is USF at Tampa. This is USF at
Tampa.
This is USF at Tampa. This is USF at Tampa.



Well, a /U at the end of your pattern will make it so the regex isn't
greedy. That may solve  your problem.

Or you could try matching "/]+>(Tampa)<\/a>/"

which will match an , followed by a >.
So it essentially makes it ungreedy.

---John Holmes...




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




[PHP] Version Upgrade on Apache/win

2003-01-15 Thread Malcolm Brownell
Hello all,

I'm having trouble with upgrading my php 4.1.1 to 4.3.
I have Apache 1.3.2 /php 4.1.1/Mysql 3.23.39 on winME. 
 It has been running fine but I can't make php 4.3 work.  
I have installed 4.3 to a directory next to my current php.
I put 4.3 in  /php43 and have php 4.1.1 in /php in the same directory.
When I switch the directory in httpd.conf to php43 and restart Apache it says
it can't LoadModule php4_module /php43/sapi/php4apache.dll
but if I switch back to /php it starts right up.
All of the files in php exist in php43.  The names are all the same 
anyway.  The two installations of php appear almost identical
but Apache doesn't like the new one.
What am I missing ?






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




Re: [PHP] HTTP_REFERER work without a problem....

2003-01-15 Thread Scott Fletcher
That wouldn't work if there is already a Session ID, so that's where
HTTP_REFERER come into play.

Try it out by logging to any webpages with Session ID.  Then copy the URL
address with the Session ID already there.  Paste it into an email and send
it to a different computer.  On the new computer, substitute a couple of
alpha-numeric characters with a different one.  Like replace any of the 5
characters with a different 5 characters.  Finally, copy the URL address
with the alter Session ID and paste it into the URL address of a browser and
press enter.  You'll find yourself being able to access the website without
logging in.  The $_SESSION data would not exist but it gave the hacker what
they need to break in and hacker aren't pretty dumb, they can figure out to
make it work along the way.

What so ironic is that the SSL can be established anyway.


"Paul Roberts" <[EMAIL PROTECTED]> wrote in message
021c01c2bcda$d007cde0$28ef86d9@laptop1">news:021c01c2bcda$d007cde0$28ef86d9@laptop1...
try looking at sessions,

if they don't have a login session id send them to the login page otherwise
they are logged in so let them see the page.

works for me

Best Wishes & Happy New Year

Paul Roberts
[EMAIL PROTECTED]

- Original Message -
From: "Scott Fletcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 9:07 PM
Subject: Re: [PHP] HTTP_REFERER work without a problem


It's not a PHP bug.  Many PHP programmer tried to their best to use
HTTP_REFERER so they can keep track of which webpages on the current website
did the user last visited.  That way, they can keep out the unauthorized
access to the website without first logging in to the website.

Well, my company's website use both SSL and Session ID.  They are good for
starter but they aren't any secure if anyone can make a direct access
without logging in.  That's where I use HTTP_REFERER to see what last page
did he or she visited, if the last page being visited is outside of my
company's website then php moved the end user to the login page.  It is
pretty effective.

The common problem with the browsers is that they aren't compactible so
HTTP_REFERER don't alway work right and sometime return a blank if those
three are being used.  I had been observing it for a few years.  Those three
are  1) HierMenus, 2) location.replace('') and 3) location.href=''.  When
either one of these are in use, some browsers return with a blank in
HTTP_REFERER.

Cheers

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> > Here's what I found so interesting
> >
> > This code, $_SERVER['HTTP_REFERER'] have worked without a
> > problem when I use the latest Mozilla build. It even work
> > with the HierMenus,
> location.replace('http://whatever.com'),
> > and location.href = http://whatever.com...
> >
> > This is a good news for PHP everywhere.
> >
> > Unfortunately, Internet Explorer still have this
> > bug...
>
> What bug is that?
>
> Is there a question here somewhere? I think I am having a
> hard time interpreting it.
>
> Chris



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






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




Re: [PHP] Question about $_GET

2003-01-15 Thread Jason Wong
On Thursday 16 January 2003 04:35, [-^-!-%- wrote:
>  I agree with Chris, the quote should stay there to prevent confusion.
>  Nevertheless, I often run in the same problem. Sometimes, the only way to
> fix it is by removing the quotes ($_GET[id]).
>
> I know PHP documents goes against this, but it dosn't always work with the
> quotes.

The recommended way to refer variables inside doubled-quoted strings is 
enclose them in braces {}. Thus:

  "{$_GET['id']}"

> Perhaps the dev team can look more into this.

Can you give examples where it doesn't work?

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

/*
Only Irish coffee provides in a single glass all four essential food groups --
alcohol, caffeine, sugar, and fat.
-- Alex Levine
*/


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




  1   2   >