php-general Digest 18 Mar 2003 10:42:23 -0000 Issue 1945
Topics (messages 140049 through 140100):
Session problem
140049 by: shaun
140052 by: Pete James
140057 by: shaun
140091 by: Paonarong Buachaiyo
One set of php for multiple subdomains
140050 by: Radu Manole
How to break out of nested loops
140051 by: Bix
140053 by: Philip Hallstrom
140054 by: Erik Price
140056 by: Bix
140058 by: Bix
Mail
140055 by: Stephen
140092 by: Chris Hewitt
script conflicts
140059 by: Sebastian
help from experienced devr's
140060 by: Dennis Gearon
140061 by: Ernest E Vogelsinger
140062 by: Dennis Gearon
documentation on pg_escape_string()
140063 by: Dennis Gearon
140064 by: Joe Conway
140067 by: John W. Holmes
A possible problem for PHP 4.3.0+MSession 1.21
140065 by: irenem.ms2.hinet.net
Re: complicated but fun, please help.
140066 by: Daniel McCullough
Re: stripping slashes before insert behaving badly
140068 by: Foong
Isn't it grea...t
140069 by: Bix
140071 by: Richard Whitney
140080 by: Robert Cummings
Only one works
140070 by: LinuxGeek
Searching for a file.
140072 by: Vincent M.
Re: copy ...
140073 by: John Taylor-Johnston
Reading GIF images in Win2k + Apache + PHP
140074 by: Patrick Teague
140077 by: Hugh Danaher
Re: Problem with pointer in result handle
140075 by: Blaine
140078 by: Jason Wong
140079 by: Blaine
Too all who are stuck with PHP/Apache2 under RH8
140076 by: Jason Young
Re: instalation problem
140081 by: Jason Wong
Ereg sass
140082 by: Liam Gibbs
140083 by: Hugh Danaher
140084 by: Liam Gibbs
140089 by: Jason k Larson
140097 by: Ernest E Vogelsinger
(newbie)textareas ...someone...please help
140085 by: Mirco Ellis
140086 by: Christian Rosentreter
140090 by: Jason Wong
Re: Microsoft access + php
140087 by: fLIPIS
Re: Ereg sass[Scanned]
140088 by: Michael Egan
base64 to 8bit unsigned int
140093 by: Hilmi Hilmiev
140094 by: Jason k Larson
Forced Download Using header()
140095 by: Kevin Kaiser
140099 by: Ernest E Vogelsinger
Disabling output control when using "ob_start"
140096 by: Michael Heuser
Re: newbie:restricting users to change data in a textarea
140098 by: Coert Metz
140100 by: Jon Haworth
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 ---
Hi,
I get the following error when using using the following script to
authenticate a user. The login form is inside a frameset, is this whats
causing th eproblem, and is there a way round this?
Warning: Cannot send session cookie - headers already sent by (output
started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in
/home/w/o/workmanagement/public_html/authenticate_user.php on line 35
authenticate_user.php:
<?php
require("dbconnect.php");
// Assume user is not authenticated
$auth = false;
// Formulate the query
$query = "SELECT * FROM WMS_User WHERE
User_Username = '$_POST[username]' AND
User_Password = '$_POST[password]'";
echo $query;
// Execute the query and put results in $result
$result = mysql_query( $query )
or die ( 'Unable to execute query.' );
// Get number of rows in $result.
$num = mysql_numrows( $result );
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
$auth = true;
//get the data for the session variables
$suser_name = mysql_result($result, 0, "User_Name");
$suser_password = mysql_result($result, 0, "User_Password");
$stype_level = mysql_result($result, 0, "User_Type");
$ses_name = $suser_name;
$ses_pass = $suser_password;
$ses_level = $stype_level;
session_register("ses_name"); //this is line 35
session_register("ses_pass");
session_register("ses_level");
}
//if user isn't authenticated redirect to appropriate page
if ( ! $auth ) {
include("login.php");
exit;
}
//if user is authenticated, include the main menu
else{
include("home.php");
}
//close connection
mysql_close();
?>
Thanks in as=dvance for your help
--- End Message ---
--- Begin Message ---
You need to start the session at the beginning of the script, or use
output buffering.
Either:
<?php
session_start();
require("...
...
or
<?php
ob_start();
require("...
...
You're trying to output stuff to the screen (which implicitly sends the
headers) then trying to send more headers by calling session_register()
(which implicitly calls session_start() )
HTH.
Pete.
shaun wrote:
Hi,
I get the following error when using using the following script to
authenticate a user. The login form is inside a frameset, is this whats
causing th eproblem, and is there a way round this?
Warning: Cannot send session cookie - headers already sent by (output
started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in
/home/w/o/workmanagement/public_html/authenticate_user.php on line 35
authenticate_user.php:
<?php
require("dbconnect.php");
// Assume user is not authenticated
$auth = false;
// Formulate the query
$query = "SELECT * FROM WMS_User WHERE
User_Username = '$_POST[username]' AND
User_Password = '$_POST[password]'";
echo $query;
// Execute the query and put results in $result
$result = mysql_query( $query )
or die ( 'Unable to execute query.' );
// Get number of rows in $result.
$num = mysql_numrows( $result );
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
$auth = true;
//get the data for the session variables
$suser_name = mysql_result($result, 0, "User_Name");
$suser_password = mysql_result($result, 0, "User_Password");
$stype_level = mysql_result($result, 0, "User_Type");
$ses_name = $suser_name;
$ses_pass = $suser_password;
$ses_level = $stype_level;
session_register("ses_name"); //this is line 35
session_register("ses_pass");
session_register("ses_level");
}
//if user isn't authenticated redirect to appropriate page
if ( ! $auth ) {
include("login.php");
exit;
}
//if user is authenticated, include the main menu
else{
include("home.php");
}
//close connection
mysql_close();
?>
Thanks in as=dvance for your help
--- End Message ---
--- Begin Message ---
silly me,
testing the query (echo $query;) was actually causing the problem!
"Pete James" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You need to start the session at the beginning of the script, or use
> output buffering.
>
> Either:
> <?php
> session_start();
> require("...
> ...
>
> or
>
> <?php
> ob_start();
> require("...
> ...
>
> You're trying to output stuff to the screen (which implicitly sends the
> headers) then trying to send more headers by calling session_register()
> (which implicitly calls session_start() )
>
> HTH.
> Pete.
>
> shaun wrote:
> > Hi,
> >
> > I get the following error when using using the following script to
> > authenticate a user. The login form is inside a frameset, is this whats
> > causing th eproblem, and is there a way round this?
> >
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at
/home/w/o/workmanagement/public_html/authenticate_user.php:12) in
> > /home/w/o/workmanagement/public_html/authenticate_user.php on line 35
> >
> > authenticate_user.php:
> > <?php
> > require("dbconnect.php");
> >
> > // Assume user is not authenticated
> > $auth = false;
> >
> > // Formulate the query
> > $query = "SELECT * FROM WMS_User WHERE
> > User_Username = '$_POST[username]' AND
> > User_Password = '$_POST[password]'";
> >
> > echo $query;
> >
> > // Execute the query and put results in $result
> > $result = mysql_query( $query )
> > or die ( 'Unable to execute query.' );
> >
> > // Get number of rows in $result.
> > $num = mysql_numrows( $result );
> >
> > if ( $num != 0 ) {
> >
> > // A matching row was found - the user is authenticated.
> > $auth = true;
> >
> > //get the data for the session variables
> > $suser_name = mysql_result($result, 0, "User_Name");
> > $suser_password = mysql_result($result, 0, "User_Password");
> > $stype_level = mysql_result($result, 0, "User_Type");
> >
> > $ses_name = $suser_name;
> > $ses_pass = $suser_password;
> > $ses_level = $stype_level;
> >
> > session_register("ses_name"); //this is line 35
> > session_register("ses_pass");
> > session_register("ses_level");
> > }
> >
> > //if user isn't authenticated redirect to appropriate page
> > if ( ! $auth ) {
> > include("login.php");
> > exit;
> > }
> >
> > //if user is authenticated, include the main menu
> > else{
> > include("home.php");
> > }
> >
> > //close connection
> > mysql_close();
> > ?>
> >
> > Thanks in as=dvance for your help
> >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Do not echo $query or any output before session_start(); or
session_register("xxx"); (mean headers)
//echo $query
Or may be you can put ob_start(); before first output and put
ob_end_flush(); after last headers
ob_start();
echo $query
.
.
//your code.
.
.
session_register("ses_level");
ob_end_flush();
Hope this helps!
"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I get the following error when using using the following script to
> authenticate a user. The login form is inside a frameset, is this whats
> causing th eproblem, and is there a way round this?
>
> Warning: Cannot send session cookie - headers already sent by (output
> started at /home/w/o/workmanagement/public_html/authenticate_user.php:12)
in
> /home/w/o/workmanagement/public_html/authenticate_user.php on line 35
>
> authenticate_user.php:
> <?php
> require("dbconnect.php");
>
> // Assume user is not authenticated
> $auth = false;
>
> // Formulate the query
> $query = "SELECT * FROM WMS_User WHERE
> User_Username = '$_POST[username]' AND
> User_Password = '$_POST[password]'";
>
> echo $query;
>
> // Execute the query and put results in $result
> $result = mysql_query( $query )
> or die ( 'Unable to execute query.' );
>
> // Get number of rows in $result.
> $num = mysql_numrows( $result );
>
> if ( $num != 0 ) {
>
> // A matching row was found - the user is authenticated.
> $auth = true;
>
> //get the data for the session variables
> $suser_name = mysql_result($result, 0, "User_Name");
> $suser_password = mysql_result($result, 0, "User_Password");
> $stype_level = mysql_result($result, 0, "User_Type");
>
> $ses_name = $suser_name;
> $ses_pass = $suser_password;
> $ses_level = $stype_level;
>
> session_register("ses_name"); //this is line 35
> session_register("ses_pass");
> session_register("ses_level");
> }
>
> //if user isn't authenticated redirect to appropriate page
> if ( ! $auth ) {
> include("login.php");
> exit;
> }
>
> //if user is authenticated, include the main menu
> else{
> include("home.php");
> }
>
> //close connection
> mysql_close();
> ?>
>
> Thanks in as=dvance for your help
>
>
--- End Message ---
--- Begin Message ---
Hi guys,
I have 2 scripts located in a directory and 3 dirs with 3 subdomain.
Something like this.
/scripts
- input.php
- output.php
/user1 -> subdomain user1.mysite.com
/user2 -> subdomain user2.mysite.com
/user3 -> subdomain user3.mysite.com
What can I do to execute the input.php script from any subdomain and get
output.php (response) in the same subdomain?
Do I need to copy the "scripts" directory in each subdomain dir?
many thanks,
Radu
--- End Message ---
--- Begin Message ---
I have a for loop within a for loop, and need to break out of both
together...
for ( blah ) {
for ( blah ) {
if ( true ) { break; } // only breaks out of this loop, how can I break it
out of both loops.
}
}
--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/control-structures.break.php
-philip
On Mon, 17 Mar 2003, Bix wrote:
> I have a for loop within a for loop, and need to break out of both
> together...
>
> for ( blah ) {
> for ( blah ) {
> if ( true ) { break; } // only breaks out of this loop, how can I break it
> out of both loops.
> }
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Bix wrote:
I have a for loop within a for loop, and need to break out of both
together...
for ( blah ) {
for ( blah ) {
if ( true ) { break; } // only breaks out of this loop, how can I break it
out of both loops.
}
}
"break accepts an optional numeric argument which tells it how many
nested enclosing structures are to be broken out of."
from http://www.php.net/manual/en/control-structures.break.php
Erik
--- End Message ---
--- Begin Message ---
Cheers buddy, didn't think of that!
;o)
"Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> http://www.php.net/manual/en/control-structures.break.php
>
> -philip
>
> On Mon, 17 Mar 2003, Bix wrote:
>
> > I have a for loop within a for loop, and need to break out of both
> > together...
> >
> > for ( blah ) {
> > for ( blah ) {
> > if ( true ) { break; } // only breaks out of this loop, how can I
break it
> > out of both loops.
> > }
> > }
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
--- End Message ---
--- Begin Message ---
Cheers matey!!!!!
Nice to know people are alwyas around to help!
;o)
"Erik Price" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> Bix wrote:
> > I have a for loop within a for loop, and need to break out of both
> > together...
> >
> > for ( blah ) {
> > for ( blah ) {
> > if ( true ) { break; } // only breaks out of this loop, how can I
break it
> > out of both loops.
> > }
> > }
>
> "break accepts an optional numeric argument which tells it how many
> nested enclosing structures are to be broken out of."
>
> from http://www.php.net/manual/en/control-structures.break.php
>
>
> Erik
>
--- End Message ---
--- Begin Message ---
Hi
I am trying to get mail working with my php setup. I have an exchange
server that I want to send mail to but I get the error
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to
relay for [EMAIL PROTECTED] in
I have setup SMTP = my server address and sendmail_from to my email address.
What else do I need to do?
Thanks,
Stephen
--- End Message ---
--- Begin Message ---
Stephen wrote:
I am trying to get mail working with my php setup. I have an exchange
server that I want to send mail to but I get the error
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to
relay for [EMAIL PROTECTED] in
I have setup SMTP = my server address and sendmail_from to my email address.
It is the email server that is not allowing your computer
(pittsh.com.au) to connect to send email. Ask the administrator of that
computer to allow your computer to relay through it. FYI it is correct
for email servers to only allow needed computers to connect to avoid
being an open relay for spammers.
HTH
Chris
--- End Message ---
--- Begin Message ---
i have two scripts included into one page, one of them i have been running
for a long time .. i recently made another script and when i include it into
the same page the other script returns this error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
resource in /home/public_html/file.php on line 59
This is part of the sql query that conflicts with the other, any ideas? it
only happens when this snippet is included in the same page that the other
is included into.
function load() {
mysql_connect($hostname,$username,$password) or die ( "Could not connet to
MySQL" );
mysql_select_db($database) or die ( "Could not connect to database" );
// Delete
$sql = "DELETE FROM $table WHERE time < " . (time()-$duration);
$result = @mysql_query($sql) or die ("Error:" . mysql_error() );
// Insert
$sql = "INSERT INTO $table (time) VALUES (" . time() . ") ";
$result = @mysql_query($sql) or die ("Error:" . mysql_error() );
// Get count
$sql = "SELECT time FROM $table";
$result = @mysql_query($sql) or die ("Error:" . mysql_error() );
return mysql_num_rows ($result);
}
TIA.
--- End Message ---
--- Begin Message ---
Simple question, only related to this forum in that all of us use
libraries that are compressed.
I'm trying to use adodb, and I uploaded it's zipped archive to a linux
box and gunzip won't unzip it. Says 'multiple entries'. Anyone know how
to upload it, short of unzipping in on a windbloze box, then ftping all
files up?
--- End Message ---
--- Begin Message ---
At 00:18 18.03.2003, Dennis Gearon said:
--------------------[snip]--------------------
>Simple question, only related to this forum in that all of us use
>libraries that are compressed.
>
>I'm trying to use adodb, and I uploaded it's zipped archive to a linux
>box and gunzip won't unzip it. Says 'multiple entries'. Anyone know how
>to upload it, short of unzipping in on a windbloze box, then ftping all
>files up?
--------------------[snip]--------------------
on your linux box, cd to the directory containing the archive, then enter
tar -xzf {archivename}
In most cases (also for adodb) this will create a directory tree containing
the extracted distribution files in the correct layout. The directory name
is usually similar to the archive name (depends on the archive contents of
course, but in case of adodb it's "adodb" and a version number (I believe).
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
Turns out the adodb guy DOES have a *.tgz file to download. I got it,
(it's missnamed in the extension), and was able to extract it fine.
Thanks for your help!
Ernest E Vogelsinger wrote:
At 00:18 18.03.2003, Dennis Gearon said:
--------------------[snip]--------------------
Simple question, only related to this forum in that all of us use
libraries that are compressed.
I'm trying to use adodb, and I uploaded it's zipped archive to a linux
box and gunzip won't unzip it. Says 'multiple entries'. Anyone know how
to upload it, short of unzipping in on a windbloze box, then ftping all
files up?
--------------------[snip]--------------------
on your linux box, cd to the directory containing the archive, then enter
tar -xzf {archivename}
In most cases (also for adodb) this will create a directory tree containing
the extracted distribution files in the correct layout. The directory name
is usually similar to the archive name (depends on the archive contents of
course, but in case of adodb it's "adodb" and a version number (I believe).
--- End Message ---
--- Begin Message ---
Anyone know where to find documentation on this? Who knows what it escapes?
please cc / bc me as I'm on digest
--- End Message ---
--- Begin Message ---
Dennis Gearon wrote:
Anyone know where to find documentation on this? Who knows what it escapes?
From PostgreSQL source (~/pgsql/src/interfaces/libpq/fe-exec.c):
8<--------------------------------------------------------------------
/* ---------------
* Escaping arbitrary strings to get valid SQL strings/identifiers.
*
* Replaces "\\" with "\\\\" and "'" with "''".
* length is the length of the buffer pointed to by
* from. The buffer at to must be at least 2*length + 1 characters
* long. A terminating NUL character is written.
* ---------------
*/
size_t
PQescapeString(char *to, const char *from, size_t length)
8<--------------------------------------------------------------------
I presume the PHP function is just a wrapper around this one (but did
not actually check).
HTH,
Joe
--- End Message ---
--- Begin Message ---
> Anyone know where to find documentation on this? Who knows what it
> escapes?
I always look in the manual when I'm looking for documentation, but
that's just me. Hell, call me crazy, but I'd probably look in the
chapter on the PG functions... but that's just me... and I have no idea
what I'm doing.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--- End Message ---
--- Begin Message ---
Dear Lady/Sir :
I can not find any technical contact in Mohawk's web but this mailling list
in the internet. I am looking for solutions. If this e-mail bothers you, I
appologize.
I found a possible msession problem in V1.21 only, which is based upon
phoenix-R1_2_030117E (PHP 4.3.0, RedHat 7.2). It looks like :
1. The PHP+msession runs slow as the listener threads increased.
The PHP msession_get( ) will take more than 100ms as the listerner
threads
is increased to 30. This slowness will be triggered only from
PHP+msession, and
that is started after a few executions (say, usually after 10 times).
The non-PHP msession-related programs do not trigger this slowness and
works good.
However, this situation and the same PHP+msession_get program
does not re-create the same slowness on PHP 4.3.0+msession 1.0.
2. As soon as the slowness appears, any msession programs
(including ./tools/list ...) slows down too, until the msessiond is
re-booted.
Anybody has the same problem or solutions ?
Best Regards,
Hammer Wang
--- End Message ---
--- Begin Message ---
Yes sorry for not being clear. I am trying to use exec() and system().
I guess I'm trying to see if there is another way to do it, like write to a
file and have acron job run every minute or so, or if there is some way to
make it seem like I am doing this with the right permissions.
From: Erik Price <[EMAIL PROTECTED]>
To: Daniel McCullough <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] complicated but fun, please help.
Date: Mon, 17 Mar 2003 16:55:52 -0500
MIME-Version: 1.0
Received: from mxrelay.ptc.com ([12.11.148.30]) by mc5-f40.law1.hotmail.com
with Microsoft SMTPSVC(5.0.2195.5600); Mon, 17 Mar 2003 13:58:28 -0800
Received: from HQ-EXFE4.ptcnet.ptc.com (localhost [127.0.0.1])by
mxrelay.ptc.com (8.9.0/8.9.0) with ESMTP id QAA22956;Mon, 17 Mar 2003
16:58:27 -0500 (EST)
Received: from hq-mail1.ptcnet.ptc.com ([132.253.201.69]) by
HQ-EXFE4.ptcnet.ptc.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 17 Mar
2003 16:56:11 -0500
Received: from ptc.com ([132.253.96.61]) by hq-mail1.ptcnet.ptc.com with
Microsoft SMTPSVC(5.0.2195.5329); Mon, 17 Mar 2003 16:56:11 -0500
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1)
Gecko/20021130
X-Accept-Language: en-us, en
References: <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
X-OriginalArrivalTime: 17 Mar 2003 21:56:11.0113 (UTC)
FILETIME=[059A0D90:01C2ECD0]
Return-Path: [EMAIL PROTECTED]
Daniel McCullough wrote:
Where I am having problems at is when they need to update the poppasswd,
which is a IMAP or QMAIL file. Plesk has files that will update the
system, but it seems that I using the exec() and system() I can access
those pl files. From the command prompt it works fine, html/php file
doesnt work. Any thoughts? I would really appreciate the help, I'm doing
this as a favor and would like to clear this off my plate.
You probably are logged into the command prompt as a different user than
what the PHP binary runs as. If the PHP binary runs as a user named
"apache", and you log in as "dmcullough" or "root", and the commands you
are trying to execute are restricted only to being run by "dmcullough" or a
group that "dmcullough" is in but "apache" is not, then PHP won't run them.
I'm assuming that you are using the system() or exec() commands, your email
is a little difficult to understand in that respect... sorry.
Erik
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---
if Magic_quotes_gpc in you php.ini is set to 'on', php will automatically
escape(add slashes) for you.
Foong
"Charles Kline" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> John,
>
> You are right, something was adding the additional slash. I removed the
> addslashes() and it fixed the problem. Something I am doing must
> already be handling that... will step through the code AGAIN and see if
> I can find it.
>
> - Charles
>
> On Monday, March 17, 2003, at 12:19 PM, John W. Holmes wrote:
>
> >> I am inserting data from a form into a mySQL database. I am using
> >> addslashes to escape things like ' in the data input (this is actually
> >> being done in PEAR (HTML_QuickForm).
> >>
> >> The weird thing is that the data gets written into the table like:
> >> what\'s your problem?
> >>
> >> WITH the slash. I am not sure what to modify to fix this so the
> > literal
> >> slash is not written.
> >
> > You're running addslashes() twice, somehow. Magic_quotes_gpc is
> > probably
> > on and you're escaping the data again. I would think PEAR would account
> > for that, but I guess not.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> >
>
--- End Message ---
--- Begin Message ---
I think it is an amazing feat to have a scripting language with such a
comprehensive (with user notes) documentation, helpful community of users
and developers, and a team of writers who for little reward, continue to
develop PHP to make it work better and faster for us all to use.
So here's to PHP!
Keep up the good work.
;o)
--- End Message ---
--- Begin Message ---
On St. Paddy's Day, let's all raise a pint and say, Here, Here!
Quoting Bix <[EMAIL PROTECTED]>:
### I think it is an amazing feat to have a scripting language with such a
### comprehensive (with user notes) documentation, helpful community of users
### and developers, and a team of writers who for little reward, continue to
### develop PHP to make it work better and faster for us all to use.
###
### So here's to PHP!
###
### Keep up the good work.
###
### ;o)
###
###
###
### --
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
###
###
--
Richard Whitney *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED] *
http://xend.net *
602-971-2791
* * *
* * *__ * *
_/ \___ *
* / * \* *
*/ * * \
* */\_ |\
/ \_ / \
/ \____/ \
/ \
/ \
/ \
--- End Message ---
--- Begin Message ---
Bix wrote:
>
> I think it is an amazing feat to have a scripting language with such a
> comprehensive (with user notes) documentation, helpful community of users
> and developers, and a team of writers who for little reward, continue to
> develop PHP to make it work better and faster for us all to use.
>
> So here's to PHP!
*cheers* to that!
Rob
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--- End Message ---
--- Begin Message ---
Hi,
I am having a problem with one of my session variables, no matter what I
try I can't get a second one to register. My webpage calls this script
directly and I am using the webpage form variables for the variables in
this script. I can register the Name variable but not the LoginName
variable.
What am I doing wrong??
Here is complete script:
<?
require_once ( "DBFunctions.php" );
#Make DB Connection
$result = makeconnection();
if( $result )
{
#validate the user
$Name = validuser("$LoginName", "$PWord");
if( strlen($Name) > 0 )
{
#start a session and register the user and limit the session
to one hour
#session_cache_expire(60);
session_start();
#here is where I check for registered sessions and
registered users
if(! session_is_registered("Name")) // this works as expected
{
session_register("Name");
}
if(! session_is_registered("LoginName"))
{
session_register( "LoginName" ); // this does not work.
}
header("Location:
http://www.xxxxxxxxxx.com/xxxxxxx/xxxxxxxx.php");
}
else
{
header("Location: http://www.xxxxxxxx.com/xxxxxxxx/");
exit();
}
}
else
{
#session_unset();
session_destroy();
echo "Problem with database.";
exit();
}
?>
--- End Message ---
--- Begin Message ---
Hello,
I am looking for a way to search a file knowing the beginig of his name.
For exemple, I know that the file I am looking for is:
montreal_000013_120.jpg
But I just know:
montreal_000013
And I can't know _120.jpg
So at this time I did this:
$dirthumbs = $dir."/thumbs" ;
$direc_src_obj2 = dir($dirthumbs) ;
while($entry=$direc_src_obj2->read()) {
if( substr($entry, 0, 15) == "$begining"){
$return[$i]["thumb"] = "$entry" ;
break ;
}
}
It works but it's not enough fast :-(
For resume, is there a way to do something like that:
ls montreal_000013*
without using the passthru function, I am looking for a native php
function doing ls $mychar*
Thanks,
Vincent.
--- End Message ---
--- Begin Message ---
John
Thanks.
John
"CPT John W. Holmes" wrote:
> If you have "TI: text ¶ TI: text2 ¶" as a string, my first example (if ereg
> is greedy by nature) will match " text ¶ TI: text2 " as a single match. It
> will be greedy and try to match as much text as it can between any TI: and ¶
> character. The second example will match text, but only if it's not (hence
> the ^ within [ and ]) the ¶ character. So, with the second, you'll end up
> with two matches " text " and " text2 ".. which is what you want, right?
>
> As for docs, just search anywhere for "regular expressions" and you can
> learn the basics. The implementation of ereg_* vs. preg_* functions are a
> little different, but once you learn the regular expression basics, you'll
> be fine. The PHP docs for each set give some examples. phpbuilder.com also
> has a good article on them.
>
> ---John Holmes...
>
> ----- Original Message -----
> From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 17, 2003 2:54 PM
> Subject: Re: [PHP] copy ...
>
> > Captn John,
> > What the difference? I recognise the code from my attempts at Perl. What's
> the diff between ^ and *? Is there a doc I can read up more on?
> > ;) Swabbie John
> >
> > "Cpt John W. Holmes" wrote:
> >
> > > What about
> > >
> > > eregi("TI(.*)¶",$line,$m)
> > >
> > > might want to use
> > >
> > > eregi("TI([^¶]*)¶",$line,$m)
> > >
> > > so it's not greedy.
> > >
> > > ---John Holmes...
> > >
> > > ----- Original Message -----
> > > From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Monday, March 17, 2003 2:31 PM
> > > Subject: Re: [PHP] copy ...
> > >
> > > > Perl, I will never touch again :) Find occurence of "TI:" and "¶" in
> the
> > > string $textarea and extract it only. The problem is the user may have
> > > entered \r\n. Therefore making \n out of the question to use as my end
> > > marker.
> > > >
> > > > John
> > > >
> > > > Marek Kilimajer wrote:
> > > >
> > > > > I have a strong feeling that POSIX regexs cannot do multiline, try
> using
> > > > > perl-compatible, or make a loop to read the textarea content line by
> > > line
> > > > >
> > > > > John Taylor-Johnston wrote:
> > > > >
> > > > > >I need to process the contents of <textarea name="textarea">
> > > > > >
> > > > > ><textarea name="textarea">SU: something ... blah blah¶
> > > > > >TI: Title ... asasa asasas asas¶
> > > > > >AU: author field ... asasasas¶
> > > > > ></textarea>
> > > > > >
> > > > > >I want to filter $textarea. I need to change my code below to grab
> > > everything between "TI:" and "¶", but not including "¶" :
> > > > > >
> > > > > >I have this code.
> > > > > >
> > > > > >--------snip------------
> > > > > >
> > > > > >filter_strings("TI: ", $textarea)
> > > > > >
> > > > > >function filter_strings($tofilter,$line){
> > > > > > if(eregi('^'.$tofilter.' (.*)$',$line,$m)) {
> > > > > > $filtered=$m[1];
> > > > > > return $filtered;
> > > > > > }
> > > > > >}
> > > > > >John Taylor-Johnston
> > > > > >Université de Sherbrooke:
> > > > > >http://compcanlit.ca/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http://compcanlit.ca/
819-569-2064
--- End Message ---
--- Begin Message ---
I have a class that reads gif images & can then make jpeg or png thumbnails
of the gif image, but it only seems to work on linux. Is there any way to
open/convert the gif to some other graphic format so I can at least read the
gif image in on windows?
here's the current code I have for reading in file types, but the gif
section blows up. Is there a way with something like readfile() or fopen()
to get the information from a gif file?
switch($type)
{
case "gif":
$orig_img = imagecreatefromgif($filename);
break;
case "jpg":
$orig_img = imagecreatefromjpeg($filename);
break;
case "png":
$orig_img = imagecreatefrompng($filename);
break;
}
Patrick
--- End Message ---
--- Begin Message ---
//When converting an image from gif to jpeg or png, you need to create an
intermediate image the same size as you want output. The following should
work, but it's not tested.
hope this helps,
Hugh
<?php
$size=getimagesize($filename); // this will get the x & y dimensions and the
file type (gif, jpeg, etc.)
if ($size[2]==1) $orig_img = imagecreatefromgif($filename);
if ($size[2]==2) $orig_img = imagecreatefromjpeg($filename);
$destination_image=imagecreatetruecolor ( $size[0], $size[1]); //
intermediate image the same size as orig_img
imagecopy ( $destination_image, $orig_img, 0, 0, 0, 0, $size[0], $size[1]);
header("content-type: image/jpeg"); // needed only if you want to use the
data stream.
imagejpeg($destination_image,'$new_file_name', 80); // if you just want the
output, you can leave out the $new_file_name.
imagedestroy($orig_img);
imagedestroy($destination_image);
?>
----- Original Message -----
From: "Patrick Teague" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 10:47 PM
Subject: [PHP] Reading GIF images in Win2k + Apache + PHP
> I have a class that reads gif images & can then make jpeg or png
thumbnails
> of the gif image, but it only seems to work on linux. Is there any way to
> open/convert the gif to some other graphic format so I can at least read
the
> gif image in on windows?
>
> here's the current code I have for reading in file types, but the gif
> section blows up. Is there a way with something like readfile() or
fopen()
> to get the information from a gif file?
>
> switch($type)
> {
> case "gif":
> $orig_img = imagecreatefromgif($filename);
> break;
> case "jpg":
> $orig_img = imagecreatefromjpeg($filename);
> break;
> case "png":
> $orig_img = imagecreatefrompng($filename);
> break;
> }
>
> Patrick
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I've discovered that it is not the pointer in the array that I am having
problems with but rather the pointer in the result handle.
From what I gather, when a mysql_fetch function (mysql_fetch_row,
mysql_fetch_assoc, mysql_fetch_array) retrieves a row from the result
handle (In this case it is $rsCommunitiesServed), the result handle's
internal pointer is advanced one position.
The first mysql_fetch function (mysql_fetch_assoc) used in the recordset
block causes the result handle's internal pointer to advance to the
second record. So, when I later use mysql_fetch_array, the result
handle's internal pointer is now on the second row of the results and so
it gives me the second record. Actually, I use the mysql_fetch_array
function in a while loop so what I get is all the records in the array
which includes all records from the result set except for the first record.
So, what I need to do is move the internal pointer of the result handle
back to the first row of the result set. How can I do this?
Thank you,
Blaine
--- End Message ---
--- Begin Message ---
On Tuesday 18 March 2003 14:50, Blaine wrote:
[snip]
> So, what I need to do is move the internal pointer of the result handle
> back to the first row of the result set. How can I do this?
mysql_data_seek()
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Internet outage
*/
--- End Message ---
--- Begin Message ---
I resolved the problem by using the mysql_data_seek function to set the
pointer to the first record.
mysql_data_seek($rsCommunitiesServed, 0);
Blaine
--- End Message ---
--- Begin Message ---
Just a quick reiteration of something I found that probably most people
already know.. but since I went through the painstaking trouble of
removing the PHP and Apache RPMs and building them from scratch (I hate
building sources), I wanted to make sure this is out there.
If you're having problems getting any PHP code to parse and you ususally
use <? and ?> ...
In the /etc/php.ini file change the short_open_tag variable to On
That's all there is to it.. lol
Also, you might wanna find the extention=mysql.so and uncomment that,
since it's commented by default
Credit goes out to the people who have previously posted this, but it's
been a while since it's been said recently, I just thought I'd help out.
--Jason
--- End Message ---
--- Begin Message ---
On Monday 17 March 2003 20:12, Guram Mosashvili wrote:
> Hi List,
> I have problem with instalation of PHP4 on my LINUX APACHE MySQL server.
>
> when I did: ./configure --with-apxs=/server/apache/bin/apxs
>
> I got error message:
> -----
> configure error: Sorry I cannot run apxs.Either you need to install Perl or
> you need to pass the absolute path of by using
> --with-apxs=/absolute/path/to/apxs
> -----
>
> However, Perle I already have in my server...
The second part of the error says you need to give the full path to your apxs
executable. If you don't know where it is, use:
find / -name apxs
to find it.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Madness has no purpose. Or reason. But it may have a goal.
-- Spock, "The Alternative Factor", stardate 3088.7
*/
--- End Message ---
--- Begin Message ---
I'm not sure why, but I can't include a period in my eregi statement:
[A-Za-z0-9_-.]*
For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
/home/website/public_html/Functions.inc on line 27
The same goes for [A-Za-z0-9_-\.]*
Anyone know why?
--- End Message ---
--- Begin Message ---
try two backslashes to escape php special characters
----- Original Message -----
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 12:33 AM
Subject: [PHP] Ereg sass
I'm not sure why, but I can't include a period in my eregi statement:
[A-Za-z0-9_-.]*
For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
/home/website/public_html/Functions.inc on line 27
The same goes for [A-Za-z0-9_-\.]*
Anyone know why?
--- End Message ---
--- Begin Message ---
> try two backslashes to escape php special characters
Tried that with the same result.
> I'm not sure why, but I can't include a period in my eregi statement:
>
> [A-Za-z0-9_-.]*
>
> For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
> /home/website/public_html/Functions.inc on line 27
>
> The same goes for [A-Za-z0-9_-\.]*
>
> Anyone know why?
>
>
>
--- End Message ---
--- Begin Message ---
It's seeing the - as a range identifier, escape it to get the literal hyphen.
How about this:
[a-zA-Z0-9_\-.]*
In my tests, the period didn't need to be escaped with the \.
HTH,
Jason k Larson
Liam Gibbs wrote:
I'm not sure why, but I can't include a period in my eregi statement:
[A-Za-z0-9_-.]*
For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in /home/website/public_html/Functions.inc on line 27
The same goes for [A-Za-z0-9_-\.]*
Anyone know why?
--- End Message ---
--- Begin Message ---
At 10:36 18.03.2003, Jason k Larson said:
--------------------[snip]--------------------
>It's seeing the - as a range identifier, escape it to get the literal hyphen.
>
>How about this:
>[a-zA-Z0-9_\-.]*
>
>In my tests, the period didn't need to be escaped with the \.
--------------------[snip]--------------------
The period is a regex placeholder for "any character". Thus it will match a
period, but also a #, a @, and everything that's not allowed in the planned
regex.
By escaping the period you're changing the meaning from "any character" to
"or a period" (in this context) so I believe that's what you want to do.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
Guys I really need your help. How do I restrict users from changing data in
a textarea? I need to display data on a page so that users can edit it and
update the database. With the help of this mailing list I got it going but
now I am running into walls. Some of the data is sensitive and can't be
changed. But the only way I know how to display data
so that it can't be edited directly is in a normal table format or print.
After the specific data has been placed in table format and the rest in
textareas only those in textareas are being used in the mysql query, where I
actually need everything to be used. I have tried declaring global variables
for the variables displayed in table format but this is not working.
I have tried looking for solutions on the net and the php manual but can't
find anything. I know it is there but I am probably staring myself blind at
the solution. If you guys need me to include my code (embarrassing!!) just
let me know.
Your help will be greatly appreciated!
Gratefully
Mirco
--- End Message ---
--- Begin Message ---
Hi,
use
<input type="hidden" name="<name>" value="<your sensitve data>">
for transporting sensitive data.
regards,
Christian
> -----Original Message-----
> From: Mirco Ellis [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 18, 2003 10:06 AM
> To: Php-General (E-mail)
> Subject: [PHP] (newbie)textareas ...someone...please help
>
> can edit it and
> update the database.
> now I am running into walls. Some of the data is sensitive
> and can't be
> changed. But the only way I know how to display data
> so that it can't be edited directly is in a normal table
> format or print.
--- End Message ---
--- Begin Message ---
On Tuesday 18 March 2003 17:24, Christian Rosentreter wrote:
> use
>
> <input type="hidden" name="<name>" value="<your sensitve data>">
>
> for transporting sensitive data.
That is not secure at all.
> > can edit it and
> > update the database.
> > now I am running into walls. Some of the data is sensitive
> > and can't be
> > changed. But the only way I know how to display data
> > so that it can't be edited directly is in a normal table
> > format or print.
For the data that cannot/should not be changed, quite simply do not accept
that value from the user. Just re-read its value from your own records.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Where it is a duty to worship the sun it is pretty sure to be a crime to
examine the laws of heat.
-- Christopher Morley
*/
--- End Message ---
--- Begin Message ---
I've written a tutorial on my site about this subject. You can find it here:
http://www.flipis.net/tutoriales/php_myaccess.php
It's in spanish, though
--- End Message ---
--- Begin Message ---
Try
[A-Za-z0-9_\-\.]*
-----Original Message-----
From: Liam Gibbs [mailto:[EMAIL PROTECTED]
Sent: 18 March 2003 08:52
To: php list
Subject: Re: [PHP] Ereg sass[Scanned]
> try two backslashes to escape php special characters
Tried that with the same result.
> I'm not sure why, but I can't include a period in my eregi statement:
>
> [A-Za-z0-9_-.]*
>
> For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
> /home/website/public_html/Functions.inc on line 27
>
> The same goes for [A-Za-z0-9_-\.]*
>
> Anyone know why?
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dear All,
I have stream data encrypted BASE64. My problem is that I must decode
this BASE64 to 8-bit unsigned array and I don't know how :( Have a
native possibility in PHP for making this or not? Have a somebody who
know, where I can find more info for this? Site, pdf, link....
10x in advance to all!!!!
--- End Message ---
--- Begin Message ---
You mean encoded base64 stream data, right? Anyway, can you give us an example of the base64
data? PHP does have native support to encode/decode base64 data. However you're losing me with
the "decode to an 8-bit unsigned array" request. This might very well just be the decoded
base64 value that you then need manipluated into an array, maybe yes?
--
Jason k Larson
Hilmi Hilmiev wrote:
Dear All,
I have stream data encrypted BASE64. My problem is that I must decode
this BASE64 to 8-bit unsigned array and I don't know how :( Have a
native possibility in PHP for making this or not? Have a somebody who
know, where I can find more info for this? Site, pdf, link....
10x in advance to all!!!!
--- End Message ---
--- Begin Message ---
I have a simple php download script that streams a non-web-accessible file
to the browser using this generally accepted method:
header("Expires: 0");
header("Cache-Control: private");
header("Content-Type: application/save");
header("Content-Length: ".filesize($total) );
header("Content-Disposition: attachment; filename=".$file_Path);
header("Content-Transfer-Encoding: binary");
$fh = fopen($total, "rb");
fpassthru($fh);
While it works, this is fairly useless in my situation where files range
from 5mb to over 100mb, because due to fpassthru() or readfile() or whatever
method used to stream the data to the recipient, the 'save as'/'open' dialog
doesn't open until the entire file has been downloaded. This is very
impractical since the user has no clue how much has been downloaded / how
much longer is left, not to mention that on very large files (~75mb) apache
will actually freeze up and become unresponsive to all users (sending cpu
usage to 100%) for nearly 10 minutes or more, assumedly because it is still
reading the file (regardless of whether the 'stop' button has been clicked
or not).
With the last 2 lines commented out (fopen() and fpassthru()), the save-as
dialog opens instantly.. is there any way fopen/fpassthru() could be delayed
until after the user chooses to open or save the file ? How would you guys
go about handling large file downloads while keeping the files themselves
non-web-accessible (aka not a direct link/redirector)?
Any help would be appreciated.
-KevinSync
--- End Message ---
--- Begin Message ---
At 11:16 18.03.2003, Kevin Kaiser said:
--------------------[snip]--------------------
> I have a simple php download script that streams a
> non-web-accessible file
>to the browser using this generally accepted method:
>
> header("Expires: 0");
> header("Cache-Control: private");
> header("Content-Type: application/save");
> header("Content-Length: ".filesize($total) );
> header("Content-Disposition: attachment; filename=".$file_Path);
> header("Content-Transfer-Encoding: binary");
> $fh = fopen($total, "rb");
> fpassthru($fh);
>
> While it works, this is fairly useless in my situation where files
> range
>from 5mb to over 100mb, because due to fpassthru() or readfile() or whatever
>method used to stream the data to the recipient, the 'save as'/'open' dialog
>doesn't open until the entire file has been downloaded. This is very
>impractical since the user has no clue how much has been downloaded / how
>much longer is left, not to mention that on very large files (~75mb) apache
>will actually freeze up and become unresponsive to all users (sending cpu
>usage to 100%) for nearly 10 minutes or more, assumedly because it is still
>reading the file (regardless of whether the 'stop' button has been clicked
>or not).
>
> With the last 2 lines commented out (fopen() and fpassthru()), the
> save-as
>dialog opens instantly.. is there any way fopen/fpassthru() could be delayed
>until after the user chooses to open or save the file ? How would you guys
>go about handling large file downloads while keeping the files themselves
>non-web-accessible (aka not a direct link/redirector)?
--------------------[snip]--------------------
Disclaimer - this is just an idea, I've never dealt with downloading that
big files.
If apache freezes because the file it's reading is too big to be handled
I'd suggest to try a chunked approach, not using fpassthrough or a single
file read. The reason is that for every system I/O the operating systems
get a chance to switch process context, and to allow cooperative multitasking.
Would go something like that:
define('CHUNKSIZE', 8192);
$fp = fopen($file, 'r') or die ("Cannot open $file");
header("Expires: 0");
header("Cache-Control: private");
header("Content-Type: application/save");
header("Content-Length: ".filesize($total) );
header("Content-Disposition: attachment; filename=".$file_Path);
header("Content-Transfer-Encoding: binary");
// --
while ($buffer = fread($fp, CHUNKSIZE)) {
echo $buffer;
}
fclose($fp);
You may need to experiment with the size of the chunks to keep up an
acceptable transfer rate. If you still encounter big holdups for other
processes you might consider using usleep() every 10th chunk or so, but use
your calculator to check how that would extend the overall transmission
time. For example, for a 100MB file, going to usleep for 50 msec after each
9kb chunk would mean that your process will sleep for 1.82 hours (!!) until
the file is delivered...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
Is there a way to disable the call back function set by "ob_start"?
I tried:
ob_end_flush();
ob_end_clean();
ob_implicit_flush(true);
Nothing seams to work. I can't detect the call back function and I can't
prevent it either. The call back function is called no matter what!
Michael
--- End Message ---
--- Begin Message ---
You can put READONLY in your TEXTAREA tag
Coert Metz
Mirco Ellis wrote:
Hi all,
I have a app that enables the user to call data out of a mysql database into
textareas. They can then edit the data and update the database. There is one
field that I whant to stop them from changing. This field I also use in my
sql query when updating the table,ie. where variable='$variable'. So what I
did was simply this:
"<tr>\n";
print "\t<td>$variable</td>\n";
print "</tr>\n";
instead of:
print "<textarea name=variable rows=1
cols=10>".stripslashes($row['variable'])."</textarea><br>";
This definately stopped them from editing it but also disabled the mysql
query from working. Can anyone just give me a couple of ideas how I can make
this work.
Thanks
Mirco
--- End Message ---
--- Begin Message ---
Hi Coert,
> > There is one field that I whant to stop them from changing
>
> You can put READONLY in your TEXTAREA tag
While this would probably keep the honest people honest (assuming it's
supported across all browsers), it won't stop anyone who wants to pollute
the database. What's to stop me making my own version of your form, without
READONLY, and submitting that?
If the OP doesn't want users to change the data in the field, he/she should
either display it so it's non-editable (i.e. in a <p>, or something), or
simply ignore any changes users make to it.
As a rule of thumb, *never* *ever* trust data that has left your server and
then come back, regardless of whether it's in a readonly textarea, a hidden
field, a cookie, whatever. Good programmers look both ways before crossing
one-way streets.
Cheers
Jon
--- End Message ---