Jump to content

correct but... incorrect?


Branden Wagner

Recommended Posts

[code]
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";
                }
        }
[/code]

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.