<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Impossibile cancellare utente]]></title><description><![CDATA[<p dir="auto">Ciao a tutti!<br />
Sto modificando uno script che permetta all'admin di aggiungere utenti ad un'area riservata.Ho quasi finito il tutto, già riesco ad aggiungere e modificare un utente, il problema è quando devo eliminare l'utente stesso. Infatti mi dice che non ho i permessi per farlo, eppure sono loggato come admin. Lo script non ha DB, ma si appoggia ad un'altra pagina (users.php).<br />
Vi posto la parte del codice che dovrebbe essere modificata:</p>
<pre><code class="language-php">&lt;?php
session_start();    // Maintain session state
header("Cache-control: private");    // Fixes IE6's back button problem.

// Check that we are logged in and an admin
if(@$_SESSION["permission"] &gt; 1){

    // Check if we have a number to mod
    if(@$_GET["del"]){
        // Check if we have already made changes and want
        // to post
        if(@$_GET["go"]){
            // Get the line number we are changing
            $id = $_GET["del"];

            // Dont allow the first user to be deleted
            if($id == 1){
                // Redirect to del page
                header("location: delUser.php?dontDelete=1");
            }
            else{
                // Get the original vars
                $file = file("users.php");

                // Create the new file structure
                #1. before line
                for($i = 0; $i &lt; $id; $i++){
                    $oldLines[$i] = $file[$i];
                }
                #2. after line
                for($i = ($id +1); $i &lt; sizeof($file); $i++){
                    $oldLines[$i] = $file[$i];
                }

                // Replace users file
                $fp = fopen("users.php", "w");

                // Add contents
                for($i = 0; $i &lt; sizeof($file); $i++){
                    if($i != $id) fwrite($fp, $oldLines[$i]);
                    else fwrite($fp, "//\r\n");
                }

                // Close file
                fclose($fp);
                
                // Redirect to del page
                header("location: delUser.php?deleted=1");
            }
        }
        ?&gt;
        &lt;script language = "javascript" type = "text/javascript"&gt;
        &lt;!-- // Confirm user wants to delete this user
            if(confirm("Are you sure that you want to delete this user?\nThis action cannot be undone.") == 1) location.href = '&lt;?php print($_SERVER["PHP_SELF"]. "?del=". $_GET["del"]."&amp;amp;go=1");?&gt;';
            else location.href = 'delUser.php';
        --&gt;
        &lt;/script&gt;
        &lt;?php
    }
    else{
    ?&gt;
</code></pre>
<p dir="auto">Grazie <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://dev.connect.gt/topic/128722/impossibile-cancellare-utente</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 15:35:51 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/128722.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Jun 2010 08:49:17 GMT</pubDate><ttl>60</ttl></channel></rss>