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 31 Jul 2003 11:04:17 -0000 Issue 2208

php-general-digest-helplists.php.net
Date: Thu Jul 31 2003 - 06:04:17 CDT


php-general Digest 31 Jul 2003 11:04:17 -0000 Issue 2208

Topics (messages 157615 through 157694):

Re: PHP cli on Mac OSX
        157615 by: Curt Zirzow

session header issue
        157616 by: Sam Folk-Williams
        157617 by: Curt Zirzow
        157625 by: Sam Folk-Williams
        157650 by: Jason Wong

Re: cookies on localhost WinXP
        157618 by: Chris Shiflett

Deleteing one session
        157619 by: Ryan A
        157624 by: Curt Zirzow

[PHP-WIN] http://www.zend.com/manual/function.memory-get-usage.php (fwd)
        157620 by: Miha Nedok
        157626 by: Curt Zirzow
        157640 by: Evan Nemerson

Re: tags to lowercase
        157621 by: Justin French
        157641 by: Curt Zirzow
        157644 by: Evan Nemerson
        157668 by: Jeff Harris

Re: textbox+database
        157622 by: Chris W. Parker

Re: looking for some kind of CMS breakthough (slightly OT)
        157623 by: Justin French

PHP Sessions
        157627 by: Lee Stewart

Re: downloading a file using headers
        157628 by: Jason Sheets

splitting content into pages
        157629 by: daniel.electroteque.org
        157630 by: Sek-Mun Wong
        157631 by: Chris W. Parker
        157633 by: daniel.electroteque.org
        157634 by: daniel.electroteque.org
        157636 by: Chris W. Parker
        157639 by: Evan Nemerson
        157643 by: Chris W. Parker
        157646 by: daniel.electroteque.org
        157647 by: Evan Nemerson
        157648 by: daniel.electroteque.org
        157659 by: daniel.electroteque.org

foreach help
        157632 by: Ryan A
        157635 by: Evan Nemerson
        157683 by: jan

Parsing Variables
        157637 by: Jason Williard
        157638 by: Curt Zirzow

Hash
        157642 by: AECT Listas
        157645 by: Evan Nemerson

mcrypt mhash
        157649 by: AECT Listas
        157656 by: Evan Nemerson

Re: PHP, JavaScript and populating DropDowns
        157651 by: Creative Solutions New Media

Removing Spaces
        157652 by: Jason Williard
        157653 by: John W. Holmes

php-cli - Controlling external programs
        157654 by: Mike Maltese
        157655 by: Chris Shiflett
        157657 by: Mike Maltese
        157661 by: Tom Rogers
        157687 by: Bogdan Stancescu

install php-gtk on mdk9.1
        157658 by: Decapode Azur
        157686 by: Decapode Azur

Google APIs with PHP
        157660 by: Daniel Ke
        157662 by: Daniel Ke

PHP 5 Usage: Possible Bug?
        157663 by: [-^-!-%-

PHP CLI: How to prevent a module from loading
        157664 by: [-^-!-%-

fpdf
        157665 by: Mukta Telang
        157666 by: Andrew Brampton

Possible My Website was hacked... with PHP... please tell me what this is???
        157667 by: Joe Harman
        157670 by: Adrian
        157673 by: Peter James
        157675 by: Joe Harman
        157676 by: Curt Zirzow
        157679 by: Joel Rees
        157682 by: Joe Harman
        157688 by: Joel Rees
        157691 by: skate
        157692 by: Randum Ian
        157693 by: skate

System() works on /usr/sbin commands
        157669 by: tirumal b
        157671 by: Adrian
        157672 by: Evan Nemerson
        157674 by: tirumal b
        157677 by: Curt Zirzow
        157690 by: Marek Kilimajer

I don't understand...
        157678 by: Jason Martyn
        157680 by: Leif K-Brooks
        157681 by: John Manko

How to you compare dates in a query in Mysql
        157684 by: Safal Solutions
        157685 by: Bogdan Stancescu

Re: Refresh a page in another frame
        157689 by: Steve Fulleylove

Article: PHP vs ASP
        157694 by: Ralph Guzman

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:


* Thus wrote René Fournier (renesmartslitters.com):
> Hello,
>
> I installed Entropy package of PHP on my 10.2.6 OSX
> (http://www2.entropy.ch/download/Entropy-PHP-4.3.2-5.dmg), which states
> that it includes PHP command line. But when I go to Terminal and type
> "PHP somescript.php4", it returns "Command not found".
>
> What am I missing?
try:

php somscript.php4

your terminal shell is case sensitive. If that doesn't work do an
'echo $PATH' and make sure your php binary is in one of those
directories.

I love OSX even though I don't use it :)

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

attached mail follows:


I've got a site with a login authentication script in a file called
login.php. Every page has a simple session check on top of it, as well
as line that captures the name of the file the user is trying to view.
The idea is that if the user tries to go straight to an inside page
without logging in, they get sent to the login page (index.php) with the
variable $file marking the page they wanted to view. When they log in,
the $file variable is sent to login.php and (if $file is set) login.php
returns them to the page they were trying to view using a simple header
redirect: header("Location: $file");

Problem: instead of sending them to the page they wanted to view, they
get sent to this URL: login.php?file=/dir/file_name.php?v=123

What's going on here? Why doesn't "Location: $file" return the contents
of $file? The session check as well as login.php code are below. I'm
stumped here -- thanks!

Sam

  ////----ON EVERY PAGE IN SITE----//////

//get name of file user is trying to view
$file=$PHP_SELF."?".$_SERVER['QUERY_STRING'];
// session check
session_start();
if (!session_is_registered("SESSION"))
{
        // if session check fails, invoke error handler
        header("Location: index.php?file=$file");
        exit();
}

/////----LOGIN.PHP----/////
if (!$file) {
        $page = "main.php";
        } else {
        $page = "$file";
        }
// login.php - performs validation

// authenticate using form variables
$status = authenticate($user_name, $password);

// if user/pass combination is correct
if ($status == 1)
{
        // initiate a session
        session_start();
        
        // register some session variables
        session_register("SESSION");

        // including the username
        session_register("user_name");
        session_register("user_id");
        $user_name = "$user_name";
        $user_id = "$user_id";

        // redirect to protected page
        header("Location: $page");
        exit();
        

attached mail follows:


* Thus wrote Sam Folk-Williams (sfolkwilliamsmn.rr.com):
> Problem: instead of sending them to the page they wanted to view, they
> get sent to this URL: login.php?file=/dir/file_name.php?v=123
>
> What's going on here? Why doesn't "Location: $file" return the contents
> of $file? The session check as well as login.php code are below. I'm
> stumped here -- thanks!
>
>
> ////----ON EVERY PAGE IN SITE----//////
>
> //get name of file user is trying to view
> $file=$PHP_SELF."?".$_SERVER['QUERY_STRING'];
> // session check
> session_start();
> if (!session_is_registered("SESSION"))
> {
> // if session check fails, invoke error handler
> header("Location: index.php?file=$file");
> exit();
> }

If this is on the login.php, $file has been set here. That will overwrite
your $file paramater (assuming your using register globals.) Thus
you get your behaviour of url:

  login.php?file=/dir/file_name.php?v-123

HTH,

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

attached mail follows:


Thanks, but that's not on the login.php page, only on all the protected
pages.

Sam

Curt Zirzow wrote:

> * Thus wrote Sam Folk-Williams (sfolkwilliamsmn.rr.com):
>
>>Problem: instead of sending them to the page they wanted to view, they
>>get sent to this URL: login.php?file=/dir/file_name.php?v=123
>>
>>What's going on here? Why doesn't "Location: $file" return the contents
>>of $file? The session check as well as login.php code are below. I'm
>>stumped here -- thanks!
>>
>>
>> ////----ON EVERY PAGE IN SITE----//////
>>
>>//get name of file user is trying to view
>>$file=$PHP_SELF."?".$_SERVER['QUERY_STRING'];
>>// session check
>>session_start();
>>if (!session_is_registered("SESSION"))
>>{
>> // if session check fails, invoke error handler
>> header("Location: index.php?file=$file");
>> exit();
>>}
>
>
> If this is on the login.php, $file has been set here. That will overwrite
> your $file paramater (assuming your using register globals.) Thus
> you get your behaviour of url:
>
> login.php?file=/dir/file_name.php?v-123
>
> HTH,
>
> Curt

attached mail follows:


On Thursday 31 July 2003 06:39, Sam Folk-Williams wrote:
> I've got a site with a login authentication script in a file called
> login.php. Every page has a simple session check on top of it, as well
> as line that captures the name of the file the user is trying to view.
> The idea is that if the user tries to go straight to an inside page
> without logging in, they get sent to the login page (index.php) with the

Don't you mean they get sent to login.php?

> variable $file marking the page they wanted to view. When they log in,
> the $file variable is sent to login.php and (if $file is set) login.php
> returns them to the page they were trying to view using a simple header
> redirect: header("Location: $file");

The Location: header requires a correctly formed URL, ie http://...

> Problem: instead of sending them to the page they wanted to view, they
> get sent to this URL: login.php?file=/dir/file_name.php?v=123
>
> What's going on here? Why doesn't "Location: $file" return the contents
> of $file?

What do you mean? Have you checked that $file contains what you expect it to
contain? Putting $file inside double-quotes doesn't magically transform its
contents.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
QOTD:
        "Unlucky? If I bought a pumpkin farm, they'd cancel Halloween."
*/

attached mail follows:


--- Curt Zirzow <curtzirzow.dyndns.org> wrote:
> > Now, when a browser sends this, it will be something like this:
> >
> > Cookie: coach_access[login_id]=coach
>
> A cookie name can only be a HTTP/1.1 tolken as defined in rfc2109:

Well, this isn't the case. You see, neither RFC 2109 nor RFC 2965 are perfectly
in synchronization with the implementation of cookies. The best specification
to reference is Netscape's original, because this is what the browsers adhered
to originally, and little has changed since. As mentioned in the PHP manual,
the specification can be found here:

http://wp.netscape.com/newsref/std/cookie_spec.html

Also, if you will run a quick test, you will observe the behavior I described
in my earlier message. I was not making it up. :-)

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

attached mail follows:


Hi,
have around 20 sessions setup and want to delete one of them...
eg:
I have the following sessions:
one
two
three
four
five
etc
I want to delete "four", what should i use? am puzzled by the manual which
offers these two options:

unset($four);
session_unregister($four);

which is better? I am starting my sessions with this kind of statement:
$_SESSION['blah'] = $_GET['blah'];

Also any idea how many sessions I can have "on" at one time? or is there no
limit? I couldnt find anything on that in the manual.

Thanks,
-Ryan

attached mail follows:


* Thus wrote Ryan A (ryanjumac.com):
> Hi,
> have around 20 sessions setup and want to delete one of them...
> eg:
> I have the following sessions:
> one
> two
> three
> four
> five
> etc
> I want to delete "four", what should i use? am puzzled by the manual which
> offers these two options:
>
> unset($four);
> session_unregister($four);
>
> which is better? I am starting my sessions with this kind of statement:
> $_SESSION['blah'] = $_GET['blah'];

unset($_SESSION['blah']);
unset($_SESSION['four']);

Remember: don't use session_register, session_unregister, or
session_is_registered when using the $_SESSION var.
 
> Also any idea how many sessions I can have "on" at one time? or is there no
> limit? I couldnt find anything on that in the manual.

my guess is limit on file size on system. although that isn't an
authoritative answer.

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

attached mail follows:


I asked this one on php-windoows, can someone here tell the answer.

-Mike

---------- Forwarded message ----------
Date: Tue, 29 Jul 2003 15:56:25 +0200 (CEST)
From: Miha Nedok <mikevoyager.unix-systems.net>
To: php-windowslists.php.net
Subject: [PHP-WIN] http://www.zend.com/manual/function.memory-get-usage.php

Any ideas with this one on Win32 ? I'm running 4.3.3RC1.

-Mike

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

attached mail follows:


* Thus wrote Miha Nedok (mikevoyager.unix-systems.net):
>
> I asked this one on php-windoows, can someone here tell the answer.
>
> -Mike
>
> ---------- Forwarded message ----------
> [...]
>
> Any ideas with this one on Win32 ? I'm running 4.3.3RC1.
>
> -Mike

I dont understand what your asking?

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

attached mail follows:


Was php configured with --enable-memory-limit?
function_exists('memory_get_usage')??? function_exists('get_memory_usage')???
Did the function even exist in 4.3.3 RC1?

Why is your address unix-systems.net and you're asking about win32?

On Wednesday 30 July 2003 04:36 pm, Miha Nedok wrote:
> I asked this one on php-windoows, can someone here tell the answer.
>
> -Mike
>
> ---------- Forwarded message ----------
> Date: Tue, 29 Jul 2003 15:56:25 +0200 (CEST)
> From: Miha Nedok <mikevoyager.unix-systems.net>
> To: php-windowslists.php.net
> Subject: [PHP-WIN] http://www.zend.com/manual/function.memory-get-usage.php
>
>
> Any ideas with this one on Win32 ? I'm running 4.3.3RC1.
>
> -Mike

attached mail follows:


Sounds great, although I doubt my host will install... has anyone
considered such a beast running as a PHP function/class?

Justin

On Wednesday, July 30, 2003, at 02:53 PM, Jeff Harris wrote:

> On Jul 30, 2003, "Curt Zirzow" claimed that:
>
> |* Thus wrote Justin French (justinindent.com.au):
> |> Hi all,
> |
> |hello.
> |
> |>
> |> has anyone developed or know of a function to convert all tags to
> |> lowercase, but still preserves the contents of the tags and the
> content
> |> of the attributes of the tags?
> |
> |nice little tool:
> |http://tidy.sourceforge.net/
> |
> |Some one built a function that uses that tool to filter, you'll
> |have to search the archives, cause I dont know of it off hand.
> |
> |
> |Curt
>
>
> I use tidy built into my scripts. In your tidy config file you can set
> covert to lower case, indent, output XHTML or whatever. Curt refers to
> phpTidyHt which basically does the same thing but with a function call.
> Most pages come out crisp and clean. The others are inherently wacked
> and
> need fixing anyway.
>
> <?php
> ob_start();
> // process stuff
> print("</body></html>");
> $str = addslashes(ob_get_contents());
> $fp = popen("echo \"" . $str .
> "\" | /path/to/tidy -config /path/tidy/config", "r");
> $newstr = "";
> do {
> $data = fread($fp, 999999);
> if (strlen($data) == 0) {
> break;
> }
> $newstr .= $data;
> }
> while(true);
> pclose($fp);
> ob_end_clean();
> $modtime = filemtime($_SERVER['PATH_TRANSLATED']);
> $gmt_modtime = gmdate('D, d M Y H:i:s', $modtime). ' GMT';
> header("Last-Modified: " . $gmt_modtime);
> header("Content-length: " . strlen(stripslashes($newstr ) ) );
> echo stripslashes($newstr);
> ?>
>
> --
> 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.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> [This E-mail scanned for viruses]
>
>

attached mail follows:


* Thus wrote Justin French (justinindent.com.au):
> Sounds great, although I doubt my host will install... has anyone
> considered such a beast running as a PHP function/class?

Hey justin,

well, i just got done toying around with a little function that can
do almost all of what you want.

With a little regex magic and the nice little function
preg_replace_callback() I made it almost 100% combatible to html.

It will choke on some badly formated attributes though, thats the
only thing to get fixed.

Here is the code and test:
http://zirzow.dyndns.org/html/php/tests/tags_tolower/preg_replace.php

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

attached mail follows:


Interesting timing...
http://coggeshall.org/archives/e_65.html

On Wednesday 30 July 2003 04:25 pm, Justin French wrote:
> Sounds great, although I doubt my host will install... has anyone
> considered such a beast running as a PHP function/class?
>
> Justin
>
> On Wednesday, July 30, 2003, at 02:53 PM, Jeff Harris wrote:
> > On Jul 30, 2003, "Curt Zirzow" claimed that:
> > |* Thus wrote Justin French (justinindent.com.au):
> > |> Hi all,
> > |
> > |hello.
> > |
> > |> has anyone developed or know of a function to convert all tags to
> > |> lowercase, but still preserves the contents of the tags and the
> >
> > content
> >
> > |> of the attributes of the tags?
> > |
> > |nice little tool:
> > |http://tidy.sourceforge.net/
> > |
> > |Some one built a function that uses that tool to filter, you'll
> > |have to search the archives, cause I dont know of it off hand.
> > |
> > |
> > |Curt
> >
> > I use tidy built into my scripts. In your tidy config file you can set
> > covert to lower case, indent, output XHTML or whatever. Curt refers to
> > phpTidyHt which basically does the same thing but with a function call.
> > Most pages come out crisp and clean. The others are inherently wacked
> > and
> > need fixing anyway.
> >
> > <?php
> > ob_start();
> > // process stuff
> > print("</body></html>");
> > $str = addslashes(ob_get_contents());
> > $fp = popen("echo \"" . $str .
> > "\" | /path/to/tidy -config /path/tidy/config", "r");
> > $newstr = "";
> > do {
> > $data = fread($fp, 999999);
> > if (strlen($data) == 0) {
> > break;
> > }
> > $newstr .= $data;
> > }
> > while(true);
> > pclose($fp);
> > ob_end_clean();
> > $modtime = filemtime($_SERVER['PATH_TRANSLATED']);
> > $gmt_modtime = gmdate('D, d M Y H:i:s', $modtime). ' GMT';
> > header("Last-Modified: " . $gmt_modtime);
> > header("Content-length: " . strlen(stripslashes($newstr ) ) );
> > echo stripslashes($newstr);
> > ?>
> >
> > --
> > 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.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > ---
> > [This E-mail scanned for viruses]

--
Status: 0
Content-type: text/html

[cgi]
"A leader is the wave pushed ahead by the ship."

-Leo Nikolaevich Tolstoy

attached mail follows:


|
|On Wednesday, July 30, 2003, at 02:53 PM, Jeff Harris wrote:
|
|> On Jul 30, 2003, "Curt Zirzow" claimed that:
|>
|> |* Thus wrote Justin French (justinindent.com.au):
|> |> Hi all,
|> |
|> |hello.
|> |
|> |>
|> |> has anyone developed or know of a function to convert all tags to
|> |> lowercase, but still preserves the contents of the tags and the
|> content
|> |> of the attributes of the tags?
|> |
[snip]
On Jul 31, 2003, "Justin French" claimed that:

|Sounds great, although I doubt my host will install... has anyone
|considered such a beast running as a PHP function/class?
|
|Justin
|
If you have enough space, you could download the tidy binary yourself and
stick it in ~/bin/tidy. It's about 155Kb. Then, you can do whatever you
want with it.

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


Patrik Fomin <mailto:pafopafo.net>
    on Wednesday, July 30, 2003 3:46 PM said:

> and when i retrive the text from the database it looks like this:
> TestTestHello
>
> is there anyway to save (enter formattions)?

Well you've left out some important information so I'm going to use my
detective skills here.

1. Are you printing this text to the page?

Or are you...

2. displaying it within in another (or same) textarea?

If you're doing #1, the reason is because the browser doesn't interpret
\n as a new line on the screen, only in the source code. Therefore you
need to send your data through nl2br() first. That will replace all the
\n into <br>.

If you're doing #2 you shouldn't have any problems because the textarea
treats \n as a newline unlike case #1. If indeed you are doing #2 and
you are still getting bad results you're probably doing something
somewhere else, in which case you should submit some code.

hth,
chris.

attached mail follows:


I have an inherit problem where a large portion of my user base are mac
users (designers and musicians). I've tested every WYSISYG editor I
can find, and only one of them (editize.com) works with macs -- and
even then, it's not particularly stable at all, and requires a very new
version of Java installed. Furthermore, whilst I don't have a problem
paying for something that works, the asking price of US$180/domain
*seems* a little high IMHO.

I'd also question how clean and standards compliant the source code it
produces is... I'm aiming for XHTML 1.0 strict at the moment, with a
heavy reliance on site-wide CSS, rather than an in-line style of
mark-up and styling.

But, it may end up being the only option :)

Justin French

On Thursday, July 31, 2003, at 03:51 AM, Pete James wrote:

> 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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> [This E-mail scanned for viruses]
>
>

attached mail follows:


Hi Curt,

No I didn't see a post about space on /tmp... Using df it shows the file
system to only be about 70% full, so there's plenty of space there. Did
you mean something else?

Any other thoughts on where to look?

Thanks,
Lee

>* Thus wrote Lee Stewart (lstewartdsgroup.com):
>
> > Using the $_SESSION[] style produces the same results... Zero length
> > session file in /tmp, and no data passed... (available at
> > http://4.43.81.92/page1a.php)
>
>
>You did see my post about space left on /tmp?
>
>
> >
> > So where do I go from here... Is there any way to debug it? Like I
> > said, I suspect it's not a PHP code bug, but I'm at a loss as to where to
> > go from here (other than re-writing the entire application in some other
> > language -- which I really don't want to do)...
>
>
>another language? how dare you say such thing here on this list :)
>
>Curt
>-- "I used to think I was indecisive, but now I'm not so sure."

----------
Lee Stewart, Senior SE
Sytek Services, a Division of DSG
(719) 566-0188 , Fax (719) 566-0655
lstewartdsgroup.com
www.sytek-services.com
www.dsgroup.com

attached mail follows:


You could use an iframe or you could turn on output buffering, when
output buffering is enabled you can send headers after normal output has
been sent. Just do ob_start(); at the top of your script. Not the most
elegant way of doing it but it would work and not require you to use an
iframe.

Jason

Amanda McComb wrote:

>I have a page that queries the database then uses the data to build an
>excel spreasheet. THat spreadsheet is downloaded according to info in the
>headers. My manager wants to put the page inside of another HTML page to
>make it prettier, but then it breaks because headers are already written
>(it's included in the other HTML page). It works fine on it's own, but
>he really wants it in that page. He wants to know if there is a
>way to trick it into working.
>
>Any ideas? I can post the code if necessary, but it's loooong and messy.
>
>THanks,
>Amanda
>
>
>
>

attached mail follows:


hi there , i have an issue trying to split content into pages , we have a
popup with content and a background image with a set height , when there is
more content the background repeats , theoretically i'd want to split the
content into pages after a given length or line length or where it meets
the background image height how can i do this ?

attached mail follows:


It depends on how complex your "content" is.

I've had a few unsuccessful attempts at this as it gets too messy. Assuming
your "content" contains html (like news), it means you have to ignore tags,
but your tags may have images, in them, etc etc, further adding to your
alignment woes. Also, splitting tags may mean that a <tag> may be without a
</tag> on the same page. Doing it automatically is just too cumbersome.

One technique I employ now is using a <!--PAGE--> comment tag inside the
html content, and then split the page using this delimiter.

It works quite well, allows me to break within a table or if the table runs
over, it means I have to close the table and open another one.

Ultimately, it's not ideal as it requires manual labour, but if you're
dealing with HTML content, that's the only way. It also allows you to
remassage your pages relatively easily if you're swapping over templates.

The "proper" way to do it is if you're original content is XML, then you
would write XSLT to chunk up the pages. I just assume not because it's
unlikely that you would.

This problem of decoupling presentation with representation is hard to avoid
if your original content is already coupled to pre-existing presentation.

<danielelectroteque.org> wrote in message
news:50556.203.15.102.65.1059615272.squirrelwww.electroteque.org...
> hi there , i have an issue trying to split content into pages , we have a
> popup with content and a background image with a set height , when there
is
> more content the background repeats , theoretically i'd want to split the
> content into pages after a given length or line length or where it meets
> the background image height how can i do this ?
>
>

attached mail follows:


danielelectroteque.org <mailto:danielelectroteque.org>
    on Wednesday, July 30, 2003 6:35 PM said:

> hi there , i have an issue trying to split content into pages , we
> have a popup with content and a background image with a set height ,
> when there is more content the background repeats , theoretically i'd
> want to split the content into pages after a given length or line
> length or where it meets the background image height how can i do
> this ?

This can be easy.

1. Make sure the content does not adjust itself based on the size of the
browser window. That is to say that the space that contains the content
should be a fixed width.

2. Then you need to calculate how many words you can legitimately fit
into this fixed space without going over.

If you 150 words will fit in the space but go right up to the very edge
and are almost spilling into a new "page" you should pull the number of
words back to 120 or something to try and make sure that the text will
not spill over.

You can be more precise if you use a fixed width font like Courier New.
If you use a variable width font (not sure if that is the technical
term) you'll have to do a little more guessing because 10 i's are not
the same width as 10 w's.

hth,
chris.

p.s. There is no space before a comma!

attached mail follows:


ok let me explain , its straight up text content from the database , say
its scrolls for ages , i need to split it into pages , so i get the length
of the string up to the last paragraph which fits i need to split it there
any idea ?

> danielelectroteque.org <mailto:danielelectroteque.org>
> on Wednesday, July 30, 2003 6:35 PM said:
>
>> hi there , i have an issue trying to split content into pages , we
>> have a popup with content and a background image with a set height ,
>> when there is more content the background repeats , theoretically i'd
>> want to split the content into pages after a given length or line
>> length or where it meets the background image height how can i do this
>> ?
>
> This can be easy.
>
> 1. Make sure the content does not adjust itself based on the size of
> the browser window. That is to say that the space that contains the
> content should be a fixed width.
>
> 2. Then you need to calculate how many words you can legitimately fit
> into this fixed space without going over.
>
> If you 150 words will fit in the space but go right up to the very edge
> and are almost spilling into a new "page" you should pull the number of
> words back to 120 or something to try and make sure that the text will
> not spill over.
>
> You can be more precise if you use a fixed width font like Courier New.
> If you use a variable width font (not sure if that is the technical
> term) you'll have to do a little more guessing because 10 i's are not
> the same width as 10 w's.
>
>
> hth,
> chris.
>
> p.s. There is no space before a comma!

attached mail follows:


maybe somehow with a substr function that gets the position of the last
paragraph ??

> ok let me explain , its straight up text content from the database ,
> say its scrolls for ages , i need to split it into pages , so i get the
> length of the string up to the last paragraph which fits i need to
> split it there any idea ?
>
>> danielelectroteque.org <mailto:danielelectroteque.org>
>> on Wednesday, July 30, 2003 6:35 PM said:
>>
>>> hi there , i have an issue trying to split content into pages , we
>>> have a popup with content and a background image with a set height ,
>>> when there is more content the background repeats , theoretically i'd
>>> want to split the content into pages after a given length or line
>>> length or where it meets the background image height how can i do
>>> this ?
>>
>> This can be easy.
>>
>> 1. Make sure the content does not adjust itself based on the size of
>> the browser window. That is to say that the space that contains the
>> content should be a fixed width.
>>
>> 2. Then you need to calculate how many words you can legitimately fit
>> into this fixed space without going over.
>>
>> If you 150 words will fit in the space but go right up to the very
>> edge and are almost spilling into a new "page" you should pull the
>> number of words back to 120 or something to try and make sure that the
>> text will not spill over.
>>
>> You can be more precise if you use a fixed width font like Courier
>> New. If you use a variable width font (not sure if that is the
>> technical term) you'll have to do a little more guessing because 10
>> i's are not the same width as 10 w's.
>>
>>
>> hth,
>> chris.
>>
>> p.s. There is no space before a comma!
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


danielelectroteque.org <mailto:danielelectroteque.org>
    on Wednesday, July 30, 2003 7:04 PM said:

> ok let me explain , its straight up text content from the database ,
> say its scrolls for ages , i need to split it into pages , so i get
> the length of the string up to the last paragraph which fits i need
> to split it there any idea ?

The primitive, basic way to do this is:

1. grab the entire document and explode it on " "
2. determine how many pages there are
3. display the first page (120 words)
4. on the next page start back at 1 except when you get to #3 go to #5
instead.
5. display the next 120 words by multiplying the page number by 120 and
continuing until pageNumber*120+120. For example, you're on page 2, and
your showing 120 words per page. That would be 2*120+120. Words shown on
page 2 are 240 through 360.
6. continue until all pages are done.

Make sense?

Chris.

p.s. No spaces come before punctuation in English. Sorry to dissapoint
you again.

attached mail follows:


Is there a reason this can't be solved with a CSS background-repeat: repeat-y;
? Or is download time of individual pages an issue?

This is really a client-side issue. The math is going to vary depending on
each user's settings- which font is used, the size of the font, random
browser stupidity, etc. Even if you try to specify such things, you'll have
issues. If you try to use a specific font, what if the user doesn't have it?
What if they have vision problems and have ordered fonts to be larger than
usual? IMHO it would be better to just use CSS and put everything on the same
page

On Wednesday 30 July 2003 07:06 pm, danielelectroteque.org wrote:
> maybe somehow with a substr function that gets the position of the last
> paragraph ??
>
> > ok let me explain , its straight up text content from the database ,
> > say its scrolls for ages , i need to split it into pages , so i get the
> > length of the string up to the last paragraph which fits i need to
> > split it there any idea ?
> >
> >> danielelectroteque.org <mailto:danielelectroteque.org>
> >>
> >> on Wednesday, July 30, 2003 6:35 PM said:
> >>> hi there , i have an issue trying to split content into pages , we
> >>> have a popup with content and a background image with a set height ,
> >>> when there is more content the background repeats , theoretically i'd
> >>> want to split the content into pages after a given length or line
> >>> length or where it meets the background image height how can i do
> >>> this ?
> >>
> >> This can be easy.
> >>
> >> 1. Make sure the content does not adjust itself based on the size of
> >> the browser window. That is to say that the space that contains the
> >> content should be a fixed width.
> >>
> >> 2. Then you need to calculate how many words you can legitimately fit
> >> into this fixed space without going over.
> >>
> >> If you 150 words will fit in the space but go right up to the very
> >> edge and are almost spilling into a new "page" you should pull the
> >> number of words back to 120 or something to try and make sure that the
> >> text will not spill over.
> >>
> >> You can be more precise if you use a fixed width font like Courier
> >> New. If you use a variable width font (not sure if that is the
> >> technical term) you'll have to do a little more guessing because 10
> >> i's are not the same width as 10 w's.
> >>
> >>
> >> hth,
> >> chris.
> >>
> >> p.s. There is no space before a comma!
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

--
Status: 0
Content-type: text/html

[cgi]
"To be true to the mythical conception of a God is to be false to the
interests of mankind."

-E. Haldeman-Julius

attached mail follows:


Evan Nemerson <mailto:evancoeus-group.com>
    on Wednesday, July 30, 2003 7:17 PM said:

> Is there a reason this can't be solved with a CSS background-repeat:
> repeat-y; ? Or is download time of individual pages an issue?

That can look funny of course if the picture doesn't tile well.

> The math is going to vary
> depending on each user's settings- which font is used, the size of
> the font, random browser stupidity, etc. Even if you try to specify
> such things, you'll have issues.

Too true.

> If you try to use a specific font,
> what if the user doesn't have it? What if they have vision problems
> and have ordered fonts to be larger than usual?

Right again.

> IMHO it would be
> better to just use CSS and put everything on the same page

But the problem with this is that people don't like really long pages.
It makes them (I've read this in a few places and I know I feel this
way) feel like it's going to take forever to read a really long article
instead of maybe five "screen length" pages.

I think pages are a good idea for long articles but I agree that it's a
sticky situation to try and accomate everyone, especially with the
original posters requirements (wants more than one page because of the
background).

Chris.

attached mail follows:


this isnt a client side issue it'll defeat the purpose if i dont repeat the
background image and then let the text flow over it , its supposed to look
like a notepage for a blogger
> Is there a reason this can't be solved with a CSS background-repeat:
> repeat-y; ? Or is download time of individual pages an issue?
>
> This is really a client-side issue. The math is going to vary depending
> on each user's settings- which font is used, the size of the font,
> random browser stupidity, etc. Even if you try to specify such things,
> you'll have issues. If you try to use a specific font, what if the
> user doesn't have it? What if they have vision problems and have
> ordered fonts to be larger than usual? IMHO it would be better to just
> use CSS and put everything on the same page
>
>
>
>
> On Wednesday 30 July 2003 07:06 pm, danielelectroteque.org wrote:
>> maybe somehow with a substr function that gets the position of the
>> last paragraph ??
>>
>> > ok let me explain , its straight up text content from the database ,
>> > say its scrolls for ages , i need to split it into pages , so i get
>> > the length of the string up to the last paragraph which fits i need
>> > to split it there any idea ?
>> >
>> >> danielelectroteque.org <mailto:danielelectroteque.org>
>> >>
>> >> on Wednesday, July 30, 2003 6:35 PM said:
>> >>> hi there , i have an issue trying to split content into pages , we
>> >>> have a popup with content and a background image with a set height
>> >>> , when there is more content the background repeats ,
>> >>> theoretically i'd want to split the content into pages after a
>> >>> given length or line length or where it meets the background image
>> >>> height how can i do this ?
>> >>
>> >> This can be easy.
>> >>
>> >> 1. Make sure the content does not adjust itself based on the size
>> >> of the browser window. That is to say that the space that contains
>> >> the content should be a fixed width.
>> >>
>> >> 2. Then you need to calculate how many words you can legitimately
>> >> fit into this fixed space without going over.
>> >>
>> >> If you 150 words will fit in the space but go right up to the very
>> >> edge and are almost spilling into a new "page" you should pull the
>> >> number of words back to 120 or something to try and make sure that
>> >> the text will not spill over.
>> >>
>> >> You can be more precise if you use a fixed width font like Courier
>> >> New. If you use a variable width font (not sure if that is the
>> >> technical term) you'll have to do a little more guessing because 10
>> >> i's are not the same width as 10 w's.
>> >>
>> >>
>> >> hth,
>> >> chris.
>> >>
>> >> p.s. There is no space before a comma!
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> Status: 0
> Content-type: text/html
>
> [cgi]
> "To be true to the mythical conception of a God is to be false to the
> interests of mankind."
>
> -E. Haldeman-Julius

attached mail follows:


Excellent point. A compromise, then?

How about using the background-repeat: repeat-y; and not trying to do any
math. Just decide how long the content should be, and wrap the page at the
next sentence. That way, you make the end users happy, but don't risk an ugly
page. For 150 characters, (untested)

<style type="text/css">
background-repeat: repeat-y;
</style>
</head>
<body>
<p>
<?php
$x = 150;
while ( $c != '.' )
        $c = substr($str, $x, 1);
echo substr($str, 0, $x);
echo "</p><p><a href=\"popup.php?startchar=$x\">Next page</a></p>";
?>
</body>

On Wednesday 30 July 2003 07:44 pm, Chris W. Parker wrote:
> Evan Nemerson <mailto:evancoeus-group.com>
>
> on Wednesday, July 30, 2003 7:17 PM said:
> > Is there a reason this can't be solved with a CSS background-repeat:
> > repeat-y; ? Or is download time of individual pages an issue?
>
> That can look funny of course if the picture doesn't tile well.
>
> > The math is going to vary
> > depending on each user's settings- which font is used, the size of
> > the font, random browser stupidity, etc. Even if you try to specify
> > such things, you'll have issues.
>
> Too true.
>
> > If you try to use a specific font,
> > what if the user doesn't have it? What if they have vision problems
> > and have ordered fonts to be larger than usual?
>
> Right again.
>
> > IMHO it would be
> > better to just use CSS and put everything on the same page
>
> But the problem with this is that people don't like really long pages.
> It makes them (I've read this in a few places and I know I feel this
> way) feel like it's going to take forever to read a really long article
> instead of maybe five "screen length" pages.
>
> I think pages are a good idea for long articles but I agree that it's a
> sticky situation to try and accomate everyone, especially with the
> original posters requirements (wants more than one page because of the
> background).
>
>
>
> Chris.

--
"He died in AD 33. Get over it."

attached mail follows:


ok i have an idea , i have a solution which may work i dont know just yet ,
ok say the strlen of the entire content is 1675 , the strlen of the content
up to the last paragraph is 1300 , how can i substr this to get the next
block of text from 1300 and also increment if there is more pages ??
> Evan Nemerson <mailto:evancoeus-group.com>
> on Wednesday, July 30, 2003 7:17 PM said:
>
>> Is there a reason this can't be solved with a CSS background-repeat:
>> repeat-y; ? Or is download time of individual pages an issue?
>
> That can look funny of course if the picture doesn't tile well.
>
>> The math is going to vary
>> depending on each user's settings- which font is used, the size of the
>> font, random browser stupidity, etc. Even if you try to specify such
>> things, you'll have issues.
>
> Too true.
>
>> If you try to use a specific font,
>> what if the user doesn't have it? What if they have vision problems
>> and have ordered fonts to be larger than usual?
>
> Right again.
>
>> IMHO it would be
>> better to just use CSS and put everything on the same page
>
> But the problem with this is that people don't like really long pages.
> It makes them (I've read this in a few places and I know I feel this
> way) feel like it's going to take forever to read a really long article
> instead of maybe five "screen length" pages.
>
> I think pages are a good idea for long articles but I agree that it's a
> sticky situation to try and accomate everyone, especially with the
> original posters requirements (wants more than one page because of the
> background).
>
>
>
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


your example doesnt work , and the whole purpose of this is because the
background image wraps if there is too much text , i'm also trying to
figure out of leaving it this way and add a few page breaks at the certain
length so the text doesnt go over the dark edge as u cant see it any ideas ?
> Excellent point. A compromise, then?
>
> How about using the background-repeat: repeat-y; and not trying to do
> any math. Just decide how long the content should be, and wrap the
> page at the next sentence. That way, you make the end users happy, but
> don't risk an ugly page. For 150 characters, (untested)
>
> <style type="text/css">
> background-repeat: repeat-y;
> </style>
> </head>
> <body>
> <p>
> <?php
> $x = 150;
> while ( $c != '.' )
> $c = substr($str, $x, 1);
> echo substr($str, 0, $x);
> echo "</p><p><a href=\"popup.php?startchar=$x\">Next page</a></p>"; ?>
> </body>
>
>
>
> On Wednesday 30 July 2003 07:44 pm, Chris W. Parker wrote:
>> Evan Nemerson <mailto:evancoeus-group.com>
>>
>> on Wednesday, July 30, 2003 7:17 PM said:
>> > Is there a reason this can't be solved with a CSS background-repeat:
>> > repeat-y; ? Or is download time of individual pages an issue?
>>
>> That can look funny of course if the picture doesn't tile well.
>>
>> > The math is going to vary
>> > depending on each user's settings- which font is used, the size of
>> > the font, random browser stupidity, etc. Even if you try to specify
>> > such things, you'll have issues.
>>
>> Too true.
>>
>> > If you try to use a specific font,
>> > what if the user doesn't have it? What if they have vision problems
>> > and have ordered fonts to be larger than usual?
>>
>> Right again.
>>
>> > IMHO it would be
>> > better to just use CSS and put everything on the same page
>>
>> But the problem with this is that people don't like really long pages.
>> It makes them (I've read this in a few places and I know I feel this
>> way) feel like it's going to take forever to read a really long
>> article instead of maybe five "screen length" pages.
>>
>> I think pages are a good idea for long articles but I agree that it's
>> a sticky situation to try and accomate everyone, especially with the
>> original posters requirements (wants more than one page because of the
>> background).
>>
>>
>>
>> Chris.
>
> --
> "He died in AD 33. Get over it."
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Hi,
I have a set of checkboxes (around 38) which will be sent to me via a
post(eg: <input name="noPlatform" type="checkbox" id="noPlatform"
value="1>)...if the checkbox is checked then session "noPlatform" should be
created...AND only the checked ones should be registered all others should
be unset.

one way to do this would be to something like this:
$noPlatform = (isset($_POST['noPlatform'])) ? 1 : 0;
then set the session or via using a if and isset...

but that would mean doing that for the whole 38 fields...I think I have seen
something like this done via a loop (for, while or foreach or a combination)
but cant find it in my old mail or the archive.

Thanks in advance,
-Ryan

attached mail follows:


Well you could do

foreach ( $_POST as $var )
        ${$var} = ( isset($_POST[$var]) ? 1 : 0);

but that's really sloppy. If possible, I'd go more for something like

$vars = Array(
        'noPlatform',
        'littlePlatform',
        'lotsaPlatform',
        'yoMommasaPlatform');

foreach ( $vars as $v ) {
        ${$v} = ( isset($_POST[$v]) ? 1 : 0 );
}

On Wednesday 30 July 2003 06:50 pm, Ryan A wrote:
> Hi,
> I have a set of checkboxes (around 38) which will be sent to me via a
> post(eg: <input name="noPlatform" type="checkbox" id="noPlatform"
> value="1>)...if the checkbox is checked then session "noPlatform" should be
> created...AND only the checked ones should be registered all others should
> be unset.
>
> one way to do this would be to something like this:
> $noPlatform = (isset($_POST['noPlatform'])) ? 1 : 0;
> then set the session or via using a if and isset...
>
> but that would mean doing that for the whole 38 fields...I think I have
> seen something like this done via a loop (for, while or foreach or a
> combination) but cant find it in my old mail or the archive.
>
> Thanks in advance,
> -Ryan

attached mail follows:


Hi

try this:

html code for all of checkboxes:

<input type="checkbox" name="ch_box[]" ....>

php code:

if(isset($_POST['ch_box'])) {
        foreach($_POST['ch_box'] as $ch_box_id => $ch_box_value) {
                processing instructions
        }
}

Regards
Jan

On Thu, 2003-07-31 at 03:50, Ryan A wrote:
> Hi,
> I have a set of checkboxes (around 38) which will be sent to me via a
> post(eg: <input name="noPlatform" type="checkbox" id="noPlatform"
> value="1>)...if the checkbox is checked then session "noPlatform" should be
> created...AND only the checked ones should be registered all others should
> be unset.
>
> one way to do this would be to something like this:
> $noPlatform = (isset($_POST['noPlatform'])) ? 1 : 0;
> then set the session or via using a if and isset...
>
> but that would mean doing that for the whole 38 fields...I think I have seen
> something like this done via a loop (for, while or foreach or a combination)
> but cant find it in my old mail or the archive.
>
> Thanks in advance,
> -Ryan
>

attached mail follows:


I would like to create a script that reads a file name that follows a
specific format and have it parsed into 2 variables. The format is as
follows:

cli_info-ACCOUNT-USERNAME.dat

The two variables that I would like to get out of this are the ACCOUNT and
USERNAME. The rest of the information can be discarded. I can get the
entire filename into a variable, but I am not sure how to parse it properly.

Any assistance would be appreciated.

Thanks,
Jason

attached mail follows:


* Thus wrote Jason Williard (jasonjasondubya.com):
> I would like to create a script that reads a file name that follows a
> specific format and have it parsed into 2 variables. The format is as
> follows:
>
> cli_info-ACCOUNT-USERNAME.dat
>
> The two variables that I would like to get out of this are the ACCOUNT and
> USERNAME. The rest of the information can be discarded. I can get the
> entire filename into a variable, but I am not sure how to parse it properly.

One method would be to use the preg_split():

list($extra, $account, $username) =
    split('/[-.]/', 'cli_info-ACCOUNT-USERNAME.dat', 3);

or a a preg_match():

preg_match('/cli_info-([^-]+)-([^.]+)\.dat/', $str, $matches);
$account = $matches[1];
$username = $matches[2];

This is assumint that account wont contain a '-' and username wont
contain a '.'.

HTH,

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

attached mail follows:


Hi,

How set up functions hash in php4.3.2

thanks

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/

attached mail follows:


do you have something agains php.net/md5? php.net/crc32? php.net/sha1? They're
all included in 4.3

On Wednesday 30 July 2003 07:40 pm, AECT Listas wrote:
> Hi,
>
> How set up functions hash in php4.3.2
>
> thanks
>
> _________________________________________________________________
> Charla con tus amigos en línea mediante MSN Messenger:
> http://messenger.yupimsn.com/

attached mail follows:


Hi,

What is utility of mcrypt and mhash?

Thanks,

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/

attached mail follows:


http://mcrypt.hellug.gr/
http://mhash.sf.net/

On Wednesday 30 July 2003 08:11 pm, AECT Listas wrote:
> Hi,
>
> What is utility of mcrypt and mhash?
>
> Thanks,
>
> _________________________________________________________________
> Charla con tus amigos en línea mediante MSN Messenger:
> http://messenger.yupimsn.com/

attached mail follows:


Thanks very much John. It looks great.

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
webmastersamplingtechnologies.com
csnmsamplingtechnologies.com
W: 902 450 5500
C: 902 430 8498

-----Original Message-----
From: John Manko [mailto:xeridadelphia.net]
Sent: July 29, 2003 2:49 PM
To: csnmns.sympatico.ca
Cc: Php-GeneralLists. Php. Net
Subject: Re: [PHP] PHP, JavaScript and populating DropDowns

assuming you have a table with colors, and each color has car associated
with it (yes, there might be dup color entries).
This should work (check spellings and case, etc..etc...)

$query="SELECT * from colors";
$results = mysql_query($query) or die ("DB ERROR:" . mysql_error());
$num = mysql_numrows($results);
$i=0;
echo "<script language=javascript>\n<!--\n";
while ($i < $num) {
    echo "\n ca[$i] = new Array();";
    echo "\n ca[$i][0] = \"" . mysql_result($results,$i,"CarID") . "\";";
    echo "\n ca[$i][1] = \"" . mysql_result($results,$i,"ColorID") . "\";";
    echo "\n ca[$i][2] = \"" . mysql_result($results,$i,"ColorName") .
"\";\n";
    ++$i;
}

echo "
function changeColor(ns)
{ var SelectColor, NumEntries, i;

    for (i = document.form1.selectcolor.length; i > 0; i--)
    {
        document.addform.selectcolor.options[i-1] = null;
    }

    document.form1.selectcolor.options[0] = new Option("-- Select Color
--",0);
    len = 0;
    if (ns != "0")
    {
        NumEntries = ca.length

        for (i = 0; i < NumEntries; i++)
        {
            if(ca[i][0] == ns){
                len++;
                document.form1.selectcolor.options[len] = new
Option(ca[i][2],ca[i][1]);
            }
        }
    }
    document.form1.selectcolor.selectedIndex = 0;
}

";
echo "\n//-->\n</script>\n";

this in later in the page...

$query="SELECT * from car";
$results = mysql_query($query) or die("<br>ERROR - Please Contact Site
Administrator<br>");
$num = mysql_numrows($results);
$i=0;
echo "<select onchange='changeColor(this.value);'
name='selectcar'><option value='0'>Select Car</option>";
while ($i < $num) {
          $id=mysql_result($results,$i,"CarID");
          $name=mysql_result($results,$i,"CarName");
         echo "<option value='$id'>$name</option>";
          ++$i;
 }
echo "</select>";

echo "<select name="selectcolor"><option value='0'>-- Select Color
--</option></select>";

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

Creative Solutions New Media wrote:

>Hello,
>
>I am using mySQL and PHP to pull some data into my page.
>
>I have 2 dropdown boxes.
>
>As an example lets say dropbox1 has a list of cars and dropbox2 has a list
>of colours.
>
>Here's the thing. The colours for each car vary so I won't know what
>colours to populate the 2nd dropbox with until a car is chosen. I really
>want this all contained on 1 page.
>
>Is there a standard way of dealing with this? The only thing I can think
of
>is to reload the page once the make of car is selected which would give me
>the opportunity to populate the 2nd drop box at that time but that doesn't
>seem like a good solution.
>
>I don't know much in the way of JS but is there a way to do what I need
that
>way?
>
>Thanks.
>
>Tim Winters
>Manager, Creative Development
>Sampling Technologies Incorporated (STI)
>webmastersamplingtechnologies.com
>csnmsamplingtechnologies.com
>W: 902 450 5500
>C: 902 430 8498
>
>
>
>
>
>

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

attached mail follows:


In parsing a file, I ended up with a number of variables that include
spaces. Is there an easy way to remove a space from a variable?

Jason

attached mail follows:


Jason Williard wrote:
> In parsing a file, I ended up with a number of variables that include
> spaces. Is there an easy way to remove a space from a variable?

$new_string = str_replace(' ','',$old_string);

?

--
---John Holmes...

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

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

attached mail follows:


I'm writing a script to be run from the command line. It controls my DAT
autoloader (tape changer) and runs tar so that I can automate my backups.
With the -M option, tar will prompt for a new tape when the current tape is
full. How can I get the signal from tar that the tape needs to be changed?
Is there another way to interact with external programs other than, exec,
backticks, etc.? I'm running 4.3.2-cli on FreeBSD with POSIX and pcntl
functions enabled.

Thanks,
Mike

attached mail follows:


--- Mike Maltese <mikepcmedx.com> wrote:
> I'm writing a script to be run from the command line.
...
> How can I get the signal from tar that the tape needs to be changed?

It sounds like you are wanting to write an interactive shell script. If this is
the case (e.g., I didn't misunderstand), you should probably use expect instead
of PHP.

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

attached mail follows:


Bah, not the answer I was looking for...I really wanted to use PHP and I
have most of what I wanted accomplished. Thanks for the tip, I will
investigate.

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20030731041820.19500.qmailweb14302.mail.yahoo.com...
> --- Mike Maltese <mikepcmedx.com> wrote:
> > I'm writing a script to be run from the command line.
> ...
> > How can I get the signal from tar that the tape needs to be changed?
>
> It sounds like you are wanting to write an interactive shell script. If
this is
> the case (e.g., I didn't misunderstand), you should probably use expect
instead
> of PHP.
>
> Hope that helps.
>
> Chris
>
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/

attached mail follows:


Hi,

Thursday, July 31, 2003, 1:53:50 PM, you wrote:
MM> I'm writing a script to be run from the command line. It controls my DAT
MM> autoloader (tape changer) and runs tar so that I can automate my backups.
MM> With the -M option, tar will prompt for a new tape when the current tape is
MM> full. How can I get the signal from tar that the tape needs to be changed?
MM> Is there another way to interact with external programs other than, exec,
MM> backticks, etc.? I'm running 4.3.2-cli on FreeBSD with POSIX and pcntl
MM> functions enabled.

MM> Thanks,
MM> Mike

Maybe this will help

http://sourceforge.net/projects/mtx/

--
regards,
Tom

attached mail follows:


Have you checked out the -F option for tar? It may prove helpful:

"If you want more elaborate behavior than this, give tar the
--info-script=script-name (--new-volume-script=script-name, -F
script-name) option. The file script-name is expected to be a program
(or shell script) to be run instead of the normal prompting procedure.
When the program finishes, tar will immediately begin writing the next
volume."

Bogdan

Mike Maltese wrote:

> I'm writing a script to be run from the command line. It controls my DAT
> autoloader (tape changer) and runs tar so that I can automate my backups.
> With the -M option, tar will prompt for a new tape when the current tape is
> full. How can I get the signal from tar that the tape needs to be changed?
> Is there another way to interact with external programs other than, exec,
> backticks, etc.? I'm running 4.3.2-cli on FreeBSD with POSIX and pcntl
> functions enabled.
>
> Thanks,
> Mike
>
>

attached mail follows:


I am trying to install PHP-GTK

here is below the error :

====================================
[blue_prawnlocalhost php-gtk-0.5.2]$ ./buildconf
[blue_prawnlocalhost php-gtk-0.5.2]$ ./configure
[blue_prawnlocalhost php-gtk-0.5.2]$ make
[....]
/PHP_GTK/php-gtk-0.5.2/main/php_gtk_object.c:889: `gtk_object_ce' undeclared
(first use in this function)
make: *** [main/php_gtk_object.lo] Erreur 1

attached mail follows:


hi,

where do I have to post to bring help about
how to install php-gtk ?

Cheers

--
I have this error :
====================================
[blue_prawnlocalhost php-gtk-0.5.2]$ ./buildconf
[blue_prawnlocalhost php-gtk-0.5.2]$ ./configure
[blue_prawnlocalhost php-gtk-0.5.2]$ make
[....]
/PHP_GTK/php-gtk-0.5.2/main/php_gtk_object.c:889: `gtk_object_ce' undeclared
(first use in this function)
make: *** [main/php_gtk_object.lo] Erreur 1

attached mail follows:


Hi all,

I am new to PHP and just tested out using NuSoap to query Google database.
The code is written by Harish Kamath. However, it doesn't work without error
message. The web server I used support PHP. Also I downloaded the required
nusoap.php class file and put it in the same directory with nusearch.php,
which query Goodgle database and I have Google's licence key for its APIs.
The code is as following:

<html>
<head><basefont face="Arial"></head>
<body>
<?

if (!$_POST['q'])
{
?>
<h2>Search</h2>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Search term: <input type="text" name="q">
</form>
<?
}
else
{
// include the class
include("nusoap.php");

// create a instance of the SOAP client object
$soapclient = new soapclient("http://api.google.com/search/beta2");

// uncomment the next line to see debug messages
// $soapclient->debug_flag = 1;

print("Before params"); // testing

// set up an array containing input parameters to be
// passed to the remote procedure
$params = array(
      'key' => 'LHZMFvNQFHJ/jGT0d6N8Iu83QVsz49rr', // Google license key
      'q' => $_POST['q'], // search term
      'start' => 0, // start from result n
      'maxResults' => 10, // show a total of n results
      'filter' => true, // remove similar results
      'restrict' => '', // restrict by topic
      'safeSearch' => true, // remove adult links
      'lr' => '', // restrict by language
      'ie' => '', // input encoding
      'oe' => '' // output encoding
);

print("before invoke the doGoogleSearch method");

// invoke the method on the server
$result = $soapclient->call("doGoogleSearch", $params,"urn:GoogleSearch",
"urn:GoogleSearch");

print("before printing results");
// print the results of the search
if ($result['faultstring'])
{
?>
  <h2>Error</h2>
  <? echo $result['faultstring'];?>
<?
}
else
{
?>
  <h2>Search Results</h2>
  Your search for <b><?=$result['searchQuery']?></b> produced
<?=$result['estimatedTotalResultsCount']?> hits.
  <br>
  <ul>
<?
  print("before displaying result");

  if (is_array($result['resultElements']))
  {
   foreach ($result['resultElements'] as $r)
   {
    echo "<li><a href=" . $r['URL'] . ">" . $r['title'] . "</a>";
    echo "<br>";
    echo $r['snippet'] . "(" . $r['cachedSize'] . ")";
    echo "<p>";
   }
  }
?>
  </ul>
<?
}
}
?>
</body>
</html>

Would be very much appreciated if someone can help me out. Thanks,

Daniel

_________________________________________________________________
Get 10Mb extra storage for MSN Hotmail. Subscribe Now!
http://join.msn.com/?pgmarket=en-hk

attached mail follows:


Sorry about it. I should include the code as attachment.

Daniel

_________________________________________________________________
Get 10Mb extra storage for MSN Hotmail. Subscribe Now!
http://join.msn.com/?pgmarket=en-hk

attached mail follows:


All,

I came across the following inconsistency between PHP 4 and PHP 5 Build
2195(Jul 24 2003 20:10:21). The error makes sense. I am just curious
about the version inconsistency. Is this due to a change in PHP 5 (as part
of the class enhancements) or is it an oversight?
For my information, please advise.

==Example==
I can initiate a class before it is defined in version 4, but not in 5.

<?
 //filename.php

 //you can initiate the class before it is defined
 $page = new PageClass;

  class PageClass{ blah...blah...blah...; }

?>
 will work in PHP 4, but will generate an 'Underfine Class' error in PHP 5.

 In PHP 5, the above must be written as

 <?
  //class must be defined first
  class ClassName { blah...blah...; }

  //class must be defined before it is initiated
  $page = new ClassName;
?>

This error makes sense, as you cannot use something that doesn't exist.
I'm mostly curious about the inconsistency between the two versions.

This is not a big issue, but I am curious? Any comments?

-john

attached mail follows:


Hey ppl!

I'm writing a shell script with php, but am having trouble with the Zend
Optimizer module. Please advise.

I get the following error when I run the script from the command line,
but not from the browser:
Failed loading /usr/local/lib/Zend/ZendOptimizer.so:
/usr/local/lib/Zend/ZendOptimizer.so: undefined symbol:
zend_get_configuration_directive

==The script ===

#!/usr/local/bin/php -q
<?php

  echo 'hello world \n';

?>

again, this error only shows up in CLI mode, not from the browser.

Any idea what is causing that?
Is there a way to disable the module from loading, without
removing the php.ini zend optimzer entries?

Please advise.

-john

attached mail follows:


 Hi,
 I want to display the results generated by the query and generate a pdf
 document (using fpdf) for the users to save. The user should be able to
save
 it by clicking on a save button. I have a script called display.php
which
 displays the result of the query..now I want user to be able to save by
 pressing save button. That is I want to do this in the display.php
script
 itself, because the result of the query is too large to POST to another
 script.
 If I do:
 $pdf->Output("/tmp