Example #1
0
                $_REQUEST["action"] = "edit";
            }
            mq("UPDATE users SET firstname='" . addslashes($_POST["firstname"]) . "', lastname='" . addslashes($_POST["lastname"]) . "', login='******', email='" . addslashes($_POST["email"]) . "' WHERE id='" . intval($_POST["id"]) . "';");
            $_REQUEST["msg"] = _("Account edited successfully");
            $_REQUEST["action"] = "";
        }
        break;
    case "docreate":
        // CREATE
        // search for existing login :
        $already = mqone("SELECT * FROM users WHERE login='******';");
        if ($already) {
            $_REQUEST["error"] = _("This login is already used, please choose another one");
            $_REQUEST["action"] = "create";
        } else {
            $pass = mkpass();
            mq("INSERT INTO users SET firstname='" . addslashes($_POST["firstname"]) . "', lastname='" . addslashes($_POST["lastname"]) . "', login='******', email='" . addslashes($_POST["email"]) . "', pass='******', role=0;");
            // FIXME: set the default role
            // Send the new password to the user's email :
            mail($_POST["email"], sprintf(_("Account created on https://%s"), $_SERVER["HTTP_HOST"]), sprintf(_("Hello,\nYour new account has just been created on https://%s\nPlease go there to login and change your password.\nYour login is %s\nand your password is %s\n\nThanks\n"), $_SERVER["HTTP_HOST"], $_REQUEST["login"], $pass));
            $_REQUEST["msg"] = _("Account created successfully");
            $_REQUEST["action"] = "";
        }
        break;
}
// SWITCH
require_once "head.php";
require_once "menu.php";
require "messagebox.php";
?>
<div class="container-fluid main"> 
Example #2
0
    <td><?php 
echo mkpass('password');
?>
</td>
  </tr>
  <tr>
    <td><?php 
echo $rqd;
?>
</td>
    <th><?php 
echo _('Confirm Password');
?>
:</th>
    <td><?php 
echo mkpass('password2');
?>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><?php 
echo mksubmit('submit');
?>
</td>
  </tr>
  </tbody></table>
</form>
<?php 
if (!$embed) {
    ?>