craygo Posted December 21, 2006 Share Posted December 21, 2006 I got that I need the part that inserts the form into the table.Ray Quote Link to comment Share on other sites More sharing options...
stem Posted December 21, 2006 Author Share Posted December 21, 2006 login.php[code]<?phpsession_start();session_unset();session_destroy();?><?session_start();require('config.php');include('mysql.php');if(isset($_POST['username'])){$username = $_POST['username'];$password = md5($_POST['password']);$getuser = "SELECT * from users WHERE username = '$username' AND password = '$password'"; $result = mysql_query($getuser) or die (mysql_error()); $r = mysql_fetch_array($result); $qualify = mysql_num_rows($result);if($qualify > 0){$_SESSION['username'] = $r['username'];$_SESSION['ugroup'] = $r['type'];?><head><title>Events Login</title><META HTTP-EQUIV="Refresh" content="3;url=eventlist.php"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link href="elder.css" rel="stylesheet" type="text/css" /></head><body><p align=center>Please wait... you will now be redirected to your server page.</p></body></html><?} else {print '<p align=center>Bad username/password<br>Click <a href="login.php">here</a> to return to login page.';}} else {include('login.html');}?>[/code]eventlist.php[code]<?phpsession_start();require('config.php');include('mysql.php');// Check if user is logged inif(isset($_SESSION['username']) && $_SESSION['ugroup'] == 1){$self = $_SERVER['PHP_SELF'];echo "<table width=300 align=center> <tr> <td colspan=2 align=center>Add event here</td> </tr> <form action='changes.php' method=POST> <tr> <td width=100>Host:</td> <td width=200><input type=text name=ehost></td> </tr> <tr> <td width=150>Event:</td> <td width=250><input type=text name=event></td> </tr> <tr> <td width=150>Place:</td> <td width=250><input type=text name=place></td> </tr> <tr> <td colspan=2 align=center><input type=submit name=add value=\"Add Event\"></td> </tr> </form> </table><hr>";include("elist.php");} else {print '<p align=center>Sorry... This is events Staff only Please login <a href="login.php">HERE</a></p>';}?></html>[/code]install.php[Code]<?phpif(isset($_POST['submit'])){// Sql connection hererequire('config.php');include('mysql.php');$password = md5($_POST['password']);$sql = "INSERT INTO users SET username = '".$_POST['username']."', password = '".$password."', ugroup = '".$_POST['ugroup']."'";$res = mysql_query($sql);if(!$res){echo "<b>could not insert new user!!</b><br>Error: ".mysql_error()."<br>SQL: ".$sql."<br>Click <a href=\"install.php\">HERE</a> to return to insert page";} else {echo "New user entered into database<br>Click <a href=\"install.php\">HERE</a> to return to insert page";}} else {?><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Sign up</title></head><body><form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="143" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th scope="col">Username:</th> </tr> <tr> <td><label> <input type="text" name="username" id="username" /> </label></td> </tr> <tr> <th>Password:</th> </tr> <tr> <td><label> <input type="password" name="password" id="password" /> </label></td> </tr> <tr> <th>Group:</th> </tr> <tr> <td><label> <div align="center"> <select name="ugroup"> <option value="1">Admin</option> <option value="2">Staff</option> <option value="3" selected="selected">Trainee</option> </select> </div> </label> </td> </tr> <tr> <td align=center><br><label> <input type="submit" name="submit" value="Submit" id="password" /> </label></td> </tr> </table></form><?php}?></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
craygo Posted December 21, 2006 Share Posted December 21, 2006 yes you need to change this on login.php[code]$_SESSION['username'] = $r['username'];$_SESSION['ugroup'] = $r['type'];[/code]to this[code]$_SESSION['username'] = $r['username'];$_SESSION['ugroup'] = $r['ugroup'];[/code]And put the 2 = signs back in and should be all set.Ray Quote Link to comment Share on other sites More sharing options...
stem Posted December 22, 2006 Author Share Posted December 22, 2006 i havn't had a chance to upload the new things yet :(Webhost has been down hopefully today or tomorrow the servers will be up againand i can see if it's working lol!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.