I have a login system that has login,register,and levels. I also have a admin control panel (admin.php) this is the code for that:
<?php
session_start();
include('/home/neochase/public_html/header.php');
if($_SESSION['level']>2)
{
echo "<h2>ADMIN ACCESS GRANTED!</h2>";
echo "<p><font size='6' face='Century Gothic'>Change a User Level</font>
<form action='aprocess.php' method='POST'>
<table>
<tr>
<td><font size='4' face='arial'>Username</font></td>
<td><font size='4' face='arial'>Level</font></td>
</tr>
<tr>
<td>
<input type='text' name='username'>
</td>
<td>
<select name='level'>
<option>0</option>
<option>2</option>
<option>3</option>
</select>
</td>
<td>
<input type='submit' value='Change!' name='Changed'>
</form>
</td>
</table><hr>";
echo "<font size='6' face='Century Gothic'>Delete a User</font>
<form action='aprocess.php' method='POST'>
<table>
<tr>
<td><font size='4' face='arial'>Username</font></td>
</tr>
<tr>
<td><input type='text' name='username'></td>
<td><input type='submit' value='Change!' name='deleteuser'></td>
</tr>
</table><hr>";
}
else
echo "You must be an administrator to view this page!!!!!!!";
?>
I am trying to get the level change to work. I have a database named neochase_login table named users and id,name,username,password,date,level,and,email
I am working on the level field and here is my code for aprocess.php
<?php
session_start();
$connect = mysql_connect("localhost","username","password") or die("Couldn't connect to db!");
mysql_select_db("neochase_login") or die("Couldn't select db!");
$username = $_POST['username'];
$level = $_POST['level'];
$submit = $_POST['Changed'];
if($submit)//This processes Change User Level
{
$query = "UPDATE `neochase_login`.`users` SET `level` = '$level' WHERE `users`.`username` =$username";
if($query)
echo "Task Completed!";
else
echo "Epic Fail!";
}
else
echo "You aren't supposed to access this file directly!";
?>
I always Get the Task Completed Message 😕 and nothing happens :queasy:
Please Help,
Chase