aca van los codigos:
user.php
Código
<?php require('config.php'); require('functions.php'); //make connection to dbase //build and issue the query $sql ="SELECT * FROM $table_name"; ?> <html> <head> <title>Bienvenidos</title> </head> <body> <p>Entraste con el Nick:</p> <?php echo $_SESSION[user_name]; ?> <form name="form1" method="post" action="username.php"> <label>Cambiar nombre de usuario <input type="text" name="username.php"> </label> <p> </p> <label></label> <input type="submit" name="Submit" value="Cambiar"> </form> <p> </p> </body> </html>
config.php no hace falta...
username.php
Código
<?php //function to get the date function last_login() { return $date; } //function that sets the session variable function sess_vars($base_dir, $server, $dbusername, $dbpassword, $db_name, $table_name, $user, $pass) { //make connection to dbase $sql = "SELECT * FROM $table_name WHERE username = '$user' and password = password('$pass')"; //get the number of rows in the result set //set session variables if there is a match if ($num != 0) { { $_SESSION[first_name] = $sql -> firstname; $_SESSION[last_name] = $sql -> lastname; $_SESSION[user_name] = $sql -> username; $_SESSION[password] = $sql -> password; $_SESSION[group1] = $sql -> group1; $_SESSION[group2] = $sql -> group2; $_SESSION[group3] = $sql -> group3; $_SESSION[pchange] = $sql -> pchange; $_SESSION[email] = $sql -> email; $_SESSION[redirect] = $sql -> redirect; $_SESSION[verified] = $sql -> verified; $_SESSION[last_login] = $sql -> last_login; } }else{ $_SESSION[redirect] = "$base_dir/errorlogin.html"; } } //functions that will determine if access is allowed function allow_access($group) { if ($_SESSION[group1] == "$group" || $_SESSION[group2] == "$group" || $_SESSION[group3] == "$group" || $_SESSION[group1] == "Administrators" || $_SESSION[group2] == "Administrators" || $_SESSION[group3] == "Administrators" || $_SESSION[user_name] == "$group") { $allowed = "yes"; }else{ $allowed = "no"; } return $allowed; } //function to check the length of the requested password function password_check($min_pass, $max_pass, $pass) { $valid = "yes"; { $valid = "no"; } return $valid; } ?>
en functions.php hay mas cosas pero esta lo que seria la parte de username.
alguna idea?