Location: PHPKode > projects > MyVPN OpenVPN Web Config > http_doc/session.php
<?
include('lib/conf.php');
require_once 'lib/Session.php';
//session_start();

if (($_POST['post']) && ($_POST['post'])==1) {
	$user_name = $_POST['user_name'];
	$pass = md5($_POST['pass']);
}
else {
	$user_name = $_SESSION['user_name'];
	$pass = $_SESSION['pass'];
	$uid = $_SESSION['uid'];
}
if ((isset($_POST['user_name'])) | (isset($_POST['pass']))) {
	session_register("user_name");
	session_register("pass"); // register user_name and pass as session variables.
}
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);

$query="SELECT * FROM USERS WHERE user_name='$user_name' AND pass='$pass'";
$result = mysql_query($query)
or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
$row = mysql_fetch_array($result);
if (!$result || mysql_num_rows($result) < 1) {
	$uid = -1;
	$valid_user = 0;
}
else {
	$uid = $row['id'];
	session_register("uid");

	if (mysql_result($result,0,'status') == '1') $valid_user = 1;
	else $valid_user = 0;
}

if ($valid_user!=1) {

session_unset();   // Unset session variables.
session_destroy(); // End Session we created earlier.

//mysql_close($conn);
}
?>
Return current item: MyVPN OpenVPN Web Config