Jump to content


Photo

correct but... incorrect?


  • Please log in to reply
1 reply to this topic

#1 Branden Wagner

Branden Wagner
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts

Posted 07 August 2006 - 11:02 PM

function add_user($email,$password)
        {
                $split = explode("@", $email);
                $username = $split[0];
                $domain = $split[1];
                $home = "/mail/virtual/". $domain ."/". $username;
                $maildir = $home ."/Maildir/";
                $crypt = $this->crypt_pass($password);
                $name = "user";

                include_once("db.class.php");
                $db = new db();
                $db->connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name);
                $query = $db->query("select * from users where id='".$email."'");
                $num = $db->num_rows($query);

                if($num == 0)           
                {
                        $query = "insert into users(id,crypt,clear,name,home,maildir) 
                                     values('$email','$crypt','$password','$name','$home','$maildir')";
                        $db->query($query) or die(mysql_error());
                        $folder = $this->dirmail . $domain ."/skel";
                        system("cp -pr $folder $home");    
                        return "User Added Successfully";
                }
                else
                {
                        return "Username in use";
                }
        }

OK 2 problems. first for some reason clear is not inserting.. it just goes in blank and i cant figure out why.
second the crypt password is not inserting properly.. the function generates a correct password that works, i know this becuase if i run the function manually and take its output and manually insert it into the DB it works however the script here doesnt insert the crypted password properly.

im sure theres 2 problems are related.


#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 07 August 2006 - 11:18 PM

Blank page? Is "display_errors" set to "Off" in your php.ini file? Add the following line to the top of your PHP script and check...

<?php  

phpinfo();exit;

?>

PHP Ninja




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users