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 19 Nov 2003 12:37:00 -0000 Issue 2424

php-general-digest-helplists.php.net
Date: Wed Nov 19 2003 - 06:37:00 CST


php-general Digest 19 Nov 2003 12:37:00 -0000 Issue 2424

Topics (messages 170210 through 170260):

Re: Assigning command line vars in script
        170210 by: Shawn McKenzie

Re: Command line output
        170211 by: Shawn McKenzie
        170245 by: Jason Wong
        170247 by: Curt Zirzow

Custom Session usind MySQL
        170212 by: Manisha Sathe
        170213 by: John W. Holmes
        170215 by: Marek Kilimajer
        170230 by: Manisha Sathe
        170237 by: John W. Holmes
        170241 by: Greg Donald

Prefilled forms (solved)
        170214 by: b b
        170217 by: John W. Holmes
        170223 by: b b
        170229 by: John W. Holmes
        170249 by: Eugene Lee

Re: {OT} Prefilled forms
        170216 by: John Nichel

Mysql question
        170218 by: Lists
        170219 by: Raditha Dissanayake
        170220 by: Lists
        170221 by: Vail, Warren
        170222 by: John Nichel
        170225 by: Raditha Dissanayake
        170227 by: John W. Holmes
        170242 by: Greg Donald

windows file permission
        170224 by: Chris Williams
        170228 by: John W. Holmes
        170246 by: Burhan Khalid

Query Batch
        170226 by: b b
        170231 by: John W. Holmes

eregi filter
        170232 by: Erin
        170234 by: Derek Ford
        170235 by: John W. Holmes
        170236 by: John W. Holmes
        170238 by: John Nichel

Re: I need answers for the questions
        170233 by: Ryan Thompson
        170240 by: Greg Donald
        170243 by: Ryan Thompson

Re: mcrypt libraries?
        170239 by: Evan Nemerson

Re: How to print nice looking text on an image?
        170244 by: Jason Wong

[PHP or maybe JavaScript or CSS] protecting my PHP from bad input
        170248 by: Miroslav I.
        170250 by: Eugene Lee
        170251 by: Miroslav I.
        170252 by: Eugene Lee

Session trubles
        170253 by: mgraf
        170259 by: Marek Kilimajer
        170260 by: mgraf

MS SQL Connectivity from Linux
        170254 by: Fernando Melo
        170255 by: Burhan Khalid
        170258 by: pete M

language selection with xml
        170256 by: Merlin
        170257 by: Marek Kilimajer

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:


I guess it's the greatest ever, that leaves everyone speechless ;-)

-Shawn

"Shawn McKenzie" <nospammckenzies.net> wrote in message
news:20031118191423.13772.qmailpb1.pair.com...
> Does this look like a good way to retrieve command line variables and
assign
> them in a script, or am I reinventing something that is already in
place???
>
> for ($i = 1; $i < $argc; $i = $i + 2) {
> $var = str_replace("-", "", $argv[$i]);
> $$var = $argv[$i+1];
> }
>
> Thanks!
> -Shawn

attached mail follows:


Guess no ones has a clue. I didnt get a RTFM or anything.

-Shawn

"Shawn McKenzie" <nospammckenzies.net> wrote in message
news:20031118194211.69527.qmailpb1.pair.com...
> O.K. I am just now experimenting with the CLI PHP and have another
> question. With the following code, none of the echo output is seen until
> the script completes. I even tried adding a flush() after the first echo
> before the imap_open, but still the same behavior. Any ideas?
>
> echo "Connecting to $server: $mbox ...\n\n";
> $conn = imap_open("{" . $server . ":143/notls/norsh}" . $mbox, $user,
> $pass);
>
> echo "Receiving messages ...\n\n";
> for ($i = 1; $i <= imap_num_msg($conn); $i++) {
> ...etc...
>
> Thanks!
> -Shawn

attached mail follows:


On Wednesday 19 November 2003 06:54, Shawn McKenzie wrote:
> hey great thanks :(
>
> "Shawn McKenzie" <nospammckenzies.net> wrote in message
> news:20031118194211.69527.qmailpb1.pair.com...
>
> > O.K. I am just now experimenting with the CLI PHP and have another
> > question. With the following code, none of the echo output is seen until
> > the script completes. I even tried adding a flush() after the first echo
> > before the imap_open, but still the same behavior. Any ideas?
> >
> > echo "Connecting to $server: $mbox ...\n\n";
> > $conn = imap_open("{" . $server . ":143/notls/norsh}" . $mbox, $user,
> > $pass);
> >
> > echo "Receiving messages ...\n\n";
> > for ($i = 1; $i <= imap_num_msg($conn); $i++) {
> > ...etc...
> >
> > Thanks!
> > -Shawn

Sorry to butt in and disrupt the conversation that you're having with yourself
and evidently enjoying, try disabling "output_buffering" in php.ini.

--
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
------------------------------------------
/*
"My father? My father left when I was quite young. Well actually, he
 was asked to leave. He had trouble metabolizing alcohol."
 -- George Carlin
*/

attached mail follows:


* Thus wrote Shawn McKenzie (nospammckenzies.net):
> Guess no ones has a clue. I didnt get a RTFM or anything.

Try running php like so:

php -doutput_buffering=0 phpfile.php

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


I want the session to be accessed from different websites, so i got the
answer in this forum only to make use of customised session with mysql.

I searched the web and came to know that 'session.save_handler' of php.ini
needs to be as 'user' but instead, on my server it is 'files'. As server is
a shared server so i may not be able to change it, what can i do to resolve
this ?

Thanks in advance
Manisha

attached mail follows:


Manisha Sathe wrote:

> I want the session to be accessed from different websites, so i got the
> answer in this forum only to make use of customised session with mysql.
>
> I searched the web and came to know that 'session.save_handler' of php.ini
> needs to be as 'user' but instead, on my server it is 'files'. As server is
> a shared server so i may not be able to change it, what can i do to resolve
> this ?

Are both websites on the same machine? If so, you can just use a common
session.save_path and pass the session_id when changing servers.

If the websites are on different machines, then you'll need to use a
database for sessions and ensure the database is accessible by each site.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Manisha Sathe wrote:
> I want the session to be accessed from different websites, so i got the
> answer in this forum only to make use of customised session with mysql.
>
> I searched the web and came to know that 'session.save_handler' of php.ini
> needs to be as 'user' but instead, on my server it is 'files'. As server is
> a shared server so i may not be able to change it, what can i do to resolve
> this ?
>
> Thanks in advance
> Manisha
>

You have to use session_set_save_handler() to register your session
handling functions. One thing I would point out is that you need to lock
the session storage, in this case one row in a table. As mysql cannot
lock a row, only whole table, I would sugest you use GET_LOCK and
RELEASE_LOCK mysql functions (with session id as the lock name) to
implement session locking.

attached mail follows:


yes, website is on same machine, but if there is to and fro from 2 websites,
then for both ways i need to pass it ? what will happen to session time
limit ? if i go website1 then go to another website2 then after 30 mins i
come back to website1 (session timeout 30mins) then what will happen ? Any
sample code would be appreciated.

if at all i decide to go for database then do i need 'session.save_handler'
as 'user' ?

manisha

> Manisha Sathe wrote:
>
> > I want the session to be accessed from different websites, so i got the
> > answer in this forum only to make use of customised session with mysql.
> >
> > I searched the web and came to know that 'session.save_handler' of
php.ini
> > needs to be as 'user' but instead, on my server it is 'files'. As server
is
> > a shared server so i may not be able to change it, what can i do to
resolve
> > this ?
>
> Are both websites on the same machine? If so, you can just use a common
> session.save_path and pass the session_id when changing servers.
>
> If the websites are on different machines, then you'll need to use a
> database for sessions and ensure the database is accessible by each site.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Manisha Sathe wrote:

> yes, website is on same machine, but if there is to and fro from 2 websites,
> then for both ways i need to pass it ? what will happen to session time
> limit ? if i go website1 then go to another website2 then after 30 mins i
> come back to website1 (session timeout 30mins) then what will happen ? Any
> sample code would be appreciated.

Nothing will happen as you'll be using the same session file so it will
not be cleaned up. What don't you try reading the page for
session_set_save_handler() and start from there...

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


On Wed, 19 Nov 2003, Manisha Sathe wrote:

>I want the session to be accessed from different websites, so i got the
>answer in this forum only to make use of customised session with mysql.
>
>I searched the web and came to know that 'session.save_handler' of php.ini
>needs to be as 'user' but instead, on my server it is 'files'. As server is
>a shared server so i may not be able to change it, what can i do to resolve
>this ?
>

Basically you just need to override the default session handler and
provide your own session functions that will use a MySQL table instead of
/tmp. Try this:

http://destiney.com/pub/php_db_sessions.tar.gz

--
Greg Donald
http://destiney.com

attached mail follows:


 Alright lets clean the slate here. I think we all
mean well and that is what counts. I apologize if I
offended anybody.

 Incidentally I can't quite explain the solution to my
dillemma. The following is a description of the
Problem and the Solution:

Problem:
 I am running apache/php server. If I populate a form,
send it and then click back I see a blank form.

Solution:
I had some prefilled form elements where I set the
value of such form element. For example I had
input type = "hidden" VALUE="whatever" ... at the
beginning of the form.

 when I took that hidden variable out and had it at
the end of the form after all the other elements I the
problem was solved. Actually any element with its
value preset should go to the end of the form. In that
case when I hit back my form was prefilled the way I
submitted it.

 It is funny I have been doing this for a while and
this is the first time I had to investigate such a
problem. I am using mozilla 5.00 or netscape 5.0 on
linux. I presume explorer wouldn't have that problem.

 Hope you don't run into this problem and waste few
hours pulling hair like I did.

 Cheers and thanks to everyone who tried to help me.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

attached mail follows:


b b wrote:

> Problem:
> I am running apache/php server. If I populate a form,
> send it and then click back I see a blank form.
>
> Solution:
> I had some prefilled form elements where I set the
> value of such form element. For example I had
> input type = "hidden" VALUE="whatever" ... at the
> beginning of the form.
>
> when I took that hidden variable out and had it at
> the end of the form after all the other elements I the
> problem was solved. Actually any element with its
> value preset should go to the end of the form. In that
> case when I hit back my form was prefilled the way I
> submitted it.

Are you saying you have something like this:

<input type="text" name="foo" value="">
<input type="hidden" name="foo" value="bar">

in order to set a default value? If that's the case, you'll never get
your value of "foo" from the textbox as the hidden value will overwrite it.

The entire issue is up to the client's browser and has nothing to do
with PHP. It's up to each browser whether it keeps your values or not;
I've seen it happen both ways with different browsers.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


 No I am saying that if you have:
<input type .... name = "w1" value = "lkjlkjlj">
<input type ... name ="w2">

 and you click submit then if you click back to see
the form the value you set w2 will be blank. If you
reverse the order however then you will see what you
entered in w2

--- "John W. Holmes" <holmes072000charter.net> wrote:
> b b wrote:
>
> > Problem:
> > I am running apache/php server. If I populate a
> form,
> > send it and then click back I see a blank form.
> >
> > Solution:
> > I had some prefilled form elements where I set the
> > value of such form element. For example I had
> > input type = "hidden" VALUE="whatever" ... at the
> > beginning of the form.
> >
> > when I took that hidden variable out and had it
> at
> > the end of the form after all the other elements I
> the
> > problem was solved. Actually any element with its
> > value preset should go to the end of the form. In
> that
> > case when I hit back my form was prefilled the way
> I
> > submitted it.
>
> Are you saying you have something like this:
>
> <input type="text" name="foo" value="">
> <input type="hidden" name="foo" value="bar">
>
> in order to set a default value? If that's the case,
> you'll never get
> your value of "foo" from the textbox as the hidden
> value will overwrite it.
>
> The entire issue is up to the client's browser and
> has nothing to do
> with PHP. It's up to each browser whether it keeps
> your values or not;
> I've seen it happen both ways with different
> browsers.
>
> --
> ---John Holmes...
>
> Amazon Wishlist:
> www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals –
> www.phparch.com
>
>
>
>

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

attached mail follows:


b b wrote:

> No I am saying that if you have:
> <input type .... name = "w1" value = "lkjlkjlj">
> <input type ... name ="w2">
>
> and you click submit then if you click back to see
> the form the value you set w2 will be blank. If you
> reverse the order however then you will see what you
> entered in w2

odd, yes, but completely client dependent, so PHP isn't going to help.

The only possible thing I can think of that might help this is playing
with what headers you send along with the page that has the form. Maybe
if the browser is directed to cache the page, it'll also save your
filled in form data... or vise versa... PHP can send the headers of
course, but you'll have to play around and there's no guarantee that
it'll be the same with each browser...

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


On Tue, Nov 18, 2003 at 06:00:12PM -0800, b b wrote:
:
: No I am saying that if you have:
: <input type .... name = "w1" value = "lkjlkjlj">
: <input type ... name ="w2">
:
: and you click submit then if you click back to see
: the form the value you set w2 will be blank. If you
: reverse the order however then you will see what you
: entered in w2

This is a client caching issue and is beyond your control, unless you
want to delve into the depths of JavaScript.

attached mail follows:


John W. Holmes wrote:

> b b wrote:
>
>> What is not right is tell me in public about it
>> when he actually sent me private messges himself
>
>
> Come on guys... let's get back to PHP.

Geez, leave it to you to kill what has the makings of a perfectly good
flame war. ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


I have a db in sql, and I need a php/mysql query/command to copy the
entire db (schema and data) to a new db. I know how to do this with a
table, but I can not figure out how to do this with a whole db. I also
know that I could do it using mysql dump, but I don't want to have to run
a shell command.

Please help,
MIchael

attached mail follows:


Creating new databases is usually done with the mysql root account. Bad
idea to use this account in a php script.

Lists wrote:

>I have a db in sql, and I need a php/mysql query/command to copy the
>entire db (schema and data) to a new db. I know how to do this with a
>table, but I can not figure out how to do this with a whole db. I also
>know that I could do it using mysql dump, but I don't want to have to run
>a shell command.
>
>Please help,
>MIchael
>
>
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


This is for an intranet application, I trust my users.

Michael

On Wed, 19 Nov 2003, Raditha Dissanayake wrote:

> Creating new databases is usually done with the mysql root account. Bad
> idea to use this account in a php script.
>
> Lists wrote:
>
> >I have a db in sql, and I need a php/mysql query/command to copy the
> >entire db (schema and data) to a new db. I know how to do this with a
> >table, but I can not figure out how to do this with a whole db. I also
> >know that I could do it using mysql dump, but I don't want to have to run
> >a shell command.
> >
> >Please help,
> >MIchael
> >
> >
> >
>
>
>

attached mail follows:


I don't believe there is one command that does all this, so you've already
ruled out one good option, but you can use PHPMyAdmin. Do you have
PHPMyAdmin installed on either or both sites?

Warren

-----Original Message-----
From: Lists [mailto:listsuc9.net]
Sent: Tuesday, November 18, 2003 5:37 PM
To: php-generallists.php.net
Subject: [PHP] Mysql question

I have a db in sql, and I need a php/mysql query/command to copy the
entire db (schema and data) to a new db. I know how to do this with a
table, but I can not figure out how to do this with a whole db. I also
know that I could do it using mysql dump, but I don't want to have to run
a shell command.

Please help,
MIchael

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

attached mail follows:


Lists wrote:

> I have a db in sql, and I need a php/mysql query/command to copy the
> entire db (schema and data) to a new db. I know how to do this with a
> table, but I can not figure out how to do this with a whole db. I also
> know that I could do it using mysql dump, but I don't want to have to run
> a shell command.
>
> Please help,
> MIchael
>

There may be a shorter way, but the only thing I can think of at the
moment is to do this via multiple queries ie

query to create new database
query to read tables and structure in old db
queries to create new tables in new db
queries to dump data from old tables
queries to load data to new tables

You may want to try the mysql list to see if this can be done in one query.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


Hi John,
ASAIK you are right. Michael, if you use the root account in php you
will be able to do what John says.

John Nichel wrote:

> Lists wrote:
>
>> I have a db in sql, and I need a php/mysql query/command to copy the
>> entire db (schema and data) to a new db. I know how to do this with
>> a table, but I can not figure out how to do this with a whole db. I
>> also know that I could do it using mysql dump, but I don't want to
>> have to run a shell command.
>>
>> Please help,
>> MIchael
>>
>
> There may be a shorter way, but the only thing I can think of at the
> moment is to do this via multiple queries ie
>
> query to create new database
> query to read tables and structure in old db
> queries to create new tables in new db
> queries to dump data from old tables
> queries to load data to new tables
>
> You may want to try the mysql list to see if this can be done in one
> query.
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


Lists wrote:

> I have a db in sql, and I need a php/mysql query/command to copy the
> entire db (schema and data) to a new db. I know how to do this with a
> table, but I can not figure out how to do this with a whole db. I also
> know that I could do it using mysql dump, but I don't want to have to run
> a shell command.

You'll need to do it with PHP...

Here's one method...

<?php

//connect to database
$database = 'xxx'; //name of database to copy
$ndatabase = 'yyy'; //name of new database

mysql_query("CREATE DATABASE $ndatabase");

$rs = mysql_query("SHOW TABLES FROM $database");
while($r = mysql_fetch_row($rs))
{
   mysql_select_db($database);
   $rs2 = mysql_query("SHOW CREATE TABLE {$r[0]}");
   $ctable = myqsl_result($rs,0);
   mysql_select_db($ndatabase);
   mysql_query($ctable);
   mysql_query("INSERT INTO {$r[0]} SELECT * FROM {$database}.{$r[0]}");
}
?>

Untested... but should work (when run as a user with suitable
permissions). :)

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


On Tue, 18 Nov 2003, Lists wrote:

>I have a db in sql, and I need a php/mysql query/command to copy the
>entire db (schema and data) to a new db. I know how to do this with a
>table, but I can not figure out how to do this with a whole db. I also
>know that I could do it using mysql dump, but I don't want to have to run
>a shell command.

Have you tried mysqlhotcopy?

http://www.mysql.com/doc/en/mysqlhotcopy.html

--
Greg Donald
http://destiney.com

attached mail follows:


I am using PHP on Windows NT CGI/FastCGI and am trying to create a text
file and then write some data to it.

$some_text = "HelloWorld";
$new_file = fopen("myfile.txt", "w");
fputs($new_file, $some_text);
fclose($new_file);

However I am getting Warning: fopen(myfile.txt): failed to open stream:
Permission denied in...

I don't usually work on Windows but I checked the file permissons on this
folder and they seem to be 777 or drwxrwxrwx

I'm guessing I have no idea how Windows permissions work.

Chris

attached mail follows:


Chris Williams wrote:

> I am using PHP on Windows NT CGI/FastCGI and am trying to create a text
> file and then write some data to it.
>
> $some_text = "HelloWorld";
> $new_file = fopen("myfile.txt", "w");
> fputs($new_file, $some_text);
> fclose($new_file);
>
> However I am getting Warning: fopen(myfile.txt): failed to open stream:
> Permission denied in...
>
> I don't usually work on Windows but I checked the file permissons on this
> folder and they seem to be 777 or drwxrwxrwx
>
> I'm guessing I have no idea how Windows permissions work.

I'm not sure what user PHP runs as when using CGI, so you'll probably
need to give "Everyone" permission to read/write to the directory this
script is run in.

Right click on the folder, choose the Security tab, and add Everyone as
a user with the appropriate permissions.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Chris Williams wrote:
> I am using PHP on Windows NT CGI/FastCGI and am trying to create a text
> file and then write some data to it.
>
> $some_text = "HelloWorld";
> $new_file = fopen("myfile.txt", "w");
> fputs($new_file, $some_text);
> fclose($new_file);
>
> However I am getting Warning: fopen(myfile.txt): failed to open stream:
> Permission denied in...
>
> I don't usually work on Windows but I checked the file permissons on this
> folder and they seem to be 777 or drwxrwxrwx

In IIS -- you have to set the permissions to "write" for the folder
that you want to your script to be able to write to (from the IIS manager)

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


 Jhon you mentioned that one may send a batch of
queries with mysql_list? maybe I understood you wrong.

 I am translating an MS-SQL application into
mysql/php. I need to be able to send a batch of
queries all at once. For example:
 $qStr = " Insert into A(name, address)
values('$name', '$address') ; Insert into B(personID,
department ...)values (identity, '$department');" ;

 $result= mysql_query($qStr, $link) ;

 In this case I inserted in two tables. for some
reason it doesn't allow me to have to sql statements
in $qStr. Is there a way around that.

 My other option is to have one sql statement per
query .... but this would be very inefficient if I
have ti do tens of inserts in one batch ...

 Cheers.
 

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

attached mail follows:


b b wrote:

> I am translating an MS-SQL application into
> mysql/php. I need to be able to send a batch of
> queries all at once. For example:
> $qStr = " Insert into A(name, address)
> values('$name', '$address') ; Insert into B(personID,
> department ...)values (identity, '$department');" ;
>
> $result= mysql_query($qStr, $link) ;

No, you can only run one query at a time.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Anyone have a good eregi filter for passwords?

Regards

R

attached mail follows:


Erin wrote:

>Anyone have a good eregi filter for passwords?
>
>
>Regards
>
>R
>
>
>
well, for one thing, don't use ereg. Use pcre, as it is faster.

preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
that will validate a password containing only upper or lowercase letters
and numbers, between 5 and 16 characters.

attached mail follows:


Erin wrote:

> Anyone have a good eregi filter for passwords?

Yes.

http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


Derek Ford wrote:
> Erin wrote:
> >
> > Anyone have a good eregi filter for passwords?
>
> well, for one thing, don't use ereg. Use pcre, as it is faster.
>
> preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
> that will validate a password containing only upper or lowercase letters
> and numbers, between 5 and 16 characters.
>

So "aaaaa" is a good password?

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


John W. Holmes wrote:
> Derek Ford wrote:
>
>> Erin wrote:
>
> > >
>
>> > Anyone have a good eregi filter for passwords?
>>
>> well, for one thing, don't use ereg. Use pcre, as it is faster.
>>
>> preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
>> that will validate a password containing only upper or lowercase
>> letters and numbers, between 5 and 16 characters.
>>
>
> So "aaaaa" is a good password?
>

It's an excelent password. I think you should change your root password
to that on all systems you have root on. Oh, and another thing....send
me the IP's to those machines. ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


On Tuesday 18 November 2003 02:12, Arivazhagi Govindarajan wrote:
> PHP Questions
>
> 1. Explain about session management and cookies ? In PHP how we can
> maintain a session
>
> 2. What is HTTP tunneling
>
> 3. How to enable PHP in Apache server manually?
>
> 4. When we upload a file using <INPUT> tag of the type FILE what are global
> variables become available for use in PHP
>
> 5. Explain SQL injections ? How we can avoid this
>
> 6. Write a small script to connect a MYSQL server in PHP
>
> 7. Given a class B network with subnet mask of 255.255.248.0 and a packet
> addressed to 130.40.32.16 whatis subnet address
>
> 8. Using single Apache server can we host multiple sites . If yes how can
> we do this if no why it is not possible
>
> 9. what is search engine optimization ? In HTML using which tag we can
> attain this?
>
> 10. Write a function in PHP script to check whether string is a valid email
> id or not?
>
> _________________________________________________________________
> Garfield on your mobile. Download now. http://server1.msn.co.in/sp03/gprs/
> How cool can life get?

What you can't find at php.net/manual/en you can find on google. But I have a
question for you..... Correct me if I'm wrong but isn't a subnet mask of
255.255.248.0 invalid??? I thought it had to be 255's and 0's.

This seems like laziness..
--
"I have a photographic memory. I just forgot the film" --Unknown
=============================
Ryan Thompson
rthompsympatico.ca
http://osgw.sourceforge.net

attached mail follows:


On Tue, 18 Nov 2003, Ryan Thompson wrote:

>What you can't find at php.net/manual/en you can find on google. But I have a
>question for you..... Correct me if I'm wrong but isn't a subnet mask of
>255.255.248.0 invalid??? I thought it had to be 255's and 0's.

Umm.. no. For a given network, say 10.0.0.0, a subnet mask of
255.255.248.0 yields the following range of possible node addresses:
10.0.0.1 to 10.0.7.254.

>This seems like laziness..

Or homework.

--
Greg Donald
http://destiney.com

attached mail follows:


On Tue, 2003-11-18 at 23:55, Greg Donald wrote:
> On Tue, 18 Nov 2003, Ryan Thompson wrote:
>
> >What you can't find at php.net/manual/en you can find on google. But I have a
> >question for you..... Correct me if I'm wrong but isn't a subnet mask of
> >255.255.248.0 invalid??? I thought it had to be 255's and 0's.
>
> Umm.. no. For a given network, say 10.0.0.0, a subnet mask of
> 255.255.248.0 yields the following range of possible node addresses:
> 10.0.0.1 to 10.0.7.254.
>
> >This seems like laziness..
>
> Or homework.
>
>
> --
> Greg Donald
> http://destiney.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Thanks for that clarification. That might actually solve some problems
at work. I didn't know that. Learn something new every day :)

Homework or otherwise. Back when I was in school I had to look it up
myself. I didn't use mailing lists, newsgroups, etc. for easy answers:)
--
"I have a photographic memory. I just forgot the film" --Unknown
=============================
Ryan Thompson
rthompsympatico.ca
http://osgw.sourceforge.net

attached mail follows:


On Tuesday 18 November 2003 01:13 pm, Jas wrote:
> Curt Zirzow wrote:
> > * Thus wrote Jas (jason.gerfenscl.utah.edu):
> >>I am not sure if I should post my question here but I will anyways.
> >>
> >>Ok, I have compiled the mcrypt libraries on a Redhat 9 box running
> >>apache 2 with php4. And I need to know the next step(s) in getting php
> >>to use the libmcrypt libraries. If anyone has set this up in the past
> >>or has some pointers (other than reading the manual) I would appreciate
> >> it.
> >
> > Did you read the next step: Installation
> > http://php.net/mcrypt
> >
> >
> > Curt
>
> Yes I have and I guess I was looking for a method of using the libmcrypt
> library without having to recompile php. Sorry for the confusion.

Have you tried using phpize?

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

--
"To think is to differ."

-Clarence Darrow

attached mail follows:


On Wednesday 19 November 2003 06:32, Kevin Stone wrote:

> I am producing a script that writes text onto a JPEG image to create
> custom printable gift certificates for an online store. The basics of
> the scripts are straight forward. However I found that the
> imagestring() function produces absolutely horrible looking pixelized
> text and on these gift certificates looks are important. I attempted to
> employ the imagepstext() family of functions but they do not appear to
> be installed on this account (it's a shared server), I'm getting "call
> to undefined function" errors.
>
> So my question is; Is there any other way to produce good looking
> anti-aliased text on an image? I'd appreciate any information, classes
> and links to guides you can point me to.

Using imagettftext() would be the easiest. As the lastest versions of PHP are
bundled with GD *and* have native support for TrueType fonts it really isn't
too difficult for your host to recompile PHP to enable such support.

--
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
------------------------------------------
/*
Lots of folks confuse bad management with destiny.
                -- Frank Hubbard
*/

attached mail follows:


#The problem:
This is about protecting my PHP from bad input (e.g.: letters instead of
numbers).

##
Is there a way to prevent user from even inputting a letter in a text box?

Thanks in advance

attached mail follows:


On Wed, Nov 19, 2003 at 08:18:32AM +0100, Miroslav I. wrote:
:
: #The problem:
: This is about protecting my PHP from bad input (e.g.: letters instead
: of numbers).

Good idea. You need to make sure user-inputted data is valid.

: ##
: Is there a way to prevent user from even inputting a letter in a text
: box?

There's two general ways to do data validation: client-side and
server-side. PHP is server-side. JavaScript is client-side.

With PHP, you allow the user to enter any data in the textbox, then code
in logic to check for illegal characters (e.g. no letters in a textbox
for one's phone number). Of course you must also code a nice response
to let the user know when the data is found to be illegal, repost the
form, etc.

With JavaScript, you can do data validation as they press the submit
button, or even disallow illegal characters as they type in a textbox.
The response is far more immediate and thus far more effective, IMHO.
Of course, if the user's web browser isn't running JavaScript, bad data
may still slip through. Then you must use PHP and do server-side data
validation.

attached mail follows:


Thanks Eugen,

I'm familiar with the concepts, but I've seen sites with textboxes that
would not show any letter typed - only numbers are displayed in the textbox.
This is what I like but don't know how to achieve. :-)

> : #The problem:
> : This is about protecting my PHP from bad input (e.g.: letters instead
> : of numbers).
>
> Good idea. You need to make sure user-inputted data is valid.
>
> : ##
> : Is there a way to prevent user from even inputting a letter in a text
> : box?
>
> There's two general ways to do data validation: client-side and
> server-side. PHP is server-side. JavaScript is client-side.
.
.
.

attached mail follows:


On Wed, Nov 19, 2003 at 10:21:16AM +0100, Miroslav I. wrote:
:
: I'm familiar with the concepts, but I've seen sites with textboxes
: that would not show any letter typed - only numbers are displayed in
: the textbox. This is what I like but don't know how to achieve. :-)

Base on what I mentioned earlier, it sounds like you're looking for
JavaScript-based data validation. Your best bet is to look at examples
of JavaScript code. Here's a link to HotScript.com:

        http://www.hotscripts.com/JavaScript/Scripts_and_Programs/Forms/index.html

attached mail follows:


PHP Version: 4.2.2

Hi

I had a problem with my session name.

In the php.ini, was set the default name PHPSESSID from the default
installation. Now i have the problem, that i use the name "audience" for
my webapplikations with PHPope (http://www.phpope.org)

I Set the name in the script with the following code:
session_name("audience");
session_set_cookie_params(time()+9999999, "/", $config["default"]["cookiedomain"]);
session_cache_limiter('no_cache');
session_start();

Now i had the problem, that i lost the session after login. The server
forgave me a new session which called PHPSESSID and not audience :-(

Now i have changed the value session.name in my php.ini to audience and it
works!

What's the problem here? A bug?

I have enabled session.auto_start.

Mit freundlichen Grüssen

Markus Graf
Hauptstrasse 80
9434 Au
0041 (0)79 / 261 16 37
mgrafiframe.ch

--
Software is like sex, it's better when it's free!

attached mail follows:


mgraf wrote:

> PHP Version: 4.2.2
>
> Hi
>
> I had a problem with my session name.
>
> In the php.ini, was set the default name PHPSESSID from the default
> installation. Now i have the problem, that i use the name "audience" for
> my webapplikations with PHPope (http://www.phpope.org)
>
> I Set the name in the script with the following code:
> session_name("audience");
> session_set_cookie_params(time()+9999999, "/", $config["default"]["cookiedomain"]);
> session_cache_limiter('no_cache');
> session_start();
>
> Now i had the problem, that i lost the session after login. The server
> forgave me a new session which called PHPSESSID and not audience :-(
>
> Now i have changed the value session.name in my php.ini to audience and it
> works!
>
> What's the problem here? A bug?
>
> I have enabled session.auto_start.

This is the problem, the session is started before your script executes
and sets the session name. Disable session.auto_start

attached mail follows:


PHP Version 4.3.3

Ok i have disabled the autostart. Now is my problem, that php us the
transparent sessions, because it append it in the URL. After the login,
all works fine, but after 5-6 clicks, i loose the session.

It send me a Cookie :
Set-Cookie: audience=a01b3fcf7cb587eee3ac61bc83edebe4; expires=Wed, 25-Dec-1901 16:01:15 GMT; path=/; domain=www.privatmarkt.com

My mozilla is adjusted to accept all cookies.
I'm confused. What is with the time? 25-Dec-1901 16:01:15 GMT!!
I set the time in the futur with the following code:

session_set_cookie_params(time()+9999999, "/", $config["default"]["cookiedomain"]);

On Wed, 19 Nov 2003, Marek Kilimajer wrote:

> mgraf wrote:
>
> > PHP Version: 4.2.2
> >
> > Hi
> >
> > I had a problem with my session name.
> >
> > In the php.ini, was set the default name PHPSESSID from the default
> > installation. Now i have the problem, that i use the name "audience" for
> > my webapplikations with PHPope (http://www.phpope.org)
> >
> > I Set the name in the script with the following code:
> > session_name("audience");
> > session_set_cookie_params(time()+9999999, "/", $config["default"]["cookiedomain"]);
> > session_cache_limiter('no_cache');
> > session_start();
> >
> > Now i had the problem, that i lost the session after login. The server
> > forgave me a new session which called PHPSESSID and not audience :-(
> >
> > Now i have changed the value session.name in my php.ini to audience and it
> > works!
> >
> > What's the problem here? A bug?
> >
> > I have enabled session.auto_start.
>
> This is the problem, the session is started before your script executes
> and sets the session name. Disable session.auto_start
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Mit freundlichen Grüssen

Markus Graf
Hauptstrasse 80
9434 Au
0041 (0)79 / 261 16 37
mgrafiframe.ch

--
Software is like sex, it's better when it's free!

attached mail follows:


Hi everyone,

What is the quickest and easiest way to enable access to a MS SQL database
from a Linux server (using PHP functions ofcourse), seeing as the MSSQL
extension is available on Win32 systems only.

Thanks
Fern

attached mail follows:


Fernando Melo wrote:

> Hi everyone,
>
> What is the quickest and easiest way to enable access to a MS SQL database
> from a Linux server (using PHP functions ofcourse), seeing as the MSSQL
> extension is available on Win32 systems only.

ODBC

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
  it is very, very good; and when it is bad,
  it is better than nothing."

attached mail follows:


I use PEAR db
http://pear.php.net/manual/en/package.database.php
http://pear.php.net/manual/en/package.database.db.intro-dsn.php

this is included with the php distibution and makes swapping databases a
doddle

pete

Fernando Melo wrote:
> Hi everyone,
>
> What is the quickest and easiest way to enable access to a MS SQL database
> from a Linux server (using PHP functions ofcourse), seeing as the MSSQL
> extension is available on Win32 systems only.
>
> Thanks
> Fern

attached mail follows:


Hi there,

I would like to create a multilanguage website with php. I heared the
easiest way is to create an xml file and use this package:
http://freshmeat.net/projects/php-xml/?topic_id=92%2C96%2C914

This still looks complicated for me, beside the fact that it depends on
an external package. Is there not a possibility to do this without an
external package, just with php?

Thanx for any info on that,

Merlin

attached mail follows:


Merlin wrote:
> Hi there,
>
> I would like to create a multilanguage website with php. I heared the
> easiest way is to create an xml file and use this package:
> http://freshmeat.net/projects/php-xml/?topic_id=92%2C96%2C914
>
> This still looks complicated for me, beside the fact that it depends on
> an external package. Is there not a possibility to do this without an
> external package, just with php?
>

The package seems to be just php. If you don't want it to be "external",
you can include it with you webapp.

Other options are constants (most widely used), variables and gettext.

Marek