Jump to content

Archived

This topic is now archived and is closed to further replies.

Branden Wagner

correct but... incorrect?

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.

Share this post


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

[code]<?php 

phpinfo();exit;

?>[/code]

Share this post


Link to post
Share on other sites

×

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.