|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Mon Oct 08 2001 - 06:46:28 CDT
php-general Digest 8 Oct 2001 11:46:28 -0000 Issue 922
Topics (messages 70307 through 70349):
User Authentication
70307 by: Tom Malone
70308 by: Kurth Bemis
70316 by: Jason G.
70333 by: Mukul Sabharwal
using date as an "id" field...
70309 by: sc
70340 by: Piotr Martyniak
Re:[PHP] not so happy with include()
70310 by: bojan.inet.co.yu
70311 by: Christian Dechery
70313 by: Kurt Lieber
Re: Change linux password using php
70312 by: Sigurd Magnusson
Re: which regexp require preg_grep() and which can be used with ereg()?
70314 by: John A. Grant
70315 by: CC Zona
Re: How to read a text file with variable line length?
70317 by: Jason G.
70318 by: Jason Brooke
Cannot add header informatiom?
70319 by: Jan Grafström
70320 by: Matthew Loff
Problem...
70321 by: Leon Mergen
70322 by: Jason Murray
70344 by: _lallous
How to change the newline (<br>) into "dot" and <br> ?
70323 by: Manisha
70324 by: nico_oreka
Re: Fancy thing.
70325 by: _lallous
Re: case insensitive replace
70326 by: _lallous
Re: using Mysql's RAND()
70327 by: _lallous
only one user logged in
70328 by: Negrea Mihai
70337 by: Seb Frost
70339 by: Negrea Mihai
supported platforms comparison
70329 by: Marco Fioretti
Sentence Break
70330 by: Boaz Yahav
70331 by: nico_oreka
70332 by: Andrey Hristov
ASP's Application.Lock equivalent in PHP ?
70334 by: Explorer
70342 by: Andrey Hristov
preg_replace
70335 by: ArsenKirillov
70341 by: Andrey Hristov
how to give parameters with command line php scripts
70336 by: bruno waes
70338 by: bruno waes
integration von php with cocoon2
70343 by: thorsten maus
Multidimensional arrays, Memory exhausted
70345 by: * R&zE:
70346 by: * R&zE:
70347 by: Andrey Hristov
70348 by: Andrey Hristov
Re: [PHP-DB] MySQL + Cyrillic chars
70349 by: Andrey Hristov
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello
I am writing a web mail application (attempting to, anyway) and am
wondering -- what is the best way to protect users' passwords that are
communicated to PHP when the user logs in? JavaScript can't encrypt it, and
of course it won't do me much good to encrypt it in my PHP script after it
gets to the server. If I use the crypt() or md5() function to make it into a
hash when it gets there, and then compare it to a hash of the original
password that's stored in a password-protected database, would that be
relatively secure? Someone could intercept the password on its way to the
server, but they wouldn't know if it was the correct one, am I right? If
anyone has a better solution, I would be most grateful. Thank you.
Tom Malone
Web Designer
http://www.tom-malone.com
attached mail follows:
At 08:05 PM 10/7/2001, Tom Malone wrote:
use https for anything that you want secure....trust me -
true - the password may not be the right one...but the next one will be :-)
~kurth
>Hello
>
>I am writing a web mail application (attempting to, anyway) and am
>wondering -- what is the best way to protect users' passwords that are
>communicated to PHP when the user logs in? JavaScript can't encrypt it, and
>of course it won't do me much good to encrypt it in my PHP script after it
>gets to the server. If I use the crypt() or md5() function to make it into a
>hash when it gets there, and then compare it to a hash of the original
>password that's stored in a password-protected database, would that be
>relatively secure? Someone could intercept the password on its way to the
>server, but they wouldn't know if it was the correct one, am I right? If
>anyone has a better solution, I would be most grateful. Thank you.
>
>Tom Malone
>Web Designer
>http://www.tom-malone.com
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Use https as previously mentioned.
When storing passwords in the db, use md5 to store them, and then md5 the
user entered password, and compare it with the md5's in the db. On the
downside, you can never, I repeat, NEVER tell what a user's password is by
the md5.
-Jason Garber
IonZoft.com
At 08:05 PM 10/7/2001 -0400, Tom Malone wrote:
>Hello
>
>I am writing a web mail application (attempting to, anyway) and am
>wondering -- what is the best way to protect users' passwords that are
>communicated to PHP when the user logs in? JavaScript can't encrypt it, and
>of course it won't do me much good to encrypt it in my PHP script after it
>gets to the server. If I use the crypt() or md5() function to make it into a
>hash when it gets there, and then compare it to a hash of the original
>password that's stored in a password-protected database, would that be
>relatively secure? Someone could intercept the password on its way to the
>server, but they wouldn't know if it was the correct one, am I right? If
>anyone has a better solution, I would be most grateful. Thank you.
>
>Tom Malone
>Web Designer
>http://www.tom-malone.com
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hi,
I've got a PHP RC4 class :
http://www.paphe.com/php/tutorials/230101.php
Infact I also have a user authentication system:
http://www.paphe.com/php/scripts/authlib.php
What I'm suggesting is make a login page which has a
random key, and use the RC4 encryption algorithm. You
can easily port it to Javascript (you would just need
to look at the manual and you're done) using my PHP
script as a sort of manual.
Hope that helps.
=====
*********************************
Know more about me:
http://www.geocities.com/mimodit
*********************************
__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
attached mail follows:
Hi;
I am using dates like 2001-10-11 to reference some data for me... How can
i set a variable to the day before?
ie. i have todays data in the database and i want to minus it from
yesterdays data... How can i do that?
Thanks;
-sc
attached mail follows:
use:
ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $your_data, $numbers);
$day_before = mktime(0, 0, 0, $numbers[2], $numbers[3], $numbers[1]) - 24
* 3600;
$new_date = date("Y/n/j", $day_before);
should work
natur
attached mail follows:
This is a MIME encoded message.
--b0d39cf22ed4724ee1499be6485baa3b5
Content-Type: text/plain
Content-Transfer-Encoding: base64
DQoNCnJlcXVpcmUgKCIkRE9PQ1VNRU5UX1JPT1Qvdml0cmluZS9hZG0vYWRtaW4ucGhwIik7DQoN
CkhUSCwNCkJvamFuDQoNCkNocmlzdGlhbiBEZWNoZXJ5IDxjZGVjaGVyeUBlYXN5bmV0LmNvbS5i
cj4gd3JvdGU6DQoNCj5JJ20gd29ya2luZyBpbiBxdWl0ZSBhIEJJRyBzeXN0ZW0gaW4gUEhQIG5v
dy4uLiBJIGhhdmUgdXAgdG8gNiAuaW5jLnBocCANCj4obGlicmFyeSBmaWxlcykgc28gZmFyLi4u
DQo+DQo+SSBoYXZlIHRoZSBmb2xsb3dpbmcgZGlyZWN0b3J5IHRyZWUuLg0KPg0KPi92aXRyaW5l
IChtYWluIHByb2dyYW0gZmlsZXMpDQo+L3ZpdHJpbmUvaW5jbHVkZSAoaW5jbHVkZSBkaXIsIHdo
ZXJlIHRoZSAuaW5jLnBocCByZXNpZGVzKQ0KPi92aXRyaW5lL2FkbSAodGhlIGFkbWluaXN0cmF0
aW9uIHBhbmVsLCB3aXRoIGxvZ2luIGV0Yy4uLikNCj4NCj50aGUgcHJvYmxlbSBpcyB0aGF0IHdp
dGhpbiB0aGUgZmlsZXMgaW4gL2FkbSBJIGRvIHNvbWUgcmVxdWlyZXMoKSBhbmQgDQo+aW5jbHVk
ZXMoKS4uLiBhbmQgd2l0aGluIHRoZSAuaW5jLnBocCdzIGFsc28uLi4gc28gSSdkIGhhdmUgc29t
ZXRoaW5nIGxpa2UuLi4NCj4NCj4vdml0cmluZS9hZG0vYWRtaW4ucGhwDQo+PD8NCj4JcmVxdWly
ZSgiLi4vaW5jbHVkZS9saWIuaW5jLnBocCIpOw0KPglyZXF1aXJlKCIuLi9pbmNsdWRlL2Vycm9y
LmluYy5waHAiKTsNCj4JLy8gZXRjLi4uDQo+Pz4NCj4NCj4vdml0cmluZS9pbmNsdWRlL2xpYi5p
bmMucGhwDQo+PD8NCj4JcmVxdWlyZV9vbmNlKCIuLi9pbmNsdWRlL2RiLmluYy5waHAiKTsNCj4J
Ly8gZXRjLi4uDQo+Pz4NCj4NCj50aGlzIHdvcmtzIGZpbmUgd2hlbiBJIGFtIGF0IC9hZG0uLi4g
YnV0IG9uY2UgSSBtb3ZlIHRvIC92aXRyaW5lIG5vbmUgb2YgDQo+dGhlIGluY2x1ZGVzLXdpdGhp
bi1pbmNsdWRlcyB3b3JrcyBiZWNhdXNlIG9mIHRoZSByZWxhdGl2ZSBkaXJzLi4uIEkgY2FuJ3Qg
DQo+dXNlIGluY2x1ZGVfcGF0aCBjdXogSSBkb24ndCBoYXZlIGFjY2VzcyB0byBwaHAuaW5pLi4u
IHdoYXQgZG8gSSBkbz8/Pw0KPg0KPl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQo+LiBD
aHJpc3RpYW4gRGVjaGVyeQ0KPi4gLiBHYWl0YS1MIE93bmVyIC8gV2ViIERldmVsb3Blcg0KPi4g
LiBodHRwOi8vd3d3LndlYnN0eWxlLmNvbS5icg0KPi4gLiBodHRwOi8vd3d3LnRhbmFtZXNhLmNv
bS5icg0KPg0KPg0KPi0tIA0KPlBIUCBHZW5lcmFsIE1haWxpbmcgTGlzdCAoaHR0cDovL3d3dy5w
aHAubmV0LykNCj5UbyB1bnN1YnNjcmliZSwgZS1tYWlsOiBwaHAtZ2VuZXJhbC11bnN1YnNjcmli
ZUBsaXN0cy5waHAubmV0DQo+Rm9yIGFkZGl0aW9uYWwgY29tbWFuZHMsIGUtbWFpbDogcGhwLWdl
bmVyYWwtaGVscEBsaXN0cy5waHAubmV0DQo+VG8gY29udGFjdCB0aGUgbGlzdCBhZG1pbmlzdHJh
dG9ycywgZS1tYWlsOiBwaHAtbGlzdC1hZG1pbkBsaXN0cy5waHAubmV0DQo+DQoNCg0K
--b0d39cf22ed4724ee1499be6485baa3b5--
attached mail follows:
this doesn't solve my problem... I tought of that...
what if someone gets my system and install it under /whatever instead of
/vitrine...??? then NO include at all will work?
I need relative includes that will work regardless of the dir in which my
system is under the webroot... that is the problem...
but thanks anyway... I'll keep trying something ( haven't come up with a
thing so far... :( )
>require ("$DOOCUMENT_ROOT/vitrine/adm/admin.php");
>
>HTH,
>Bojan
>
>Christian Dechery <cdechery
easynet.com.br> wrote:
>
> >I'm working in quite a BIG system in PHP now... I have up to 6 .inc.php
> >(library files) so far...
> >
> >I have the following directory tree..
> >
> >/vitrine (main program files)
> >/vitrine/include (include dir, where the .inc.php resides)
> >/vitrine/adm (the administration panel, with login etc...)
> >
> >the problem is that within the files in /adm I do some requires() and
> >includes()... and within the .inc.php's also... so I'd have something
> like...
> >
> >/vitrine/adm/admin.php
> ><?
> > require("../include/lib.inc.php");
> > require("../include/error.inc.php");
> > // etc...
> >?>
> >
> >/vitrine/include/lib.inc.php
> ><?
> > require_once("../include/db.inc.php");
> > // etc...
> >?>
> >
> >this works fine when I am at /adm... but once I move to /vitrine none of
> >the includes-within-includes works because of the relative dirs... I can't
> >use include_path cuz I don't have access to php.ini... what do I do???
> >
> >_____________________________
> >. Christian Dechery
> >. . Gaita-L Owner / Web Developer
> >. . http://www.webstyle.com.br
> >. . http://www.tanamesa.com.br
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> >For additional commands, e-mail: php-general-help
lists.php.net
> >To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
_____________________________
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br
attached mail follows:
How about:
define('DIR_INCLUDES', 'path/to/my/includes/')
and then use something like:
require ($DOOCUMENT_ROOT . DIR_INCLUDES . "adm/admin.php"); //untested,
off-the-cuff code
I encourage you to look at the source code for The Exchange Project
(theexchanceproject.org). They're using includes extensively for all
functions, classes, etc. and have a well-designed, well-laid out system.
(IMO) Should provide some inspiration.
--kurt
> -----Original Message-----
> From: Christian Dechery [mailto:cdechery
easynet.com.br]
> Sent: Sunday, October 07, 2001 5:37 PM
> To: bojan
inet.co.yu
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Re:[PHP] not so happy with include()
>
>
> this doesn't solve my problem... I tought of that...
>
> what if someone gets my system and install it under /whatever
> instead of
> /vitrine...??? then NO include at all will work?
> I need relative includes that will work regardless of the dir
> in which my
> system is under the webroot... that is the problem...
>
> but thanks anyway... I'll keep trying something ( haven't
> come up with a
> thing so far... :( )
>
>
> >require ("$DOOCUMENT_ROOT/vitrine/adm/admin.php");
> >
> >HTH,
> >Bojan
> >
> >Christian Dechery <cdechery
easynet.com.br> wrote:
> >
> > >I'm working in quite a BIG system in PHP now... I have up to 6
> > >.inc.php (library files) so far...
> > >
> > >I have the following directory tree..
> > >
> > >/vitrine (main program files)
> > >/vitrine/include (include dir, where the .inc.php resides)
> > >/vitrine/adm (the administration panel, with login etc...)
> > >
> > >the problem is that within the files in /adm I do some
> requires() and
> > >includes()... and within the .inc.php's also... so I'd
> have something
> > like...
> > >
> > >/vitrine/adm/admin.php
> > ><?
> > > require("../include/lib.inc.php");
> > > require("../include/error.inc.php");
> > > // etc...
> > >?>
> > >
> > >/vitrine/include/lib.inc.php
> > ><?
> > > require_once("../include/db.inc.php");
> > > // etc...
> > >?>
> > >
> > >this works fine when I am at /adm... but once I move to
> /vitrine none
> > >of the includes-within-includes works because of the
> relative dirs...
> > >I can't use include_path cuz I don't have access to
> php.ini... what
> > >do I do???
> > >
> > >_____________________________
> > >. Christian Dechery
> > >. . Gaita-L Owner / Web Developer
> > >. . http://www.webstyle.com.br
> > >. . http://www.tanamesa.com.br
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > >For additional commands, e-mail: php-general-help
lists.php.net To
> > >contact the list administrators, e-mail:
> php-list-admin
lists.php.net
> > >
>
>
> _____________________________
> . Christian Dechery
> . . Gaita-L Owner / Web Developer
> . . http://www.webstyle.com.br
> . . http://www.tanamesa.com.br
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail:
> php-general-help
lists.php.net To contact the list
> administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Great :) let me know of any developments!
Evan Nemerson wrote:
> Yeah, it is my understanding that Mandrake is based on Redhat. The
> algorithm used, according to john the ripper, is FreeBSD MD5 (i guess they
> have their own version of it...) There are different salts for each
> username (which i am guessing would be the username since if you change
> the username in the shadow file and leave the password you can't login-
> *DON'T USE THE ROOT ACCOUNT TO TEST THIS!!!*). I'll keep working on it as
> long as i find it interesting.
>
>
> On Friday 05 October 2001 05:02 pm, you wrote:
>> Thanks for the replies,
>> Don't worry about the Mandrake specific stuff; I'm on Redhat. although it
>> seems to the same as what you're talking about;
>>
>> My shadow is in format:
>> fakeaccount:$1$5PXJfLSQ$LSxsnZfHzBrkDdT2NZefK.:11600:0:99999:7:::
>>
>> (the password was 'password')
>>
>> I probably would not have the .php script make the changes; it would need
>> to run as root and I can't have that. I would make a simple C program
>> which would go 'changepwd <username> <newpasswordencrypted>' as i said
>> before. this means i can have that run as root, and -know- all it will do
>> is change passwords. Yeah I would probably put the requirement to put in
>> old password as well, although to get to that screen you need to get
>> there anyway ...
>>
>> Evan Nemerson wrote:
>> > Here's what I got from the mandrake security mailing list so far:
>> >
>> >
>> >
>> >
>> > This is strange. I was just going to write a mail to this list about
>> > this. it seems that /etc/shadow accepts both crypt passwords (the short
>> > passwd) and MD5 passwords. (34 characters with $ and slashes does seem
>> > to me like md5). I found this because I was transferring users between
>> > servers so I copy and pasted the passwords and it worked on both
>> > occasions. very strange...
>> >
>> > Bye
>> > --
>> > Haim
>> >
>> > On Thu, Oct 04, 2001 at 11:07:57PM -0700, Evan Nemerson wrote:
>> >> Does anyone know what algorithm is used on the passwords in the
>> >> /etc/shadow or /etc/passwd files? All the documentation I can find
>> >> says crypt is used with two characters of salt which should output 13
>> >> characters. However my shadow file shows 34 character strings with
>> >> dollar signs and slashes (shouldn't the output be alpha-numeric???). I
>> >> already checked md5- nope.
>> >>
>> >> Please reply to my e-mail address since i don't subscribe to this list
>> >> (sorry, but i get enough php-general to keep me busy).
>> >>
>> >>
>> >> Thanks in advance,
>> >> Evan Nemerson
>
-- Sigurd Magnusson Director www.totallydigital.co.nz
attached mail follows:
"Cc Zona" <cczona
nospam.invalid> wrote in message
news:20011006180059.20769.qmail
pb1.pair.com...
> In article <20011005222902.49675.qmail
pb1.pair.com>,
> jazrant
zsc.nrcan.zc.ca (John A. Grant) wrote:
>
> > In Perl I used "/\S/" to check for blank lines read from a file.
> > Now I'm learning PHP. How do I know what is a 'standard'
> > regexp that ereg() can handle and how do I know what is
> > Perl-specific syntax so that I must use preg_grep() instead?
>
> The preg_* functions are faster and more powerful than ereg_*. So the
main
> reason to ever use an ereg is because one both unfamiliar with PCRE syntax
> and uninterested in learning it. You already know Perl regex, so no
> problem there: you do know PCRE (or will, with a five minute study of the
> manual to learn the minor differences between Perl and PCRE syntax).
>
> If you feel like learning ereg syntax too, google for "POSIX regular
> expressions", to numerous copies of the relevant man page (regex (6),
> IIRC..?). You'll find it easy to learn!
Yeah, I looked at the page(s). Incomprehensible and not very practical.
What is the simplest way to check for a blank line (just spaces, tabs etc.) read from a file using ereg()? I couldn't find any equivalent for the Perl "/\S/". I must admit that contrary to your conclusion that I already know Perl regex, I'm a bit of a newbie at regex and the little I know came from the (excellent) Perl doc examples.
-- John A. Grant * I speak only for myself * (remove 'z' to reply) Radiation Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here
attached mail follows:
In article <20011008024151.15354.qmail
pb1.pair.com>,
jazrant
zsc.nrcan.zc.ca (John A. Grant) wrote:
> What is the simplest way to check for a blank line (just > spaces, tabs etc.) read from a file using ereg()? I couldn't > find any equivalent for the Perl "/\S/".
I still don't understand why you would bother looking for an ereg equivalent when you can just use "/\S/" as-is with a preg_*, but <shrug>...
\S means "not a whitespace character" in Perl/PCRE. There's not a special character in POSIX for that, but you can use a negative character class instead:
"[^[:space:]]"
or
"[^\t\r\n ]"
> I must admit that > contrary to your conclusion that I already know Perl regex, > I'm a bit of a newbie at regex and the little I know came > from the (excellent) Perl doc examples.
Okay, since you find that easy to read, then by all means keep on familiarizing yourself with it. Like I said before, once you know Perl regex syntax it takes maybe 5 minutes to pickup the minor differences needed for PCRE.
If you're looking for a book teaching Perl and POSIX syntax in-depth, "Mastering Regular Expressions" (O'Reilly) by Jeffrey Friedl is the one to get. There are also many, many basic tutorials on the web that address POSIX regular expressions syntax (commonly referring to it simply as "extended regular expressions") if you're still finding the POSIX docs "incomprehensible".
Cheers!
-- CC
attached mail follows:
Use fgets() http://www.php.net/manual/en/function.fgets.php
-Jason Garber www.IonZoft.com
At 08:19 PM 10/7/2001 -0600, Carlos Fernando Scheidecker Antunes wrote:
>Hello all,
>
>I would like to ask the following help concerning text files.
>
>I've got column delimited text files and I need to read each line/record to
>populate a MySQL table.
>
>I understand that when you use fread($file, $length) you must specify the
>length of each line. The problem is that the last column is a description
>column and it can be from zero chars to 50 chars long. Because of that the
>length of each line is not a fixed number.
>
>What to do in a situation like this?
>
>Thanks in advance,
>
>Carlos Fernando Scheidecker Antunes.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Or possibly even just file() - in many situations this is easier than having to use fopen, then read the file in, then close it.
jason
> Use fgets() > http://www.php.net/manual/en/function.fgets.php > > -Jason Garber > www.IonZoft.com > > At 08:19 PM 10/7/2001 -0600, Carlos Fernando Scheidecker Antunes wrote: > >Hello all, > > > >I would like to ask the following help concerning text files. > > > >I've got column delimited text files and I need to read each line/record to > >populate a MySQL table. > > > >I understand that when you use fread($file, $length) you must specify the > >length of each line. The problem is that the last column is a description > >column and it can be from zero chars to 50 chars long. Because of that the > >length of each line is not a fixed number. > > > >What to do in a situation like this? > > > >Thanks in advance, > > > >Carlos Fernando Scheidecker Antunes.
attached mail follows:
Hi! I have this form to logon to page3.php, but always get warning message headers alredy sent. What am I doing wrong? Thanks for any help. Jan <? session_start(); include($DOCUMENT_ROOT."/database.inc"); function form() { echo "\n<form action=\"" . $PHP_SELF . "\" method=\"post\">"; echo "\n<P>Username"; echo "\n<br><INPUT NAME=\"user_name\" TYPE=\"text\" SIZE=\"20\"><br>"; echo "\n<P>Password"; echo "\n<br><INPUT NAME=\"password\" TYPE=\"password\" SIZE=\"20\"><br>"; echo "\n<input type=\"submit\" NAME=\"submit\" Value=\"Submit\">"; echo "\n</form>"; } //Start page echo "<html>\n<head>\n<title>Login example</title>\n</head>\n<body>"; form();
if ($user_name && $password) {
$res =
mysql_query("SELECT user_name FROM user WHERE
user_name='$user_name' AND password='$password'");
if(
mysql_num_rows($res) != 0) {
$verified_user = $user_name;
session_register("$verified_user");
Header("Location: http://www.myserver.com/page3.php");
}
}
echo "\n</body>\n</html>";
?> Jan Grafström Lillemans Hus AB Sweden
attached mail follows:
The word "Header" is self-explanatory :)
You cannot send a "Header" (comes -before- HTML) after your script has sent HTML to the browser.
You have two options-- Rearrange your code so the header is sent, if necessary, -before- any HTML output... Or, you can use output buffering functions. (see ob_start() and flush() in the manual)
-----Original Message-----
From: Jan Grafström [mailto:jan
grafstrom.net]
Sent: Monday, October 08, 2001 2:05 AM
To: php-general
lists.php.net
Subject: [PHP] Cannot add header informatiom?
Hi! I have this form to logon to page3.php, but always get warning message headers alredy sent. What am I doing wrong? Thanks for any help. Jan <? session_start(); include($DOCUMENT_ROOT."/database.inc"); function form() { echo "\n<form action=\"" . $PHP_SELF . "\" method=\"post\">"; echo "\n<P>Username"; echo "\n<br><INPUT NAME=\"user_name\" TYPE=\"text\" SIZE=\"20\"><br>"; echo "\n<P>Password"; echo "\n<br><INPUT NAME=\"password\" TYPE=\"password\" SIZE=\"20\"><br>"; echo "\n<input type=\"submit\" NAME=\"submit\" Value=\"Submit\">"; echo "\n</form>"; } //Start page echo "<html>\n<head>\n<title>Login example</title>\n</head>\n<body>"; form();
if ($user_name && $password) {
$res =
mysql_query("SELECT user_name FROM user WHERE
user_name='$user_name' AND password='$password'");
if(
mysql_num_rows($res) != 0) {
$verified_user = $user_name;
session_register("$verified_user");
Header("Location: http://www.myserver.com/page3.php");
}
}
echo "\n</body>\n</html>";
?> Jan Grafström Lillemans Hus AB Sweden
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hello,
I don't know if this is the right group for it, but I'm posting it here anyway...
I have an online browser based gaming site (not displaying the URL for possible advertising rules in this group, since it's not really relevant) , and I got a little problem here... My visitors try to be online as much as possible, logged in... they have to update things, by hand... now, visitors get smarter and smarters, and while they are sleeping, they have scripts/macro's running to update their information.
Now my problem: is there ANY way I could detect that macro? I was thinking of generating a number and displaying it in an image, but that will cost the player a lot of time. I was also thinking of automatically logging out once in the 30 minutes, but that will cause a lot of irritation too...
Any suggestions?
Thanks in advance,
Leon Mergen
attached mail follows:
> Now my problem: is there ANY way I could detect that macro? I > was thinking of generating a number and displaying it in an > image, but that will cost the player a lot of time. I was > also thinking of automatically logging out once in the 30 > minutes, but that will cause a lot of irritation too...
You could check the $HTTP_USER_AGENT and see if a user's UserAgent changes from Netscape or MSIE to cURL or lynx overnight...
Jason
attached mail follows:
In worst cases the image generation is found to be an effective way for what you're asking for... see Yahoo, Altavista, and many others...
"Leon Mergen" <leon
blazebox.com> wrote in message
news:004101c14fc2$2fd89f60$012aa8c0
leon...
Hello,
I don't know if this is the right group for it, but I'm posting it here anyway...
I have an online browser based gaming site (not displaying the URL for possible advertising rules in this group, since it's not really relevant) , and I got a little problem here... My visitors try to be online as much as possible, logged in... they have to update things, by hand... now, visitors get smarter and smarters, and while they are sleeping, they have scripts/macro's running to update their information.
Now my problem: is there ANY way I could detect that macro? I was thinking of generating a number and displaying it in an image, but that will cost the player a lot of time. I was also thinking of automatically logging out once in the 30 minutes, but that will cause a lot of irritation too...
Any suggestions?
Thanks in advance,
Leon Mergen
attached mail follows:
I am having the text fetched from mySQL database. I converted newline to <br> with nl2br function.
I need to detect <br> and need to put 'dot' in front of it and then display. (like unnumbered list with 'dot' as a separator)
Is there any command line (substring and indexof to detect it ?)
thanks in advance,
manisha
attached mail follows:
maybe " eregi_replace("/<br>/",".<br>,$text) " ???
see the manual for eregi_replace(), or ereg_replace ()...
----- Original Message -----
From: "Manisha" <manisha
aurica.com>
To: <php-general
lists.php.net>
Sent: Monday, October 08, 2001 8:42 AM
Subject: [PHP] How to change the newline (<br>) into "dot" and <br> ?
> I am having the text fetched from mySQL database. I converted newline to
> <br> with nl2br function.
>
> I need to detect <br> and need to put 'dot' in front of it and then
> display. (like unnumbered list with 'dot' as a separator)
>
> Is there any command line (substring and indexof to detect it ?)
>
> thanks in advance,
>
> manisha
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
>
attached mail follows:
have you seen this? test.php?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
"Andrey Hristov" <ahristov
icygen.com> wrote in message
news:01100519440508.10871
andrey.masq...
> After getting the PHP source from the CVS and compiling I tested with
> phpinfo(). The result was amazing :))))
> =======cutted=============
> <a href="http://www.php.net/"><img
> src="/master/test.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42" border=0
> align="right" alt="PHP Logo"></a><h1>PHP Version 4.0.8-dev</h1>
> =======cutted=============
>
>
> --
> Andrey Hristov
> IcyGEN Corporation
> BALANCED SOLUTIONS
> http://www.icygen.com
attached mail follows:
try this: <? $field = "sQl"; $what = 'testing 1 2 3'; $str = "[<a href=\"something\">$field</a>]"; $t = preg_replace("/(<a[^>]*>)(.+?)(<\/a>)/i", "$1$what$3", $str); print $t; ?>
"Gregor Jaksa" <gre-gor
delphi-si.com> wrote in message
news:20011006153822.84079.qmail
pb1.pair.com...
> Hello,
> I'm trying replace $field with "[<a href="something">$field</a>]" in
> $string, but here's the problem.
> If $field is for example SQL then str_replace replaces only "SQL" not
"Sql"
> or "sql". I tried with preg_replace but i cant find any good solution. Can
> anyone help me ?
>
> thx
>
>
attached mail follows:
thanks for the tip!
"Matthew Loff" <matt
willetts.com> wrote in message
news:002001c14f7d$81646070$0ce60281
bang...
>
> SELECT * FROM table ORDER BY RAND() LIMIT 1;
>
>
> -----Original Message-----
> From: Christian Dechery [mailto:cdechery
easynet.com.br]
> Sent: Sunday, October 07, 2001 5:51 PM
> To: php-general
lists.php.net
> Subject: [PHP] using Mysql's RAND()
>
>
> can I use Mysql's RAND() to get a random row from a table???
>
> _____________________________
> . Christian Dechery
> . . Gaita-L Owner / Web Developer
> . . http://www.webstyle.com.br
> . . http://www.tanamesa.com.br
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hello!
I have a program with which the administrator can setup some system. I need only one administrator to be logged in at a time. If, on successful login, I set the sid in the database and erase it on logout I have problems when the logged in administrator closes the window or anything else that does not erase the stored sid. And if he wants to login again the programm will say that there is another administrator logged in. I tried to put php to clean the session_id after, let's say, 40 mins with a probability of 100%... but if the administrator closes the window accidentaly he won't be able to login for the next 40 minutes. That is not very nice.
Any ideeas? plz help
Mihai
attached mail follows:
Well I assume they need a username and password to log in. So store that info for the currently logged in administrator along with your "sid" (maybe with IP address or something as well) and let him log in again even if shown to already be logged in.
- seb
-----Original Message-----
From: Negrea Mihai [mailto:mike
spidernet.co.ro]
Sent: 08 October 2001 12:10
To: php-general
lists.php.net
Subject: [PHP] only one user logged in
Hello!
I have a program with which the administrator can setup some system. I need only one administrator to be logged in at a time. If, on successful login, I set the sid in the database and erase it on logout I have problems when the logged in administrator closes the window or anything else that does not erase the stored sid. And if he wants to login again the programm will say that there is another administrator logged in. I tried to put php to clean the session_id after, let's say, 40 mins with a probability of 100%... but if the administrator closes the window accidentaly he won't be able to login for the next 40 minutes. That is not very nice.
Any ideeas? plz help
Mihai
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.282 / Virus Database: 150 - Release Date: 25/09/2001
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.282 / Virus Database: 150 - Release Date: 25/09/2001
attached mail follows:
On Monday 08 October 2001 09:45, Seb Frost wrote: > Well I assume they need a username and password to log in. So store that > info for the currently logged in administrator along with your "sid" (maybe > with IP address or something as well) and let him log in again even if > shown to already be logged in.
And what if the computer he is on powers off and he moves to another computer?
attached mail follows:
Hello,
I am tryong to learn more about PHP support on different OS/HTTP server combinations
I have read the FAQ and manual, and know which platforms PHP runs on, but am looking for things like:
performance comparison (same PHP release on different OS/servers...) platform specific configuration tools " " " " mailing list/websites licensing (free on Linux/pay on windows) anything else on these lines
Both personal experience and pointer to online material are higly welcome.
Thank you in advance,
Marco
attached mail follows:
Hi
Is there any PHP command or class that takes a sentence and breaks it to any given length without breaking the words in the middle?
Sincerely
berber
attached mail follows:
wordwrap()
look at the online php manual
http://php.net/manual/wordwrap or something like that...
you will find there an alternative wordwrap function if you haven't got PHP4
----- Original Message -----
From: "Boaz Yahav" <berber
netvision.net.il>
To: "PHP General (E-mail)" <php-general
lists.php.net>
Sent: Monday, October 08, 2001 10:41 AM
Subject: [PHP] Sentence Break
Hi
Is there any PHP command or class that takes a sentence and breaks it to any given length without breaking the words in the middle?
Sincerely
berber
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Example 1. wordwrap() example $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap( $text, 20 ); echo "$newtext\n"; This example would display: The quick brown fox jumped over the lazy dog. Example 2. wordwrap() example $text = "A very long woooooooooooord."; $newtext = wordwrap( $text, 8, "\n", 1); echo "$newtext\n"; This example would display: A very long wooooooo ooooord.
Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com
On Monday 08 October 2001 11:41, you wrote:
> Hi
>
> Is there any PHP command or class that takes a sentence and breaks it to
> any given length without breaking the words in the middle?
>
> Sincerely
>
> berber
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
--
attached mail follows:
Hi
Anyone knows how to implement subj ?
Thanks
attached mail follows:
What kind of lock is this?
Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com
On Monday 08 October 2001 11:47, you wrote: > Hi > > Anyone knows how to implement subj ? > > Thanks
--
attached mail follows:
How to do something like :
$text_of_template=preg_replace("~\[\*\*phpsrc\*\*[ ]*(.*)[ ]*\]~si","<pre>". implode(file("\\1"))."</pre>",$text_of_template);
i.e. how one can change [**phpsrc** name.php ] in text of template to text of php script ..., i think of using preg_* functionms but i don't know howto use functions on it's "second" argument's. Help me please...
attached mail follows:
I found that preg_replace_callback() maybe will suit to your needs but I 've used it.
preg_match_all($pattern,$the_page,$matches,PREG_PATTERN_ORDER); foreach ($matches[1] as $key=>$value){ $the_page=str_replace($matches[0][$key],implode(file('',$value),$the_page); }
Hope this helps.
Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com
On Monday 08 October 2001 12:59, you wrote: > How to do something like : > > $text_of_template=preg_replace("~\[\*\*phpsrc\*\*[ ]*(.*)[ > ]*\]~si","<pre>". implode(file("\\1"))."</pre>",$text_of_template); > > i.e. how one can change [**phpsrc** name.php ] in text of template to text > of php script > ..., > i think of using preg_* functionms but i don't know howto use functions on > it's "second" argument's. > Help me please...
--
attached mail follows:
i would like to give along two parameters with a command line php script, on a webpage i would do it like /file.php?count=2&filename=random.txt
thanks in advance
bruno
attached mail follows:
Bruno Waes wrote in message <20011008091044.36149.qmail
pb1.pair.com>...
>i would like to give along two parameters with a command line php script,
on
>a webpage i would do it like /file.php?count=2&filename=random.txt
ok i found it on http://www.faqts.com/knowledge_base/view.phtml/aid/3510
bruno
attached mail follows:
im looking for a way to include a php-servlet into cocoon2
until now i havnt even found the php-servlet...
im using rpm's for redhat 7.1
two things would help me any further:
1. is the php-servlet integrated in the php4.06 ???
2. is this the servlet im able to integrate into cocoon2 ???
thanks in advance
attached mail follows:
Hi there,
Can anyone tell me why arrays cause such a problem in PHP?
I've got a tab separated file that I want to process. When I read it in memory PHP gives me an error that the allowed memory size is exhausted:
Allowed memory size of <size> bytes exhausted ....
The construction I use is that I open the file and use fgetcsv to read the "records". This returns a 1D array for each record. I add that record/array to an array (2D) in which I store the complete contents of the file. So... something like:
$total = array(); $one_record = array(); while ($one_record = fgetcsv ($fd, $max_length, $delimiter)) { array_push ($total, $one_record); }
The file I try to read is 1.5M, contains 9040 lines and each line contains 85 "columns". Using the 2D construction described above, PHP requires up to 32M as the memory_limit. And even then, after testing it several times, that isn't enough. So... My conclusion is that PHP can't really handle multidimensional arrays very well.
Reading the complete file into memory using file(), doesn't give any problems. I can set the memory_limit downto 3M and it still works fine.
When I use the fgetcsv() construction described above, I can get it to work though... But I have to make a minor change for that:
array_push ($total, implode ("\t", $one_record));
That's right... I have to make it a 1D array!!! Then there's nothing wrong.
When I use file() and then try to make a 2D array... it doesn't work either:
$contents = file (); foreach ($contents as $record) { $data = split ("\t", $record); array_push ($total, $data); }
This also produces the memory exhausted error.
Some other way to try and process this file (and a dirty one it is!) is by creating all separate 1D arrays:
$var_name = "myVar_$counter"; $$var_name = $data; $counter++;
But.... No! Doesn't work. All of a sudden PHP doesn't want to work with the 1D arrays neither.
Can anyone tell me more about this array-bug in PHP? Or even better... Does anyone know something about a patch for this?
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
Some additions to this problem:
*** The webserver (Apache) doesn't seem to have any problems at all! The processes don't grow, etc. No prob at all.
*** After testing _a_lot_, PHP starts producing the error (memory exhausted) at any time. Pages with hardly any processing to do can't be displayed because PHP tells me the memory is exhausted.
*** PHP version 4.0.6
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
Just a suggestions. If that will not hurt you than get the version from the CVS and compile it I heard that it is Release Candidate 3, so it's stable.
Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com
On Monday 08 October 2001 13:45, you wrote: > Some additions to this problem: > > > *** > The webserver (Apache) doesn't seem to have any problems at all! The > processes don't grow, etc. No prob at all. > > *** > After testing _a_lot_, PHP starts producing the error (memory > exhausted) at any time. Pages with hardly any processing to do can't > be displayed because PHP tells me the memory is exhausted. > > *** > PHP version 4.0.6
--
attached mail follows:
Sorry :((( but suggestion_that_might_help.
On Monday 08 October 2001 14:00, you wrote: > > Just a suggestions. If that will not hurt you than get the version from > > the CVS and compile it I heard that it is Release Candidate 3, so it's > > stable. > > Is this bug fixed there, then? I still haven't found anything > anywhere about this bug. Not in the documentation, not in the > archives, not in the bugreports... Nowhere. Is it a known bug > already? And would using the CVS help, or is it just a suggestion > that _might_ help?
attached mail follows:
Chicho mi mi kaza che e uspql da podkara kirilica v MySQL. Porazgledaj na mysql.com . Ako problema v v izpisvaneto vig convert_cyr_string() ili neshto podobno. BTW, toj si instalira PHPTriad(ot sourceforge.net), taka che i tam moge da ima info. Na men lichno ne mi se e nalagalo da polzvam kirilica v mySQL.
Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com
On Monday 08 October 2001 14:33, you wrote:
> Hello,
> i have just used MyAccess tool (downloadable from mysql.com) to convert an
> MS Access 2000 table into MySQL.
> So this process gone OK, but the fields contain cyrillic characters that
> appear unreadable when i use SELECT statement.
> I know i must use some PHP functions to extract them, but don't know which?
> And is this possible when i already have imported into MySQL using
> myAccess?
>
> --
> _________________________________
> Ventsyslav Vassilev
> Comel Soft Multimedia;
> Sofia, Bulgaria, Rakovsky Str. 130;
> Work Phone: +359 2 988-00-09;
> ICQ UIN: 11199819;
> e-mail: wency
comelsoft.com;
> Visit: http://www.comelsoft.com
--
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]