Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/web/activate.php
<?php
/**
 * Product: Katyshop
 * @version 0.3.2.1
 * @author Catalin Hulea - hide@address.com
 * @copyright Copyright (C) 2007 Catalin Hulea
 * @license GNU General Public License version 3
 * 			You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
 * @link https://sourceforge.net/projects/katyshop
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 */
require_once(dirname(__FILE__) . "/init.php");

if(!empty($_GET["username"]))
{
	$db = Application::getDb();
	$u = $db->tbUser->getUserByUsername($_GET["username"]);
	$u = Factory::instantiateUser($u);
	if($u->id == 0)
	{
		Application::addError("Acest username nu a putut fi gasit");
	}
	elseif($u->isActive())
	{
		Application::addMessage("Contul este activ, acum va puteti loga");
		Tools::redirect("login.php", true);
	}
	elseif($u->isDeactivated())
	{
		$errors[] = "Acest user a fost dezactivat de un admin si nu poate fi folosit pentru autentificare. Va rugam sa contactati departamentul de suport";
	}
	elseif($u->activation_code == @$_GET["activation_code"])
	{
		$u->activate();
		$db->tbUser->updateObj($u);
		Application::addMessage("Felicitari, contul dumneavoastra a fost activat. Acum va puteti loga.");
		Tools::redirect("login.php", true);
	}
	elseif($u->activation_code != @$_GET["activation_code"])
	{
		Application::addError("Cod de activare gresit");
	}
}
?>
<html>
<head>
<title><?php echo APP_NAME; ?></title>
<?php require_once(WEB_DIR . "/includes/html_head.php"); ?>
</head>

<body>
<div id="container">
<?php require_once(WEB_DIR . "/includes/header.php"); ?>
<div id="middle">
<div id="left_vertical_line">
<?php require_once(WEB_DIR . "/includes/left.php"); ?>
<div id="content">
<h1>Activare cont de utilizator</h1>
<?php require_once(WEB_DIR . "/includes/print_messages.php"); ?>

<dl>
<dt></dt>
<dd>
<form method="get" action="activate.php">
<table>
<tr>
<td>Username: </td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Cod de activare: </td>
<td><input type="text" name="activation_code"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="text-align: right; "><input type="submit" value="Activati" class="button"></td>
</tr>
</table>
</form>
</dd>
</dl>

</div>
<?php require_once(WEB_DIR . "/includes/right.php"); ?>
<?php require_once(WEB_DIR . "/includes/footer.php"); ?>
</div>
</div>
</div>
</body>
</html>
Return current item: Katyshop