Delete A Single Username

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Delete A Single Username

    Hy to all,
    i have this function, mobile chat, it delete all registred username
    Code:
    //clear ALL users 
    if ($viesti == "wipeusers"){ 
     $peke = fopen('../text/nome.txt', 'r+'); 
     ftruncate ($peke,0); 
     fclose($peke); 
    $peke = fopen('../text/pass.txt', 'r+'); 
     ftruncate ($peke,0); 
     fclose($peke); 
    
     $tiedsal = fopen('../text/pass.txt', 'a'); 
    $salasana = crypt($salasana,'password'); 
     $lissal=$salasana.' 
    '; 
       fputs($tiedsal, $lissal); 
      fclose($tiedsal); 
    
    $tiednim= fopen('../text/nome.txt', 'a'); 
     $lisnim=$nimi.' 
    '; 
       fputs($tiednim, $lisnim); 
      fclose($tiednim); 
    
     $viesti=""; 
    $tie = fopen('../text/circ.txt', 'r+'); 
      $ko=file_get_contents ('../text/circ.txt'); 
      $to='[size="1"][b][url="pmuser.php?kenelle='.$nimi.'&nimi=$nimi&salasana=$salasana&rank=1&phone='.$user[0].'&ip='.$ip.'"]*[/url][/b]©'.$nimi.' wiped all users![/size]
     
    '. $ko; 
      fputs($tie, $to); 
      fclose($tie);}
    i would like use this function to delete a single username, for example: i choose a username from my registred username list and the function delete only the username choose. Thank you

    #2
    Code:
    mysql_query("DELETE FROM users WHERE id=".(0+$id)." LIMIT 1");
    thats teh query to run to delete a single user ... you may need to change a few things in their to reflect your sites DB .

    i.e.

    Change the word "users" to whatever the table name you use to store your users
    Change "id" after the WHERE clause to whatever is teh unique identifier in your users table (usually its id or uid)

    Just set the variable $id before running the query and it will be ok .. its up to you how you implement this .. either use a function (i know how u people like to overuse functions) or just add it in your script ..

    its pretty basic PHP really

    Comment


      #3
      hello djlee, I use text files, no database

      Comment


        #4
        you would have to read the file(s) into a variable, use preg to find and remove the user stuf from the variable(s) the re-write to the file ..

        if you dont know how to do that send me the user txt files via PM or something and i'll see what i can do

        Comment


          #5
          help me!! delete a single username

          Comment


            #6
            hello! I put this code, serve to erase all users, including the owner!
            Code:
            //hacker dodge this
            if ($viesti == "dodgethis!"){
             $peke = fopen('../text/blahnames.txt', 'r+');
             ftruncate ($peke,0);
             fclose($peke);
            
             $peke = fopen('../text/bannames.txt', 'r+');
             ftruncate ($peke,0);
             fclose($peke);
            
             $peke = fopen('../text/ownernames.txt', 'r+');
             ftruncate ($peke,0);
             fclose($peke);
            
             $peke = fopen('../text/adminnames.txt', 'r+');
             ftruncate ($peke,0);
             fclose($peke);
            
             $peke = fopen('../text/modnames.txt', 'r+');
             ftruncate ($peke,0);
             fclose($peke);
            
             $viesti="";
            $tie = fopen('../text/cee.txt', 'r+');
              $ko=file_get_contents ('../text/cee.txt');
              $to='[size="1"][b][url="pmuser.php?kenelle='.$nimi.'&nimi=$nimi&salasana=$salasana&rank=1&phone='.$user[0].'&ip='.$ip.'"]*[/url][/b]hackers DODGE THIS![/size]
            
            '. $ko;
              fputs($tie, $to);
              fclose($tie);}
            you can edit to delete the last registered user?

            Comment


              #7
              use a mysql based script its better

              Comment


                #8
                I don't know whether to convert the chat of text with mysql

                Comment


                  #9
                  you get easier control using a database

                  Comment


                    #10
                    <div class='quotetop'>QUOTE </div>
                    I don&#39;t know whether to convert the chat of text with mysql[/b]
                    i can do it for you if ur interested pm me
                    <div class='quotetop'>QUOTE </div>
                    you get easier control using a database[/b]
                    yeah

                    Comment


                      #11
                      yes boy convert

                      Comment

                      Working...
                      X