[PHP] Re: Email validation

2002-06-14 Thread Pedro Pontes

That one does not accept '+'.  In fact, that was the 1st time I ever saw
such a character in an e-mail address. I did not check the RFC, but if it is
valid, just add the '+' char to the reg. exp. like this:

function mailCheck($strEMailAddress)
{
 return eregi(^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$,
$strEMailAddress);
}

This should now accept your mail address.

Regards,

Pedro Alberto Pontes

- Original Message -
From: Timothy J. Luoma [EMAIL PROTECTED]
Newsgroups: php.general
To: Pedro Pontes [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 04:49
Subject: Re: Email validation


 On Wed, 12 Jun 2002, Pedro Pontes wrote:

  function checkEmail($strEMailAddress)
  {
   return eregi(^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$,
  $strEMailAddress);
  }
 
  You have it now :).

 I'm still learning my PHP regex... does the above allow someone to have a
 literal + in their email address, ala [EMAIL PROTECTED] which is
 perfectly valid, but often rejected by email validators?

 TjL





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




[PHP] Sudden timeouts

2002-06-12 Thread Pedro Pontes

Hello all,

I'm getting sudden timeouts in a site that makes use of sessions to keep
login information. In every page, a function is called that does:

session_set_cookie_params (1200);
session_start();

These timeouts don't seem to present any time or place pattern, they occur
randomly, before the 1200 period of inactivity, of course.

Has anyone gone through this problem already?

Thank you very much.

Pedro Alberto Pontes



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




[PHP] Re: Email validation

2002-06-12 Thread Pedro Pontes

function checkEmail($strEMailAddress)
{
 return eregi(^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$,
$strEMailAddress);
}

You have it now :).

Regards,


Pedro Alberto Pontes

Jeroen Timmers [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is there a simple function that validate an email adres

 Thx

 Jeroen Timmers




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




[PHP] Re: Timing out session cookies

2002-05-07 Thread Pedro Pontes

session_set_cookie_params ($expiration_time_in_seconds);

Regards,

--


Pedro Alberto Pontes

Mick Sear [EMAIL PROTECTED] wrote in message
06D1C9FA1087D4119FC900508B95056E011FECF2@eulexch1a">news:06D1C9FA1087D4119FC900508B95056E011FECF2@eulexch1a...
 Hi,

 How do I set an expiration time on a session cookie?  I basically want to
 log users out automatically after a period of inactivity.

 Cheers,
 Mick




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




[PHP] Configuration problems

2002-05-07 Thread Pedro Pontes

I have /usr/local/lib/libgd.a,

but when I

./configure --with-gd=/usr/local/lib --enable-gd-native-ttf --with-mysql --
with-apache=/usr/local/apache_1.3.24/ --enable-track-vars --with-oci8 --with
-zlib-dir=/usr/local/lib

I get

configure: error: Unable to find libgd.(a|so) anywhere under
/usr/local/lib

What am I doing wrong?

Thank you.


--


Pedro Alberto Pontes




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




Re: [PHP] Secure user authentication

2002-05-06 Thread Pedro Pontes

I wasn't in fact aware of that domain test thingie. So my main worry is no
more.

Thank you guys.

--


Pedro Alberto Pontes

The_radix [EMAIL PROTECTED] wrote in message
004c01c1f348$2db81c40$3200a8c0@oracle">news:004c01c1f348$2db81c40$3200a8c0@oracle...
 Pedro Pontes wrote:
  with a SIMPLE equals test. So if a user happens to get that crypted
 value
  of the password (from a temporary file on the server, for example), then
 all
  the little devil has to do is to create a dummy session user object, or
in
  your case, array, set its password value to the stolen crypted hash and
 then
  link freely to any of your pages.


 well simply put? no..

 If a user can get the crypted value off your server, AND also figure how
to
 trick the PHP engine into accepting a session cookie that wasn't created
on
 your domain, then that would be either:
 a) you have dangerous and volatile PHP scripts that allow users to perform
 such nasty tricks
 b) your server security should be greatly improved..


 Jon Haworth wrote:
  Why are you passing the password around, hashed or not, in the first
 place?
  Just have a yes/no flag for whether the session is an authenticated user
 or
  not.

  Is there any particular reason why you'd need to reauthenticate on every
  page?

 yes.. too true.. and simply put.. I could just pass the key or something
 around instead and then in my PHP header that runs on each and every page
 just reload a array with all the details anyway.. instead of passing
around
 the array..

 oh and as for reauthenticating well that's done because.. well stupid
 really when you think of it.. Unless they breach PHP as mentioned above,
and
 trick the session system, then there is little need to keep auth'ing
them..


 Haha.. Actually I just looked at my code.. Sorry I was mistaken.. due to
the
 complexity of my site. it doesn't actually reauth as such.. instead it
 checks to see the status of the user and does some log updates.. (to
keep
 track of user's still online etc..) ... when I say status.. I mean if I
 ban/block users while logged in.. the changes happen AS SOON as they view
 another page on the site and they get a lovely page telling them of their
 predicament :)



 Anywayz.. very interesting topic.. I will keep an eye on this..


 Miguel says:
  This would only work if some other user is able to create files that the
  web server thinks are part of your domain (since the session cookies are
  domain-specific). Sounds to me like your problem here is severe server
  misconfiguration. If your server environment is that insecure, then
  worrying about anything else is sort of a waste of time.

 Yes.. Too true..


 Michael Kismal says:
  What I can't figure out is why you're allowing people to just randomly
  put pages on your server.  If someone was to randomly register a similar
  user object, etc - why bother?  If I can put pages on your server and
  execute them, I'd do some something far more malicious than just pretend
  I'm user X.


 Precisely what I am getting at too..


 Yes the general opinion seems to be: If someone can get the session
handler
 of the PHP engine tricked so easily, or gain access so easily to your
 site... Then you'd better look into that WAY before you start picking on
 authentication schemes..


 No harm intended ok.. Just pointing out some facts..


 Hope I can help.. Would love to demonstate some ideas/etc.. about how I do
 security stuff..



 Bye
 :::
 :  Julien Bonastre [The-Spectrum.org CEO]
 :  A.K.A. The_RadiX
 :  [EMAIL PROTECTED]
 :  ABN: 64 235 749 494
 :  QUT Student :: 04475739
 :::
 - Original Message -
 From: Pedro Pontes [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, May 04, 2002 12:33 AM
 Subject: Re: [PHP] Secure user authentication


  First of all, thank you for your devote answer.
 
  The method I was thinking about before was to pass the md5 hash of the
  password around, as the passwords are already md5'ed in the DB. Your
 method
  seems more secure as you use a totally spiced-up and personalized
 encryption
  engine.
 
  But, the main question remains, I think. If you pass your crypted
password
  around, then, in each page, you must check it agains't the database
entry
  with a SIMPLE equals test. So if a user happens to get that crypted
 value
  of the password (from a temporary file on the server, for example), then
 all
  the little devil has to do is to create a dummy session user object, or
in
  your case, array, set its password value to the stolen crypted hash and
 then
  link freely to any of your pages.
 
  Am I right? Thanks again.
 
  --
 
 
  Pedro Alberto Pontes
 
  The_radix [EMAIL PROTECTED] wrote in message
  003601c1f2aa$6120dbb0$f86086cb@oracle">news:003601c1f2aa$6120dbb0$f86086cb@oracle...
   Hmm yes good question..
  
   Security was (still is) a major for my organisation's site and I did
   something a little u

Re: [PHP] Defining PHP varibles from URL

2002-05-06 Thread Pedro Pontes

The way you're doing it now, you're first ERASING whatever value passed from
the URL, with

$file=;

and then trying to use it...

If this ' $file= '  is some declaration attempt, just drop it, you don't
need to declare variables in PHP. Just check if $file has a value and then
use it.

For example,

if ($file != )
include($file);

Hope it helps.


--


Pedro Alberto Pontes
[EMAIL PROTECTED] wrote in message
009501c1f4e0$636d3e80$0100a8c0@JohnH">news:009501c1f4e0$636d3e80$0100a8c0@JohnH...
I don't mean to be a pain but could someone send me a working example?

I am what you would probably call a 'newbie'

For those who don't know here is my previous message

 can't seem to define a varible from the url entered into a browser.

I wish to use the following code or something like it.
script language=php
$file = ;
//the above is defined from the url
include $file;
/script
It could be what I was typing in the url bar.
file.php?file=foobar.inc

Thanks,
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com



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




[PHP] Re: Call to a member function on a non-object...?

2002-05-03 Thread Pedro Pontes

You must have created that function inside some class definition. When you
do that, you must first instantiate that class to have access to its
functions (methods).

If you have:

class YourClass
{
function YourClass()
{
// constructor
}

function methodOne()
{
// method 1
}
}

To call the function methodOne, you must first:

$objectName = new YourClass();

and only then

$objectName-methodOne();

Hope it helps.

--


Pedro Alberto Pontes

Richard Brenner [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi.

 When I try to call a manual defined function in my function.inc file, I
get
 the error:
 Fatal error: Call to a member function on a non-object in /www/xyz/.. on
 line xy
 I've defined the function in a seperate .inc file and included this is the
 mainpage.

 Do you have any solutions for this problem?

 Thanks,
 Richard





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




[PHP] Secure user authentication

2002-05-03 Thread Pedro Pontes

Hello,

I'm using the regular user authentication method, that is, check the
specified login/pass agains't the entries in the DB, if it is valid, create
the user object and register it with the section.

How can we prevent any user from creating a simple PHP page that creates a
simmilar user object, registers it with the session and then links to my
pages? One way would be to check, in each page, for the password in the
session user object and match it with the DB entry, but storing the password
in the session is not advisable, as other users in the host system may have
access to that information.

Please advise.

Thank you ver much for your time.

--


Pedro Alberto Pontes



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




Re: [PHP] New Session Variable unset doesn't work

2002-05-03 Thread Pedro Pontes

Yes, always remember that unset() deletes the REFERENCE to the variable, not
the variable itself, so in the next page, when you session_start() again,
the reference is recreated to the still existing value.

So, session_unregister is fundamental to unregister the reference from the
session.

To destroy the variable's value you must use $var = null;

Regards,

--


Pedro Alberto Pontes


Dan Hardiker [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I somehow cannot unset Session variables. If I set for example
  $_SESSION[error]=formcheck (the new style) and I want to unset it
  at the end of the page (unset($_SESSION[error])), it's there again on
  the next page.
 
  Is there a special way to unset the new Session variables?

 Seen as you used session_register to set the session variable, it would
 make sense for you to use session_unregister to do the inverse.

 --
 Dan Hardiker [[EMAIL PROTECTED]]
 ADAM Software  Systems Engineer
 First Creative Ltd





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




Re: [PHP] Secure user authentication

2002-05-03 Thread Pedro Pontes

First of all, thank you for your devote answer.

The method I was thinking about before was to pass the md5 hash of the
password around, as the passwords are already md5'ed in the DB. Your method
seems more secure as you use a totally spiced-up and personalized encryption
engine.

But, the main question remains, I think. If you pass your crypted password
around, then, in each page, you must check it agains't the database entry
with a SIMPLE equals test. So if a user happens to get that crypted value
of the password (from a temporary file on the server, for example), then all
the little devil has to do is to create a dummy session user object, or in
your case, array, set its password value to the stolen crypted hash and then
link freely to any of your pages.

Am I right? Thanks again.

--


Pedro Alberto Pontes

The_radix [EMAIL PROTECTED] wrote in message
003601c1f2aa$6120dbb0$f86086cb@oracle">news:003601c1f2aa$6120dbb0$f86086cb@oracle...
 Hmm yes good question..

 Security was (still is) a major for my organisation's site and I did
 something a little unique and robust..


 I love programming and I hate stealing (some call it borrowing) other
 programmer's scripts/code from the web.. therefore I write it _all_
myself..


 Trust me.. Sometimes this is a dumb attitude to take such as when I
created
 my first Perl discussion forum.. still running I think
 (http://the-radix.hypermart.net i think) and that consisted of this huge
 perl system to maintain the files etc.. for members and the forum..


 Anyway! off the sub now..


 I used sessions and pass around the array of columns for that member/user
..
 but the password is put through my own fairly unbreakable (yes.. I am
 serious) password key system..


 An idea to make your own safe keys to pass them around or use for
 authenticating is simple maths and a crypt() or my preferred: md5()
 function..


 I simply do some lovely maths like for each char of pword I loop through
 them and append them onto the entire pword string plus the length, get the
 md5 of that.. then md5 that md5 with the md5 of the previous result and
then
 do some maths, pick some specified characters (like every 3rd or whatever
 you wish) .. strrev( reverse the string) md5 that again, all md5'ed
again..


 :) haha, you get the idea..


 SO basically you'll end up with a nice 32 char string which is QUITE safe
to
 pass around and the chance anyone's gonna decrypt it IMHO is about zilch,
 buckley's, zut, nil, null, zero..


 And all you have to do, is when they login once, just run the password
they
 entered through this algorithm and check it against the stored algo'd
 password..

 Ah yes that's the next thing.. the DB passwords will also have to be proc.
 using your algorithm..

 So it's kinda like a key security idea.. you are not meant to decrypt md5
 hashes.. instead recreate it using what you are supplied and then compare
 both hashes..


 Simple :P




 Ok hope that helps

 :::
 :  Julien Bonastre [The-Spectrum.org CEO]
 :  A.K.A. The_RadiX
 :  [EMAIL PROTECTED]
 :  ABN: 64 235 749 494
 :  QUT Student :: 04475739
 :::
 - Original Message -
 From: Pedro Pontes [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, May 03, 2002 10:19 PM
 Subject: [PHP] Secure user authentication


  Hello,
 
  I'm using the regular user authentication method, that is, check the
  specified login/pass agains't the entries in the DB, if it is valid,
 create
  the user object and register it with the section.
 
  How can we prevent any user from creating a simple PHP page that creates
a
  simmilar user object, registers it with the session and then links to my
  pages? One way would be to check, in each page, for the password in the
  session user object and match it with the DB entry, but storing the
 password
  in the session is not advisable, as other users in the host system may
 have
  access to that information.
 
  Please advise.
 
  Thank you ver much for your time.
 
  --
 
 
  Pedro Alberto Pontes
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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




Re: [PHP] Secure user authentication

2002-05-03 Thread Pedro Pontes

Hi Jon,

I am considering doing that because any user can create a simple PHP script
with his/her object with the authenticated flag set to authorized,
register that object with the session and then link to any of my pages,
which if they don't make any kind of password test, they will unsuspectly
accept the intrusion.

What kind of test do you do in each of your pages? I just test if there is a
user object registered and if its type (group), set upon successfully login,
is allowed in the specified page. But if I create a separate script that
just creates a simmilar object (with the same fields), artificially
attribute a group and login to it, register it with the session and then
link to any of my pages (without passing through the login page), they won't
suspect that the access rights were forged.

Thank you.

--


Pedro Alberto Pontes

Jon Haworth [EMAIL PROTECTED] wrote in message
67DF9B67CEFAD4119E4200D0B720FA3F010C4017@BOOTROS">news:67DF9B67CEFAD4119E4200D0B720FA3F010C4017@BOOTROS...
 Hi,

  The method I was thinking about before was to pass
  the md5 hash of the password around, as the passwords
  are already md5'ed in the DB. Your method seems more
  secure as you use a totally spiced-up and personalized
  encryption engine.

 *boggle*

 Why are you passing the password around, hashed or not, in the first
place?
 Just have a yes/no flag for whether the session is an authenticated user
or
 not.

 Is there any particular reason why you'd need to reauthenticate on every
 page?


 Cheers
 Jon



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