Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'header.php';
- require_once 'conn.php';
- require_once 'functions.php';
- $userid = $username = $usercognome = $usersesso = $usercitta = $useremail = $password = $accesslvl = '';
- $mode = "Create";
- if (isset($_SESSION['user_id']))
- { $userid = antixsq($_SESSION['user_id']);
- $mode = "Edit";
- if ( isset($_GET['user']) )
- {
- if ( ($userid == $_GET['user']) || ($_SESSION['access_lvl'] > 2) )
- {
- $userid = antixsq($_GET['user']);
- $mode = "Modify";
- }
- }
- $sql = "SELECT * FROM forum_users WHERE id=".$userid;
- $result = mysql_query($sql) or die('Could not look up user data; ' . mysql_error());
- $row = mysql_fetch_array($result);
- $username = $row['name'];
- $usercognome = $row['cognome'];
- (int)$usersesso = (int)$row['sesso'];
- $usercitta = $row['citta'];
- $passwd = $row['passwd'];
- $useremail = $row['email'];
- $accesslvl = $row['access_lvl'];
- $signature = $row['signature'];
- $musica = $row['musica'];
- $film = $row['film'];
- $TV = $row['TV'];
- $libri = $row['libri'];
- $sport = $row['sport'];
- $hobby = $row['hobby'];
- }
- if ($mode == "Edit")
- {
- include('divsinistra.php');
- echo '<div id="content">';
- echo '<code><a href="index.php">Home</a> · Impostazioni</code>';
- }
- global $errors; // questo per rendere disponibile anche nella funzione la matrice contenente gli eventuali errori
- if(count($errors) != 0){
- display_errors();
- }
- ?>
- <center><h2><code><?php echo $mode;?> Account</code></h2></center>
- <?php echo '<form method="post" action="transact-user.php">';?>
- <br />
- <table border="0" width="90%" align="center" >
- <tr>
- <td align="left"><font color="gray"><code>Nome:</code></font></td>
- <td><input type="text" class="txtinput" id="nome" name="name" maxlength="30" value="<?php echo $row['name']; ?>"></td>
- </tr>
- <tr>
- <td align="left"><font color="gray"><code>Cognome:</code></font></td>
- <td><input type="text" class="txtinput" id="nome" name="cognome" maxlength="30" value="<?php echo $row['cognome']; ?>"></td>
- </tr>
- <tr>
- <td align="left">
- <legend><font color="gray"><code>Sesso:</code></font></legend></td>
- <td align="left">
- <font color="gray"><code>M</code></font><input type="radio" name="sesso" <?php if ($row['sesso']=="1"){echo 'checked="checked"';} else {(int)$usersesso= "1";}?> value="<?php echo (int)$usersesso ;?>"/>
- <font color="gray"><code>F</code></font><input type="radio" name="sesso" <?php if ($row['sesso']=="0"){echo 'checked="checked"';} else {(int)$usersesso= "0";}?> value="<?php echo (int)$usersesso ;?>"/>
- <font color="gray"><code>
- <?php
- if(isset($_SESSION['name'])){
- if ($row['sesso'] =="1"){
- echo 'Uomo';}
- else{ echo 'Donna';
- } }
- ?>
- </code></font>
- </td>
- </tr>
- <tr>
- <td align="left"><font color="gray"><code>Città:</code></font></td>
- <td>
- <input type="text" class="txtinput" id="citta" name="citta" maxlength="30" value="<?php echo $usercitta; ?>"></td>
- </td>
- </tr>
- <tr>
- <td align="left"><font color="gray"><code>Email:</code></font></td>
- <td><input type="text" class="txtinput" id="email" name="email" maxlength="30" value="<?php echo $useremail; ?>"></td>
- </tr>
- <?php
- if ($mode == "Modify") {
- echo "<div><fieldset>\n";
- echo " <legend>Access Level</legend>\n";
- $sql = "SELECT * FROM forum_access_levels ORDER BY access_lvl DESC";
- $result = mysql_query($sql,$dbh)
- or die('Could not list access levels; ' . mysql_error());
- while ($row = mysql_fetch_array($result)) {
- echo ' <input type="radio" class="radio" id="acl_' .
- $row['access_lvl'] . '" name="accesslvl" value="' .
- $row['access_lvl'] . '" ';
- if ($row['access_lvl'] == $accesslvl) {
- echo 'checked ';
- }
- echo '>' . $row['access_name'] . "<br>\n";
- }
- echo "</fieldset></div>";
- }
- if ($mode != "Modify") echo "<div id=\"passwords\">";
- if ($mode == "Edit") {
- if (isset($_GET['error']) and $_GET['error'] == "nopassedit") {
- echo "<span class=\"error\">Could not modify passwords.";
- echo " Please try again.</span><br>";
- }
- ?>
- <tr>
- <td align="left"><font color="gray"><code>Vecchia Password:</code></font></td>
- <td><input type="password" id="passwd" name="oldpasswd" maxlength="50" value="<?php if (isset($_SESSION['name'])) {echo $passwd;} ?>"></td>
- </tr>
- <?php
- }
- if ($mode != "Modify") {
- ?>
- <tr>
- <td align="left"><font color="gray"><code>Password:</code></font></td>
- <td><input type="password" id="passwd" name="passwd" maxlength="50" value="<?php if (isset($_SESSION['name'])) {echo $passwd;} ?>"></td>
- </tr>
- <tr>
- <td align="left"><font color="gray"><code>Verifica Password:</code></font></td>
- <td><input type="password" id="passwd" name="passwd2" maxlength="50" value="<?php if (isset($_SESSION['name'])) {echo $passwd;} ?>"></td>
- </tr>
- <?php }
- if ($mode != "Modify") echo "</div>";
- if ($mode != "Create") {
- ?>
- <table border="0" width="90%" align="center">
- <tr>
- <td align="left"><font color="gray"><code>Firma:</code></font></td>
- <td a><textarea name="signature" id="signature" cols="40" rows="1"><?php
- echo $signature; ?></textarea></td>
- </tr>
- <tr>
- <td align="left"><font color="gray"><code>Musica:</code></font></td>
- <td a><textarea name="musica" id="musica" cols="40" rows="1"><?php
- echo $musica; ?></textarea></td>
- </tr>
- <td align="left"><font color="gray"><code>Film:</code></font></td>
- <td a><textarea name="film" id="film" cols="40" rows="1"><?php
- echo $film; ?></textarea></td>
- </tr>
- <td align="left"><font color="gray"><code>Programmi TV:</code></font></td>
- <td a><textarea name="TV" id="TV" cols="40" rows="1"><?php
- echo $TV; ?></textarea></td>
- </tr>
- <td align="left"><font color="gray"><code>Libri:</code></font></td>
- <td a><textarea name="libri" id="libri" cols="40" rows="1"><?php
- echo $libri; ?></textarea></td>
- </tr>
- <td align="left"><font color="gray"><code>Sport:</code></font></td>
- <td a><textarea name="sport" id="sport" cols="40" rows="1"><?php
- echo $sport; ?></textarea></td>
- </tr>
- <td align="left"><font color="gray"><code>Hobby:</code></font></td>
- <td a><textarea name="hobby" id="hobby" cols="40" rows="1"><?php
- echo $hobby; ?></textarea></td>
- </tr>
- <?php } ?>
- <tr>
- <td><input class="blackbutton" type="submit" name="action" value="<?php echo $mode; ?> Account"></td>
- <?php if ($mode == "Edit") {?>
- <td><input type="hidden" name="accesslvl" value="<?php echo $accesslvl; ?>"></td>
- <?php } ?>
- <td><input type="hidden" name="userid" value="<?php echo $_SESSION['user_id']; ?>"></td>
- </tr>
- </table>
- </form>
- </div>
- <?php
- if ($mode == "Edit") {
- include('footer.php');?>
- </div>
- </body>
- </html>
- <?php
- }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement