Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Sessione Vs Post

  1. #1

    Sessione Vs Post

    Salve, continuo ad avere un problema con la sessione....

    illustro...

    ho la pagina NewUser.php che è accessibile solamente se si è loggati dalla pagina iniziale login che genera una sessione e la variabile viene inviata alla Login2 che provvede a verificare se si è utenti o amministratori, se si è amministratori si viene indirizzati alla pagina NewUser.php, che si occupa di creare nuovi utenti facendo un POST a se stesso, ma qualcosa va in casino nella fase del POST...

    ecco il codice ....grazie

    codice:
    <? 
    $hosts="192.168.0.2:3306";
    $userdb="web";
    $passdb="xxx";
    $db="dps";
    mysql_connect("$hosts","$userdb","$passdb") or die ("Impossibile connettersi alla base dati");
    mysql_select_db("$db") or die ("Impossibile selezionare il database");
    
    // Anti-Notice
    $_POST['descrizione'] = isSet($_POST['descrizione']) ? $_POST['descrizione'] : '';
    $_POST['user2'] = isSet($_POST['user2']) ? $_POST['user2'] : '';
    $_POST['password'] = isSet($_POST['password']) ? $_POST['password'] : '';
    $_POST['gruppo'] = isSet($_POST['gruppo']) ? $_POST['gruppo'] : '';
     
    @$user = $_SESSION['user'];
    
    
    
    if ($user == "")
    {
    $percorso = $_SERVER['HTTP_HOST'].$_SERVER['PATH_INFO'];
    $ip_hack = $_SERVER['REMOTE_ADDR'];
    $time = date("H:i:s");
    echo "Non si ha accesso a questa pagina !!!";
    mail("xxxxxxxxxx@xxxxxxxxxxx.com","Accesso Fraudolento","Tentativo di accesso non autorizzato in $percorso da $ip_hack alle $time","From: xxxxx@xxxxxx.com");
    }
    else
    {
    ?>
    
    <html>
    <head>
    <title>Admin Page - New User</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
    </head>
    <body>
    <div align="center">
      <table width="731" border="0" cellpadding="0" cellspacing="0">
        
        <tbody>
          <tr> 
            <td height="95" colspan="9" valign="top"><table width="100%" height="93" border="0" cellpadding="0" cellspacing="0" background="../img-site/admin-img.gif">
                
                <tr> 
                  <td width="731" height="2" valign="top"> </td>
                </tr>
                <tr> 
                  <td height="77" background="../img-site/admin-img.gif"></td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td width="101" height="37"></td>
            <td width="138"></td>
            <td width="15"></td>
            <td width="96"></td>
            <td width="40"></td>
            <td width="100"></td>
            <td width="19"></td>
            <td width="136"></td>
            <td width="86"></td>
          </tr>
          <tr> 
            <td height="123"></td>
            <td></td>
            <td></td>
            <td colspan="3" align="center" valign="top" axis="1"> <table border="2" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FF3300">
                
                <tbody width="230" bgcolor="#00FFCC">
                  <tr bordercolor="#FF3300" bgcolor="#FF3300" width="220"> 
                    <td width="85"> <label><font size="2" face="Arial, Helvetica, sans-serif">Descrizione 
                      :</font></label></td>
                    <form method="post" action="NewUser.php" enctype="multipart/form-data">
                      <td width="120"> <input name="descrizione" type="text" size="20" maxlength="60"></td>
                      <td width="21"></td>
                      <tr bordercolor="#FF3300" bgcolor="#FF3300" width="220"> 
                        <td> <label><font size="2" face="Arial, Helvetica, sans-serif">User 
                          :</font></label></td>
                        <td> <input name="user2" type="text" size="20" maxlength="10"></td>
                        <td></td>
                      <tr bordercolor="#FF3300" bgcolor="#FF3300" width="220"> 
                        <td> <label><font size="2" face="Arial, Helvetica, sans-serif">Password 
                          :</font></label></td>
                        <td> <input name="password" type="password" size="10" maxlength="8"> 
                          <font size="1">(max 8 car.)</font> </td>
                        <td></td>
    					<tr bordercolor="#FF3300" bgcolor="#FF3300" width="220"> 
                        <td> <label><font size="2" face="Arial, Helvetica, sans-serif">Gruppo 
                          :</font></label></td>
                          <td><select name="gruppo" size="1">
                              <option>Admin</option>
                              <option selected>User</option>
                            </select></td>
    						<input  name="user" type="hidden" value="<? echo $user;?>">
                      <tr bordercolor="#FF3300" bgcolor="#FF3300"> 
                        <td height="21"></td>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr bordercolor="#FF3300" bgcolor="#FF3300"> 
                        <td height="26" colspan="2" align="center"> 
    
     
                            <input name="Crea" type="submit" value="Crea Utente">
                            <input type="reset" name="Reset" value="Reimposta">
                          </p></td>
                    </form>
                    <td></td>
                  </tr>
                </tbody>
              </table></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height="20"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td height="15"></td>
            <td></td>
            <td></td>
            <td></td>
            <td valign="top"><a href="Logout.php"> 
              <h5>Logout</h5>
              </a></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td height="17"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height="12"></td>
            <td colspan="7" valign="top"><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">Documento 
                Pubblica Sicurezza</font></div></td>
            <td></td>
          </tr>
          <tr> 
            <td height="25"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height="146"></td>
            <td></td>
            <td colspan="5" valign="top"> 
    <?
    //Dichiara Variabili
    $descrizione = $_POST['descrizione'];
    $user2 = $_POST['user2'];
    $password = $_POST['password'];
    $gruppo = $_POST['gruppo'];
    $select = "select user from userlogin where user='{$user2}'";
    $select_adm="select user from userlogin where user='{$user2}' and gruppo='User'";
    $insert = "insert into userlogin (user,password,descrizione,gruppo) values ('{$user2}','{$password}','{$descrizione}','{$gruppo}')";
    
    $result = mysql_num_rows(mysql_query($select));
    if (($user2) && ($password) > "")
      {
       echo "Utente      : \"$user2\"\n\n
    ";
       echo "
    ";
       echo "Password    : \"$password\"\n\n
    ";
       echo "
    ";
         if ($result == 0)
           {
            mysql_query($insert);
    	    echo "<h3>Utente Inserito con successo !</h3>\n\n
    ";
    		$result_adm = mysql_num_rows(mysql_query($select_adm)); 
    		 if ($result_adm == 1)
    		 {		         
    		 @mkdir("infiles/$user2/");
    		 }
    	     else {
    		 }
    	}
    	else
    	{
    	echo "[b]<font color=\"#00DD77\"><h3>Utente presente nel DataBase !!!</h3></font>[b]\n\n
    ";
    	echo "<a href=DelUser.php?utente=$user2>Elimina</a>";
    	}  
    }
    ?>
            </td>
            <td></td>
            <td></td>
          </tr>
          <tr> 
            <td height="228"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
        </tbody>
      </table>
    </div>
    
    </body>
    </html>
    <?
    }
    ?>

    io ci provo anche se è dura!!!
    vieni a trovarmi http://www.netlabit.com

  2. #2
    up

    io ci provo anche se è dura!!!
    vieni a trovarmi http://www.netlabit.com

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.