The online racing simulator
simple logging (LOG) system
hello everyone What I want to do is I want to record the events of which authorized person performs which action to which user in the admin panel I designed, in a txt and when necessary, I want to read from this file and print it on the panel. If I need to summarize more How can I print and read data in txt with lapper? Basic view of the admin panel I pictured:
Attached images
Screenshot_20230216-204006_1.jpg
** Best answer **
Hello,

Before you want to write text to a file, you must create a file first.
CreateFile();

To edit the file like adding/deleting lines to/from the file
EditFile();

And to read the file.
Readfile();

See some examples below.


<?php 
Create
/Edit/ReadTextfiles
        
#===================================================
        #Create textfiles (Include FileExist options) (only .txt extension)
        #===================================================
                
$FileName "Filename";
                
$NameofDirectory "C:\Users\User\Desktop";
                
$FileExistOption 0;
            
               
What todo if file exist:

               
no action
               1 
overwrite file
               2 
overwrite file create backup file.

               
CreateFile($FileName,$NameofDirectory,$FileExistOption);
           
        
#===================================================
        #Read file (Possible to read various Filetypes: .log/.txt/.ini/.cfg.lpr)
        #===================================================
                
$LinesofFile Readfile($Filename,$Folder);
                
What info you get from file.
                
                -
FileSize in bytes
                
-CreationDate/Time
                
-ModificationDate/Time
                
-Number Of lines
                
-LineNumber
                
-Text from each line
                
                
!!!!EXAMPLE CODE!!!!
                
                    
$Filename "TestFile";
                    
$Folder "C:\Users\Danny\Desktop";
                    
$Extension ".txt";
                    
$LinesofFile Readfile($Filename,$Folder,$Extension);
                    
                
                    
$NrOfLines ToNum($LinesofFile["NumberOfLines"]);
                    
$FileCreationDate $LinesofFile["TimeOfCreation"];
                    
$FileModificationTime $LinesofFile["TimeOfModification"];
                    
$FileSize $LinesofFile["FileSize"];
                    
                    
privmsg("Reading file: " $Filename "" .$Extension);
                    
privmsg("NumberOfLines: " $NrOfLines "");
                    
privmsg("Size of file: " $FileSize " bytes");
                    
privmsg("Creation time: " $FileCreationDate "");
                    
privmsg("Modify time: " $FileModificationTime "");
                    
                    FOR ( 
$i 0$i <= $NrOfLines-$i $i 1)
                        
$linenr $LinesofFile[$i,"LineNumber"];
                        
$line $LinesofFile[$i,"Line"];
                        
privmsg("[".$linenr."]: ".$line);                    
                    ENDFOR

        !!!!!!!!!! USE 
THE FOR/WHILE LOOPONLY FOR THE LINES YOU WANT TO BE DISPLAYED ON YOUR SCREEN !!!!!!!!!!!!!!!!!!!
            
        
#===================================================
        #Edit file (Possible to edit various Filetypes: .log/.txt/.ini/.cfg/.lpr)
        #===================================================
        
                
$Filename "TestFile";
                
$Folder "C:\Users\Blah\Desktop";
                
$NewText "TESTTEST";
                
$LineToEdit = -1;  # -1 to create a extra line
                
$Extension ".txt"
                
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);

               
#Delete a single line in the file.
               #Set '-1' as $NewText and set $LineToEdit which line you want to delete.
    
                
$Filename "TestFile";
                
$Folder "C:\Users\Blah\Desktop";
                
$NewText = -1;
                
$LineToEdit 5
                
$Extension ".txt"
                
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);
?>

Quote from Bass-Driver :Hello,

Before you want to write text to a file, you must create a file first.
CreateFile();

To edit the file like adding/deleting lines to/from the file
EditFile();

And to read the file.
Readfile();

See some examples below.


<?php 
Create
/Edit/ReadTextfiles
        
#===================================================
        #Create textfiles (Include FileExist options) (only .txt extension)
        #===================================================
                
$FileName "Filename";
                
$NameofDirectory "C:\Users\User\Desktop";
                
$FileExistOption 0;
            
               
What todo if file exist:

               
no action
               1 
overwrite file
               2 
overwrite file create backup file.

               
CreateFile($FileName,$NameofDirectory,$FileExistOption);
           
        
#===================================================
        #Read file (Possible to read various Filetypes: .log/.txt/.ini/.cfg.lpr)
        #===================================================
                
$LinesofFile Readfile($Filename,$Folder);
                
What info you get from file.
                
                -
FileSize in bytes
                
-CreationDate/Time
                
-ModificationDate/Time
                
-Number Of lines
                
-LineNumber
                
-Text from each line
                
                
!!!!EXAMPLE CODE!!!!
                
                    
$Filename "TestFile";
                    
$Folder "C:\Users\Danny\Desktop";
                    
$Extension ".txt";
                    
$LinesofFile Readfile($Filename,$Folder,$Extension);
                    
                
                    
$NrOfLines ToNum($LinesofFile["NumberOfLines"]);
                    
$FileCreationDate $LinesofFile["TimeOfCreation"];
                    
$FileModificationTime $LinesofFile["TimeOfModification"];
                    
$FileSize $LinesofFile["FileSize"];
                    
                    
privmsg("Reading file: " $Filename "" .$Extension);
                    
privmsg("NumberOfLines: " $NrOfLines "");
                    
privmsg("Size of file: " $FileSize " bytes");
                    
privmsg("Creation time: " $FileCreationDate "");
                    
privmsg("Modify time: " $FileModificationTime "");
                    
                    FOR ( 
$i 0$i <= $NrOfLines-$i $i 1)
                        
$linenr $LinesofFile[$i,"LineNumber"];
                        
$line $LinesofFile[$i,"Line"];
                        
privmsg("[".$linenr."]: ".$line);                    
                    ENDFOR

        !!!!!!!!!! USE 
THE FOR/WHILE LOOPONLY FOR THE LINES YOU WANT TO BE DISPLAYED ON YOUR SCREEN !!!!!!!!!!!!!!!!!!!
            
        
#===================================================
        #Edit file (Possible to edit various Filetypes: .log/.txt/.ini/.cfg/.lpr)
        #===================================================
        
                
$Filename "TestFile";
                
$Folder "C:\Users\Blah\Desktop";
                
$NewText "TESTTEST";
                
$LineToEdit = -1;  # -1 to create a extra line
                
$Extension ".txt"
                
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);

               
#Delete a single line in the file.
               #Set '-1' as $NewText and set $LineToEdit which line you want to delete.
    
                
$Filename "TestFile";
                
$Folder "C:\Users\Blah\Desktop";
                
$NewText = -1;
                
$LineToEdit 5
                
$Extension ".txt"
                
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);
?>


Sorry for my delayed reply, I'll keep trying the method you provided, thank you for sharing your information.

FGED GREDG RDFGDR GSFDG