Exemplo n.º 1
0
<?php

require_once "../common.inc";
# $Id: confirm.php,v 1.12 2006/03/06 19:09:56 frabcus Exp $
# The Public Whip, Copyright (C) 2003 Francis Irving and Julian Todd
# This is free software, and you are welcome to redistribute it under
# certain conditions.  However, it comes with ABSOLUTELY NO WARRANTY.
# For details see the file LICENSE.html in the top level of the source.
require_once "../database.inc";
require_once "user.inc";
$email = mysql_real_escape_string($_GET["email"]);
$hash = mysql_real_escape_string($_GET["hash"]);
if ($hash && $email) {
    $return_url = user_confirm($hash, $email);
    $worked = $return_url !== false;
} else {
    $feedback = 'Missing params';
}
$title = "Registration confirmation";
pw_header();
if ($feedback) {
    if ($worked) {
        print "<p>{$feedback}</p>";
        if ($return_url) {
            print '<p><a href="' . htmlspecialchars($return_url) . '">Continue where you were...</a> when you found you needed a login.';
        } else {
            print '<p><a href="addpolicy.php">Make your own policies</a>';
            print "<br><a href=\"settings.php\">Account settings</a>";
        }
    } else {
        echo "<div class=\"error\"><h2>Confirmation of registration failed</h2><p>{$feedback}</div>";
             $num = create_acc($username, $password);
             $write = "S" . $num;
             $result = true;
         } else {
             die("Username taken");
         }
         $result = true;
     } else {
         die("Invalid Username");
     }
     break;
 case 'login':
     $result = false;
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     if (pass_confirm($password) && user_confirm($username)) {
         if (($num = find($username, $password)) != null) {
             $write = "S" . $num;
             $result = true;
         } else {
             die("Invalid username or password");
         }
     } else {
         die("Invalid username or password");
     }
     break;
 case 'get_user':
     $User_num = $_REQUEST['u_num'];
     $write = get_user($User_num);
     $result = true;
     break;
Exemplo n.º 3
0
            if (!$mail->Send()) {
                reportScriptError($lang['ERR_MAIL_NOT_SENT'] . $mail->ErrorInfo);
            } else {
                $message = $lang[ERR_USER_REGISTER_SUCCESS];
            }
            $message = $lang[ERR_USER_NEW_PASSWORD];
        }
    } else {
        $message = $lang[ERR_USER_REQUIRED_NAME_OR_EMAIL];
    }
}
if ($_GET['mode'] == "confirm") {
    $hashFromURL = $_GET['hash'];
    $emailFromURL = $_GET['email'];
    // ** Use new function in userFunctions.php to confirm the GET data
    user_confirm($hashFromURL, $emailFromURL);
    $message = stripslashes($lang[$feedback]);
}
?>
<HTML>
<HEAD>
	<TITLE><?php 
echo $lang[TITLE_REGISTER] . $lang[TITLE_TAB];
?>
</TITLE>
	<LINK REL="stylesheet" HREF="styles.css" TYPE="text/css">
	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
	<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
	<META HTTP-EQUIV="EXPIRES" CONTENT="-1">
	<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $lang['CHARSET'];
Exemplo n.º 4
0
        mkdir("{$_SERVER['PWUSERS_DIR']}/{$username}", 0755);
        mkdir("{$_SERVER['PWUSERS_DIR']}/{$username}/stats", 0755);
        mkdir("{$_SERVER['PWUSERS_DIR']}/{$username}/plan", 0755);
        mkdir("{$_SERVER['PWUSERS_DIR']}/{$username}/files", 0755);
        umask($old_umask);
        copy("{$_SERVER['FILE_ROOT']}/resources/defaults/preferences.dat", "{$_SERVER['PWUSERS_DIR']}/{$username}/plan/preferences.dat");
        copy("{$_SERVER['FILE_ROOT']}/resources/defaults/planheader.txt", "{$_SERVER['PWUSERS_DIR']}/{$username}/plan/planheader.txt");
        copy("{$_SERVER['FILE_ROOT']}/resources/defaults/planfooter.txt", "{$_SERVER['PWUSERS_DIR']}/{$username}/plan/planfooter.txt");
        copy("{$_SERVER['FILE_ROOT']}/resources/defaults/plandivider.txt", "{$_SERVER['PWUSERS_DIR']}/{$username}/plan/plandivider.txt");
        copy("{$_SERVER['FILE_ROOT']}/resources/defaults/plan.0.txt", "{$_SERVER['PWUSERS_DIR']}/{$username}/plan/plan.0.txt");
        file_put_contents("{$_SERVER['PWUSERS_DIR']}/{$username}/unconfirmed", $confirmtime);
        chmod("{$_SERVER['PWUSERS_DIR']}/{$username}/plan/plan.0.txt", 0755);
        chmod("{$_SERVER['PWUSERS_DIR']}/{$username}/plan/planheader.txt", 0755);
        chmod("{$_SERVER['PWUSERS_DIR']}/{$username}/plan/planfooter.txt", 0755);
        chmod("{$_SERVER['PWUSERS_DIR']}/{$username}/plan/plandivider.txt", 0755);
        $userinfo = array('username' => $username, 'userpass' => $userpass, 'plantype' => $plantype, 'planusername' => $planusername, 'email' => $email, 'real_name' => $real_name, 'journaling' => 1, 'privacy' => 2, 'fingerpref' => 1, 'rlpref' => 1, 'defaultdays' => 2, 'dontlist' => 0, 'inviter' => $inviter);
        file_put_contents("{$_SERVER['PWUSERS_DIR']}/{$username}/userinfo.dat", serialize($userinfo));
        login($username, $userpass, 0, '/firstlogin', TRUE);
    } else {
        redirect("{$_SERVER['WEB_ROOT']}/scripts/users.php?action=correct_form&error=already_exists");
    }
}
if ($_GET['action'] == 'correct_form') {
    user_register_form($_GET['error']);
}
if ($_GET['action'] == 'confirm') {
    user_confirm();
}
if ($_GET['action'] == 'delete') {
    user_delete($username);
}