Copyright (C) 2007 nso Copyright (c) 2007 Victor Vikene This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *********************************************************************************** */ include('init.php'); include($includedir . 'header.php'); $db = new dbcon(); /* Set the correct templatefile for the templatesystem */ $xtpl = new XTemplate('lagbruker.xtpl',$tpldir); if (isset($_POST['submitted'])) { //Make a DB-connection if ($_POST['passwd'] === $_POST['pwcheck']) { $username = mysql_real_escape_string($_POST['uname'],$db->link); $passwd = sha1($_POST['passwd']); $email = mysql_real_escape_string($_POST['email'],$db->link); $date = time(); $sql = "INSERT INTO `%slusers` (`username`, `passwd`, `email`, `date`) VALUES ('$username','$passwd','$email','$date')"; $db->query($sql); if (mysql_affected_rows($db->link) === 1) { $message = $lang['usercreated'] . "" . $lang['login'] . ""; dialogbox($message, 'info'); } else { dialogbox($lang['uknownerror'], 'warning'); } } else { dialogbox($lang['passwordsnotequal'], 'warning'); } } else { $xtpl->assign('USERNAME', $lang['username']); $xtpl->assign('PASSWORD', $lang['password']); $xtpl->assign('RETYPE_PASSWORD', $lang['retype_password']); $xtpl->assign('EMAIL', $lang['email']); $xtpl->assign('MAKEUSER', $lang['makeuser']); $xtpl->assign('MAKEUSERURL', 'makeuser.php'); } /* Finally we parse the variables to the templatefile */ $xtpl->parse('main'); $xtpl->out('main'); include($includedir . 'tail.php'); ?>