php-general Digest 21 Mar 2004 00:45:35 -0000 Issue 2658

Topics (messages 181020 through 181059):

Re: too much trimming
        181020 by: Gerben
        181021 by: Gerben

Image size ??
        181022 by: Tom Wuyts
        181023 by: Marek Kilimajer

Re: [PEAR] Auth
        181024 by: Firman Wandayandi
        181026 by: Firman Wandayandi

Re: Turn on E_ALL Error Reporting
        181025 by: Jason Wong

Apache - PHP Load-n-Go ?
        181027 by: gordon stewart

HELP! Apache dies on regular MySQL query :-/
        181028 by: -{ Rene Brehmer }-
        181057 by: Raditha Dissanayake

mail headers
        181029 by: Will

PS : [PHP] Apache - PHP Load-n-Go ? : FIXED
        181030 by: gordon stewart

Convert Date Format?
        181031 by: Jeff Oien
        181033 by: trlists.clayst.com
        181035 by: Jeff Oien
        181036 by: John W. Holmes
        181037 by: Michael Lewis

This Group....
        181032 by: gordon stewart
        181034 by: John W. Holmes

9 Months Ago
        181038 by: Jeff Oien
        181039 by: Red Wingate

string function that inserts a char
        181040 by: Five
        181041 by: Five
        181043 by: Jason Giangrande

Coding Style Guide Neded
        181042 by: Sheeraz Fazal
        181044 by: Michal Migurski

ip to country
        181045 by: Enda Nagle
        181046 by: Manuel Lemos
        181055 by: Marek Kilimajer
        181056 by: Filip de Waard

Re: PHP encounters Access Violation
        181047 by: Ben Ramsey

Scheduling PHP on Windows
        181048 by: Ben Ramsey

Function to check a valid date
        181049 by: Chris Bruce
        181050 by: Ben Ramsey

CMS Templating with Standards Based HTML Delima...
        181051 by: Adam Reiswig
        181052 by: Ben Ramsey
        181053 by: Filip de Waard
        181054 by: Yann Larrivee

Re: Comparing 2 files
        181058 by: Raditha Dissanayake

Re: Question on PDF upload
        181059 by: Raditha Dissanayake

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
you need to add an space after "?>" for to output the newline after it.


"Ivan Sergio Borgonovo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've simple code like this:
>
> -- begin --
> #!/usr/bin/php -q
> <?
> $pippo='goofy'
> ?>
>
> hey my name is <?= $pippo ?>
> and
> I feel good
> -- end --
>
> I would expect this output:
>
> -- begin --
>
> hey my name is goofy
> and
> I feel good
> -- end --
>
> but I obtain this:
> -- begin --
>
> hey my name is goofy and
> I feel good
> -- end --
>
> Lines are indented with tabs.
> I suspect something related to -w flag, but I haven't been able to
> switch this behaviour off.
>
> thx

--- End Message ---
--- Begin Message ---
you need to add an space after "?>" for to output the newline after it.



"Ivan Sergio Borgonovo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've simple code like this:
>
> -- begin --
> #!/usr/bin/php -q
> <?
> $pippo='goofy'
> ?>
>
> hey my name is <?= $pippo ?>
> and
> I feel good
> -- end --
>
> I would expect this output:
>
> -- begin --
>
> hey my name is goofy
> and
> I feel good
> -- end --
>
> but I obtain this:
> -- begin --
>
> hey my name is goofy and
> I feel good
> -- end --
>
> Lines are indented with tabs.
> I suspect something related to -w flag, but I haven't been able to
> switch this behaviour off.
>
> thx

--- End Message ---
--- Begin Message ---
Hi, 
 
Is there any way to know the size of an image ??
 
 
Thanx in advance,
RCTycooner
 
---------------------------------
Admin of The Silver Luna Forums
http://www.wuyts.org/tom/phpbb2/
[EMAIL PROTECTED]
---------------------------------

--- End Message ---
--- Begin Message --- http://www.php.net/getimagesize

Tom Wuyts wrote:
Hi, Is there any way to know the size of an image ??
Thanx in advance,
RCTycooner
---------------------------------
Admin of The Silver Luna Forums
http://www.wuyts.org/tom/phpbb2/
[EMAIL PROTECTED]
---------------------------------



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

Stefan right, I just notice on the error
Fatal error: _factory(): Failed opening required 'Auth/Container/DB.php'
(include_path='.:') in /www/news/Auth-1.2.3/Auth.php on line 218

I'd bet you didn't turned On include_path directive on php.ini. Please
correct
thism, just remove semicolon at front of include_path.

include_path = "path/to/pear"

Firman

----- Original Message -----
From: "Stefan Neufeind" <[EMAIL PROTECTED]>
To: "pear-general" <[EMAIL PROTECTED]>; "Frederic SOSSON"
<[EMAIL PROTECTED]>
Sent: Saturday, March 20, 2004 8:41 PM
Subject: Re: [PEAR] Auth


> Seems you didn't really "install" the package on your server but
> simply unpacked it? This is not the recommended way. See the docs on
> the possibilities available for installing pear-packages
> (http://pear.php.net/manual/en/).
>
> However, if you really want to try make it working with the unpacked
> version, include "Auth-1.2.3/" in your include-path.
>
>
> Good luck,
>  Stefan
>
> On 20 Mar 2004 at 13:47, Frederic SOSSON wrote:
>
> > I am just trying to authenticate users with Pear Auth-1.2.3.
> >
> > My code is this one:
> >
> > => require_once "Auth-1.2.3/Auth.php";
> > =>
> > => function loginFunction() {
> > =>         echo "<FORM METHOD=POST  action=\"" . $_SERVER['PHP_SELF'] .
"?login=1\">";
> > =>         echo "<TABLE ALIGN='center' cellspacing='1'
cellpadding='0'>";
> > =>         echo "<TR>";
> > =>         echo    "<TD CLASS='texte'>User name:</TD>";
> > =>         echo    "<TD><INPUT TYPE='text' NAME='username'></TD>";
> > =>         echo "</TR>";
> > =>         echo "<TR>";
> > =>         echo    "<TD CLASS='texte'>Password:</TD>";
> > =>         echo    "<TD><INPUT TYPE='password' NAME='password'></TD>";
> > =>         echo "</TR>";
> > =>         echo "<TR>";
> > =>         echo   "<TD></TD>";
> > =>         echo    "<TD><INPUT TYPE='submit' CLASS='button'
VALUE='Go!'></TD>";
> > =>         echo "</TR>";
> > =>         echo "</TABLE>";
> > =>         echo "</FORM>";
> > => }
> > =>         $dsn = "mysql://root:[EMAIL PROTECTED]/news";
> > =>         $a = new Auth("DB", $dsn, "loginFunction");
> > =>
> > =>         $a->start();
> > =>
> > =>      if ($a->getAuth()) {
> > =>                 echo "OK";
> > =>         } else {
> > =>                 echo "Pas OK";
> > =>         }
> > => ?>
> >
> > and i've got this message in my browser:
> >
> > => Warning: _factory(Auth/Container/DB.php): failed to open stream: No
such file or directory in /www/news/Auth-1.2.3/Auth.php on line 218
> >
> > => Fatal error: _factory(): Failed opening required
'Auth/Container/DB.php' (include_path='.:') in /www/news/Auth-1.2.3/Auth.php
on line 218
> >
> > Any idea?
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Wrong List!!

----- Original Message -----
From: "Firman Wandayandi" <[EMAIL PROTECTED]>
To: "Frederic SOSSON" <[EMAIL PROTECTED]>
Cc: "PHP-GEN" <[EMAIL PROTECTED]>
Sent: Saturday, March 20, 2004 9:27 PM
Subject: [PHP] Re: [PEAR] Auth


> Hi Frederic,
>
> Stefan right, I just notice on the error
> Fatal error: _factory(): Failed opening required 'Auth/Container/DB.php'
> (include_path='.:') in /www/news/Auth-1.2.3/Auth.php on line 218
>
> I'd bet you didn't turned On include_path directive on php.ini. Please
> correct
> thism, just remove semicolon at front of include_path.
>
> include_path = "path/to/pear"
>
> Firman
>
> ----- Original Message -----
> From: "Stefan Neufeind" <[EMAIL PROTECTED]>
> To: "pear-general" <[EMAIL PROTECTED]>; "Frederic SOSSON"
> <[EMAIL PROTECTED]>
> Sent: Saturday, March 20, 2004 8:41 PM
> Subject: Re: [PEAR] Auth
>
>
> > Seems you didn't really "install" the package on your server but
> > simply unpacked it? This is not the recommended way. See the docs on
> > the possibilities available for installing pear-packages
> > (http://pear.php.net/manual/en/).
> >
> > However, if you really want to try make it working with the unpacked
> > version, include "Auth-1.2.3/" in your include-path.
> >
> >
> > Good luck,
> >  Stefan
> >
> > On 20 Mar 2004 at 13:47, Frederic SOSSON wrote:
> >
> > > I am just trying to authenticate users with Pear Auth-1.2.3.
> > >
> > > My code is this one:
> > >
> > > => require_once "Auth-1.2.3/Auth.php";
> > > =>
> > > => function loginFunction() {
> > > =>         echo "<FORM METHOD=POST  action=\"" . $_SERVER['PHP_SELF']

--- End Message ---
--- Begin Message ---
On Friday 19 March 2004 00:43, Roger Spears wrote:

> I changed the title of this email so it doesn't thread hijack...

Sorry, but you're still hijacking someone's thread. Smart mail clients use the 
following headers (which were still present in your post) to perform 
threading:

References: <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>

Not so smart mail clients uses the Subject.



In detail:

You have started a new thread by taking an existing posting and replying to
it while you changed the subject.

That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.

Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.

--- End Message ---
--- Begin Message ---
Hi there

About 12 months ago, - (on an old PC), I ran Apache, &
installed PHP.. (I dont remember any hastles at the
time..)

Anyway, I havnt used PHP much - (didnt need to..)

- I have a new PC now - & loaded Apache onto it (a
test server, before I upload to main 24/7
website/server)

Its 3:30 a.m. on Sunday now - & all Friday night & Sat
Night - Ive been trying to instal PHP & make it "Go"

However, - Its not..

CURRENT SITUATION :-

Ive installed a new PHP (on my Win 98 system)..
& when I go into http://localhost/index.php - it asks
me what I'll like to do with it...

- I say to open in I.E. - However its as of c:\etc..
etc.. etc\index.php 

It wont open it in the actual browser / website...

SUGGEST

Can anyone suggest a "Beginners guide" - Step-by-step
guide to installing PHP with Apache ?

PS

When I run PHP via a DOS PROMPT - I can put "php -v" &
it tells me the version number  etc (its in the PATH
statement)...


Thankyou

G


=====
New Zealand Online Communities Group.
[EMAIL PROTECTED]  or http://nzocg.kwister.com/
Spam free communities

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

--- End Message ---
--- Begin Message --- Okay ... I've run into the strangest error situation.

Running Apache 2.0.48 on WinXP Pro SP1, and just upgraded PHP from 4.2.3 to 4.3.0 and didn't do anything but to delete the 4.2.3 binaries and replace them with the 4.3.0 binaries.

Problem is I get this error message:


Internal Server Error


The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

----------
Apache/2.0.48 (Win32) Server at localhost Port 80


The log says this:


[Sat Mar 20 15:54:56 2004] [error] [client 127.0.0.1] Premature end of script headers: php.exe


The script that causes this looks like this:


require('sql.php');

$link = mysql_connect($dbhost,$dbuser,$dbpass)
  or die('Could not connect : '.mysql_error());
// echo('Connected successfully');
mysql_select_db($database) or die('Could not select database');

function stripAccents($string) {
$returnString = strtr($string,
'àáâãäçèéêëìíîïñòóôõöšùúûüýÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖŠÙÚÛÜÝ', 'aaaaaceeeeiiiinooooosuuuuyAAAAACEEEEIIIINOOOOOSUUUUY');
// $returnString = str_replace('æ','ae',str_replace('Æ','AE',$returnString));
$returnString = str_replace("'",'',$returnString);
return $returnString;
}


$updated = 0; $totalupd = 0;
for ($i = ord("a"); $i < ord("z")+1; $i++) {
echo('<b>Working on '.strtoupper(chr($i)).'</b><br>');
// commenting out this query makes the error go away, but then the script fails of course
$query = mysql_query("SELECT * FROM girlz WHERE `lastname` LIKE '".chr($i)."%' ORDER BY `lastname` ASC");
$numrows = mysql_num_rows($query);
echo('<b>Loaded/working on '.$numrows.' rows</b><br>');
$updated = 0;
while ($row = mysql_fetch_array($query)) {
$girlID = $row['ID'];
$lastname = $row['lastname'];
$firstname = $row['firstname'];
$middlename = $row['middlename'];


    $firstsort = stripAccents(html_entity_decode($firstname),ENT_QUTES);
    $middlesort = stripAccents(html_entity_decode($middlename),ENT_QUOTES);
    $lastsort = stripAccents(html_entity_decode($lastname),ENT_QUOTES);

echo("<font color=\"#0000ff\">$firstname $middlename $lastname</font>");
echo("<font color=\"#800000\">$firstsort $middlesort $lastsort</font><br>\n");
$result = mysql_query("UPDATE girlz SET `lastsort`='$lastsort',`firstsort`='$firstsort',`middlesort`='$middlesort' WHERE `ID`='$girlID'") or die('Unable to update '.mysql_error());


    $updated++;
    echo("<b>Updated $updated rows</b><br>\n");
  }
  $totalupd += $updated;
}

echo("<b>Total updated: $totalupd rows</b><br>\n");

mysql_close();


I upgraded to 4.3.0 only to be able to use html_entity_decode(), and because my new host is using 4.3.0, and I try to keep the same version level for proper testing purposes.
It only happens on this one script, which only purpose is to transpose some names with HTML entities into something that MySQL can sort properly... the weird thing is: I had the html_entity_decode in a sub-function, and it worked fine. Then I moved it into the main script and removed the function, and it does this error.
I've got 2 other much bigger and much more complex scripts that work on the same DB/table with similar, but double queries with and without limits, and they work without any problems at all.


What causes this? ... And how the heck do I make it work properly ???

TIA

Rene
--
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

--- End Message ---
--- Begin Message ---
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apached does not die just because a script misbehave. Please refer to the line above.


--
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions

--- End Message ---
--- Begin Message ---
Hello all,
I searched for this but did not find what I was looking for.  I want to send
a file from a directory, i know how to do that in txt but I would like to
send a doc or rtf document.  Is the header like this:

$headers = "Content-Type: multipart/mixed";

Thanks,
~WILL~

--- End Message ---
--- Begin Message ---
Sorry for the new thread - I deleted my old email
(thread ID)...

http://marc.theaimsgroup.com/?l=php-general&m=107979353616896&w=2

Basically : FIXED


I went to the website :-  & on the 3rd-4th screen :-

http://www.webmasterstop.com/tutorials/apache-php-mysql-installation3.shtml

I found MY answer..

I didnt have the ScriptAlias /php/ "c:/php/"  set up
correctly..

The 3 lines I needed (without the dashes) are :-

=======
ScriptAlias /php/ "c:/php/"

AddType application/x-httpd-php .php .phtml

Action application/x-httpd-php "/php/php.exe" 
=======

I went to my localhost & now I've got PHP going...

G


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

--- End Message ---
--- Begin Message ---
How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)

Or alternatively take the Month/Day/Year format and find
anything older than 9 months ago.
Thanks.
Jeff Oien

--- End Message ---
--- Begin Message ---
On 20 Mar 2004 Jeff Oien wrote:

> How do I convert this
> 9/8/2001
> (which is Month/Day/Year)
> to this
> 20010908
> (YearMonthDay - with leading zeros)

How about:

<?php
        $date = '9/8/2001';
        list($mm, $dd, $yy) = explode('/', $date);
        print(sprintf('%4d%02d%02d', $yy, $mm, $dd));
?>

--
Tom




--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:

On 20 Mar 2004 Jeff Oien wrote:


How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)


How about:

<?php
        $date = '9/8/2001';
        list($mm, $dd, $yy) = explode('/', $date);
        print(sprintf('%4d%02d%02d', $yy, $mm, $dd));
?>

Can I put that print (sprintf etc. into a variable? Thanks. Jeff Oien

--- End Message ---
--- Begin Message --- Jeff Oien wrote:

How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)

echo date('Ymd',strtotime('9/8/2001'));


--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Try:

$variable=sprintf('%4d%02d%02d', $yy, $mm, $dd));

----- Original Message ----- 
From: "Jeff Oien" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, March 20, 2004 11:36 AM
Subject: Re: [PHP] Convert Date Format?


> [EMAIL PROTECTED] wrote:
> 
> > On 20 Mar 2004 Jeff Oien wrote:
> > 
> > 
> >>How do I convert this
> >>9/8/2001
> >>(which is Month/Day/Year)
> >>to this
> >>20010908
> >>(YearMonthDay - with leading zeros)
> > 
> > 
> > How about:
> > 
> > <?php
> > $date = '9/8/2001';
> > list($mm, $dd, $yy) = explode('/', $date);
> > print(sprintf('%4d%02d%02d', $yy, $mm, $dd));
> > ?>
> 
> Can I put that print (sprintf etc. into a variable? Thanks.
> Jeff Oien
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hi there

Got PHP going :)

- ok - Is this the correct group to ask ? 
Or can anyone suggest another group / forum for newbie
how-to questions..

BASICALLY :- Ive been programming in HTML / CGI (Perl)
for several years, & have only 'briefly' done PHP..

- At work, Someone wants one of my CGI scripts to
convert to PHP... 

Ive only discovered this forum a few hours ago - &
have for the last 2 days/nights been trying to figure
out how to get PHP going / running (on my home
server)..
(its Sunday Morning here)...

Anyways,

Can someone point me in the right direction to some
tutorials ( & *EXAMPLES* ) to do the following
functions (or point mer to an appropriate forum - see
above)..

:- Open a file & insert into an array/variable. (im
trying to figure that one out now - get file-open
errors)..

(& close / flock etc... - not sure if flocking is on
PHP ?)

:- turn a variable (split it) into an array..

:- Loop through an array - & display a line IF it
matches another variable etc..

I think those 3 things are good starting points - I
think I'll learn fast - But just need pointers to the
usage / PHP commands - That I know I can do in Perl..


Thanks

G


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

--- End Message ---
--- Begin Message --- gordon stewart wrote:

Can someone point me in the right direction to some
tutorials ( & *EXAMPLES* ) to do the following
functions (or point mer to an appropriate forum - see
above)..

http://us2.php.net/manual/en/


:- Open a file & insert into an array/variable. (im
trying to figure that one out now - get file-open
errors)..

file()


(& close / flock etc... - not sure if flocking is on
PHP ?)

flock()


:- turn a variable (split it) into an array..

explode()


:- Loop through an array - & display a line IF it
matches another variable etc..

in_array()


I think those 3 things are good starting points - I
think I'll learn fast - But just need pointers to the
usage / PHP commands - That I know I can do in Perl..

http://us2.php.net/file http://us2.php.net/flock http://us2.php.net/explode http://us2.php.net/in_array etc...

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
When I do this:
$lastmonth = mktime(0, 0, 0, date("m")-9, date("d"),  date("Y"));
echo "$lastmonth";

It prints this:
1056081600

Could you tell me what I'm missing? Thanks and thanks for the previous
help.
Jeff Oien

--- End Message ---
--- Begin Message ---
mktime returns an Unix Timestamp, you need to format it using
date( [form] , <[timestamp]> ).

http://php.net/date

Jeff Oien wrote:
When I do this:
$lastmonth = mktime(0, 0, 0, date("m")-9, date("d"),  date("Y"));
echo "$lastmonth";

It prints this:
1056081600

Could you tell me what I'm missing? Thanks and thanks for the previous
help.
Jeff Oien


--- End Message ---
--- Begin Message ---
I just finished looking through string functions
http://us2.php.net/manual/en/ref.strings.php
and can't find one that inserts a character, not replaces one.

If there's a string that's over 50 chars long without a space, I want to insert a 
space without replacing or losing any of the
original characters. Is there a function to do that?

advance thanks,
Dale

--- End Message ---
--- Begin Message ---
"Five" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I just finished looking through string functions
> http://us2.php.net/manual/en/ref.strings.php
> and can't find one that inserts a character, not replaces one.
>
> If there's a string that's over 50 chars long without a space, I want to insert a 
> space without replacing or losing any of the
> original characters. Is there a function to do that?
>
> advance thanks,
> Dale

I should add that, unless there's a function that does it all, I'm not really 
concerned with the finding the 50th char part. I know
there's other funcs for that kind of thing. It's just that all I'm trying to do is 
make sure that when the string is output, it will
wrap to the width of a table and not stretch the table width to suit it's fancy.
If I manufacture a function to do all of the little things necessary to make this 
thing wrap, it seems like a lot of ugly code to do
a simple task.

--- End Message ---
--- Begin Message --- Five wrote:
"Five" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

I just finished looking through string functions
http://us2.php.net/manual/en/ref.strings.php
and can't find one that inserts a character, not replaces one.

If there's a string that's over 50 chars long without a space, I want to insert a 
space without replacing or losing any of the
original characters. Is there a function to do that?

advance thanks,
Dale


I should add that, unless there's a function that does it all, I'm not really 
concerned with the finding the 50th char part. I know
there's other funcs for that kind of thing. It's just that all I'm trying to do is 
make sure that when the string is output, it will
wrap to the width of a table and not stretch the table width to suit it's fancy.
If I manufacture a function to do all of the little things necessary to make this 
thing wrap, it seems like a lot of ugly code to do
a simple task.


Use substr_replace() and set the length value to 0. Here's an example:


$text = "Thistext";
echo "$text<br />";
$text = substr_replace($text, " ", 4, 0);
echo $text;

Test it and you will see that a space is added into the text without replacing any of it.

--
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com

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

I am looking for "Coding Style Guide" for PHP?

Thanks

--- End Message ---
--- Begin Message ---
>I am looking for "Coding Style Guide" for PHP?

PEAR has a good one, http://pear.php.net/manual/en/standards.php

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

--- End Message ---
--- Begin Message ---
I have a site that will have different pricing by world region / country and
also offer different currencies.

Presently, the user has to select their country from a select menu and
submit the form, but I would like to eliminate this step if possible, and
set the country according to their IP address.

I had a quick look at http://www.iptocountry.com but was wondering if there
was a way of doing this with PHP functions?

I know its in use on the php.net and google.com sites (when I go to either I
get ie.php.net or google.ie) so was wondering if its costly / easy to
implement?

Thanks for the help,

Enda
--


Enda Nagle
+353 86 168 0774
[EMAIL PROTECTED]
www.nightsol.net

--- End Message ---
--- Begin Message --- On 03/20/2004 06:48 PM, Enda Nagle wrote:
I have a site that will have different pricing by world region / country and
also offer different currencies.

Presently, the user has to select their country from a select menu and
submit the form, but I would like to eliminate this step if possible, and
set the country according to their IP address.

I had a quick look at http://www.iptocountry.com but was wondering if there
was a way of doing this with PHP functions?

I know its in use on the php.net and google.com sites (when I go to either I
get ie.php.net or google.ie) so was wondering if its costly / easy to
implement?

You may also want to try this NetGeo interface class.


http://www.phpclasses.org/netgeoclass

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message --- Manuel Lemos wrote:
On 03/20/2004 06:48 PM, Enda Nagle wrote:

I have a site that will have different pricing by world region / country and
also offer different currencies.


Presently, the user has to select their country from a select menu and
submit the form, but I would like to eliminate this step if possible, and
set the country according to their IP address.

I had a quick look at http://www.iptocountry.com but was wondering if there
was a way of doing this with PHP functions?


I know its in use on the php.net and google.com sites (when I go to either I
get ie.php.net or google.ie) so was wondering if its costly / easy to
implement?


You may also want to try this NetGeo interface class.

http://www.phpclasses.org/netgeoclass


You can use this class but remember that these services limit the number of requests per ip address. php.net and google certainly don't use the free service but instead bought a database. If your site is busy you should buy one too.

--- End Message ---
--- Begin Message --- On Mar 21, 2004, at 1:01 AM, Marek Kilimajer wrote:
Manuel Lemos wrote:
On 03/20/2004 06:48 PM, Enda Nagle wrote:
I have a site that will have different pricing by world region / country and
also offer different currencies.


Presently, the user has to select their country from a select menu and
submit the form, but I would like to eliminate this step if possible, and
set the country according to their IP address.


I had a quick look at http://www.iptocountry.com but was wondering if there
was a way of doing this with PHP functions?


I know its in use on the php.net and google.com sites (when I go to either I
get ie.php.net or google.ie) so was wondering if its costly / easy to
implement?
You may also want to try this NetGeo interface class.
http://www.phpclasses.org/netgeoclass

You can use this class but remember that these services limit the number of requests per ip address. php.net and google certainly don't use the free service but instead bought a database. If your site is busy you should buy one too.

PHP.net uses a free database: http://ip-to-country.webhosting.info/ which is actually quite good.


Regards,

Filip de Waard
--- End Message ---
--- Begin Message --- Ben Ramsey wrote:
What does this error mean?

PHP has encountered an Access Violation at 0177A8B4

I get it intermittently from pages in phpOpenTracker that call the jpgraph functions. It's just a blank white page with that error, and that doesn't help me out at all. I'm running Windows Server 2003/IIS 6 with PHP 5RC1.


I just wanted to freshen this post once more since no one's responded. Perhaps it just means that no one knows? I've tried Googling on this, but not much has turned up in the way of help.


Also, I forgot to mention, but I'm running PHP 5RC1 as an ISAPI module and not CGI. Not sure if that helps.

Again, this problem is intermittent and does not occur all the time (even when calling the same pages--sometimes I the graph generates correctly, sometimes I get this error). I have narrowed down the error to occurring only with the graph script.

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey

--- End Message ---
--- Begin Message --- I know how to run a PHP script as a cron job on a *nix machine. So, does anyone know how to use the Task Scheduler on Windows to do the same? Or is it even possible?

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey

--- End Message ---
--- Begin Message --- Hello all,

I was going to build a function to check whether a selected date exists, but thought that I would see if anyone has done this type of thing already which would indeed save me some time.

I have a form where the users select the day of the week, month, date and year from 4 pulldowns. (Saturday, March 20, 2004). I need to have a function that will check to see if that is indeed a real date.

Does this sound familiar to anyone?

Thanks a bunch :)

--

Chris Bruce
[EMAIL PROTECTED]

Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

****************************************************************
This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.

--- End Message ---
--- Begin Message --- Your likely to find many ways to do this and many functions with many lines of code that do many variations of what you want. Can I use the word "many" many more times?

Such is the way with programming.

Here's my take on it. Pull all your values into one long string:

$date_string = "{$_POST["week_day"]}, {$_POST["month"]} {$_POST["day"]}, {$_POST["year"]}";

Now, you have a string in the format "Saturday, March 20, 2004".

Now, use strtotime() to figure out whether it's a valid date:

if (($timestamp = strtotime($date_string)) === -1) {
    // Not a valid date; do some error reporting here
} else {
    // It is a valid date, $timestamp is now a valid Unix
    // timestamp of $date_string; use it like below:
    echo date("m/d/Y", $timestamp);
}

See also http://us4.php.net/strtotime


Chris Bruce wrote:


Hello all,

I was going to build a function to check whether a selected date exists, but thought that I would see if anyone has done this type of thing already which would indeed save me some time.

I have a form where the users select the day of the week, month, date and year from 4 pulldowns. (Saturday, March 20, 2004). I need to have a function that will check to see if that is indeed a real date.

Does this sound familiar to anyone?

Thanks a bunch :)

--

Chris Bruce
[EMAIL PROTECTED]

Idextrus
E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189

****************************************************************
This e-mail and its contents are privileged, confidential and
subject to copyright.  If you are not the intended recipient,
please delete this e-mail immediately.  Any unauthorized use
or disclosure of the information herein is prohibited.


-- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey

--- End Message ---
--- Begin Message --- I have just been to hotscripts.com looking under their php area for good cms software. The sheer number of choices is staggering to say the least. I found Smarty and it seems like it might make a good choice for my needs. I am really looking to fill two needs.

One, a robust cms in which I can create standards based web templates (ie, table less layouts using xhtml strict and css)

and Two, an easy method in which my clients can still edit their own content with out having to learn anything new, or at least as little as possible. Some sort of wysiwyg would be great if that's possible with out conflicting with existing css styles and as long as it didn't insert font tags and tables all over.

Is there a good open source php based cms system out there that can do the above? I'd sure like to know about it. Thanks for any pointers!

-Adam R.
--- End Message ---
--- Begin Message --- Adam,

The question you ask is an important one. Is there a CMS out there that meets your client's needs that you don't have to write from scratch? In short, the answer is "no." I've sifted through mounds and mounds of CMSes, and I haven't found one that I really like. It's really up to your own tastes and the requirements of the project. I've always had to write one from scratch due to project requirements. Though, I hope to eliminate that need in the future with the CMS I am currently developing.

So, how can I help you? I can't tell you the name of an end-all-be-all CMS solution. But I can point you to a place to look for open-source solutions. That place is Sourceforge.net. Go there and search Software/Group for "Content Management". You'll get tons of results. Sift through those results and try the ones that sound like they fit your needs. There're are a couple of notable ones that may fit your requirements (e.g. phpWebSite boasts compliant XHTML 1.0 output--though I've never tried it).

-Ben

Adam Reiswig wrote:

I have just been to hotscripts.com looking under their php area for good cms software. The sheer number of choices is staggering to say the least. I found Smarty and it seems like it might make a good choice for my needs. I am really looking to fill two needs.

One, a robust cms in which I can create standards based web templates (ie, table less layouts using xhtml strict and css)

and Two, an easy method in which my clients can still edit their own content with out having to learn anything new, or at least as little as possible. Some sort of wysiwyg would be great if that's possible with out conflicting with existing css styles and as long as it didn't insert font tags and tables all over.

Is there a good open source php based cms system out there that can do the above? I'd sure like to know about it. Thanks for any pointers!

-Adam R.

-- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey

--- End Message ---
--- Begin Message --- On Mar 21, 2004, at 12:01 AM, Adam Reiswig wrote:
Is there a good open source php based cms system out there that can do the above? I'd sure like to know about it. Thanks for any pointers!

No :-(


There are some options that might interest you, like Drupal. But there isn't anything like 'a perfect Open Source CMS'.

Regards,

Filip de Waard
--- End Message ---
--- Begin Message ---
Hi,

There are a few steps to do befor you go ahead and choose a CMS.

One of them, is determining your needs.
Second is looking at the major projects and see how each of them answer
your needs.
The size of the community supporting the project.
Code quality (does it re-use existing code from the community ie: did
they recode their database abstraction layer or used PearDB)
How many database it support (mysql is good, but maybe you want to offer
the choice to your customer)
Is done in 00 ?
Does it have search engine friendly url by default (many cms generate
really long url)
Does it support many languages (in my case this is important to be able
to manage a multi-langual website).
And the most important one, Is it easy to modify and is their a good
user and programmer reference and manual.

Plus doing a set of bench mark might be interesting to do, to know how
many visitors the system can handle

If none answer exactly your need, (say 90%) why not code the 10% and
give it to the community instead of recoding the hole thing.

Coding such a system is complexe, and will require alot of energy, will
the community could provid most of the work.

Here are a couple website that could help you choose.
http://www.opensourcecms.com/
http://www.cmsreview.com/
http://www.cmsinfo.org/

Another quit way to get around the most popular CMS would be to attend
to our CMS debate (will be in french) at the PHP Quebec Conference.

In 2 hours we will go around the most critical needs that a CMS should
offer, and how the most popular project like :TikiWiki, Spip, Xoops,
Typo3, Zope, answer them.

Personally i use xoops for the PHP Quebec community website
http://www.phpquebec.org i also saw breifly tikiwiki seems a great
product.


Good luck.

Yann Larrivée


On Sat, 2004-03-20 at 18:01, Adam Reiswig wrote:
> I have just been to hotscripts.com looking under their php area for good 
> cms software.  The sheer number of choices is staggering to say the 
> least.  I found Smarty and it seems like it might make a good choice for 
> my needs.   I am really looking to fill two needs.
> 
> One, a robust cms in which I can create standards based web templates 
> (ie, table less layouts using xhtml strict and css)
> 
> and Two, an easy method in which my clients can still edit their own 
> content with out having to learn anything new, or at least as little as 
> possible.  Some sort of wysiwyg would be great if that's possible with 
> out conflicting with existing css styles and as long as it didn't insert 
> font tags and tables all over.
> 
> Is there a good open source php based cms system out there that can do 
> the above?  I'd sure like to know about it.  Thanks for any pointers!
> 
> -Adam R.

--- End Message ---
--- Begin Message ---
You are reinventng the wheel try
`diff file1 file2`;


Jens Schmeiser wrote:


Dear list.

I want to compare two text files and print the differences. The text files
contain the structure of a database, so they are very big (>6000 lines).
The file looks like that:

TABLENAME#COLUMNNAME#DATATYPE#DATALENGTH#DATAPRECISION#NULLS
...

I only check if the datatype and nulls are different. If so, then the two
lines of the files will be printed.

I tried to do that and it works excellent if there aren't many differences,
but if there are many diffs, it takes time and time.

What I do now is to read the to files to an array and get the differences
with array_diff

$array1=file('file1.txt');
$array2=file('file2.txt');

$result1 = array_diff($array1,$array2);
$result2 = array_diff($array2,$array1);

After that I do the following:
foreach ($result1 as $line1) {
        foreach ($result2 as $line2) {
                // compare the two lines and show the differences;
                continue;
        }
}

Is there a better way to do that (and of course faster)?


Regards Jens





--
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions

--- End Message ---
--- Begin Message ---
Finally, may I ask a question? In my case, all of the PDFs that generated
from MS Word + Acrobat can be upload with the content-length=512KB, but the
PDFs generated from PageMaker, its content-length is greater than 512KB, why
the content-lengths are different?


Probably because they use two different libraries to produce the PDF. It is an open standard and there are a handfull of different libraries out there.

Sorry for my poor english.

Thanks for your help.

Jeffrey





chkFields();">



--
Raditha Dissanayake.
---------------------------------------------
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions

--- End Message ---

Reply via email to