php-general Digest 28 Nov 2005 23:56:07 -0000 Issue 3821

Topics (messages 226539 through 226564):

Re: Advice Needed for Klorofil Open Source PHP Platform
        226539 by: Ahmed Saad

Re: Can't execute external program
        226540 by: Ahmed Saad

Language check
        226541 by: Khorosh Irani
        226542 by: Jochem Maas

Re: Two version of PHP in single server
        226543 by: John Nichel
        226553 by: Curt Zirzow

Re: Adding links to HTML for a CMS
        226544 by: Jay Blanchard
        226551 by: Mark Steudel

PHP6, UTF & strlen
        226545 by: Jared Williams
        226546 by: Jay Blanchard
        226547 by: Richard Davey
        226548 by: Jochem Maas
        226552 by: Jared Williams

Re: PhpMailer vs Pear:Mail
        226549 by: Mark Steudel
        226550 by: David Grant
        226563 by: Petr Smith

Database problem?
        226554 by: William Stokes
        226555 by: Jay Blanchard
        226556 by: Jim Moseby
        226557 by: Curt Zirzow
        226558 by: William Stokes
        226559 by: Jay Blanchard
        226560 by: John Nichel
        226561 by: William Stokes
        226562 by: Jim Moseby

help avoid multiple login
        226564 by: mail.pmpa

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 11/28/05, Reza Iqbal <[EMAIL PROTECTED]> wrote:
> As a new open source project, we will need many advice in order
> to make it success.


ah an "open source" project with "encoded source code"?! how come?

-ahmed

--- End Message ---
--- Begin Message ---
On 11/21/05, Voip tech <[EMAIL PROTECTED]> wrote:
> <?php
> exec("/var/www/html/myprog -E 123456789098.dat sample1.txt
> sample1.new");
> ?>

use <? system ("/var/www/html/myprog -E 123456789098.dat sample1.txt
sample1.new", $return_val); ?> and check $return_val?

-ahmed

--- End Message ---
--- Begin Message ---
Hello
I want to sure that all the character of a posted string is in my
language(persian for example).What should I do?
Thanks

--- End Message ---
--- Begin Message ---
Khorosh Irani wrote:
Hello
I want to sure that all the character of a posted string is in my
language(persian for example).What should I do?

a few alternatives:

1. read through each posted string manually.
2. hire a persian monkey to do that for you. (monkeys are cheaper ;-)
3. google around for a persian spellchecker and use that - if you
can find one then the chances are you'll have to use it via an exec() call or
something similar.
4. or use the pspell php extension ... I have no idea of persian
dictionaries are available:

http://php.net/manual/en/ref.pspell.php

you are in luck, aspell does support Persian (fa):

http://aspell.sourceforge.net/man-html/Supported.html


Thanks


--- End Message ---
--- Begin Message ---
J.F.Kishor wrote:
Hi,

        I have  a query, can we run  two versions of PHP  in linux 7.2
        server.

        I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
        another application in the same server.

        Do  I need to  do some  configuration changes  to set  the php
        path. To  look up different  versions based on the  request of
        the application.

I don't think you can run them together under the same webserver (Apache) as the AddType is the same for both...

AddType application/x-httpd-php

You would need to find a way to distinguish between the two.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Mon, Nov 28, 2005 at 12:07:02PM +0530, J.F.Kishor wrote:
> Hi,
> 
>       I have  a query, can we run  two versions of PHP  in linux 7.2
>       server.
> 
>       I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
>       another application in the same server.
> 
>       Do  I need to  do some  configuration changes  to set  the php
>       path. To  look up different  versions based on the  request of
>       the application.

1) just run the php4.x code with php5.1
2) configure one version as a module the other one to run as a cgi.
 
Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
[snip]
I am trying to create my own CMS. To being with I want to let users edit 
anything within a <p> tag.

I want to have a menu to the left and display the webpage in the rest of the

page, and for each set of <p> tags I want the user to be able to click on 
the link to edit that paragraph.

My problem is how can I include a webpage in my CMS and for each <p> tag 
wrap an <a href""> tag araound it?
[/snip]

Much applause for your initiative.

You can include a webpage in your CMS using frames or iframes
(http://www.w3.org). While there you can look for information on anchors,
which is what an <a> tag is.

--- End Message ---
--- Begin Message ---
 Store each paragraph text in a database

Table 1 = tblPage
id      Name
1       Welcome Page
2       About Page
Table 2 = Content
id      pageid  content
1       1               This is some content in a paragraph
2       1               This is some more content
3       1               This is the last content on this page
4       2               Some about content

Then when you display your page you pass the page id through the URL like:

http://www.domain.com/page.php?pageid=1

// get the page id of course do some validating is_numeric etc
$id = $_GET['pageid'];

// using pear db package
$res =& $db->query ( "SELECT * FROM tblContent WHERE pageid = '".$id."'" );

// loop through data and display it with an edit link
while( $res->fetchInto( $objData ) )
{
        echo "<p>".$objData->content."<a
href=\"edit.php?pageid=".$objData->od."\">Edit</a></p>";
}

Your edit page would then have some code that would load the content into a
text area or wywsiwig editor or something .... You would then also have to
add functionality where a user could add a paragraph and what order you
would want those paragraphs to show up in, delete paragraphs.

Hope that helps.

Mark
-----Original Message-----
From: Shaun [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 26, 2005 4:24 AM
To: php-general@lists.php.net
Subject: [PHP] Adding links to HTML for a CMS

Hi,

I am trying to create my own CMS. To being with I want to let users edit
anything within a <p> tag.

I want to have a menu to the left and display the webpage in the rest of the
page, and for each set of <p> tags I want the user to be able to click on
the link to edit that paragraph.

My problem is how can I include a webpage in my CMS and for each <p> tag
wrap an <a href""> tag araound it?

Thanks for your advice. 

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

--- End Message ---
--- Begin Message ---
Hi,
        Just been looking over some code, and saw

        if (strlen($data) !== file_put_contents($filename, $data))
                ....

        where $data is UTF8, so wondering if this is going to break in PHP6, if 
so what should be the equivalent code?


Jared

--- End Message ---
--- Begin Message ---
[snip]
Just been looking over some code, and saw

        if (strlen($data) !== file_put_contents($filename, $data))
                ....

        where $data is UTF8, so wondering if this is going to break in PHP6,
if so what should be the equivalent code?
[/snip]

PHP6?

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

Monday, November 28, 2005, 4:04:29 PM, you wrote:

>         Just been looking over some code, and saw
>         if (strlen($data) !== file_put_contents($filename, $data))
>                 ....
>         where $data is UTF8, so wondering if this is going to break
> in PHP6, if so what should be the equivalent code?

If $data is UTF8 already, shouldn't you really be using mb_strlen? In
which case, I'd expect it to function exactly the same in PHP6.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

--- End Message ---
--- Begin Message ---
Jared Williams wrote:
Hi,
        Just been looking over some code, and saw

        if (strlen($data) !== file_put_contents($filename, $data))
                ....

        where $data is UTF8, so wondering if this is going to break in PHP6, if 
so what should be the equivalent code?

that currently works with UTF8 strings? or does it only work because you happen 
to
only ever have singlebyte characters in your strings?

currently strlen() does not give the expected value on 'multibyte' strings (or strings that contain one or more multibyte chars) which is why the mb_*() functions exist [e.g. mb_strlen()].

In php6 all string functions should work with unicode (I believe its UTF16 
internally) transparently
and therefore tyhe code you showed should not break BUT rather it should start 
working ;-)

don't hold your breath for php6 - making php unicode native is a complex, 
difficult undertaking,
it will come when its ready - given the snafu's [IMO] surrounding php5.0.5 and 
php5.1 I hope
they take their time.

rgds,
Jochem




Jared


--- End Message ---
--- Begin Message ---
> 
> Jared Williams wrote:
> > Hi,
> >     Just been looking over some code, and saw
> > 
> >     if (strlen($data) !== file_put_contents($filename, $data))
> >             ....
> > 
> >     where $data is UTF8, so wondering if this is going to 
> break in PHP6, if so what should be the equivalent code?
> 
> that currently works with UTF8 strings? or does it only work 
> because you happen to only ever have singlebyte characters in 
> your strings?

Works with UTF8 strings. Handled nl & fr translations of the PHP Manual fine.
Tried kr & ja, but the docbook srcs coming out of CVS aren't compliant.

> currently strlen() does not give the expected value on 
> 'multibyte' strings (or strings that contain one or more 
> multibyte chars) which is why the mb_*() functions exist 
> [e.g. mb_strlen()].

strlen() returns the byte count, as does file_put_contents return the number of 
written bytes.

> 
> In php6 all string functions should work with unicode (I 
> believe its UTF16 internally) transparently and therefore 
> tyhe code you showed should not break BUT rather it should 
> start working ;-)

It works now. It'll break of strlen() starts returning character counts, 
instead of byte counts.
 
> don't hold your breath for php6 - making php unicode native 
> is a complex, difficult undertaking, it will come when its 
> ready - given the snafu's [IMO] surrounding php5.0.5 and 
> php5.1 I hope they take their time. 

Not, just that this is one of the few bits of code that could be problematic, 
as the pages are almost competely generated by xslt
extension, therefore avoiding PHP character encoding issues.

Jared

--- End Message ---
--- Begin Message ---
Would you mind elaborating on why?  

-----Original Message-----
From: Richard Heyes [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 28, 2005 12:53 AM
To: Cabbar Duzayak
Cc: php-general@lists.php.net
Subject: Re: [PHP] PhpMailer vs Pear:Mail

Cabbar Duzayak wrote:
> Could you please tell which one you recommend in terms of 
> stability/speed and share your experience in terms of these 2?

Ooo, that would have to be PEAR::Mail...

--
Richard Heyes
http://www.phpguru.org/

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

--- End Message ---
--- Begin Message ---
*cough*

http://pear.php.net/package/Mail

*cough*

Mark Steudel wrote:
> Would you mind elaborating on why?  
> 
> -----Original Message-----
> From: Richard Heyes [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 28, 2005 12:53 AM
> To: Cabbar Duzayak
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] PhpMailer vs Pear:Mail
> 
> Cabbar Duzayak wrote:
>> Could you please tell which one you recommend in terms of 
>> stability/speed and share your experience in terms of these 2?
> 
> Ooo, that would have to be PEAR::Mail...
> 
> --
> Richard Heyes
> http://www.phpguru.org/
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Cabbar Duzayak wrote:
Could you please tell which one you recommend in terms of
stability/speed and share your experience in terms of these 2?

Thanks...


I tried all and ended with http://www.phpguru.org/static/htmlMimeMail5.html

fast, stable, usable.

Petr

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

This page works on a operator hosted production server but not my own test 
server. I have no idea what's causing this and I REALLY need some help or 
ideas what to check.

This is the browsers address line:
http://localhost/index.php?team=F10a

I have this in my page and it doesn't work:
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
$kysely = mysql_query($sql);
$tulos = mysql_fetch_row($kysely);
$jouk_nimi = $tulos[0];

$jouk_nimi -variable will be empty.

This works (replaced the $team with static entry "F10a")
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='F10a' ";
$kysely = mysql_query($sql);
$tulos = mysql_fetch_row($kysely);
$jouk_nimi = $tulos[0];

$jouk_nimi get's right value from database.

This sql clause works when ran from PhpMyAdmin. It returns the right value.
"select jouk_nimi from x_jun_jouk where jouk_id='F10a'

So I think that somehow the $team variable is not passed from the address 
line. Is there something in PHP ar Apache that needs to be configured

differently? The test server is on a OpenSuse 10.0. Apache version is 
2.0.54-10. Apache2-Mod_PHP4 version is 4.4.0-6.2. MySQL version is 4.1.13-3.

PHP4-Mysql is installed. Everything ispretty much on their default 
confgiration.

All modules installed were supplied with the Suse 10.0

Thanks
-Will 

--- End Message ---
--- Begin Message ---
[snip]
http://localhost/index.php?team=F10a

I have this in my page and it doesn't work:
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
$kysely = mysql_query($sql);
$tulos = mysql_fetch_row($kysely);
$jouk_nimi = $tulos[0];

$jouk_nimi -variable will be empty.

This works (replaced the $team with static entry "F10a")
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='F10a' ";
$kysely = mysql_query($sql);
$tulos = mysql_fetch_row($kysely);
$jouk_nimi = $tulos[0];

$jouk_nimi get's right value from database.
[/snip]

register_globals is 'on' on the other server. Try

$sql = "select jouk_nimi from x_jun_jouk where jouk_id=$_GET['team'] ";

--- End Message ---
--- Begin Message ---
> 
> This page works on a operator hosted production server but 
> not my own test 
> server. I have no idea what's causing this and I REALLY need 
> some help or 
> ideas what to check.
> 
> This is the browsers address line:
> http://localhost/index.php?team=F10a
> 
> I have this in my page and it doesn't work:
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
> 
> $jouk_nimi -variable will be empty.
> 
> This works (replaced the $team with static entry "F10a")
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='F10a' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
> 
> $jouk_nimi get's right value from database.
> 
> This sql clause works when ran from PhpMyAdmin. It returns 
> the right value.
> "select jouk_nimi from x_jun_jouk where jouk_id='F10a'
> 
> So I think that somehow the $team variable is not passed from 
> the address 
> line. Is there something in PHP ar Apache that needs to be configured
> 
> differently? The test server is on a OpenSuse 10.0. Apache version is 
> 2.0.54-10. Apache2-Mod_PHP4 version is 4.4.0-6.2. MySQL 
> version is 4.1.13-3.
> 
> PHP4-Mysql is installed. Everything ispretty much on their default 
> confgiration.
> 
> All modules installed were supplied with the Suse 10.0


Hi Will.

Looks to me that you don't have register_globals turned on in your home
server.  Add this to the top:

$team=$_GET['team'];

...and see if it works.

I'll leave the SQL injection dangers of your code to other posters. ;-)

JM

--- End Message ---
--- Begin Message ---
On Mon, Nov 28, 2005 at 08:37:36PM +0200, William Stokes wrote:
... 
> I have this in my page and it doesn't work:
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
> 
> $jouk_nimi -variable will be empty.
...
> 
> So I think that somehow the $team variable is not passed from the address 
> line. Is there something in PHP ar Apache that needs to be configured

You'll notice if you compare the output of phpinfo() from both
server, the other server has register_globals on.

You can fix this by explicitly defining where the variable $team is
comming from. 

$team = mysql_real_escape_string($_GET['team']);
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";

Also note the escaping of the string; you should be sure to
properly escape the string to avoid sql injection.

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
OK. Where can I change the register_globals setting?

Thanks for the fast replies.

-Will

"Jay Blanchard" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> [snip]
> http://localhost/index.php?team=F10a
>
> I have this in my page and it doesn't work:
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
>
> $jouk_nimi -variable will be empty.
>
> This works (replaced the $team with static entry "F10a")
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='F10a' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
>
> $jouk_nimi get's right value from database.
> [/snip]
>
> register_globals is 'on' on the other server. Try
>
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id=$_GET['team'] "; 

--- End Message ---
--- Begin Message ---
[snip]
OK. Where can I change the register_globals setting?
[/snip]

In the php.ini

--- End Message ---
--- Begin Message ---
William Stokes wrote:
OK. Where can I change the register_globals setting?
<snip>

In the php.ini and/or in a .htaccess (if you're using Apache, and that Apache server is configured to allow such changes in a .htaccess). However, let me be the fist to suggest that you leave register_globals off, and write code to work with that (it will continue to work properly on a server with globals on). Also, the standing rule: Never Trust User Input.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Damn! It Worked. Thanks :)

"Jay Blanchard" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> [snip]
> OK. Where can I change the register_globals setting?
> [/snip]
>
> In the php.ini 

--- End Message ---
--- Begin Message ---
> 
> Damn! It Worked. Thanks :)
> 


Even so, John's excellent advice should still be taken.  You should not
generally code with a dependence on register_globals, for reasons you have
just seen.

JM

--- End Message ---
--- Begin Message ---
Greetings

I'm having some trouble on a members online script.
I use a php script to track member login to avoid multiple logins on
different ips etc.
When a logged member closes the browser window I can't delete the table
entry because I will not have access to some sort of "Session_OnEnd" action
on hosting.
Is there a workaround for this?

I'm using PHP 5.0.4 and IIS on win XP.

Thanks in advance.
Pedro.

--- End Message ---

Reply via email to