OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 30 Jul 2003 22:22:41 -0000 Issue 2207

php-general-digest-helplists.php.net
Date: Wed Jul 30 2003 - 17:22:41 CDT


php-general Digest 30 Jul 2003 22:22:41 -0000 Issue 2207

Topics (messages 157504 through 157614):

Re: Search in PhP
        157504 by: Nicholas Robinson
        157534 by: Pradeep D'souza

Re: Mail funtion question
        157505 by: Irvin Amoraal

mnoGoSearch
        157506 by: imran

Location header - slow redirect
        157507 by: admin
        157510 by: Nicholas Robinson
        157511 by: admin

Re: The return of mysql_fetch_assoc()
        157508 by: John W. Holmes

hehe....is this a repost?
        157509 by: Dan Anderson

check for duplicate databases
        157512 by: Steve Buehler

Updating a table after a successful download
        157513 by: Luis Lebron
        157517 by: David Nicholson
        157521 by: Luis Lebron
        157523 by: David Nicholson

Querying a form
        157514 by: Gerard Samuel
        157603 by: Jeff Harris

Re: debuging and getting mor information about failures
        157515 by: Ford, Mike [LSS]
        157576 by: Jeff Harris

capturing reloads
        157516 by: Diana Castillo
        157518 by: Donald Tyler
        157520 by: Chris Boget
        157528 by: Curt Zirzow
        157539 by: Pete James

Free'ing Sockets Error
        157519 by: Adam Voigt

[bug?] good old upload problem
        157522 by: Robert Janeczek

Re: include and imagejpg() weird behavior - maybe header?
        157524 by: Rob Adams

Please Help
        157525 by: Safal Solutions
        157526 by: Jay Blanchard

Files created by PHP/Apache
        157527 by: Joachim
        157529 by: John W. Holmes
        157541 by: Joachim
        157544 by: Curt Zirzow
        157550 by: Joachim
        157558 by: Curt Zirzow
        157572 by: Joachim

Re: How can I add records to database every 60 minutes???
        157530 by: erythros
        157531 by: skate
        157536 by: erythros

Global variables in a class? Nested classes VS inheritance...
        157532 by: anachronism.mengelt.com
        157537 by: Tom Rogers

Re: looking for some kind of CMS breakthough (slightly OT)
        157533 by: bill
        157543 by: Mark
        157548 by: Pete James

formating date
        157535 by: Gronquist, Jim M
        157538 by: Peter Knight
        157564 by: Carl Furst

solution/thanks re: date format
        157540 by: Gronquist, Jim M

PHPSESSID AND SID
        157542 by: Daryl Meese
        157609 by: Hank TT

looking for scheduling program
        157545 by: Chris W. Parker
        157546 by: Dan Joseph
        157547 by: Richard Baskett
        157549 by: Chris W. Parker

List Administrator
        157551 by: Johnny Martinez
        157553 by: Chris W. Parker
        157554 by: Johnny Martinez
        157555 by: Johnny Martinez
        157556 by: Lars Torben Wilson
        157559 by: Curt Zirzow
        157561 by: Lars Torben Wilson
        157562 by: John Manko
        157565 by: Chris W. Parker
        157567 by: Johnny Martinez

php error log : productinfo finished message
        157552 by: Merlin
        157560 by: Curt Zirzow
        157563 by: Merlin
        157575 by: Curt Zirzow

Simple date question
        157557 by: Roy W
        157566 by: David Nicholson
        157570 by: Kevin Stone
        157605 by: Jeff Harris

has anyone seen this done?
        157568 by: Ryan.K.Look.courts.state.hi.us
        157574 by: Jay Blanchard

Re: Probs with Vars in shop cart app
        157569 by: Mignon Hunter

cookies on localhost WinXP
        157571 by: Steve Buehler
        157573 by: John W. Holmes
        157577 by: Steve Buehler
        157580 by: Chris Shiflett
        157591 by: Steve Buehler
        157594 by: John W. Holmes
        157595 by: Steve Buehler
        157596 by: Chris Shiflett
        157598 by: John W. Holmes
        157599 by: Chris Shiflett
        157600 by: Rob Adams
        157601 by: Steve Buehler
        157602 by: Steve Buehler
        157613 by: Curt Zirzow

downloading a file using headers
        157578 by: Amanda McComb
        157584 by: Mehdi Achour
        157585 by: Mehdi Achour
        157588 by: John W. Holmes
        157589 by: Curt Zirzow

Using link to submit a form
        157579 by: Tyler Longren
        157582 by: Mehdi Achour
        157583 by: andu
        157586 by: Jennifer Goodie
        157587 by: Matt Palermo

emacs, speedbar, php-mode
        157581 by: Spencer Thiel

Refresh a page in another frame
        157590 by: Steve Fulleylove
        157592 by: Mehdi Achour
        157593 by: Curt Zirzow

PHP cli on Mac OSX
        157597 by: René Fournier

textbox+database
        157604 by: Patrik Fomin
        157606 by: Mehdi Achour
        157612 by: Kevin Stone

retrieving multi-select form values
        157607 by: Hank TT
        157608 by: Kevin Stone

Registering Session
        157610 by: Ralph Guzman
        157614 by: Curt Zirzow

Re: Debugging a Session Problem
        157611 by: Lee Stewart

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


 Try running a exec() running a grep command on your DocumentRoot.

something like 'grep -ril fred * would just produce the filenames containing
fred or -ri would display the context.

You could then produce links to the files from the resulting output.

HTH

On Wednesday 30 Jul 2003 10:51 am, khuram noman wrote:
> Hello
>
> i have a site in php but not using database i want to
> add the search facilty in that site means user can
> search into the contents of the site .so how can i do
> that in php without using database.waiting for ur soon
> reply
>
> thanks
> khuram noman
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com

attached mail follows:


Option 1 : use Javascript { Lot of free scripts on the internet }

Option 2 : Use an array filled with information

Rgds,
Pradeep
----- Original Message -----
From: "khuram noman" <khuram_nomanyahoo.com>
To: <php-generallists.php.net>
Sent: Wednesday, July 30, 2003 3:21 PM
Subject: [PHP] Search in PhP

> Hello
>
> i have a site in php but not using database i want to
> add the search facilty in that site means user can
> search into the contents of the site .so how can i do
> that in php without using database.waiting for ur soon
> reply
>
> thanks
> khuram noman
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


Thanks for your reply Bobby.
   I thought I might be able to use the to supress the errors. The way you
wrote the code below is close to what I am doing, sending the bulk emails
one at a time. I didn't see anything like $result= mail($to, $subject,
$msg) in the online PHP documentation. but it looks like it should do the
trick.

Thanks again.

"Bobby Patel" <anup_patelrogers.com> wrote in message
news:20030730033028.97292.qmailpb1.pair.com...
> I haven't worked with PHP mail for a while, but since no one has responded
> I'll give you something to consider:
>
> 1. Why don't you try error suppression , ? or you can set
error_reporting
> down or you can capture all output by using output buffering.
> 2. You can trap the invalid email, but it may be *more* complex and result
> in a slower script. You will have to evaluate this for yourself,
>
> $emails = array (); #array of email info
> # In the form
> # $emails[0] = array (email => mailto:'abcabc.com' , name => 'Reciever
> Name');
> # $emails[1] = array (email => mailto:'abcxyz.com' , name => 'Reciever
Name
> 2');
>
> $invalid_emails = array();
> foreach ($emails as $index => $info){
>
> $result = mail ($info['email'], 'Bulk Newsletter Subject', 'email
> messafge') ;
> if (!$result) {
> $invalid_emails [] = $info['email']; // capture invalid email
> }
> }
>
> Please note, that the code above will call mail once for each email, so if
> you have 100 emails this will run 100 times, where as if you stacked all
the
> emails into one mail call. But then you may not be able to find the
invalid
> emails.
>
>
>
>
> "Irvin Amoraal" <irvincabletv.on.ca> wrote in message
> news:20030729214615.15280.qmailpb1.pair.com...
> > I am using the PHP mail() function to send subscribed-to bulk email. It
> > successfully sends emails to the valid email addresses, but I get a
series
> > of error messages at the top of the PHP page like:
> > /home/[my folder]/dead.letter... Saved message in
> > /home/[my folder]/dead.letter 123... User unknown
> >
> > I'm almost positive the error msgs are caused by invalid email addresses
> > that are stored in the database.
> >
> > I have two questions:
> > 1. How can I suppress the error msg's? mail....?
> > 2. Can the error be trapped and the invalid email address captured to be
> > spit out in code?
> >
> > Thanks for your help.
> >
> > Irvin.
> >
> >
>
>

attached mail follows:


hi

Anyone tell that abt mnoGoSearch function can config on WNT server.....

imran

attached mail follows:


I'm using the following short script to redirect users to another page
on my site (php 4.3.2, Apache 2.0.47).

<?php
$goLang='en';
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/" . $goLang . "/");
exit;
?>

I'm having a problem where it takes up to 15 seconds for the redirect
page to load, but for other redirects on the site programmed in a
similar way using php and the location header the page loads straight away.

I'm a bit perplexed and would appreciate some suggestions.
Thanks
Phil

attached mail follows:


try putting this after the header:

echo "<HTML></HTML>";

It forces the redirect to take place immediately (in most cases!).

HTH

On Wednesday 30 Jul 2003 11:53 am, admin wrote:
> I'm using the following short script to redirect users to another page
> on my site (php 4.3.2, Apache 2.0.47).
>
> <?php
> $goLang='en';
> header("Location: http://" . $_SERVER['HTTP_HOST'] . "/" . $goLang . "/");
> exit;
> ?>
>
> I'm having a problem where it takes up to 15 seconds for the redirect
> page to load, but for other redirects on the site programmed in a
> similar way using php and the location header the page loads straight away.
>
> I'm a bit perplexed and would appreciate some suggestions.
> Thanks
> Phil

attached mail follows:


Excellent, that does the trick.
Thank you
Phil

On Mercoledì, lug 30, 2003, at 13:56 Europe/Rome, Nicholas Robinson
wrote:

> try putting this after the header:
>
> echo "<HTML></HTML>";
>
> It forces the redirect to take place immediately (in most cases!).
>
> HTH
>
> On Wednesday 30 Jul 2003 11:53 am, admin wrote:
>> I'm using the following short script to redirect users to another page
>> on my site (php 4.3.2, Apache 2.0.47).
>>
>> <?php
>> $goLang='en';
>> header("Location: http://" . $_SERVER['HTTP_HOST'] . "/" . $goLang .
>> "/");
>> exit;
>> ?>
>>
>> I'm having a problem where it takes up to 15 seconds for the redirect
>> page to load, but for other redirects on the site programmed in a
>> similar way using php and the location header the page loads straight
>> away.
>>
>> I'm a bit perplexed and would appreciate some suggestions.
>> Thanks
>> Phil
>

attached mail follows:


Ney André de Mello Zunino wrote:
> Ray Hunter wrote:
>
>>> $fooVar = mysql_fetch_assoc($result)["barColumn"];
>>
>>
>> No bug here...mysql_fetch_assoc($result) is a function that takes a
>> result set as an argument and returns only one row as an associated
>> array...that is why you need to do
>
>
> Thanks for the quick response, but I am not sure I understand your
> argument. Yes, I am aware that the function returns an array
> corresponding to a single row/record; what I don't understand is why I
> am not able to apply a key directly to that "temporary" return value. In
> other words, it is necessary to "copy" the resulting row into a new
> variable so that it is then possible to use the column name (key) to
> retrieve the desired value.

Use mysql_result() if you want to fetch a single column directly.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com

attached mail follows:


Student Suspended over Use of PHP:

http://bbspot.com/News/2000/6/php_suspend.html

-Dan

attached mail follows:


I have a program that I am writing in PHP/MySQL. I have made some upgrades
to the database and like an idiot, forgot to write down the changes or to
make the changes in several other databases for the other clients that are
using the program also. What I am trying to do is to have a program,
(preferably in PHP) that will look at the structure of the main database
that I changed, then it will check the other databases to make sure that
the structure is identical and if not, it will change them to make them
identical. Is there a program already out there that would do this? Or is
there someone out there that can help me to write it?

Thanks
Steve

attached mail follows:


I currently have some code in a document management system that is used to
check-out a document.
It looks like this:

//Update the status of the document
$query = "UPDATE $table_data SET status = '$SESSION_UID' WHERE id = '$id'";
$result=&$conn->Execute($query);

//Download the document.
header ("Content-Type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$realname");
readfile($filename);

The problem I am having is that when the download is canceled by the user
the document still shows up as being checked out. Is there a way to know if
the document has been successfully downloaded before I update the database.
Something like:

//Download the document.
header ("Content-Type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$realname");
readfile($filename);

//Determine if download is successful????. Set download variable.

if($download=1)
{
  //Update the status of the document
  $query = "UPDATE $table_data SET status = '$SESSION_UID' WHERE id =
'$id'";
  $result=&$conn->Execute($query);
}

thanks,

Luis R. Lebron

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Wed, 30 Jul 2003 at
13:46, lines prefixed by '>' were originally written by you.
> The problem I am having is that when the download is canceled by
the
> user
> the document still shows up as being checked out. Is there a way
to
> know if
> the document has been successfully downloaded before I update the
> database.

The connection handling section of the manual may help you...
http://uk.php.net/manual/en/features.connection-handling.php

You could possibly use register_shutdown_function() and
connection_aborted() to set the status back if the connection was
cancelled.

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


I tried changing the code to:

// send headers to browser to initiate file download
        header ("Content-Type: application/octet-stream");
        header ("Content-Disposition: attachment; filename=$realname");
        readfile($filename);
        if(connection_aborted()==0)
        {
                $query = "UPDATE $table_data SET status = '$SESSION_UID'
WHERE id = '$id'";
                $result=&$conn->Execute($query);
        }

But it still doesn't work as expected. What am I doing wrong?

thanks,

Luis

-----Original Message-----
From: David Nicholson [mailto:medjnicholson.com]
Sent: Wednesday, July 30, 2003 8:18 AM
To: Luis Lebron
Cc: php-generallists.php.net
Subject: Re: [PHP] Updating a table after a successful download

Hello,

This is a reply to an e-mail that you wrote on Wed, 30 Jul 2003 at
13:46, lines prefixed by '>' were originally written by you.
> The problem I am having is that when the download is canceled by
the
> user
> the document still shows up as being checked out. Is there a way
to
> know if
> the document has been successfully downloaded before I update the
> database.

The connection handling section of the manual may help you...
http://uk.php.net/manual/en/features.connection-handling.php

You could possibly use register_shutdown_function() and
connection_aborted() to set the status back if the connection was
cancelled.

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Wed, 30 Jul 2003 at
14:43, lines prefixed by '>' were originally written by you.
> I tried changing the code to:
> // send headers to browser to initiate file download
> header ("Content-Type: application/octet-stream");
> header ("Content-Disposition: attachment; filename=$realname");
> readfile($filename);
> if(connection_aborted()==0)
> $query = "UPDATE $table_data SET status = '$SESSION_UID'
> WHERE id = '$id'";
> $result=&$conn->Execute($query);
> But it still doesn't work as expected. What am I doing wrong?

It is executing your if(connection_aborted()==0) as soon as it
gets to it when parsing the code instead of when the connection with
the broswer terminates. You need to use
register_shutdown_function() as well. I tested this code...

<?php
register_shutdown_function("myshutdown");

header ("Content-Type: application/octet-stream");
readfile("verybigfile.mpg");

function myshutdown(){
    if(connection_aborted()==0){
        exec ("net send ZXC connection_aborted()==0");
    } else {
        exec ("net send ZXC connection_aborted()!=0");
    }
}

?>

..and it worked fine. Notice I used "net send ZXC" (ZXC is my
Windows computer name) as you cannot echo after the connection has
closed.

HTH

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


Im looking for links to tutorials, or if someone can post code here,
where php
can be used to query a form, so that I can retrieve its results.
Thanks for any pointers...

attached mail follows:


On Jul 30, 2003, "Gerard Samuel" claimed that:

|Im looking for links to tutorials, or if someone can post code here,
|where php
|can be used to query a form, so that I can retrieve its results.
|Thanks for any pointers...

How about some of these?
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=php+form+tutorial
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.

attached mail follows:


> -----Original Message-----
> From: Chris W. Parker [mailto:cparkerswatgear.com]
> Sent: 29 July 2003 19:22
> To: Ford, Mike [LSS]; Gabriel Guzman; Peter James
> Cc: php-generallists.php.net
> Subject: RE: Fw: [PHP] debuging and getting mor information about
> failures
>
>
> Ford, Mike <LSS>
> on Tuesday, July 29, 2003 11:00 AM said:
>
> > I know the braces vs. end-token debate is almost on the scale of a
> > holy war, and I admit to hating the curly-brace style with
> a passion,
> > but when I see code like this:
> >
> > function doit()
> > {
> > for()
> > {
> > if()
> > }
> > ...
> > }
> > else
> > {
> > ...
> > } // if
> > } // for
> > }
> >
> > I wonder why the heck the author didn't just go for the alternative
> > syntax with proper end-tokens and get the added value they deliver.
>
> You are correct. If I had in fact originally written my block of code
> with "// if" and "// for" it would make more sense to use the
> alternative syntax that you detailed in your original mail. But I
> /didn't/ use "// if" and "// for" therefore I wouldn't use the
> alternative syntax because it's just more characters to type

All true so far, and I wouldn't argue with any of this if that is your preference.

> and
> generates no useful benefit.

But this I would take issue with -- as I said in my original email, you tend to get more-focussed error messages if you accidentally omit one of the end-tags than if you omit a closing brace. It's also more obvious exactly *which* end-tag you've left out. (Although I did once spend half a day completely failing to spot a missing "endif" right where the error message was pointing, and chasing all sorts of other red herrings before seeing the error and turning the local air blue in disbelief!!!).

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: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


On Jul 30, 2003, "Ivo Fokkema" claimed that:

|"Chrstian Brensteiner" <eingfoanyahoo.de> wrote in message
|news:20030729071131.17365.qmailpb1.pair.com...
|> whats the best option to get more information about a failure in your
|sorce
|> code ?
|>
|> whenever i get failures that are situated at the very end of my script how
|> do i get to know wherer they start?
|>
|> now i have get from apache + php this return
|>
|> Parse error: parse error, unexpected $ in
|> c:\programme\easyphp\www\cms\procede_presse.php on line 268
|>
|> 268 is the last line of my script how to deal with those failures in an
|> intelligent way?
|Getting these errors at the last line in your script generally means that
|you omitted a closing '}'.
|
|So when you would do :
|
|<?php
|function something () {
| print ("done");
|?>
|
|You will get a similar error. Check all of your functions and
|if/else/foreach/ etc. structures for an omitted '}' to fix your script.\
|
|Good luck!
|
|--
|Ivo Fokkema

Proper indenting should help you solve this issue. Check other threads or
the pear manual for ideas. As annoying as this error is, it is not so
nearly difficult to fix as the "you're missing something and php is only
going to output a blank page with no error information" error that I get
way too often.

Jeff
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.

attached mail follows:


anyone know how to catch if someone has reloaded a page?

attached mail follows:


The only way I know is to use sessions.

Each time they load the page, you would check a session variable that you
use store the status of a specific page. E.g.

if($_SESSION['ReloadStatus']['ContactUs'] == true)
        {
        //Page has already been loaded once. This is a reload.
        //--------[ Your code here ] ----------\\
        }
else
        {
        //Page hasn't already been loaded. This is the first visit.
        //--------[ Your code here ] ----------\\
        
        //Register this page as loaded:
        $_SESSION['ReloadStatus']['ContactUs'] == true
        }

-----Original Message-----
From: Diana Castillo [mailto:dianainterhotel.com]
Sent: Wednesday, July 30, 2003 8:12 AM
To: php-generallists.php.net
Subject: [PHP] capturing reloads

anyone know how to catch if someone has reloaded a page?

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

attached mail follows:


> The only way I know is to use sessions.
>
> Each time they load the page, you would check a session variable that you
> use store the status of a specific page. E.g.
>
> if($_SESSION['ReloadStatus']['ContactUs'] == true)
> {
> //Page has already been loaded once. This is a reload.
> //--------[ Your code here ] ----------\\
> }
> else
> {
> //Page hasn't already been loaded. This is the first visit.
> //--------[ Your code here ] ----------\\
>
> //Register this page as loaded:
> $_SESSION['ReloadStatus']['ContactUs'] == true
> }

That's not going to work if all you are interested in doing is
catching when the user clicks the 'Reload' button. How do
you know the user didn't go to another page then come back
to the 'Contact Us' page? What you probably want to do is
something like this:

if($_SESSION['CurrentPage'] == 'ContactUs' ) {
}

$_SESSSION['CurrentPage'] = 'ContactUs';

Or something along those lines.

Chris

attached mail follows:


* Thus wrote Diana Castillo (dianainterhotel.com):
> anyone know how to catch if someone has reloaded a page?

The way I prevent reloads is with a combination of session
variables and an extra form field, here is how I go about it:

form_page.php:
<?
$formhash = md5(uniq(rand() . time()));
$_SESSION['formhash'] = $formhash;

// Add this to your form:
?>
<input type="hidden" name="_formhash_" value="<?php echo $formhash?>">

process_page.php:
<?

// grab the session var and test its existance
if ( $formhash = $_SESSION['formhash']) ) {

  // clear out hash in session so if the user refreshes this
  // page and has a _formhash_ var it will be considered bad
  unset($_SESSION['formhash']);

  // test the form var against the session
  if ($formhash != $_REQUEST['_formhash_']) ) {
    // user did not come from the form that generated page
    // so hash is invalid
  }

  }
} else {
  // invlalid data, has no hash
}

This should be generic enough so it can be used on all form
processing pages without any modifications.

You do have to make sure that the form_page.php does not get cached
by the browser.

HTH,

Curt
--
"I used to think I was indecisive, but now I'm not so sure."

attached mail follows:


My personal favourite is to logically separate actions and views, which
is very easy to do and is virtually foolproof.

This way a user submits a form to a page that outputs nothing. This
page does its work, then redirects to another page which only shows
data. This is invisible to the user, and the browser doesn't remember
anything about the action page. If the user clicks refresh, they will
not be performaing any actions, just refreshing the view. They would
have to manually go back and resubmit the form to repost the data.

If you need to use data from your action on your screen, just use the
session...

An (untested, and off the top of my head) example of this is below:

<?php

session_start();

if (isset($_REQUEST['action']))
{
        // do something
        $_SESSION['action_data'] = 'action_data';
        session_write_close();
        header("Location: {$_SERVER['SCRIPT_NAME']}?screen=foo");
}
else if (isset($_REQUEST['screen']))
{
        // show the page
        print "Here's the results from my action:";
        print_r($_SESSION['action_data']);
}
else
{
        // default operation (welcome page, etc)
        header("Location: {$_SERVER['SCRIPT_NAME']}?screen=default");
}

?>

HTH.
Pete

Curt Zirzow wrote, On 2003/Jul/30 8:58 AM:
> * Thus wrote Diana Castillo (dianainterhotel.com):
>
>>anyone know how to catch if someone has reloaded a page?
>
>
> The way I prevent reloads is with a combination of session
> variables and an extra form field, here is how I go about it:
>
> form_page.php:
> <?
> $formhash = md5(uniq(rand() . time()));
> $_SESSION['formhash'] = $formhash;
>
> // Add this to your form:
> ?>
> <input type="hidden" name="_formhash_" value="<?php echo $formhash?>">
>
>
> process_page.php:
> <?
>
> // grab the session var and test its existance
> if ( $formhash = $_SESSION['formhash']) ) {
>
> // clear out hash in session so if the user refreshes this
> // page and has a _formhash_ var it will be considered bad
> unset($_SESSION['formhash']);
>
>
> // test the form var against the session
> if ($formhash != $_REQUEST['_formhash_']) ) {
> // user did not come from the form that generated page
> // so hash is invalid
> }
>
> }
> } else {
> // invlalid data, has no hash
> }
>
> This should be generic enough so it can be used on all form
> processing pages without any modifications.
>
> You do have to make sure that the form_page.php does not get cached
> by the browser.
>
> HTH,
>
> Curt

attached mail follows:


I cannot make PHP release the port after it binds
to it, the following script should just open a
port, accept one line of input, write the contents
to the out file, then unbind and close the connection.

It works fine, with the exception of if I run it
again, it reads the port as still being bound. Any
ideas on how to fix my script, or atleast free the
port without having to reboot?

<?php
        define('IP','127.0.0.1');
        define('PORT','23');
 
        $s = socket_create(AF_INET,SOCK_STREAM,0);
        socket_bind($s,IP,PORT);
        socket_listen($s);

        $f = fopen('out','w');

        $a = socket_accept($s);
        fwrite($f,socket_read($a,1000));

        fclose($f);

        socket_shutdown($a);
        socket_close($a);

        socket_shutdown($s);
        socket_close($s);
?>

--
Adam Voigt (adamcryptocomm.com)
Linux/Unix Network Administrator
The Cryptocomm Group

attached mail follows:


php 4.2.3
apache 1.3.20

when uploading files bigger than limits set in php.ini warning is being
reported (in files) and no further script execution takes place. to be
specific - it looks like no execution is being made at all. i get 0 bytes
response. i don`t want to upload files bigger then limit tells, i just want
to display nice error message so user will know what hit him. is this
possible?

rash

attached mail follows:


I copied and pasted your code into two different files, changed the image
name (of course) and it worked just fine on the first try for me. You must
have something being output before your header() call. If you can't find
it, send me your two files and I'll try running them on my server.

  -- Rob

"Oli" <phpedal.us> wrote in message
news:20030730073323.61253.qmailpb1.pair.com...
> Nobe, the image.php script starts with <? as the absolute first
characters.
> Also if I comment out the header function I don't get the header error but
I
> get the gobbledygook (the picture data I guess). Combine the code in one
> script and all is fine, with or without the header function.
>
> Oli
>
>
> "Rob Adams" <rob_adamshotmail.com> wrote in message
> news:20030729184417.53333.qmailpb1.pair.com...
> > "Oli" <phpedal.us> wrote in message
> > news:20030729173407.44957.qmailpb1.pair.com...
> > > I have a function that resizes images. If I put it in the same php
file
> > that
> > > calles it it workes fine. Gives a nice thumbnail or whatever size I
> choose
> > > to display. If I however put it in a seperate file and include it and
> call
> > > it I get garbage and the following error:
> > >
> > > Warning: Cannot modify header information - headers already sent by
> > (output
> > > started at /home/edal/public_html/album/image.php
> > >
> > > Here is the resize function (in file image.php):
> > > <?
> > > function resize($filepath,$nw = 50,$string = '')
> > > {
> > > header("Content-type: image/jpeg");
> >
> > The above line is causing your error. According to the error, it's
> > something in your image.php file. Is there a space or carriage return
> > before your opening php tag in image.php?
> >
> > -- Rob
> >
> >
> >
> > > $im = imagecreatefromjpeg($filepath);
> > > $w = imagesx ($im);
> > > $h = imagesy ($im);
> > > $nh = round($h*$nw/$w,0);
> > > $newim = imagecreatetruecolor($nw,$nh);
> > > $black = imagecolorallocate($newim, 0, 0, 0);
> > > imagecopyresampled($newim,$im,0,0,0,0,$nw,$nh,$w,$h);
> > > imagestring($newim, 2, 5, 5, $string, $black);
> > > imagedestroy($im);
> > > return $newim;
> > > } ?>
> > >
> > > and the calling script:
> > > <?php
> > > include 'image.php';
> > > $image = resize('Capri.jpg',200,'Capri');
> > > imagejpeg($image);
> > > imagedestroy($image);
> > > ?>
> > >
> > > Any ideas?
> > >
> > > Oli
> > >
> > >
> >
> >
>
>

attached mail follows:


Hello friends,

I have two files
one is letter.php and another is simple.php

in simple.php
i assign a value to a php variable , after assigning, i call letter.php in
the same file.

what is my requirment
-------------------------------
that assigned value in simple.php to a variable should display in the
outcome of letter.php.

Tried code
--------------
letter.php

<html>
<body>
<?php
echo "$contact_person";
?>
</body>
</html>

simple.php
<?php
        $fd=file("Letters/letter.php","r");

        $message="
        ".$contact_person="Sudhakar"."";
        foreach ($fd as $value)
        {
                $value= strip_tags($value);
                $message.= "$value";
        }

        echo($message);
?>

getting output which is wrong

output
---------
Sudhakar contact_person; ?>

Output should be
 Sudhkar

Instead of contact_person Sudhkar should display

attached mail follows:


[snip]
I have two files
one is letter.php and another is simple.php

in simple.php
i assign a value to a php variable , after assigning, i call letter.php
in
the same file.
[/snip]

http://www.php.net/include

HTH

attached mail follows:


Hi!

I've got a problem with preconfigured server (Apache 1.3/MySQL 3/PHP 4):

Files and directories created by a PHP script are always owned by the apache
user and apache group. But the script itself is inside of a virtualhost
which has another user and group (web2 / ftponly)!

So in fact the script has to run with the rights of the user web2?? Perhaps
it does, but files/dirs are create with owner apache.

I want the files, created by the script, to be owned by web2.
The important part (I think ;-) of httpd.conf looks like:

-snip-

User apache
Group apache

NameVirtualHost xxx.xxx.xxx.xxx:80
php_admin_flag safe_mode On
php_admin_value safe_mode_exec_dir /var/www/empty

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName xxx.yyy.xxx
ServerAlias xxx.zzz.yyy
DocumentRoot /var/www/web2/html
User web2
Group ftponly
ScriptAlias /cgi-bin/ /var/www/web2/html/cgi-bin/
php_admin_value open_basedir /var/www/web2/
php_admin_value upload_tmp_dir /var/www/web2/phptmp/
</VirtualHost>

-snap-

Hint: /var/www/web2 is the homedirectory of web2, he has all rights there.

Can anybody help me? What do I have to change?

 Joachim

attached mail follows:


> I've got a problem with preconfigured server (Apache 1.3/MySQL 3/PHP 4):
>
> Files and directories created by a PHP script are always owned by the
apache
> user and apache group. But the script itself is inside of a virtualhost
> which has another user and group (web2 / ftponly)!
>
> So in fact the script has to run with the rights of the user web2??
Perhaps
> it does, but files/dirs are create with owner apache.

PHP runs as a module inside of apache, so any files it creates are owned by
the Apache user. That's the way it works.

If you run PHP as a CGI, this does not happen. Or use FTP to make files.

---John Holmes...

attached mail follows:


Cpt John W. Holmes wrote:

>> So in fact the script has to run with the rights of the user web2??
> Perhaps
>> it does, but files/dirs are create with owner apache.
>
> PHP runs as a module inside of apache, so any files it creates are owned
> by the Apache user. That's the way it works.
>
> If you run PHP as a CGI, this does not happen. Or use FTP to make files.

And there is no other way? No way to configure it? Or, are there any
hacks/patches, workarounds?

This way, it seems to me like security hole, because I have to use 0777
while creating, then everybody could do everything with the files. Well,
there is the open_basedir setting, put then, what's about other user doing
other things (not PHP)?

No way?
 Joachim

attached mail follows:


* Thus wrote Joachim (JOFTgmx.de):
> Cpt John W. Holmes wrote:
>
> >> So in fact the script has to run with the rights of the user
> >> web2??
> > Perhaps
> >> it does, but files/dirs are create with owner apache.
> >
> > PHP runs as a module inside of apache, so any files it creates
> > are owned by the Apache user. That's the way it works.
> >
> > If you run PHP as a CGI, this does not happen. Or use FTP to
> > make files.
>
> And there is no other way? No way to configure it? Or, are there
> any hacks/patches, workarounds?
>
> This way, it seems to me like security hole, because I have to
> use 0777 while creating, then everybody could do everything with
> the files. Well, there is the open_basedir setting, put then,
> what's about other user doing other things (not PHP)?
>

Yes that is a big security hole. There are some hosting solutions,
I cant really help you there, but this concept I think should work
would be:

permissions: 0770

user/group: $virtualuser/apache

where $virtualuser is the user's ftp login, shell access (if
available).

now only the user and the apache process (thus php) can write to it. the files
are even locked out for anybody to see. Now with the combination of
open_basedir, it should all be safe.

I hope that puts you in the right direction,

the above stuff is just a concept and not guaranteed

Curt
--
"I used to think I was indecisive, but now I'm not so sure."

attached mail follows:


Curt Zirzow wrote:

>> This way, it seems to me like security hole, because I have to
>> use 0777 while creating, then everybody could do everything with
>> the files. Well, there is the open_basedir setting, put then,
>> what's about other user doing other things (not PHP)?
>>
>
> Yes that is a big security hole. There are some hosting solutions,
> I cant really help you there, but this concept I think should work
> would be:
> [...]
> user/group: $virtualuser/apache

Hmm, well. It may be "more" secure, but there is still the problem, that
every $virtualuser can access the files. You still have to hope that there
is now "bad" $virtualuser.

Anyway, thanks :-)!
 Joachim

attached mail follows:


* Thus wrote Joachim (JOFTgmx.de):
> Curt Zirzow wrote:
>
> >> This way, it seems to me like security hole, because I have to
> >> use 0777 while creating, then everybody could do everything with
> >> the files. Well, there is the open_basedir setting, put then,
> >> what's about other user doing other things (not PHP)?
> >>
> >
> > Yes that is a big security hole. There are some hosting solutions,
> > I cant really help you there, but this concept I think should work
> > would be:
> > [...]
> > user/group: $virtualuser/apache
>
> Hmm, well. It may be "more" secure, but there is still the problem, that
> every $virtualuser can access the files. You still have to hope that there
> is now "bad" $virtualuser.

perhaps a little more detail on how things would be set up:

Folder strucure user/group permissions
/www/virtual1-domain.com/www/ virtual1/apache 0770
/www/virtual2-domain.com/www/ virtual2/apache 0770

thus virtual1 cant touch virtual2's files and vice versa.

Curt
--
"I used to think I was indecisive, but now I'm not so sure."

attached mail follows:


Curt Zirzow wrote:

> * Thus wrote Joachim (JOFTgmx.de):
>> > Yes that is a big security hole. There are some hosting solutions,
>> > I cant really help you there, but this concept I think should work
>> > would be:
>> > [...]
>> > user/group: $virtualuser/apache
>>
>> Hmm, well. It may be "more" secure, but there is still the problem, that
>> every $virtualuser can access the files. You still have to hope that
>> there is now "bad" $virtualuser.
>
> perhaps a little more detail on how things would be set up:
>
> Folder strucure user/group permissions
> /www/virtual1-domain.com/www/ virtual1/apache 0770
> /www/virtual2-domain.com/www/ virtual2/apache 0770
>
> thus virtual1 cant touch virtual2's files and vice versa.

Oh, yes, thanks you opened my eyes! :-)

 Joachim

attached mail follows:


  even when youre not online? is the database online or local? another
question is how is the game played in php?

   i take it scripts are being called over and over right? if so then add a
time function to one of those scripts. when gameplay starts load the time to
mysql (or a file) and then everytime the script is run check the time to see
if the time has exceeded 60 minuets, if it has run you php script to load
the data to mysql.

  you could even go the further step and have it check for internet
conection and load to a file if failed, then load file(s) the next time a
internet connection is detected.

"Phpu" <phpugo.ro> wrote in message
news:000a01c355b6$aaae14d0$060aa8c0cretzu...
Hello
I'm making an online game in php and mysql. Can someone tell me how can I
add records to database every 60 minutes (even when i'm not online)

attached mail follows:


> i take it scripts are being called over and over right? if so then add
a
> time function to one of those scripts. when gameplay starts load the time
to
> mysql (or a file) and then everytime the script is run check the time to
see
> if the time has exceeded 60 minuets, if it has run you php script to load
> the data to mysql.

the trouble with this is what if no-one hits the page for several hours?
will it run 3-4 updates at once, or just the one?

i'm guessing what your actually after is cron. you'd be running it on a *nix
box for this, but you get cron to run the script every hour.

i'm guessing your making some kind of ticker? similar to that in
www.planetarion.com ? it's a fairly easy thing to do, and if you do a search
for planetarion clones, you'll find exactly what your looking for.

don't have a script that runs permanently tho, please. huge waste of
resources, and you've also got the problems of timeouts, and how to restart
a script if it crashes.

attached mail follows:


yea... if no one hits the website for hours then only a few updates will
occur.

you could however write a very small javascript to call on a php script
every hour.

"Skate" <rootfatcuban.com> wrote in message
news:034a01bffa3b$480e62a0$1400000afatcuban...
>
> > i take it scripts are being called over and over right? if so then
add
> a
> > time function to one of those scripts. when gameplay starts load the
time
> to
> > mysql (or a file) and then everytime the script is run check the time to
> see
> > if the time has exceeded 60 minuets, if it has run you php script to
load
> > the data to mysql.
>
>
> the trouble with this is what if no-one hits the page for several hours?
> will it run 3-4 updates at once, or just the one?
>
> i'm guessing what your actually after is cron. you'd be running it on a
*nix
> box for this, but you get cron to run the script every hour.
>
> i'm guessing your making some kind of ticker? similar to that in
> www.planetarion.com ? it's a fairly easy thing to do, and if you do a
search
> for planetarion clones, you'll find exactly what your looking for.
>
> don't have a script that runs permanently tho, please. huge waste of
> resources, and you've also got the problems of timeouts, and how to
restart
> a script if it crashes.
>
>
>

attached mail follows:


Hello,

I'm lookin for some tips on the best way to do this...

I make a database connection outside of my classes... lets call it
$myDBConnection. I need to use this connection in a class nested in a
class... Was wondering the most efficient way of doing this? I don't want to
create a new db connection in the class. I want to use the existing one...

If no one has a better Idea I'll pass the connection through the constructor
of the first class, and then again into the constructor of the nested
class... then I can query and use the database connection as
$this->myDBConnection.... Just wanted to avoid that because there's about 5
db connections I'll have to pass in...

Any thoughts? Would it make things easyer if the base class inherited all
nested classes instead of nesting them?

Any help would be appreciated.

Thanks

-Dennis

attached mail follows:


Hi,

Thursday, July 31, 2003, 1:30:54 AM, you wrote:
amc> Hello,

amc> I'm lookin for some tips on the best way to do this...

amc> I make a database connection outside of my classes... lets call it
amc> $myDBConnection. I need to use this connection in a class nested in a
amc> class... Was wondering the most efficient way of doing this? I don't want to
amc> create a new db connection in the class. I want to use the existing one...

amc> If no one has a better Idea I'll pass the connection through the constructor
amc> of the first class, and then again into the constructor of the nested
amc> class... then I can query and use the database connection as
$this->>myDBConnection.... Just wanted to avoid that because there's about 5
amc> db connections I'll have to pass in...

amc> Any thoughts? Would it make things easyer if the base class inherited all
amc> nested classes instead of nesting them?

amc> Any help would be appreciated.

amc> Thanks

amc> -Dennis

what I do is have a global array of classes and register each class
like this:

class a {
        function a(){
                global $classes;
                $classes['a'] =& $this;
        }
}
class b {
        var $a;
        function b(){
                global $classes;
                if(isset($classes['a'])){
                        this->a =& $classes['a'];
                }else{
                        $this->a = new a();
                }
        }
}

--
regards,
Tom

attached mail follows:


I'd recommend starting simple.

Paragraph breaks are two carriage returns (Enter, Enter). Give the writers some
ability to do bold, italic, etc. by using something that isn't html (I don't
store html tags in text fields). For example +b+would make this bold-b-, or
+i+would make this italic-i-. You can also have +c+ to center -c- and could do
the same thing with +16+sizes-16- and +red+colors-red-

Then, when displaying the text, translate what they have into html. +b+ becomes
<b> and -b- becomes </b>. +c+ become <div align="center"> and -c- become
</div>, etc.

Images are a bit different. I let them specify the content and order of images
(uploaded with the content), but I have the script align them where appropriate
(count the number of paragraphs, insert the images in between appropriately,
alternating sides [right, left, right, etc.]).

I find these simple things work for two reasons. First, authors are used to
editors doing things with their text; think of a magazine or newspaper editing,
cutting, putting in pictures, etc. Second, authors don't want to learn html any
more than they want to learn page layout programs. Give them some basic
formatting stuff and add more as needed.

kind regards,

bill

Justin French wrote:

> Hi all,
>
> I've been writing CMS's for years now, and at the moment, I find myself
> looking for some breakthrough, or at the very least, a change in the
> way I do things.
>
> Anyone can write a CMS to manage simple articles with a data structure
> like:
>
> id
> author
> date_written
> heading
> body
> keywords
> description
> publish_date
> expires_date
>
> But, it still requires the writer to know a little mark-up
> (p,b,h1,h2,i,a,img,etc) in order to create an article with multiple
> paragraphs, sections, headings, images, etc, with well structured,
> valid mark-up.
>
> So, I've started thinking about how this can be tackled.
>
> Idea #1 was to have an unlimited number of 'blocks' or 'objects'
> *related* to an article, resulting in two tables:
>
> ARTICLE
> id, author, date, title, keywords, desc, etc
>
> BLOCKS
> id, articleid, heading, content, order, etc
>
> But the reality is that different types of pages will require different
> types of blocks (some with headings, some with images, some with
> captions, etc). On the surface, this seems either too big to tackle,
> or too complex to expect the writer/contributor to grasp.
>
> I'd be really interested in hearing how any one else is tackling this
> stuff, even if it is only remotely related to PHP.
>
> Justin

attached mail follows:


But isn't this just defining your own version of something like
bbcode? And wouldn't you be better off using bbcode in that case,
when there are plenty of classes for parsing it already out there?

You could even edit the parsers to limit the set of tags available to
your users.

--- bill <billbilltron.com> wrote:
> I'd recommend starting simple.
>
> Paragraph breaks are two carriage returns (Enter, Enter). Give the
> writers some
> ability to do bold, italic, etc. by using something that isn't html
> (I don't
> store html tags in text fields). For example +b+would make this
> bold-b-, or
> +i+would make this italic-i-. You can also have +c+ to center -c-
> and could do
> the same thing with +16+sizes-16- and +red+colors-red-
>
> Then, when displaying the text, translate what they have into html.
> +b+ becomes
> <b> and -b- becomes </b>. +c+ become <div align="center"> and -c-
> become
> </div>, etc.
>
> Images are a bit different. I let them specify the content and
> order of images
> (uploaded with the content), but I have the script align them where
> appropriate
> (count the number of paragraphs, insert the images in between
> appropriately,
> alternating sides [right, left, right, etc.]).
>
> I find these simple things work for two reasons. First, authors
> are used to
> editors doing things with their text; think of a magazine or
> newspaper editing,
> cutting, putting in pictures, etc. Second, authors don't want to
> learn html any
> more than they want to learn page layout programs. Give them some
> basic
> formatting stuff and add more as needed.
>
> kind regards,
>
> bill
>
> Justin French wrote:
>
> > Hi all,
> >
> > I've been writing CMS's for years now, and at the moment, I find
> myself
> > looking for some breakthrough, or at the very least, a change in
> the
> > way I do things.
> >
> > Anyone can write a CMS to manage simple articles with a data
> structure
> > like:
> >
> > id
> > author
> > date_written
> > heading
> > body
> > keywords
> > description
> > publish_date
> > expires_date
> >
> > But, it still requires the writer to know a little mark-up
> > (p,b,h1,h2,i,a,img,etc) in order to create an article with
> multiple
> > paragraphs, sections, headings, images, etc, with well
> structured,
> > valid mark-up.
> >
> > So, I've started thinking about how this can be tackled.
> >
> > Idea #1 was to have an unlimited number of 'blocks' or 'objects'
> > *related* to an article, resulting in two tables:
> >
> > ARTICLE
> > id, author, date, title, keywords, desc, etc
> >
> > BLOCKS
> > id, articleid, heading, content, order, etc
> >
> > But the reality is that different types of pages will require
> different
> > types of blocks (some with headings, some with images, some with
> > captions, etc). On the surface, this seems either too big to
> tackle,
> > or too complex to expect the writer/contributor to grasp.
> >
> > I'd be really interested in hearing how any one else is tackling
> this
> > stuff, even if it is only remotely related to PHP.
> >
> > Justin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

=====
Mark Weinstock
mark_weinstockyahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
***************************************

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

attached mail follows:


Why not use a wysiwyg edit box? There are quite a few of them... unless
you don't want to restrict your users too much.

http://www.labs4.com/htmleditbox/2.0/demo.php

Mark wrote, On 2003/Jul/30 11:11 AM:
> But isn't this just defining your own version of something like
> bbcode? And wouldn't you be better off using bbcode in that case,
> when there are plenty of classes for parsing it already out there?
>
> You could even edit the parsers to limit the set of tags available to
> your users.
>
>
> --- bill <billbilltron.com> wrote:
>
>>I'd recommend starting simple.
>>
>>Paragraph breaks are two carriage returns (Enter, Enter). Give the
>>writers some
>>ability to do bold, italic, etc. by using something that isn't html
>>(I don't
>>store html tags in text fields). For example +b+would make this
>>bold-b-, or
>>+i+would make this italic-i-. You can also have +c+ to center -c-
>>and could do
>>the same thing with +16+sizes-16- and +red+colors-red-
>>
>>Then, when displaying the text, translate what they have into html.
>> +b+ becomes
>><b> and -b- becomes </b>. +c+ become <div align="center"> and -c-
>>become
>></div>, etc.
>>
>>Images are a bit different. I let them specify the content and
>>order of images
>>(uploaded with the content), but I have the script align them where
>>appropriate
>>(count the number of paragraphs, insert the images in between
>>appropriately,
>>alternating sides [right, left, right, etc.]).
>>
>>I find these simple things work for two reasons. First, authors
>>are used to
>>editors doing things with their text; think of a magazine or
>>newspaper editing,
>>cutting, putting in pictures, etc. Second, authors don't want to
>>learn html any
>>more than they want to learn page layout programs. Give them some
>>basic
>>formatting stuff and add more as needed.
>>
>>kind regards,
>>
>>bill
>>
>>Justin French wrote:
>>
>>
>>>Hi all,
>>>
>>>I've been writing CMS's for years now, and at the moment, I find
>>
>>myself
>>
>>>looking for some breakthrough, or at the very least, a change in
>>
>>the
>>
>>>way I do things.
>>>
>>>Anyone can write a CMS to manage simple articles with a data
>>
>>structure
>>
>>>like:
>>>
>>>id
>>>author
>>>date_written
>>>heading
>>>body
>>>keywords
>>>description
>>>publish_date
>>>expires_date
>>>
>>>But, it still requires the writer to know a little mark-up
>>>(p,b,h1,h2,i,a,img,etc) in order to create an article with
>>
>>multiple
>>
>>>paragraphs, sections, headings, images, etc, with well
>>
>>structured,
>>
>>>valid mark-up.
>>>
>>>So, I've started thinking about how this can be tackled.
>>>
>>>Idea #1 was to have an unlimited number of 'blocks' or 'objects'
>>>*related* to an article, resulting in two tables:
>>>
>>>ARTICLE
>>>id, author, date, title, keywords, desc, etc
>>>
>>>BLOCKS
>>>id, articleid, heading, content, order, etc
>>>
>>>But the reality is that different types of pages will require
>>
>>different
>>
>>>types of blocks (some with headings, some with images, some with
>>>captions, etc). On the surface, this seems either too big to
>>
>>tackle,
>>
>>>or too complex to expect the writer/contributor to grasp.
>>>
>>>I'd be really interested in hearing how any one else is tackling
>>
>>this
>>
>>>stuff, even if it is only remotely related to PHP.
>>>
>>>Justin
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> =====
> Mark Weinstock
> mark_weinstockyahoo.com
> ***************************************
> You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
> ***************************************
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>

attached mail follows:


My script currently works; printing the date that it extracts from mysql
table.

It prints the date as:

 

2004-01-29

 

$mailed=$row["mailed"];

$payment=$row["payment"];

$ID=$row["ID"];

echo "<TR><TD>$mailed</TD><TD>$payment</TD></TR>";

 

 

I'm trying to change the format so that the date appears as:

January 29, 2004

 

$mailed=$row["mailed"];

$payment=$row["payment"];

$ID=$row["ID"];

$thisdate=date("F/d/Y",$row->mailed);

echo "<TR><TD>$thisdate</TD><TD>$payment</TD></TR>";

 

This gives the right format, however, it seems to be trying to do the
current date rather then my submitted date?

 

Any idea how I do this?

 

-----------------------------------------------------------------

Jim Gronquist
Computer Network and Programming Analyst

Office of the Bursar

Indiana University

812.856.3026 x6-3026
jgronquiindiana.edu

 

attached mail follows:


> -----Original Message-----
>
>
> My script currently works; printing the date that it extracts from mysql
> table.
>
> It prints the date as:
>
>
>
> 2004-01-29
>
>
>
> $mailed=$row["mailed"];
>
> $payment=$row["payment"];
>
> $ID=$row["ID"];
>
> echo "<TR><TD>$mailed</TD><TD>$payment</TD></TR>";
>
>
>
>
>
> I'm trying to change the format so that the date appears as:
>
> January 29, 2004
>
>
>
> $mailed=$row["mailed"];
>
> $payment=$row["payment"];
>
> $ID=$row["ID"];
>
> $thisdate=date("F/d/Y",$row->mailed);
>
> echo "<TR><TD>$thisdate</TD><TD>$payment</TD></TR>";
>
>
>
> This gives the right format, however, it seems to be trying to do the
> current date rather then my submitted date?
>
>
>
> Any idea how I do this?
>
>
>

Try this:

$mailed=$row["mailed"];

$payment=$row["payment"];

$ID=$row["ID"];

$Timestamp=strtotime($row[mailed]);
$thisdate=date("F/d/Y",$Timestamp);

echo "<TR><TD>$thisdate</TD><TD>$payment</TD></TR>";

Before you can use date with a string I believe you have to get the
timestamp from your string and then use that to format date.

Peter

attached mail follows:


You can do it by selecting the formatted date from the mysql server using
the DATE_FORMAT command which would be:

SELECT DATE_FORMAT('%M %D, %Y', date_field_name_or_mysqldate);

-----Original Message-----
From: Gronquist, Jim M [mailto:jgronquiindiana.edu]
Sent: Wednesday, July 30, 2003 11:53 AM
To: php-generallists.php.net
Subject: [PHP] formating date

My script currently works; printing the date that it extracts from mysql
table.

It prints the date as:

2004-01-29

$mailed=$row["mailed"];

$payment=$row["payment"];

$ID=$row["ID"];

echo "<TR><TD>$mailed</TD><TD>$payment</TD></TR>";

I'm trying to change the format so that the date appears as:

January 29, 2004

$mailed=$row["mailed"];

$payment=$row["payment"];

$ID=$row["ID"];

$thisdate=date("F/d/Y",$row->mailed);

echo "<TR><TD>$thisdate</TD><TD>$payment</TD></TR>";

This gives the right format, however, it seems to be trying to do the
current date rather then my submitted date?

Any idea how I do this?

-----------------------------------------------------------------

Jim Gronquist
Computer Network and Programming Analyst

Office of the Bursar

Indiana University

812.856.3026 x6-3026
jgronquiindiana.edu

attached mail follows:


Great!

 

I actually had 2 dates - using your suggestion as follows worked:

 

$mailed=3D$row["mailed"];

$payment=3D$row["payment"];

$ID=3D$row["ID"];

$Timestamp=3Dstrtotime($row[mailed]);

$mailedf=3Ddate("F d, Y",$Timestamp);
$Timestamp=3Dstrtotime($row[payment]);

$paymentf=3Ddate("F d, Y",$Timestamp);

echo "<TR><TD>$mailedf</TD><TD>$paymentf</TD></TR>";

 

 

-Jim

 

-----------------------------------------------------------------

Jim Gronquist

attached mail follows:


This should be a simple question but I can't find the answer in the manual.

is it necessary to global variables or constants in functions?
i.e.
function Foo()
{
  global $PHPSESSID;
  global SID; // how would you do that anyway?
}

Thanks in advance

Daryl

attached mail follows:


phpsessid is the default name of the session cookie sent from the browser to
PHP. So it becomes part of the $_COOKIE array, which PHP automatically
turns into a global variable for you.

Therefore I use $_COOKIE['phpsessid'] to retrieve it.

But often I use session_name() to replace phpsessid with a more descriptive
name. In that case, the key in the cookie collection is changed
accordingly.

So it seems there's nothing special about phpsessid other than it being the
default cookie name.

----- Original Message -----
From: "Daryl Meese" <darylmmagiasoftware.com>
To: <php-generallists.php.net>
Sent: Wednesday, July 30, 2003 12:59 PM
Subject: [PHP] PHPSESSID AND SID

> This should be a simple question but I can't find the answer in the
manual.
>
> is it necessary to global variables or constants in functions?
> i.e.
> function Foo()
> {
> global $PHPSESSID;
> global SID; // how would you do that anyway?
> }
>
> Thanks in advance
>
> Daryl
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hello,

I'm looking for a fairly simple program. What I want is a program that
will send an email to a predetermined address at a predetermined time.

For example, I forget my family and friends birthdates very easily. I'd
like to enter a "task" or a "note" for each person and tell the program
to remind me of their birthday every day for two weeks before their
actual birthdate. I also want to enter two email addresses so that the
program will email at work and at home.

Is there something out there already that does this or should I write it
myself?

Thanks,
Chris.

attached mail follows:


Hi Chris,

        its always more fun to write your own, however, check php project our
(might be spelled projekt, I can't remember). Should be on freshmeat or
sourceforge. It might do what you want.

-Dan Joseph

> -----Original Message-----
> From: Chris W. Parker [mailto:cparkerswatgear.com]
> Sent: Wednesday, July 30, 2003 1:32 PM
> To: php-generallists.php.net
> Subject: [PHP] looking for scheduling program
>
>
> Hello,
>
> I'm looking for a fairly simple program. What I want is a program that
> will send an email to a predetermined address at a predetermined time.
>
> For example, I forget my family and friends birthdates very easily. I'd
> like to enter a "task" or a "note" for each person and tell the program
> to remind me of their birthday every day for two weeks before their
> actual birthdate. I also want to enter two email addresses so that the
> program will email at work and at home.
>
> Is there something out there already that does this or should I write it
> myself?
>
>
>
> Thanks,
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Or just go to http://www.birthdayalarm.com/ and have them do it for you :)

I regard as a mortal sin not only the lying of the senses in matters of
love, but also the illusion which the senses seek to create where love is
only partial. I say, I believe, that one must love with all of one's being,
or else live, come what may, a life of complete chastity. - George Sand

> From: "Dan Joseph" <djosephduhq.us>
> Date: Wed, 30 Jul 2003 13:34:53 -0400
> To: <php-generallists.php.net>
> Subject: RE: [PHP] looking for scheduling program
>
> Hi Chris,
>
> its always more fun to write your own, however, check php project our
> (might be spelled projekt, I can't remember). Should be on freshmeat or
> sourceforge. It might do what you want.
>
> -Dan Joseph
>
>> -----Original Message-----
>> From: Chris W. Parker [mailto:cparkerswatgear.com]
>> Sent: Wednesday, July 30, 2003 1:32 PM
>> To: php-generallists.php.net
>> Subject: [PHP] looking for scheduling program
>>
>>
>> Hello,
>>
>> I'm looking for a fairly simple program. What I want is a program that
>> will send an email to a predetermined address at a predetermined time.
>>
>> For example, I forget my family and friends birthdates very easily. I'd
>> like to enter a "task" or a "note" for each person and tell the program
>> to remind me of their birthday every day for two weeks before their
>> actual birthdate. I also want to enter two email addresses so that the
>> program will email at work and at home.
>>
>> Is there something out there already that does this or should I write it
>> myself?
>>
>>
>>
>> Thanks,
>> 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
>

attached mail follows:


Richard Baskett <mailto:phpbaskettcase.com>
    on Wednesday, July 30, 2003 10:44 AM said:

> Or just go to http://www.birthdayalarm.com/ and have them do it for
> you :)

That is a very cool idea, except that I want to schedule anything at all
and have access to the code. But still that's a great thing for someone
that doesn't know how to program but still wants a birthday reminding
service.

> I regard as a mortal sin not only the lying of the senses in matters
> of love, but also the illusion which the senses seek to create where
> love is only partial. I say, I believe, that one must love with all
> of one's being, or else live, come what may, a life of complete
> chastity. - George Sand

Good thing I don't regard it as a mortal sin or I'd be in trouble!

Chris.

attached mail follows:


List Administrator,
Google spidered the web view to the list and is indexing our email
addresses. Any chance you can edit the code to change "userdomain.com" to
show as "user at domain dot com" as many of the public message boards do?
This will help reduce the spam we get.

Johnny

attached mail follows:


Johnny Martinez <mailto:jmartinezcitrusglobal.com>
    on Wednesday, July 30, 2003 11:07 AM said:

> Google spidered the web view to the list and is indexing our email
> addresses. Any chance you can edit the code to change
> "userdomain.com" to show as "user at domain dot com" as many of the
> public message boards do? This will help reduce the spam we get.

Until all the email harvesters start to recognize those types of email
addresses too.

Chris.

attached mail follows:


www.phpbuilder.com is doing this.

J

-----Original Message-----
From: Johnny Martinez [mailto:jmartinezcitrusglobal.com]
Sent: Wednesday, July 30, 2003 11:07 AM
Cc: php-generallists.php.net
Subject: [PHP] List Administrator

List Administrator,
Google spidered the web view to the list and is indexing our email
addresses. Any chance you can edit the code to change "userdomain.com" to
show as "user at domain dot com" as many of the public message boards do?
This will help reduce the spam we get.

Johnny

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

attached mail follows:


ack! these folks are doing it too: http://archives.neohapsis.com

-----Original Message-----
From: Johnny Martinez [mailto:jmartinezcitrusglobal.com]
Sent: Wednesday, July 30, 2003 11:14 AM
Cc: php-generallists.php.net
Subject: RE: [PHP] List Administrator

www.phpbuilder.com is doing this.

J

-----Original Message-----
From: Johnny Martinez [mailto:jmartinezcitrusglobal.com]
Sent: Wednesday, July 30, 2003 11:07 AM
Cc: php-generallists.php.net
Subject: [PHP] List Administrator

List Administrator,
Google spidered the web view to the list and is indexing our email
addresses. Any chance you can edit the code to change "use