topical media & game development
basic-php-13-transact-user.php / php
<?php
require_once 'conn.php';
require_once 'http.php';
if (isset(_REQUEST['action']) {
case 'Login':
if (isset(_POST['passwd']))
{
_POST['email'] . "' " .
"AND passwd='" . result = mysql_query(conn)
or die('Could not look up user information; ' .
mysql_error());
if (result)) {
session_start();
row['user_id'];
row['access_lvl'];
row['name'];
}
}
redirect('index.php');
break;
case 'Logout':
session_start();
session_unset();
session_destroy();
redirect('index.php');
break;
case 'Create Account':
if (isset(_POST['email'])
and isset(_POST['passwd2'])
and _POST['passwd2'])
{
_POST['email'] . "','" .
_POST['passwd'] . "')";
mysql_query(conn)
or die('Could not create user account; ' . mysql_error());
session_start();
conn);
_SESSION['name'] = _POST['name'])
and isset(_POST['accesslvl'])
and isset(sql = "UPDATE cms_users " .
"SET email='" . _POST['name'] .
"', access_lvl=" . _POST['userid'];
mysql_query(conn)
or die('Could not update user account; ' . mysql_error());
}
redirect('admin.php');
break;
case 'Send my reminder!':
if (isset(sql = "SELECT passwd FROM cms_users " .
"WHERE email='" . result = mysql_query(conn)
or die('Could not look up password; ' . mysql_error());
if (mysql_num_rows(row = mysql_fetch_array(subject = 'Comic site password reminder';
row['passwd'] .
"\n\nYou can use this to log in at http://" .
_SERVER['PHP_SELF']) . '/';
mail(subject, _POST['name'])
and isset(_SESSION['user_id']))
{
_POST['email'] .
"', name='" . _SESSION['user_id'];
mysql_query(conn)
or die('Could not update user account; ' . mysql_error());
}
redirect('cpanel.php');
break;
}
}
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.