Jump to content
xisto Community

Soviet Rathe

Members
  • Content Count

    467
  • Joined

  • Last visited


Reputation Activity

  1. Upvote
    Soviet Rathe got a reaction from XRumerTest in How To Take Your Computer Hard Drive Apart Complete guide to destroying/looking inside your hard drive   
    Wow this was really cool to read, the pictures are cool, I think it's just amazing how a hard drive works so much like an old-time record player.I want to try this one day, but then again I hope I'm not unfortunate enough to have a hard drive fail on me :3
  2. Upvote
    Soviet Rathe reacted to Eza in How To Post On Knowledgesutra [resolved] Old versus new members   
    Some old members seem to think that they own this forum.Being a member of the forum for a long time gives some privileges. And old members are appreciated for all the time they gave and all the efforts they made. Their posts and topics make this forum to what it is nowadays.On the other hand things move on. New ways of using the internet are invented. And new ways of using websites are developed. So when old members are stuck to their old way of posting and reading the posts of other members it might happen that they don't understand the changes that happen on the internet.So before telling other members how to behave on the forum it might be usefull to think if the negative attitude comes from outdated points of view.
  3. Upvote
    Soviet Rathe got a reaction from kobra500 in New Knowledgesutra Logo!   
    OpaQue wants a new logo so here it is

    Here's what it looks like when applied to the forums:

    It wasn't made by me, I had it made by someone else for KS
    What you think?
  4. Upvote
    Soviet Rathe reacted to electriic ink in How To Read And Write Files Using Php php :: reading and writing files   
    How To Read And Write And Files
    a simple trick using php
     
    For this script all you need is a php enabled server, a text document and a basic understanding of php itself:
     
    Beginning

    Create a text file called name.txt in any directory.
    Change the file permissions to 777
    Create a empty php file in the same directory.
    You are now ready to begin reading and writing your files. If you just want to read the file scroll straight down to Reading the File else read through the whole tut  
     
    Open The File
     
    Before you can write to the file, you need to open it:
     

    <? $thefile = "name.txt"; /* Our filename as defined earlier */$towrite = "Black widgets rule!"; /* What we'll write to the file */$openedfile = fopen($thefile, "w");
    This opens the file name.txt which we created earlier for writing, but you can open it for reading and both. Just replace the w with one of the following: 

    You can find more of these at php.net. I have only quoted a few. 
    Also, the fopen() function must be stored as a variable!
     
    If you have done what I have said correctly, the file should be opened so now we are ready to write things into it:
     
    Writing The File
     
    Writing to the file is very easy. You use the fwrite() function like so:
     

    <? $thefile = "name.txt"; /* Our filename as defined earlier */$towrite = "Black widgets rule!"; /* What we'll write to the file */$openedfile = fopen($thefile, "w");fwrite($openedfile, $towrite);
    Again, a breeze all it does is write $towrite to $thefile. You must always write the content to the variable with fopen() stored within it not the one just containing the path to the file! Please bare in mind that because of the way we opened the file all information previously stored in the file will be overwritten! 
    Note: I was told that you can use file_put_contents() instead of fwrite(). You use it in the same way as fwrite() except you would use $thefile instead of $openedfile and like file_get_contents() there's no fopen() and fclose()! Only for PHP5+ though.
     
    Reading The File
     
    Reading a file is even easier. You could go through the fopen() method but I'm gonna show you an easier way:
     

    <?$thefile = "name.txt"; /* Our filename as defined earlier */$towrite = "Black widgets rule!"; /* What we'll write to the file */$whatsinthefile = file_get_contents($thefile); ?>
    No opening the file, no closing the file. Just that. 
    Closing the file
     
    If you opened the file using fopen() then you have to close it using fclose(). Simple:
     

    <?$thefile = "name.txt"; /* Our filename as defined earlier */$towrite = "Black widgets rule!"; /* What we'll write to the file */$openedfile = fopen($thefile, "w");fwrite($openedfile, $towrite);fclose($openedfile);?>
    It couldn't be easier than that and if everything is done just as I say there should be no php errors at all  
    Any questions about this tutorial?

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.