php-general Digest 16 Mar 2005 11:32:04 -0000 Issue 3341

Topics (messages 210856 through 210882):

Calling a function from the parent class
        210856 by: Eli
        210861 by: Jason Barnett

is_a() against instanceof
        210857 by: Eli
        210862 by: Jason Barnett
        210866 by: Eli
        210869 by: Christian Stadler

Re: Update db with $_POST
        210858 by: Danny Brow
        210863 by: Jason Barnett
        210872 by: Danny Brow
        210880 by: Ligaya Turmelle
        210881 by: Danny Brow

opendir
        210859 by: Steve Buehler

Re: Can I use ftp_put to bypass upload_max_filesize?
        210860 by: Eli
        210868 by: Esad Hajdarevic
        210873 by: SED

Re: if table not exists
        210864 by: Steve Buehler
        210871 by: John Taylor-Johnston
        210879 by: Ligaya Turmelle

Re: recommending a PHP book?
        210865 by: Matt Zandstra

QuickForm->process()
        210867 by: Esad Hajdarevic

Re: password Boxes
        210870 by: Kevin

Re: warning & question about mysql sessions & concurrency
        210874 by: Brian

Reading posted form variables
        210875 by: Simon Allison
        210878 by: Ligaya Turmelle

Ad software
        210876 by: Ryan A
        210877 by: James Williams

Log out button
        210882 by: William Stokes

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:
        php-general@lists.php.net


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

<?php
class A
{
   public function func() { echo "A"; }
}
class B extends A
{
   public function func() { echo "B"; }
}
$cls=new B();
$cls->func();  //echo: B
?>

How can I call func() of class A from $cls object (that when I call func() it will echo "A" and not "B")?

Changing functions names or declaring another function in class B that will call parent::func() are not good for me.

-thanks, Eli
--- End Message ---
--- Begin Message ---
Eli wrote:
...
> How can I call func() of class A from $cls object (that when I call
> func() it will echo "A" and not "B")?
>
...

<?php

class A {
  function func() { echo "A\n"; }
}

class B extends A {
  function func() { echo "B\n"; }
  function AMethod($method, $args = array() ) {
    return call_user_func_array( array( 'A', $method ), $args );
  }
}

$cls = new B();
/** Produces B as expected */
$cls->func();
/** Produces A as expected
If you don't need $this in your function A::func
then this is the best way to go.  */
A::func();
/** Produces A, as expected */
$method = 'func';
call_user_func_array( array( 'A', $method), array() );
/** Functionally the same as above, but produces B instead of A? */
$cls->AMethod('func');

?>

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


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

PHP5 uses the 'instanceof' keyword instead of the deprecated is_a() function.
But there's a big difference between the two:
- is_a($cls,"ClassName") *doesn't require* from ClassName to be declared, and return false when ClassName is not declared.
- ($cls instanceof ClassName) *requires* from ClassName to be declared, and generates a fatal error when ClassName is not declared.

Since is_a() is deprecated.. is there a way to use instanceof exactly like is_a() function (so it will not make an error when the class is not declared)?

-thanks, Eli
--- End Message ---
--- Begin Message ---
Eli wrote:
...
> - is_a($cls,"ClassName")  *doesn't require* from ClassName to be
> declared, and return false when ClassName is not declared.
...

Try is_subclass_of()

http://php.net/manual/en/function.is-subclass-of.php

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message --- Jason Barnett wrote:
Eli wrote:
...

- is_a($cls,"ClassName")  *doesn't require* from ClassName to be
declared, and return false when ClassName is not declared.

...

Try is_subclass_of()

http://php.net/manual/en/function.is-subclass-of.php

is_subclass_of() is not exactly like is_a(), in that it will return false if the object is exactly from the class.

$cls=new ClassName();
var_dump(is_subclass_of($cls,"ClassName"));  //dumps: FALSE!
var_dump(is_a($cls,"ClassName"));  //dumps: TRUE!

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eli schrieb:
> - ($cls instanceof ClassName)  *requires* from ClassName to be declared,
> and generates a fatal error when ClassName is not declared.
How about
if (class_exists('ClassName') AND $cls instanceof ClassName)
{
   ...
}

Regards,
  Christian Stadler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCN5d09250Hcbf/3IRAjACAJ4nuKWyohEgv74Ycj/oXYn/7vWW7gCaAqm3
FV6CJd6Sz3+K4Ur4WlKRlcM=
=K8j5
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
Thanks for looking,

I figured it out, after RTFM for db, I found that I needed to do field=? 
instead of using VALUES ().



Example:

$db->query('UPDATE items SET item_name=?, item_desc=?, item_price=?, 
extraprice=? WHERE item_id = 3',
            array($_POST['title'], $_POST['description'], $_POST['price'], 
$_POST['extraprice']));






>I'm trying to update some form data with this db update query and it's
>not working, I'm not getting an error either.

>$db->query("UPDATE items SET item_name = $_POST[title], item_desc =
>$_POST[description], item_price = $_POST[price], extraprice =
>$_POST[extraprice] WHERE item_id = 3");

>& 

>I've tried this:

>$db->query("UPDATE items SET (item_name, item_desc, item_price,
>extraprice)
>       VALUES (?,?,?,?) WHERE item_id = 3",
>       array($_POST['title'], $_POST['description'], $_POST['price'],
>$_POST['extraprice']));

--- End Message ---
--- Begin Message ---
Danny Brow wrote:
> Thanks for looking,
>
> I figured it out, after RTFM for db, I found that I needed to do field=? 
> instead of using VALUES ().
>
>
>
> Example:
>
> $db->query('UPDATE items SET item_name=?, item_desc=?, item_price=?, 
> extraprice=? WHERE item_id = 3',
>             array($_POST['title'], $_POST['description'], $_POST['price'], 
> $_POST['extraprice']));
>

FYI - You should at least escape the $_POST data (more filtering may be
necessary) before you go inserting it into your database.  When using
raw $_POST data it may be possible for someone to DROP DATABASE.

Search the archives (STFA) for more on this topic.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
On Tue, 2005-03-15 at 18:45 -0500, Jason Barnett wrote:
> Danny Brow wrote:
> > Thanks for looking,
> >
> > I figured it out, after RTFM for db, I found that I needed to do field=? 
> > instead of using VALUES ().
> >
> >
> >
> > Example:
> >
> > $db->query('UPDATE items SET item_name=?, item_desc=?, item_price=?, 
> > extraprice=? WHERE item_id = 3',
> >             array($_POST['title'], $_POST['description'], $_POST['price'], 
> > $_POST['extraprice']));
> >
> 
> FYI - You should at least escape the $_POST data (more filtering may be
> necessary) before you go inserting it into your database.  When using
> raw $_POST data it may be possible for someone to DROP DATABASE.

I was planning on this, but I like to get things working first then move
on to cleaning the input up. I'm still learning the db stuff, so the
less that can cause an issue the better.

Thanks,
Dan.

--- End Message ---
--- Begin Message ---
assuming you are using PEAR DB -

$result =& $db->query("UPDATE items SET (item_name, item_desc, item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3", array($_POST['title'], $_POST['description'], $_POST['price'],
$_POST['extraprice']));
if (PEAR::isError($result))
{
echo "Error: There was an error with the query. Message returned: ";
die($result->getMessage().' '.$db->getUserInfo().' '));
}

Should give you some info to tell you what is wrong.

Danny Brow wrote:

I'm trying to update some form data with this db update query and it's
not working, I'm not getting an error either.

$db->query("UPDATE items SET item_name = $_POST[title], item_desc =
$_POST[description], item_price = $_POST[price], extraprice =
$_POST[extraprice] WHERE item_id = 3");

&

I've tried this:

$db->query("UPDATE items SET (item_name, item_desc, item_price,
extraprice)
       VALUES (?,?,?,?) WHERE item_id = 3",
       array($_POST['title'], $_POST['description'], $_POST['price'],
$_POST['extraprice']));


Thanks, Dan.



-- Respectfully, Ligaya Turmelle

"Life is a game.... so have fun"
--- End Message ---
--- Begin Message ---
On Wed, 2005-03-16 at 16:50 +1000, Ligaya Turmelle wrote:
> assuming you are using PEAR DB -
> 
> $result =& $db->query("UPDATE items SET (item_name, item_desc, 
> item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3", 
> array($_POST['title'], $_POST['description'], $_POST['price'],
>   $_POST['extraprice']));
> if (PEAR::isError($result))
> {                     
>       echo "Error: There was an error with the query.  Message returned: ";
>       die($result->getMessage().'  '.$db->getUserInfo().' '));
> }


Thanks I got it worked out though, I'm going to try this also to see
what happens, I'm trying to learn the best I can and when things break
and you fix em you learn a lot more.  Thanks again.

PS this is what I did:

$db->query('UPDATE items SET item_name=?, item_desc=?, item_price=?,
extraprice=? WHERE item_id = 3',
            array($_POST['title'], $_POST['description'],
$_POST['price'], $_POST['extraprice']));

I've already posted this to the list, but it may not be there yet.

--- End Message ---
--- Begin Message --- So that I could use the opendir feature with an ftp url, I downloaded php-5.0.3 and used the following to make the cgi version:
./configure --enable-ftp
make
cp ./sapi/cgi/php /root

Here is my script:
----start of script /root/z.php----
#!/root/php
<?php
if ($handle = opendir('ftp://login:[EMAIL PROTECTED]/SHARE1/')) {
  echo "Directory handle: $handle\n";
  echo "Files:\n";
  while (false !== ($file = readdir($handle))) {
    echo "$file\n";
  }
  closedir($handle);
}
?>
----end of script----

When I run the script, I get the following error. I am root doing this and can ftp normally into the server with ncftp. I have another script (shell script /bin/sh) that I have been doing ftp with, but want some added features that php 5.0.3 will allow.
----start z.php output-----
# /root/z.php
Content-type: text/html
X-Powered-By: PHP/5.0.3

<br />
<b>Warning</b>: opendir(ftp://[EMAIL PROTECTED]/SHARE1/) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: not implemented in <b>/root/z.php</b> on line <b>3</b><br />
----end z.php output----

Any help in this would be greatly appreciated. I really would like to get this running. I am assuming that there is a compile option that I need to add.

Thanks
Steve

--- End Message ---
--- Begin Message --- Sed wrote:
Is it somehow possible, to use ftp_put to upload a file bigger than the
upload_max_filesize is set in the php.ini? (eg. upload 100Mb while
upload_max_filesize is set to 16MB)

You will have also to consider the browser's timeout limit. Uploading a 100MB file via HTTP POST will probably take quite a long time that the browser will timeout and interrupt the transfer.

I got a thought, but didn't try to check it out:
If there's a way to split a file to small chunks (i.e 2MB a chunk), then you can use JS Remote Scripting (HTTPRequest) to upload the chunks one by one, and then append all chunks on server side and you get the 100MB file. This way you can also display a progress bar of uploading. Of course the chunks will be transffered like packets (in TCP), so each chunk will have an header that relates it to the original file.
The part that is not well cleared to me is whether is possible to split a file into chunks using JS.
What do you think?

-thanks, Eli
--- End Message ---
--- Begin Message ---
I'm not sure, but using multipart encoding may help, it
essentially breaks the huge file into smaller chunks.

Esad

Sed wrote:
I have been thinking about a way to upload a file through a web-browser,
bigger than the upload_max_filesize is set in the php.ini on the server.

Is it somehow possible, to use ftp_put to upload a file bigger than the
upload_max_filesize is set in the php.ini? (eg. upload 100Mb while
upload_max_filesize is set to 16MB)

Regards,
SED

--- End Message ---
--- Begin Message ---
Are you meaning timeout limit? Not PHP script execution limit in php.ini?
What I understand, the PHP script does not run until the file is uploaded to
the server via POST.

SED

-----Original Message-----
From: Eli [mailto:[EMAIL PROTECTED] 
Sent: 15. mars 2005 23:27
To: php-general@lists.php.net
Subject: [PHP] Re: Can I use ftp_put to bypass upload_max_filesize?

Sed wrote:
> Is it somehow possible, to use ftp_put to upload a file bigger than 
> the upload_max_filesize is set in the php.ini? (eg. upload 100Mb while 
> upload_max_filesize is set to 16MB)

You will have also to consider the browser's timeout limit. Uploading a
100MB file via HTTP POST will probably take quite a long time that the
browser will timeout and interrupt the transfer.

I got a thought, but didn't try to check it out:
If there's a way to split a file to small chunks (i.e 2MB a chunk), then you
can use JS Remote Scripting (HTTPRequest) to upload the chunks one by one,
and then append all chunks on server side and you get the 100MB file. This
way you can also display a progress bar of uploading. Of course the chunks
will be transffered like packets (in TCP), so each chunk will have an header
that relates it to the original file.
The part that is not well cleared to me is whether is possible to split a
file into chunks using JS.
What do you think?

-thanks, Eli

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

--- End Message ---
--- Begin Message ---
http://dev.mysql.com/doc/mysql/en/create-table.html

At 03:29 PM 3/15/2005, John Taylor-Johnston wrote:

How do I get PHP to create a table, if one does not already exist?

I have to do something with:

$news = mysql_query($sql) or die(print mysql_error());

What can I also add something to $sql?

$sql = "if not exists CREATE TABLE `demo_assignment1` ...

John


--------snip--------

 $server = "localhost";
 $user = "myname";
 $pass = "mypass";
 $db = "mydb";
 $table = "demo_assignment1";

############################################
## What do I add here?
############################################

$sql = "CREATE TABLE `demo_assignment1` (
  `StudentNumber` varchar(8) NOT NULL default '',
  `Exercise1` varchar(100) NOT NULL default '',
  `Exercise2` varchar(100) NOT NULL default '',
  `TimeStamp` timestamp(14) NOT NULL,
  PRIMARY KEY  (`TimeStamp`)
) TYPE=MyISAM COMMENT='place something here';";

$myconnection = mysql_connect($server,$user,$pass);

mysql_select_db($db,$myconnection);

############################################
## What do I do here?
$news = mysql_query($sql) or die(print mysql_error());
############################################


#if table exists, I will now

 $sql = "INSERT INTO $table (StudentNumber,Exercise1,Exercise2)
    values ('$StudentNumber','$Exercise1','$Exercise2')";
 mysql_select_db($db,$myconnection);
 mysql_query($sql) or die(print mysql_error());

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

--- End Message ---
--- Begin Message ---
> http://dev.mysql.com/doc/mysql/en/create-table.html

Thanks. Then this looks reasonable?

Would anyone code it differently?

#################################################
$server = "localhost";
$user = "myname";
$pass = "mypass";
$db = "mydb";
$table = "demo_assignment1";

#################################################
$myconnection = mysql_connect($server,$user,$pass);

#################################################
$sql = "CREATE TABLE IF NOT EXISTS `demo_assignment1` (
`StudentNumber` varchar(8) NOT NULL default '',
`Exercise1` varchar(100) NOT NULL default '',
`Exercise2` varchar(100) NOT NULL default '',
`TimeStamp` timestamp(14) NOT NULL,
PRIMARY KEY  (`TimeStamp`)
) TYPE=MyISAM COMMENT='place something here';";

mysql_select_db($db,$myconnection);
mysql_query($sql) or die(print mysql_error());


#################################################
$sql = "INSERT INTO $table
(StudentNumber,Exercise1,Exercise2) values
('$StudentNumber','$Exercise1','$Exercise2')";

mysql_select_db($db,$myconnection);
mysql_query($sql) or die(print mysql_error());

mysql_close($myconnection);

--- End Message ---
--- Begin Message ---
have you looked at the MySQL manual?
http://dev.mysql.com/doc/mysql/en/create-table.html

John Taylor-Johnston wrote:

How do I get PHP to create a table, if one does not already exist?

I have to do something with:

$news = mysql_query($sql) or die(print mysql_error());

What can I also add something to $sql?

$sql = "if not exists CREATE TABLE `demo_assignment1` ...

John


--------snip--------

 $server = "localhost";
 $user = "myname";
 $pass = "mypass";
 $db = "mydb";
 $table = "demo_assignment1";

############################################
## What do I add here?
############################################

$sql = "CREATE TABLE `demo_assignment1` (
  `StudentNumber` varchar(8) NOT NULL default '',
  `Exercise1` varchar(100) NOT NULL default '',
  `Exercise2` varchar(100) NOT NULL default '',
  `TimeStamp` timestamp(14) NOT NULL,
  PRIMARY KEY  (`TimeStamp`)
) TYPE=MyISAM COMMENT='place something here';";

$myconnection = mysql_connect($server,$user,$pass);

mysql_select_db($db,$myconnection);

############################################
## What do I do here?
$news = mysql_query($sql) or die(print mysql_error());
############################################


#if table exists, I will now

 $sql = "INSERT INTO $table (StudentNumber,Exercise1,Exercise2)
    values ('$StudentNumber','$Exercise1','$Exercise2')";
 mysql_select_db($db,$myconnection);
 mysql_query($sql) or die(print mysql_error());


-- Respectfully, Ligaya Turmelle

"Life is a game.... so have fun"
--- End Message ---
--- Begin Message --- As the author, I'm precluded from _recommending_ my book 'PHP 5 Objects Patterns and Practice'. Nevertheless it does cover design patterns in general and enterprise patterns in particular, so it's relevant to the thread.

http://www.amazon.com/exec/obidos/tg/detail/-/1590593804

It's worth taking a look at http://www.phppatterns.com/ as well as some of the non-PHP resources mentioned. Martin Fowler's Patterns of Enterprise Application Architecture is seminal in this area. Core J2EE Patterns by Alur et al is good too, though you have to filter out quite a lot of EJB-specific stuff. If you're looking for an introduction to patterns in general then a fantastic starting point is 'Design Patterns Explained' by Shalloway and Trott.

mz


On Tue, 15 Mar 2005, Jeremiah Fisher wrote:

"PHP 5 Power Programming" by Andi Gutmans, Stig Bakken, and Derick Rethans may be worth the read for you. It doesn't mention an MVC, but they do talk a little about patterns in PHP.

However, you probably won't find much in-depth coverage of patterns in PHP. There are alot of good books written on patterns in C++, Java, and C#, but PHP doesn't have that "enterprise" stigma about it.

I've nearly finished an MVC-based framework in PHP, and think that Java should be sincerely evaluated before you take up the endeavor. I've had to reinvent alot of Struts functionality. Not only that, but you'll probably go further with J2EE on your resume than PHP.

O'Reilly has some good books on design patterns. I picked up Head First myself, and though it was repetitive, it got the point across pretty well. You'll find that most of the code is in Java, but it should be easy to read if you speak PHP 5.

For a quick online reference of some common design patterns (and if you can read C#), you can look at this site: http://www.dofactory.com/Patterns/Patterns.aspx#list

Thanks,

Jeremy


Danny Lin wrote:
Can any one recommend a good book that discusses MVC design patterns with
PHP (and mySQL)?

Thanks.



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

Shouldn't

void HTML_QuickForm::process (mixed $callback [, bool $mergeFiles = TRUE])

actually return the value returned by the callback function?

One example when this may be handy:

if ($form->process(array(&$fb,'processForm'), false)) {
//data processed (FormBuilder's processForm returns true when //data has been manipulated)
}

PS. Sorry if this message gets cross-posted, I've tried posting to .dev, but message never appeared

Greetings,

Esad Hajdarevic
--- End Message ---
--- Begin Message ---
"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Does anyone know how to change the style of password boxes so when the
> > characters are entered an asterisk appears rather that a smal circle?
> >
> > Or is this just determed by the OS and uncangable with CSS or Javascript
> > of
> > PHP?
>
> They are certainly NOT changeable with PHP.
>
> I doubt that JavaScript holds the answer either.

I don't know much about JavaScript or VBScript, but I believe there is an
action called "OnKeyPress" or something to that effect. If that's there,
writing a function that accepts the key pressed and replace it with another
character, while the original pressed character is stored in a shadow array?
Like I said.. have no clue, if this is possible, but that is what I would
try....

>
> You might, however, find an HTML ATTRIBUTE supported by some browsers that
> allows you to change the character used.  I doubt it, but it's possible.
>
> If it is possible, presumably CSS allows you to change the attribute as
> well, though you never know for sure with CSS...
>
> For sure, whatever you do find, it ain't something that's standard across
> all browsers.  But you may only care about the one browser that uses the
> small circles anyway.
>
> Why in the world do you WANT to change it? [puzzled]
>
> --
> Like Music?
> http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
session_write_close() is also nice in that freeing the lock doesn't
destroy your existing copy of the session variables, you can still use
them in the rest of your script just remember that they exist in your
current script as they were when you called session_start(), even if
some other script modifies the session, you won't know until your next
call to session_start().

Be careful using data from an unlocked session to to modify that data
later on, as another instance can modify the session in between.  Only
release the lock when you really don't care if it's modified
elsewhere.



On Sat, 12 Mar 2005 14:50:44 -0600, Josh Whiting <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 11, 2005 at 09:57:46AM -0800, Richard Lynch wrote:
> > > well the trouble is not in the writing at the end of the request, which
> > > would likely only be a single query and therefore not need a transaction
> > > in itself. the trouble is the lack of locking out other requests from
> > > reading the data when you're using it during the main body of
> > > the request.
> [...]
> > Short Version:  Either your frames/tabs are gonna be so clunky as to be
> > useless, or you need to lock them into only one, or you need business
> > logic, not session-logic.  Solving the race condition at session layer
> > will only make your application un-responsive.
> >
> > This may go a long way to explaining why you're not finding any readily
> > available solutions out there at the session layer.
> 
> You raise good points.  However, my goal is simply to have a
> transparent, database-driven replacement for PHP's native session
> handler.  I don't want to change my application logic because I'm
> switching session handlers - my application shouldn't care!  And so,
> transparently reproducing PHP's session layer functionality is going to
> mean locking concurrent requests out, because that is what PHP's session
> handler already does (for good reason IMHO).
> 
> you're argument about slow frames is valid, but is ALSO applicable to
> PHP's native session handler, e.g. i'm not introducing a new problem.
> the trouble can be mostly avoided in either case by not starting session
> in frames that don't need it (most of them), and doing any session stuff
> right away and calling session_write_close() ASAP to free up the lock so
> other frames can run.
> 
> you're right that i could change my application logic to deal safely
> with concurrent requests from the same session, but PHP already nicely
> defeats the issue so you don't have to worry about it, and at a more or
> less negligable performance loss if you design the scripts to reduce
> session open/locked time to the bare minimum...
> 
> i would speculate that the reason i haven't found a readily available
> solution is because most folks either (1) don't understand the problem,
> or (2) don't think such a race condition is likely enough to warrant a
> fix, or (3) are using a different backend (oracle, etc.) that makes the
> problem easy to solve. the PHP team, however, clearly thought it was
> important enough as is evident by their session handler design.
> 
> ...have i convinced you yet of the worthiness of this endeavor? :)
> 
> /jw
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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

 

I have a form which allows users to enter a message and then submits to a
confirmation page which displays the submitted message, and it has a form
with a hidden field which uses php to retrieve the message posted from the
initial page and posts that message if the user clicks the submit button
which confirms that it is correct.

 

However included in the message is a link to a file, and while the message
is displayed correctly on the confirmation page, it has trouble putting the
message into the hidden field, (some goes in the field and some is printed
on the webpage. The code I have used to retrieved the message and store it
in the hidden field is:

 

    <input name="msg" type="hidden" id="msg" value="<?php echo $_POST['msg']
?>" >

 

However, when I ran the script all that as stored in the hidden field was:

 

    Please use the link below to download my newsletter<br/><a href=\ 

 

And on the confirm page where the hidden field is the page had written:

 

    Click here to download and view newsletter " >

 

Obviously this has something to do with the quotation marks in the a href
statement, however I am new to php and my attempts using addslashes and
stripslashes have failed. I would be most grateful if anyone could help me. 

 

Cheers,

Simon

 


--- End Message ---
--- Begin Message --- I cheat. when I am putting something into a hidden field that will have HTML - I base64_encode it. then when the receiving page gets it I decode it. It keeps the html from accidentally showing up and "hides" it from the user. It's ugly - but effective.

Simon Allison wrote:

Hey,



I have a form which allows users to enter a message and then submits to a
confirmation page which displays the submitted message, and it has a form
with a hidden field which uses php to retrieve the message posted from the
initial page and posts that message if the user clicks the submit button
which confirms that it is correct.



However included in the message is a link to a file, and while the message
is displayed correctly on the confirmation page, it has trouble putting the
message into the hidden field, (some goes in the field and some is printed
on the webpage. The code I have used to retrieved the message and store it
in the hidden field is:



    <input name="msg" type="hidden" id="msg" value="<?php echo $_POST['msg']
?>" >



However, when I ran the script all that as stored in the hidden field was:



Please use the link below to download my newsletter<br/><a href=\



And on the confirm page where the hidden field is the page had written:



    Click here to download and view newsletter " >



Obviously this has something to do with the quotation marks in the a href
statement, however I am new to php and my attempts using addslashes and
stripslashes have failed. I would be most grateful if anyone could help me.



Cheers,

Simon





-- Respectfully, Ligaya Turmelle

"Life is a game.... so have fun"
--- End Message ---
--- Begin Message ---
Hey,
I am looking for a software that just lists adverts...
eg:
Like ebay but without the bidding

Requirements are simple, so simple that i am sure something like this exists
and i dont have to write it myself:
0.They must register first then...
1.offer the person to put in his ad details, a few other details like his
telephone number, asking price etc
2.(optional) add a photo
3. They can delete their ad if they want to later

4.normal visitors can search or browse by category or latest additions etc

I can give you an example in the form of a swedish site:
http://www.blocket.se

I have found something very close in ASP but i dont trust MS products and
would rather it be in PHP as i can tinker with it (i dont know ASP and my
server does not support it)

As you can see, it wouldnt take too long to build but i have little time so
i would rather finish my "lingering old projects" than start on something
new from scratch....its for a pet site where people can sell (or
barter/exchange) aquarium fish, fish food, aquariums, filters, stands etc

Checking google and hot scripts just sends me to ad management software like
banner rotators and bidding systems etc.

Any help appreciated and thanks in advance.
-Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005

--- End Message ---
--- Begin Message --- Ryan A wrote:
Hey,
I am looking for a software that just lists adverts...
eg:
Like ebay but without the bidding

Requirements are simple, so simple that i am sure something like this exists
and i dont have to write it myself:
0.They must register first then...
1.offer the person to put in his ad details, a few other details like his
telephone number, asking price etc
2.(optional) add a photo
3. They can delete their ad if they want to later

4.normal visitors can search or browse by category or latest additions etc

I can give you an example in the form of a swedish site:
http://www.blocket.se

I have found something very close in ASP but i dont trust MS products and
would rather it be in PHP as i can tinker with it (i dont know ASP and my
server does not support it)

As you can see, it wouldnt take too long to build but i have little time so
i would rather finish my "lingering old projects" than start on something
new from scratch....its for a pet site where people can sell (or
barter/exchange) aquarium fish, fish food, aquariums, filters, stands etc

Checking google and hot scripts just sends me to ad management software like
banner rotators and bidding systems etc.

Any help appreciated and thanks in advance.
-Ryan



Try photoposts classifieds at www.photopost.com
--- End Message ---
--- Begin Message ---
Hello,
Again this might be more of a HTML quetion. If so sorry about that.

Anyway I was just trying to make a log out button to a page. It should end a 
session or/and close browser window. (Closing browser ends the session as 
well I think?)

All variable values are deleted when browser is closed. Right?

Can anyone help?

Thanks
-Will 

--- End Message ---

Reply via email to