[PHP] multiple constructor question

2004-04-08 Thread jdavis
Hello,
 I have looked around for information on using multiple constructors 
with OO PHP. I have found little, and from what I have seen I'm thinking
that  it's not supported. Is this true. I wrote the code below to try
to emulate multiple constructors.. is this what everyone else does to
try to get the same functionality?

thanks,  
-- 
[EMAIL PROTECTED]

Bad spellers of the world untie!


#!/usr/bin/php4
?php

$args = $_SERVER['argv'];

if($args[0]){
 $tc = new TestCon($args[1]);
}
else{
 $tc = new TestCon();
}


class TestCon{
 function TestCon($name = NULL){
  if($name){
   $this-doIt($name);
  }
  else{
   $this-doIt(User);
  }
 }  
 function doIt($string){
  echo Hello $string\n;
 }
}

?

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



Re: [PHP] path to binary for php on linux

2004-04-08 Thread jdavis
On Wed, 2004-04-07 at 18:17, Andy B wrote:
 it was installed with get
 and which php doesnt do anything just returns to the prompt with no output
 
 - Original Message - 
 From: Curt Zirzow [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, April 07, 2004 8:11 PM
 Subject: Re: [PHP] path to binary for php on linux
 
 
  * Thus wrote Andy B ([EMAIL PROTECTED]):
   anybody know what the exact path for the php binary on linux is?
  

locate finds all files containing the search string ... this works..
but you can just find binaries and important conf-files with

[EMAIL PROTECTED] ~---whereis php4
php4: /usr/bin/php4 /etc/php4 /usr/lib/php4 /usr/include/php4 
/usr/share/man/man1/php4.1.gz
[EMAIL PROTECTED] ~---


also depending on what linux you are using ...
you can just ask the package manager...

redhat- rpm -qa | grep php4 
then rpm -qp --filebypkg php4_main.rpm // or whatever the above command tells you the 
name is

debian- dpkg -L php4

good luck,
jd

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



[PHP] PHP OO concepts

2004-04-07 Thread jdavis
Hello,
 
 I have am checking out PHP OOP and it's pretty smooth. I have a decent
amount of Java experience so PHP OOP is  really easy
to pick up. However I have a few questions I was hoping someone
could help me with.

Can php have a main()? If not ... how to you start a program that is
purley PHP OOP or is this even possible?

How popular is PHP OOP? Should I use PHP OOP for small dynamic web
pages? Is this the convention?

Thanks,
jd




-- 
[EMAIL PROTECTED]

Bad spellers of the world untie!

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



[PHP] simple mysql_result() question

2004-04-07 Thread jdavis
hello,
 I am trying to authenticate users. I run this MySQL query using
vars provided via a form

select password from dealers where username = '$user'

this works great if $user is actually a user in the database.
otherwise i get this error

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3
in /var/www/php/AuthTool.php on line 52

its because of this

$thePass = mysql_result($result,'0','password');

is there a way to stop this error, should i be using mysql_fetch_array
instead? Code below.

Thanks,
jd



function auth(){
 $user = $_POST['user'];
 $pass = $_POST['pass'];
 $query = select password from dealers where username = '$user';
 $result = $this-sqlQuery($query);
 if(!$result){
  echo Sorry there was a error\n;
 }
 else{
  $thePass = mysql_result($result,'0','password');
  if($thePass){
   echo $thePass\n;
  }
  else{
   echo no such user - $user\n;
  }
 }
}
-- 
[EMAIL PROTECTED]

Bad spellers of the world untie!

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



[PHP] problems with md5()

2004-04-07 Thread jdavis
hello,
 I have a database containing usernames and md5 encrypted passwords.
When i use md5() to encrypt a users password recived via a form
to compare to the md5ed passwd in the database i get problems...

for instance ...

user foo has passwd 'pass' 
'pass' md5ed in database is this 

1a1dc91c907325c69271ddf0c

i got this using phps md5.

Then ... when i md5 a pass i recieve later to compare
for a login the password 'pass' comes up like this...

1a1dc91c907325c69271ddf0c944bc72

they are the same except the trailing 944bc72

this happens when i try other password too.

here is the code that is giving me the problems...

function auth(){
 $user = $_POST['user'];
 $pass = rtrim($_POST['pass']);  // i added this trying to fix :(
 $pass = md5($pass);
 $query = select password from dealers where username = '$user';
 $result = $this-sqlQuery($query);
 if(!$result){
  echo Sorry there was a error, please try again later.\n;
 }
 else{  
  $thePass = mysql_fetch_array($result);
  if($thePass[0]){
   if(strcmp( $pass , $thePass[0]) == 0){
echo match\n;
   }
   else{
echo pass = $pass br; // from from   
echo hash = $thePass[0];// from db  
   }
  }
  else{
   $this-logonPage(1);
  }
 }
}



can some one tell me what im doing wrong

thanks,


[EMAIL PROTECTED]

Bad spellers of the world untie!

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



RE: [PHP] problems with md5()

2004-04-07 Thread jdavis
On Wed, 2004-04-07 at 22:59, Chris wrote:
 The second, longer, one is the correct one.
 
 It looks like the column you've got the password stored in is too small, it
 must be 32 characters long
 
 Chris
 


On Wed, 2004-04-07 at 22:57, Jason Wong wrote:
md5() returns a 32 character string so whatever is stored in your DB is 
obviously truncated. Make sure the field holding the password is of 
sufficient size/length.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


thank you both so much , that was exactly the problem :)


thanks,
jd

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



[PHP] test - ignore

2004-03-25 Thread jdavis

-- 
jdavis [EMAIL PROTECTED]

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



[PHP] problem with mail()

2004-03-25 Thread jdavis
hello,  I have a 
php script that i have ran on a linux and bsd box, on both boxes the script will work 
and sendmail for a while, then it just seems to stop working. Does anyone have a idea 
why this is.

thanks,
-- 
jdavis [EMAIL PROTECTED]
 


?php 
header(Location: http://www.xxx.com/CSacknowledge.html;);
  
$sendTo = '[EMAIL PROTECTED]';
$subject = 'Cutomer Service Request';
$body = Customer Service Request \n\n;
$body .= ip :  . $_SERVER['REMOTE_ADDR'] . \n;
$body .= date :  . date(l dS of F Y h:i:s A) . \n;
foreach($_POST as $key = $value){
if($value != NULL){
if($value == checkboxValue ){
$value = Add to Mailing List;
}
$body .= $key : $value\n;
}
}
mail($sendTo,$subject,$body);
?

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