can anyone make me a simple script to write text to a log file on server...

 

Results 1 to 5 of 5
http://myservername.com/myscript.php?password="blah"&text="blah blah blah blah" so then on my server ill have log.txt with "blah blah ...
  1. #1
    SleepieGirl's Avatar
    SleepieGirl is offline Regular Member
    Join Date
    Mar 2009
    Location
    TenDollarBlog.com
    Posts
    439
    Thanks
    20
    Thanked 283 Times in 76 Posts

    Default can anyone make me a simple script to write text to a log file on server...

    http://myservername.com/myscript.php?password="blah"&text="blah blah blah blah"

    so then on my server ill have log.txt with "blah blah blah blah" inside of it?




  2. #2
    lincher is offline Registered Member
    Join Date
    Jun 2013
    Posts
    83
    Thanks
    59
    Thanked 22 Times in 17 Posts

    Default Re: can anyone make me a simple script to write text to a log file on server...

    Code:
    <?php
    
    $pass = $_GET['password'];
    $text = $_GET['text'];
    
    if($pass = "blah")
    {
    $file = fopen("log.txt","w"); 
    echo fwrite($file,$text) . " bytes written.";
    fclose($file);
    }
    else
    {
    echo "Incorrect password!";
    }
    
    ?>
    That should do it.
    Just create log.txt file before using it.
    Last edited by lincher; 08-31-2013 at 12:05 AM.

  3. The Following User Says Thank You to lincher For This Useful Post:

    SleepieGirl (08-31-2013)

  4. #3
    amandatorey is offline Newbies
    Join Date
    Sep 2013
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: can anyone make me a simple script to write text to a log file on server...

    lincher's solution is excellent, but here's a shorter version with no need to create log.txt beforehand and more extensive error-checking.

    Code:
    <?php
    
    isset($_GET['pass'])    or die('you need a password');
    $_GET['pass'] == 'blah' or die('wrong password');
    isset($_GET['text'])    or die('you need to specify text');
    
    file_put_contents('log.txt', $_GET['text']);
    
    ?>

  5. #4
    tripper_john_md is offline Newbies
    Join Date
    Feb 2011
    Location
    Southern Germany
    Posts
    40
    Thanks
    2
    Thanked 33 Times in 17 Posts

    Default Re: can anyone make me a simple script to write text to a log file on server...

    And one more addition:
    file_put_contents() will overwrite your file without the proper flags set.
    So if you want to log continuously and keep the logged text, use:

    PHP Code:
    <?php
    file_put_contents
    ('log.txt'$_GET['text'], FILE_APPEND);
    ?>

  6. #5
    xbyte's Avatar
    xbyte is offline Jr. VIP
    Join Date
    Jan 2013
    Posts
    193
    Thanks
    16
    Thanked 25 Times in 23 Posts

    Default Re: can anyone make me a simple script to write text to a log file on server...

    If you need something more specific, you can contact me on skype : byte-x
    Wont cost you anything


Similar Threads

  1. [Urgent]Need a Coder to write a simple script
    By rchieox in forum Hire a Freelancer
    Replies: 8
    Last Post: 02-25-2013, 06:40 PM
  2. Script To Capture Text Inside .txt File and Put Into Image File
    By joxnard562 in forum Hire a Freelancer
    Replies: 4
    Last Post: 12-28-2012, 06:58 AM
  3. i need a script to transfer data from excel to text file
    By joxnard562 in forum Hire a Freelancer
    Replies: 3
    Last Post: 12-02-2012, 07:47 AM
  4. Replies: 3
    Last Post: 09-15-2012, 05:10 PM
  5. Replies: 2
    Last Post: 08-06-2010, 10:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109