<?php
require "inc/init.php";
require "inc/small_functions.php";
$post_vars = array(
'name','username','password','password2','email','cancel'
);
include "import_vars_post.inc";
#$get_vars = array('task_id','note_id');
#include "import_vars_get.inc";
if ($cancel) {
header ("Location: home.php");
exit;
}
// validate data
$name = AddSlashes(StripSlashes($name));
$username = AddSlashes(StripSlashes($username));
$password = AddSlashes(StripSlashes($password));
$password2 = AddSlashes(StripSlashes($password2));
$email = AddSlashes(StripSlashes($email));
// can he add users?
if (GetUserInfo($user_id,$d,$can_add_user,$d,$d,$d,$d)) {
// if user cannot add users send him home
if ($can_add_user != 1) Header ("Location: home.php");
} else {
// user doesn't exist
// give him login screen
Header ("Location: index.php");
}
// verify if passwords match
if ("$password" != "$password2") $error = $strThepasswordsdontmatch;
// verify if username doesnt exist
if(GetUserId($username,$d)) $error = $strThatusernameisalreadybeingused;
// if we get parameters (without any error messages)
// save them and head to home.php (homepage)
// otherwise ask for a new twin user
if ($name && $username && !$error) {
if (GetNodeLeafFromTree($user_id,$node,$leaf)) {
CreateUser($node,$leaf,$username,$password,$name,$email,$can_add_user);
Header ("Location: home.php");
} else {
// non-existent user, get outta here
Header ("Location: index.php");
}
} else {
?>
<html>
<head>
<title><? echo $strAddtwinuser; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<? if ($charset) print $charset; else print "ISO-8859-1"; ?>">
<link href="css/pman.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor=<? print $bgcolorNewTwinUser; ?>>
<table width=100% height=100%>
<tr>
<td width=30% valign=middle align=center>
<form method=post>
<?
if ($error) $error = "\n<p align=center><font color=#FF0000>$error</font></p>\n";
$content = "
<br><div align=center>$error
$strRealname: <input type=text name=name value=\"$name\"><br>
$strUsername: <input type=text name=username value=\"$username\"><br>
$strPassword: <input type=password name=password value=\"$password\"><br>
$strConfirmpassword: <input type=password name=password2><br><br>
$strEmail: <input type=text name=email value=\"$email\" size=30><br><br>
<input type=submit value=\"$strCreate\">
<input type=submit name=cancel value=\"$strCancel\"><br>
</div>\n";
$title = $strAddtwinuser;
$color = $boxtitlecolorNewTwinUser;
$plus = "width=45%";
include "templates/box.php";
?>
<form>
</td>
</tr>
</table>
</body>
</html>
<?
}
?>