예제 #1
0
function login()
{
    $controller = new UserTools();
    $db = new DB();
    $db->connect();
    if (!isset($_POST['apikey'])) {
        echo "bad api key";
        return NULL;
    }
    if (isset($_POST['username']) && isset($_POST['password'])) {
        $user = $_POST['username'];
        $pass = $_POST['password'];
        $result = $controller->login($user, $pass);
        echo $result;
        /*
        $query = $db->select('users', 'username=$user,pass_hash=$pass');
        if(mysql_num_rows($query) == 1){
        	//success
        	$_SESSION['logged_in'] = $query['id'];
        } else {
        	//fail
        	echo "invalid username or password";
        }
        */
    }
}
예제 #2
0
			}

			#userbase-invite-code {
				width: 290px;
			}
			</style>

			<form id="userbase-invitation-form" action="" method="GET">
			<fieldset>
			<legend><?php 
            echo $message;
            ?>
</legend>
			<p>
			<input id="userbase-invite-code" name="invite" size="30" value="<?php 
            echo UserTools::escape($_GET['invite']);
            ?>
"/>
			<button id="userbase-invitation-button" type="submit">&gt;&gt;</button>
			</p>
			</fieldset>
			</form>
			<?php 
        }
    }
    if ($show_registration_form) {
        foreach (UserConfig::$authentication_modules as $module) {
            $id = $module->getID();
            ?>
			<div style="margin-bottom: 2em">
			<h3 name="<?php 
예제 #3
0
$error = "";
if (isset($_SESSION['logged_in'])) {
    header("Location: index.php");
}
//check to see that the form has been submitted
if (isset($_POST['submit-form'])) {
    //retrieve the $_POST variables
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $password = $_POST['password'];
    $password_confirm = $_POST['password-confirm'];
    $email = $_POST['email'];
    $avatar = $_POST['avatar'];
    //initialize variables for form validation
    $success = true;
    $userTools = new UserTools();
    if (empty($email) || empty($firstname) || empty($password) || empty($password_confirm)) {
        $error .= "Some required fields are missing.<br/> \n\r";
        $success = false;
    }
    //validate that the form was filled out correctly
    //check to see if user name already exists
    if ($userTools->checkEmailExists($email)) {
        $error .= "That email is already taken.<br/> \n\r";
        $success = false;
    }
    //check to see if passwords match
    if ($password != $password_confirm) {
        $error .= "Passwords do not match.<br/> \n\r";
        $success = false;
    }
예제 #4
0
<?php

/**
 * Created by PhpStorm.
 * User: Alexandr
 * Date: 01.02.16
 * Time: 18:03
 */
if (isset($_GET['key1'])) {
    $logout = new UserTools();
    $logout->logout($_GET['key1']);
}
예제 #5
0
function _USERBASE_render_navbox()
{
    $current_user = User::get();
    $accounts = array();
    if (UserConfig::$useAccounts && !is_null($current_user)) {
        $accounts = Account::getUserAccounts($current_user);
        $current_account = Account::getCurrentAccount($current_user);
    }
    ?>
<div id="navbox">
	<?php 
    if (!is_null($current_user)) {
        if (count($accounts) > 1) {
            ?>
<select id="account-picker" name="account" onchange="document.location.href='<?php 
            echo UserConfig::$USERSROOTURL;
            ?>
/change_account.php?return=/dashboard/&account='+this.value"><?php 
            foreach ($accounts as $account) {
                ?>
<option value="<?php 
                echo $account->getID();
                ?>
"<?php 
                if ($current_account->isTheSameAs($account)) {
                    echo ' selected';
                }
                ?>
><?php 
                echo UserTools::escape($account->getName());
                ?>
</option><?php 
            }
            ?>
</select>
		<?php 
        }
        if (UserConfig::$useAccounts && !is_null($current_account)) {
            ?>
			<!-- <span id="profile"><a href="/p/<?php 
            echo UserTools::escape($current_account->getID());
            ?>
/" title="<?php 
            echo UserTools::escape($current_account->getName());
            ?>
's public profile">Public profile</a></span> | -->
		<?php 
        }
        ?>
		<span id="username"><a href="<?php 
        echo UserConfig::$USERSROOTURL;
        ?>
/edit.php" title="<?php 
        echo UserTools::escape($current_user->getName());
        ?>
's user information"><?php 
        echo UserTools::escape($current_user->getName());
        ?>
</a></span> |
		<span id="logout"><a href="<?php 
        echo UserConfig::$USERSROOTURL;
        ?>
/logout.php">logout</a></span>
		<?php 
    } else {
        ?>
		<span id="signup"><a href="<?php 
        echo UserConfig::$USERSROOTURL;
        ?>
/register.php">Sign Up Now!</a></span> |
		<span id="login"><a href="<?php 
        echo UserConfig::$USERSROOTURL;
        ?>
/login.php">log in</a></span>
	<?php 
    }
    ?>
</div>
<?php 
}
예제 #6
0
<?php

require_once 'includes/global.inc.php';
$userId = $_GET['userId'];
$token = $_GET['token'];
// echo 'entre like a boss' ;
// echo $userId;
// echo $token;
$userTools = new UserTools();
$userTools->closeSession($userId, $token);
header("Location: https://192.168.122.2:6081/~usuario10/login.html");
예제 #7
0
    public function renderEditUserForm($action, $errors, $user, $data)
    {
        ?>
		<style>
		#userbase-usernamepass-edit-form {
			font: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
			padding: 0.4em 1em;
			margin: 0;
			width: 520px;
			border: 4px solid #ccc;
			border-radius: 7px;
			-moz-border-radius: 7px;
			-webkit-border-radius: 7px;
		}

		#userbase-usernamepass-edit-form li {
			font-size: 1.2em;
			line-height: 1.5;

			clear: both;
			margin: 0 0 .75em;
			padding: 0;
		}

		#userbase-usernamepass-edit-form fieldset {
			border: 0;
			padding: 0;
			margin: 0;
		}

		#userbase-usernamepass-edit-form legend {
			border: 0;
			padding: 0;
			margin: 0;
			font-size: 1.8em;
			line-height: 1.8;
			padding-bottom: .6em;
		}

		#userbase-usernamepass-edit-form ul {
			list-style: none;
			margin: 0;
			padding: 0;
		}

		#userbase-usernamepass-edit-form label {
			display: block;
			float: left;
			line-height: 1.6;
			margin-right: 10px;
			text-align: right;
			width: 165px;
			padding: 3px 0;
		}

		#userbase-usernamepass-edit-form label:after {
			content: ':';
		}

		#userbase-usernamepass-edit-button {
			margin-left: 180px;
			padding: 0.3em 25px;
			cursor: pointer;
		}

		#userbase-usernamepass-edit-forgotpass {
			margin-left: 130px;
                        cursor: pointer;
			font-size: 0.6em;
			display: block;
		}

		#userbase-usernamepass-edit-form input {
			background: #f6f6f6;
			border: 2px solid #888;
			border-radius: 2px;
			-moz-border-radius: 2px;
			-webkit-border-radius: 2px;
			padding: 4px;
		}

		#userbase-usernamepass-edit-form input:focus {
			background: #fff;
		}

		#userbase-usernamepass-edit-form abbr {
			cursor: help;
			font-style: normal;
			border: 0;
			color: red;
			font-size: 1.2em;
			font-weight: bold;
		}

		#userbase-usernamepass-edit-form .userbase-usernamepass-edit-section {
			font-size: 1.5em;
			font-weight: bold;
			margin-top: 1em;
		}
		</style>
		<form id="userbase-usernamepass-edit-form" action="<?php 
        echo $action;
        ?>
" method="POST">
		<fieldset>
		<legend>Update your name, email and password</legend>
		<ul>
		<?php 
        $username = $user->getUsername();
        if (is_null($username)) {
            ?>
		<li><label>Username</label><input name="username" type="text" size="25" maxlength="25" value="<?php 
            echo array_key_exists('username', $data) ? UserTools::escape($data['username']) : '';
            ?>
"/><?php 
            echo array_key_exists('username', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['username'])) . '">*</span>' : '';
            ?>
</li>
		<?php 
        } else {
            ?>
		<li><label>Username</label><b title="Sorry, you can't change your username">&nbsp;<?php 
            echo UserTools::escape($username);
            ?>
</b></li>
		<?php 
        }
        ?>
		<li class="userbase-usernamepass-edit-section">Name and email</li>
		<li><label>Name</label><input name="name" type="test" size="40" value="<?php 
        echo UserTools::escape(array_key_exists('name', $data) ? $data['name'] : $user->getName());
        ?>
"/><?php 
        echo array_key_exists('name', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['name'])) . '">*</span>' : '';
        ?>
</li>
		<li><label>E-mail</label><input name="email" type="text" size="40" value="<?php 
        echo UserTools::escape(array_key_exists('email', $data) ? $data['email'] : $user->getEmail());
        ?>
"/><?php 
        echo array_key_exists('email', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['email'])) . '">*</span>' : '';
        ?>
</li>

		<li class="userbase-usernamepass-edit-section">Change password</li>
		<?php 
        if (!is_null($user->getUsername())) {
            ?>
		<li><label>Current password</label><input name="currentpass" type="password" size="25" autocomplete="off"/><?php 
            echo array_key_exists('currentpass', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['currentpass'])) . '">*</span>' : '';
            ?>
</li>
		<?php 
        }
        ?>
		<li><label><?php 
        if (is_null($user->getUsername())) {
            ?>
Set a<?php 
        } else {
            ?>
New<?php 
        }
        ?>
 password</label><input name="pass" type="password" size="25" autocomplete="off"/><?php 
        echo array_key_exists('pass', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['pass'])) . '">*</span>' : '';
        ?>
</li>
		<li><label>Repeat new password</label><input name="repeatpass" type="password" size="25" autocomplete="off"/><?php 
        array_key_exists('repeatpass', $errors) ? ' <span style="color:red" title="' . UserTools::escape(implode("\n", $errors['repeatpass'])) . '">*</span>' : '';
        ?>
</li>
		<li><button id="userbase-usernamepass-edit-button" type="submit" name="save">Save</button></li>
		</ul>
		</fieldset>
		</form>
		<?php 
    }
예제 #8
0
    public function renderEditUserForm($action, $errors, $user, $data)
    {
        $db = UserConfig::getDB();
        $user_id = $user->getID();
        $module = $this->getID();
        $oauth_user_id = null;
        $serialized_userinfo = null;
        if ($stmt = $db->prepare('SELECT oauth_user_id, userinfo FROM ' . UserConfig::$mysql_prefix . 'user_oauth_identity WHERE user_id = ? AND module = ?')) {
            if (!$stmt->bind_param('is', $user_id, $module)) {
                throw new Exception("Can't bind parameter" . $stmt->error);
            }
            if (!$stmt->execute()) {
                throw new Exception("Can't execute statement: " . $stmt->error);
            }
            if (!$stmt->bind_result($oauth_user_id, $serialized_userinfo)) {
                throw new Exception("Can't bind result: " . $stmt->error);
            }
            $stmt->fetch();
            $stmt->close();
        } else {
            throw new Exception("Can't prepare statement: " . $db->error);
        }
        ?>
		<form action="<?php 
        echo $action;
        ?>
" method="POST">
		<?php 
        if (is_null($oauth_user_id)) {
            if (is_null($this->connectButtonURL)) {
                ?>
<input type="submit" name="add" value="Connect existing <?php 
                echo $this->getTitle();
                ?>
 account &gt;&gt;&gt;"/><?php 
            } else {
                ?>
<input type="image" name="add" src="<?php 
                echo UserTools::escape($this->connectButtonURL);
                ?>
" value="add"/><?php 
            }
        } else {
            ?>
			<div><?php 
            $this->renderUserInfo($serialized_userinfo);
            ?>
</div>
			<input type="hidden" name="oauth_user_id" value="<?php 
            echo htmlentities($oauth_user_id);
            ?>
"/>
			<input type="submit" name="remove" value="remove" style="font-size: xx-small"/>
			<?php 
        }
        ?>
		<input type="hidden" name="save" value="Save &gt;&gt;&gt;"/>
		</form>
		<?php 
    }
예제 #9
0
        $cohort_provider = $provider;
        $selected = true;
    }
    ?>
<option value="<?php 
    echo UserTools::escape($id);
    ?>
"<?php 
    if ($selected) {
        ?>
 selected="yes"<?php 
    }
    ?>
>
	<?php 
    echo UserTools::escape($provider->getTitle());
    ?>
	</option><?php 
}
if (is_null($cohort_provider)) {
    $cohort_provider = UserConfig::$cohort_providers[0];
}
?>
</select>
</div>

</form>
</div>

<?php 
$cohort_lookup = array();
예제 #10
0
 public function getHTML()
 {
     return '<a href="http://www.ohloh.net/accounts/' . UserTools::escape($user_info['id']) . '" target="_blank">@' . $this->userinfo['name'] . '</a>';
 }
예제 #11
0
				$("#answerForm").submit();
			});
		})
	   </script>
	</head>
	<body>
	<?php 
showNavbar($user, "From");
?>
	<div class="container">
		<h2>Commentz From:</h2>
		<form id="answerForm" class="form-horizontal" action="from.php" method="post">
			<?php 
// Show a popup with the users to see comments from.
//
$uTools = new UserTools();
$uTools->showUserPopup($fromID, true);
// Hidden field containing the id of the person that we want to see comments from.
echo '<input id="fromID" name="fromID" type="hidden" value="' . $fromID . '">';
// Show selected user site link.
echo '<br><br><label for="link">Site Link:</label>' . "\n";
$link = $fromUser->link;
if ($link == null) {
    echo "No link defined yet for this user.\n";
} else {
    echo '<a id="link" href="' . $link . '" target="_BLANK">' . $link . '</a>' . "\n";
}
// Show selected user blog link.
echo '<br><br><label for="link">Blog Link:</label>' . "\n";
$blog = $fromUser->blog;
if ($blog == null) {
예제 #12
0
<?php

//login.php
require_once 'includes/global.inc.php';
$error = "";
$email = "";
$password = "";
//check to see if they've submitted the login form
if (isset($_POST['submit-login'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];
    $userTools = new UserTools();
    if ($userTools->login($email, $password)) {
        //successful login, redirect them to a page
        header("Location: index.php");
    } else {
        $error = "Incorrect E-mail or password. Please try again.";
    }
}
?>

<!DOCTYPE html>
<html>
<head>
	<title>Login</title>
	<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
예제 #13
0
        if (!$feature->isEnabled()) {
            ?>
 style="text-decoration: line-through"<?php 
        }
        ?>
>
		<input id="feature_<?php 
        echo UserTools::escape($feature->getID());
        ?>
" type="checkbox" name="feature[<?php 
        echo UserTools::escape($feature->getID());
        ?>
]"<?php 
        echo $feature->isEnabledForUser($user) ? ' checked="true"' : '';
        ?>
>
		<label for="feature_<?php 
        echo UserTools::escape($feature->getID());
        ?>
"><?php 
        echo UserTools::escape($feature->getName());
        ?>
</label>
		</div><?php 
    }
    ?>
	<input type="submit" name="savefeatures" value="update features">
	</form>
<?php 
}
require_once dirname(__FILE__) . '/footer.php';
예제 #14
0
				$("#answerForm").submit();
			});
		})
	   </script>
	</head>
	<body>
	<?php 
showNavbar($user, "To");
?>
	<div class="container">
		<h2>Commentz To:</h2>
		<form id="answerForm" class="form-horizontal" action="index.php" method="post">
			<?php 
// Show a popup with the users to send comments to.
//
$uTools = new UserTools();
$uTools->showUserPopup($toID);
// Hidden field containing the id of the person that the comments are intended for.
echo '<input id="toID" name="toID" type="hidden" value="' . $toID . '">';
// Show selected user site link.
echo '<br><br><label for="link">Site Link:</label>' . "\n";
$link = $toUser->link;
if ($link == null) {
    echo "No link defined yet for this user.\n";
} else {
    echo '<a id="link" href="' . $link . '" target="_BLANK">' . $link . '</a>' . "\n";
}
// Show selected user blog link.
echo '<br><br><label for="link">Blog Link:</label>' . "\n";
$blog = $toUser->blog;
if ($blog == null) {
예제 #15
0
@session_start();
if (!@(require "Config/Main.php")) {
    die;
}
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/UserTools.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/GenericMessages.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/UserTools.php";
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/UserTools.tpl.php")) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/LoggedOnly.class.php";
    new LoggedOnly();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
    $db = new MuDatabase();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
    $acc = new Account($db);
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/UserTools.class.php";
    $ut = new UserTools();
    $tpl = new Template();
    $my_array['UserToolsTitle'] = "";
    $my_array['UserToolsContent'] = "";
    $my_array['WarningMessage'] = "";
    if (isset($UserToolsRequiresSNO) && $UserToolsRequiresSNO && (!isset($_SESSION['sno__numb']) || $_SESSION['sno__numb'] === false)) {
        $sno_tpl['url'] = $_SERVER['REQUEST_URI'];
        if (!isset($_SESSION['sno__numb'])) {
            $sno_tpl['Feedback'] = "";
        } else {
            if ($_SESSION['sno__numb'] === false) {
                $sno_tpl['Feedback'] = $GenericMessage09;
            }
        }
        $tpl->Assign($sno_tpl);
        $tpl->Display("Templates/{$MainTemplate}/SNO.tpl.php");
예제 #16
0
<?php

require_once 'classes/User.class.php';
require_once 'classes/UserTools.class.php';
require_once 'classes/DB.class.php';
//connect to the database
$db = new DB();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//start the session
session_start();
$current_user;
$logged_in = false;
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $current_user = unserialize($_SESSION['user']);
    $_SESSION['user'] = serialize($userTools->get($current_user->id));
    $current_user = unserialize($_SESSION['user']);
    $logged_in = true;
}
예제 #17
0
<?php

error_reporting(E_ERROR | E_PARSE | E_WARNING);
// error_reporting(E_ALL);
//start the session
session_start();
// Requirements
require_once '../../libs/nocsrf.php';
require_once '../../classes/User.class.php';
require_once '../../classes/UserTools.class.php';
require_once '../../classes/DB.class.php';
require_once '../../classes/Account.class.php';
require_once '../../includes/constants.inc.php';
require_once '../../utils/InputValidation.util.php';
//connect to the database
$db = DB::getInstance();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $user = unserialize(Validation::xss_clean($_SESSION['user']));
    $_SESSION['user'] = serialize($userTools->get(Validation::xss_clean($_SESSION["emailId"])));
}
예제 #18
0
                        <div class="list-wrap noborder">

                            <div id="featured2">

                                <table id="usertable">
                                    <thead>
                                        <tr>
                                            <th>Id</th>
                                            <th>Name</th>
                                            <th>LinkedIn Id</th>
                                            <th>Company</th>
                                        </tr>
                                    </thead>
                                    <tbody>
									<?php 
$userTools = new UserTools();
$users = $userTools->getAll();
foreach ($users as $user) {
    ?>
                                           <tr>
                                                <td><?php 
    echo $user['id'];
    ?>
</td>
                                                <td><?php 
    echo $user['name'];
    ?>
</td>
                                                <td><?php 
    echo $user['linkedin_id'];
    ?>
예제 #19
0
<?php

//global.inc.php
//start the session
session_name("Commentz");
session_start();
require_once 'classes/User.class.php';
require_once 'classes/UserTools.class.php';
require_once 'classes/DB.class.php';
require_once 'includes/navbar.inc.php';
require_once 'includes/utils.inc.php';
//connect to the database
$db = new DB();
$db->connect();
//initialize UserTools object
$userTools = new UserTools();
//refresh session variables if logged in
if (isset($_SESSION['logged_in'])) {
    $user = unserialize($_SESSION['user']);
    $_SESSION['user'] = serialize($userTools->get(3));
}
예제 #20
0
#userbase-passwordreset-form input:focus {
	background: #fff;
}
</style>


<div id="userbase-passwordreset">
<h2>Password reset</h2>

<form id="userbase-passwordreset-form" action="" method="POST">
<fieldset>
<legend>Please enter new password</legend>
<ul>
<li><label>New password</label><input name="pass" type="password" size="25" autocomplete="off"/><?php 
echo array_key_eXists('pass', $errors) ? ' <span style="color:red" title="' . UserTools::escape($errors['pass']) . '">*</span>' : '';
?>
</li>
<li><label>Repeat new password</label><input name="repeatpass" type="password" size="25" autocomplete="off"/><?php 
echo array_key_exists('repeatpass', $errors) ? ' <span style="color:red" title="' . UserTools::escape($errors['repeatpass']) . '">*</span>' : '';
?>
</li>
<li><button id="userbase-passwordreset-button" type="submit" name="save">Save changes</button></li>
</ul>
</fieldset>
</form>

</div>

<?php 
require_once UserConfig::$footer;
예제 #21
0
    ?>
<h2>Other accounts</h2>
<p>Click on account name to open it:</p>
<ul>
<?php 
    foreach ($manageable_accounts as $account) {
        if ($account->isTheSameAs($managed_account)) {
            ?>
<li><b><?php 
            echo UserTools::escape($account->getName());
            ?>
</b></li><?php 
        } else {
            ?>
<li><a href="<?php 
            echo UserConfig::$USERSROOTURL;
            ?>
/manage_account.php?account=<?php 
            echo $account->getID();
            ?>
"><?php 
            echo UserTools::escape($account->getName());
            ?>
</a></li><?php 
        }
    }
    ?>
</ul>
<?php 
}
require_once UserConfig::$footer;
예제 #22
0
<?php

//welcome.php
require_once 'includes/global.inc.php';
require_once 'classes/OrderTool.class.php';
//check to see if they're logged in
// if(!isset($_SESSION['logged_in'])) {
// 	header("Location: http://localhost:9000/login.html");
// }
//get the user object from the session
//$user = unserialize($_SESSION['user']);
//Get userID and token to know if have valid session
//
//token=f766a167-9f28-4088-94c4-886fc98b2758
$userTools = new UserTools();
$userId = $_GET['userId'];
$token = $_GET['token'];
$username = $_GET['username'];
$orderId = $_GET['order'];
$orders = array();
if ($token != '' && $userId != '') {
    if ($userTools->checkSession($userId, $token)) {
        //get the orders/ all orders
        $orderTool = new OrderTool();
        $orders = $orderTool->getOrder($orderId);
        // <script type="text/javascript">
        // 	jsFunction();
        // </script>
    } else {
        //header("Location: login.php");
        header("Location: 404.php");
예제 #23
0
<?php

session_start();
require_once 'inc/global.inc.php';
$UserTools = new UserTools();
$UserTools->logout();
header('location:index.php');
예제 #24
0
//инициализируем php переменные, которые используются в форме
$username = "";
$password = "";
$password_confirm = "";
$email = "";
$error = "";
//проверить отправлена ли форма
if (isset($_POST['submit-form'])) {
    //получить переменные $_POST
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password_confirm = $_POST['password-confirm'];
    $email = $_POST['email'];
    //инициализировать переменные для проверки формы
    $success = true;
    $userTools = new UserTools();
    //проверить правильность заполнения формы
    //проверить не занят ли этот логин
    if ($userTools->checkUsernameExists($username)) {
        $error .= "That username is already taken.<br/> \n\r";
        $success = false;
    }
    //проверить совпадение паролей
    if ($password != $password_confirm) {
        $error .= "Passwords do not match.<br/> \n\r";
        $success = false;
    }
    if ($success) {
        //подготовить информацию для сохранения объекта нового пользователя
        $data['username'] = $username;
        $data['password'] = md5($password);
예제 #25
0
<?php

// question.php
// Handle insert, update and delete of
// an individual question.
//
require_once 'includes/global.inc.php';
require_once 'classes/Question.class.php';
require_once 'classes/QuestionTools.class.php';
//check to see if they're logged in
if (!isset($_SESSION['logged_in'])) {
    header("Location: login.php");
}
//get the user object from the session
$userID = $_SESSION["userID"];
$uTool = new UserTools();
$user = $uTool->get($userID);
if ($user->userPriv != 'A') {
    header("Location: index.php");
}
$question = null;
$questionID = "";
$mode = "";
//check to see that the form has been submitted
if (isset($_POST['questionID'])) {
    $questionID = $_POST['questionID'];
    $data['id'] = $questionID;
    $data['title'] = $_POST['title'];
    $data['type'] = $_POST['type'];
    $data['text'] = $_POST['text'];
    $question = new Question($data);
예제 #26
0
파일: login.php 프로젝트: kArTeL/FruitStore
<?php

//login.php
require_once 'includes/global.inc.php';
$error = "";
$username = "";
$password = "";
//check to see if they've submitted the login form
if (isset($_POST['submit-login'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $userTools = new UserTools();
    if ($userTools->login($username, $password)) {
        //successful login, redirect them to a page
        header("Location: index.php");
    } else {
        $error = "Incorrect username or password. Please try again.";
    }
}
?>

<html>
<head>
	<title>Login</title>
</head>
<body>
<?php 
if ($error != "") {
    echo $error . "<br/>";
}
?>
예제 #27
0
        exit;
    }

    //retrieve the $_POST variables
    $firstName = Validation::xss_clean(DB::makeSafe($_POST["firstName"]));
    $middleName = Validation::xss_clean(DB::makeSafe($_POST["middleName"]));
    $lastName = Validation::xss_clean(DB::makeSafe($_POST["lastName"]));
    $emailId = Validation::xss_clean(DB::makeSafe($_POST["emailId"]));
    $mobileNo = Validation::xss_clean(DB::makeSafe($_POST["mobileNo"]));
    $password = Validation::xss_clean(DB::makeSafe($_POST["password"]));
    $password_confirm = Validation::xss_clean(DB::makeSafe($_POST['retypePassword']));
	$securityType = Validation::xss_clean(DB::makeSafe($_POST['radio']));

    //initialize variables for form validation
    $success = true;
    $userTools = new UserTools();
    
    //validate that the form was filled out correctly
    if (filter_var($emailId, FILTER_VALIDATE_EMAIL) != true) {
        $success = false;
        ?>
        <script>
          alert("Email Validation Failed");
        </script>
        <?php
    }

    if (!preg_match("/(\d{11})/", $mobileNo)) {
        $success = false;
        ?>
        <script>
예제 #28
0
<?php

/**
 * Created by PhpStorm.
 * User: Alexandr
 * Date: 01.02.16
 * Time: 13:44
 */
$config::$menu = "login";
config::$page = "Авторизация";
if (isset($_POST['sub']) && $_POST['captcha'] == $_SESSION['captcha']) {
    $login = new UserTools();
    $login->login($_POST);
} elseif (isset($_POST['sub']) && $_POST['captcha'] !== $_SESSION['captcha']) {
    $_SESSION['reg_error_captcha'] = "Не верный код капчи";
}
//echo $_COOKIE['auth'];
예제 #29
0
session_start();
require_once '../../php/classes/obj/Group.class.php';
require_once '../../php/classes/obj/User.class.php';
require_once '../../php/classes/db/DB.class.php';
require_once '../../php/classes/controller/GroupTools.class.php';
require_once '../../php/classes/controller/UserTools.class.php';
/*
require_once '../classes/obj/Group.class.php';
require_once '../classes/obj/User.class.php';
require_once '../classes/db/DB.class.php';
require_once '../classes/controller/GroupTools.class.php';
require_once '../classes/controller/UserTools.class.php';
*/
$db = new DB();
$db->connect();
$userTools = new UserTools();
$groupTools = new GroupTools();
if (isset($_POST['getGroup'])) {
    echo json_encode($groupTools->get($_SESSION['groupID']));
} else {
    if (isset($_POST['getMember'])) {
        echo "getting member " . $_POST['getMember'];
        echo json_encode($userTools->get($_POST['getMember']));
    }
}
/*
session_start();
if(isset($_SESSION['logged_in'])){
	$user = unserialize($_SESSION['user']);
	$_SESSION['user'] = serialize($userTools->get($user->id));
}
예제 #30
0
// allows them to see their comments to every other
// student (also ordered by question).
//
// Clicking on a user name allows them to see either
// all of that person's answers to them or all of their
// answers to that person depending on which report is
// being viewed (controlled via radio button).
//
require_once 'includes/global.inc.php';
require_once 'classes/Answer.class.php';
require_once 'classes/AnswerTools.class.php';
//check to see if they're logged in
if (!isset($_SESSION['logged_in'])) {
    header("Location: login.php");
}
$uTool = new UserTools();
$aTool = new AnswerTools();
//get the user object from the session
$userID = $_SESSION["userID"];
if ($userID == "") {
    echo "Lost userID SESSION variable...<br>";
    $uTool->logout();
    header("Location: login.php");
}
$user = $uTool->get($userID);
// Which report? From or To?
//
if (isset($_POST['reportType'])) {
    $mode = $_POST['reportType'];
} else {
    $mode = "from";