Advertisement
Guest User

rejestracja iredmail

a guest
May 16th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2.     $dbhost = "localhost";
  3.     $dbusername = "root";
  4.     $dbpassword = "";
  5.     $database = "vmail";
  6.     mysql_connect($dbhost,$dbusername,$dbpassword);
  7.     mysql_select_db($database) or die ( "Unable to select database");
  8.  
  9.     #this will list your domains
  10.    $sql = mysql_query("SELECT * FROM domain ORDER BY domain ASC");
  11.     while($row = mysql_fetch_array($sql)){
  12.         $domain = $row['domain'];
  13.         echo "$domain" . PHP_EOL;
  14.     }
  15.  
  16.     #this will delete a domain
  17.    $sql = "DELETE FROM domain WHERE domain = '$domain'";
  18.     mysql_query($sql);
  19.  
  20.     # just a way of doing it, you phpmaster -- laugh at errors, that's off the top of my hat.
  21.    $username = mysql_real_escape_string($_POSTwhatever...);
  22.     $domain = mysql_real_escape_string(some $_POST value you got back, you know, coder.);
  23.     $admin = 0;
  24.     $global_admin = 0;
  25.     $password = 'whatever';
  26.     $hash = shell_exec("doveadm pw -s 'ssha512' -p '$password'"); #now use google if you are lost, coder.
  27.    $sql = mysql_query("INSERT INTO mailbox SET username = '$username@$domain', password = '$hash', name = '$username', domain = '$domain', isadmin = $admin, isglobaladmin = $global_admin, maildir = '$domain/$username', created = '$time_now', local_part = '$username'");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement