Logging your Website Actions(Logging in the Database)

Page 1 of 2 12 LastLast
Results 1 to 25 of 41
  1. #1
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Logging your Website Actions(Logging in the Database)

    NOTE: THIS WAS TESTED, AND IT WORKS 100%. IF IT DOESN'T WORK FOR YOU, YOU DID SOMETHING WRONG IN THE PROCESS.

    NOTE 2: Take off the Link Variable if you have an include function to include your configurations.
    EX:
    include('configs/config.php');



    Instructions:
    1. Execute the 1st Code into the database.
    2. Restart MSSQL (Program).
    3. Go to Account_DBF and find the LOG_TBL
    3a. If it's there, close MSSQL.
    3b. If it's not there, execute again.
    4. Put the 2nd Code(PHP) into a php file.
    5. Access the php file.
    6. Open MSSQL, and view the log, Is it in there?
    7. If yes, You are now logging actions in your webserver.



    Anyone who wants it:

    Execute this in MSSQL.
    When its executed, restart MSSQL.(Program)
    Code:
    BEGIN TRANSACTION
    USE ACCOUNT_DBF
    SET QUOTED_IDENTIFIER ON
    SET ARITHABORT ON
    SET NUMERIC_ROUNDABORT OFF
    SET CONCAT_NULL_YIELDS_NULL ON
    SET ANSI_NULLS ON
    SET ANSI_PADDING ON
    SET ANSI_WARNINGS ON
    COMMIT
    BEGIN TRANSACTION
    GO
    CREATE TABLE dbo.LOG_TBL
    	(
    	ip nvarchar(MAX) NOT NULL,
    	reason nvarchar(MAX) NOT NULL
    	)  ON [PRIMARY]
    	 TEXTIMAGE_ON [PRIMARY]
    GO
    ALTER TABLE dbo.LOG_TBL SET (LOCK_ESCALATION = TABLE)
    GO
    COMMIT
    PHP Code:
    <?php
            $link 
    = @mssql_connect("Your Computer Name\SQLEXPRESS""MSSQL UserName(Often SA)""MSSQL Password") or die ("Cannot connect to MSSQL");
          
    $ip $_SERVER['REMOTE_ADDR'];

    $log mssql_query("INSERT INTO [ACCOUNT_DBF].dbo.[LOG_TBL] (ip, reason) VALUES ('{$ip}', 'Log Test Successful!')");

    if(
    $log) {
    echo 
    'Test Successful!';
    }
    else
    {
    echo 
    'Error Logging';
    }
    ?>


  2. #2
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: Logging your Website Actions(Logging in the Database)

    Whats the point?

  3. #3
    Banned VLxPain is offline
    BannedRank
    May 2010 Join Date
    121Posts

    Re: Logging your Website Actions(Logging in the Database)

    to log people visiting your site, but well, you should look into access.log ;>

  4. #4
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by VLxPain View Post
    to log people visiting your site ;>

    This.

    It'll log who accesses.

    It can be edited to put
    $account = $_SESSION['Account'];

    So it would be:
    PHP Code:
    <?php 
            $link 
    = @mssql_connect("Your Computer Name\SQLEXPRESS""MSSQL UserName(Often SA)""MSSQL Password") or die ("Cannot connect to MSSQL"); 
           
    $ip $_SERVER['REMOTE_ADDR'];
    $account $_SESSION['Account'];

    $log mssql_query("INSERT INTO [ACCOUNT_DBF].dbo.[LOG_TBL] (ip, reason, account) VALUES ('{$ip}', 'Log Test Successful!', '{$account}')"); 

    if(
    $log) { 
    echo 
    'Test Successful!'

    else 

    echo 
    'Error Logging'

    ?>

    Then again, you would have to edit the design of the table to add a new row
    "IP" "reason" "account"

  5. #5
    Banana Adler is offline
    MemberRank
    Feb 2009 Join Date
    1,119Posts

    Re: Logging your Website Actions(Logging in the Database)

    Very simple script, could be useful to people who aren't PHP savvy. Why does it echo that the logging was successful? Shouldn't it be hidden, or was that only used for testing reasons? Otherwise, this would be more practical:

    PHP Code:
    <?php
    $link 
    = @mssql_connect("XXX\SQLEXPRESS","XXX","XXX") or die ("Cannot connect to MSSQL");   
    $ip $_SERVER['REMOTE_ADDR'];
    $log mssql_query("INSERT INTO [ACCOUNT_DBF].dbo.[LOG_TBL] (ip,reason) VALUES ('{$ip}','Logging Successful')");
    ?>
    You can also make an array for logging the browsers used or OS's, such as 'Windows 7' => '(Windows NT 6.1)', etc. For people who can read PHP but can't write it, here's a list of all $_SERVER arrays so you can insert more than just IP addresses:

    PHP Code:
    $_SERVER['PHP_SELF'];
    $_SERVER['argv'];
    $_SERVER['argc'];
    $_SERVER['GATEWAY_INTERFACE'];
    $_SERVER['SERVER_ADDR'];
    $_SERVER['SERVER_NAME'];
    $_SERVER['SERVER_SOFTWARE'];
    $_SERVER['SERVER_PROTOCOL'];
    $_SERVER['REQUEST_METHOD'];
    $_SERVER['REQUEST_TIME'];
    $_SERVER['QUERY_STRING'];
    $_SERVER['DOCUMENT_ROOT'];
    $_SERVER['HTTP_ACCEPT'];
    $_SERVER['HTTP_ACCEPT_CHARSET'];
    $_SERVER['HTTP_ACCEPT_ENCODING'];
    $_SERVER['HTTP_ACCEPT_LANGUAGE'];
    $_SERVER['HTTP_CONNECTION'];
    $_SERVER['HTTP_HOST'];
    $_SERVER['HTTP_REFERER'];
    $_SERVER['HTTP_USER_AGENT'];
    $_SERVER['HTTPS'];
    $_SERVER['REMOTE_ADDR'];
    $_SERVER['REMOTE_HOST'];
    $_SERVER['REMOTE_PORT'];
    $_SERVER['SCRIPT_FILENAME'];
    $_SERVER['SERVER_ADMIN'];
    $_SERVER['SERVER_PORT'];
    $_SERVER['SERVER_SIGNATURE'];
    $_SERVER['PATH_TRANSLATED'];
    $_SERVER['SCRIPT_NAME'];
    $_SERVER['REQUEST_URI'];
    $_SERVER['PHP_AUTH_DIGEST'];
    $_SERVER['PHP_AUTH_USER'];
    $_SERVER['PHP_AUTH_PW'];
    $_SERVER['AUTH_TYPE'];
    $_SERVER['PATH_INFO'];
    $_SERVER['ORIG_PATH_INFO']; 

  6. #6
    Found a place to live. Blackbox is offline
    MemberRank
    Sep 2008 Join Date
    2,412Posts

    Re: Logging your Website Actions(Logging in the Database)

    Or you can always do a little research and learn to get the real IP address of the people.
    PHP Code:
    $_SERVER['REMOTE_ADDR']; 
    doesn't work correctly when faced with proxies.

  7. #7
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: Logging your Website Actions(Logging in the Database)

    The Echoing was part of the testing purposes.

    It must be taken off if you want to be anonymous with your logging. Otherwise, you can just do this
    PHP Code:
    if($log) {
    echo 
    'You have been logged, Dont try anything fishy!';

    Any suggestions for scripts would be accepted ;> PM me if you have one.

  8. #8
    Banana Adler is offline
    MemberRank
    Feb 2009 Join Date
    1,119Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by blackbox View Post
    or you can always do a little research and learn to get the real ip address of the people.
    PHP Code:
    $_SERVER['REMOTE_ADDR']; 
    doesn't work correctly when faced with proxies.
    Like these?
    PHP Code:
    $_SERVER['HTTP_X_FORWARDED_FOR']
    $_SERVER['HTTP_X_FORWARDED_SERVER']
    $_SERVER['HTTP_X_FORWARDED_HOST'

  9. #9
    Gamma 404 is offline
    MemberRank
    Jul 2007 Join Date
    3,143Posts

    Re: Logging your Website Actions(Logging in the Database)

    Might be useful for UserCP / AdminCP :)

  10. #10
    Cyclops-Network Owner Alexsh is offline
    MemberRank
    Sep 2009 Join Date
    New YorkLocation
    306Posts

    Re: Logging your Website Actions(Logging in the Database)

    Useless.

  11. #11
    0xC0FFEE spikensbror is offline
    MemberRank
    Dec 2006 Join Date
    SwedenLocation
    1,855Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by Alexsh View Post
    Useless.
    Agreed.
    Anyone that has the least bit off skills should be able to code something much better than this.

  12. #12
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: Logging your Website Actions(Logging in the Database)

    If you have nothing good to say, ignore the fuckin' topic. No need for critizism.

  13. #13
    0xC0FFEE spikensbror is offline
    MemberRank
    Dec 2006 Join Date
    SwedenLocation
    1,855Posts

    Re: Logging your Website Actions(Logging in the Database)

    If no-one got criticism, they wouldn't get any better.
    But fine, if you wanna stay noob. Don't let me stop you.

  14. #14
    Account Upgraded | Title Enabled! darkesthour123 is offline
    MemberRank
    Oct 2009 Join Date
    Sheffield (UK)Location
    270Posts

    Re: Logging your Website Actions(Logging in the Database)

    Constructive criticism is good. Saying it is useless isn't really constructive but on the other hand without anything with behind it its not of any use; this could be useful. I personally think that he created this for learning purposes but hey thats just what i think.

  15. #15
    0xC0FFEE spikensbror is offline
    MemberRank
    Dec 2006 Join Date
    SwedenLocation
    1,855Posts

    Re: Logging your Website Actions(Logging in the Database)

    Yeah, constructive criticism wasn't given from me cause he told me to take it somewhere else.

  16. #16
    Account Upgraded | Title Enabled! darkesthour123 is offline
    MemberRank
    Oct 2009 Join Date
    Sheffield (UK)Location
    270Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by spikensbror View Post
    Yeah, constructive criticism wasn't given from me cause he told me to take it somewhere else.
    Yea thats fine in fairness. I would have done the same. I think it was a little harsh to just say useless but then again that's just Alexsh. Only problem i see around these forums is that when you get server owners that are up their own ass.

  17. #17
    Cyclops-Network Owner Alexsh is offline
    MemberRank
    Sep 2009 Join Date
    New YorkLocation
    306Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by darkesthour123 View Post
    Yea thats fine in fairness. I would have done the same. I think it was a little harsh to just say useless but then again that's just Alexsh. Only problem i see around these forums is that when you get server owners that are up their own ass.
    Funny considering the fact that you basically just said the same thing about my bat file Hypocrite much?

  18. #18
    Found a place to live. Blackbox is offline
    MemberRank
    Sep 2008 Join Date
    2,412Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by spikensbror View Post
    Agreed.
    Anyone that has the least bit off skills should be able to code something much better than this.
    Quote Originally Posted by spikensbror View Post
    If no-one got criticism, they wouldn't get any better.
    But fine, if you wanna stay noob. Don't let me stop you.
    Quote Originally Posted by spikensbror View Post
    Yeah, constructive criticism wasn't given from me cause he told me to take it somewhere else.
    Your first post contained no constructive criticism, you only agreed it was useless and someone with better skills could do better. (dur dur dur)

    So you can't come back and say you didn't give constructive criticism because he told you to stuff it. He said that after you had already 'criticized' his work by agreeing it was useless and could be improved.

    Your last few posts in this thread honestly have made no sense.

  19. #19
    Account Upgraded | Title Enabled! darkesthour123 is offline
    MemberRank
    Oct 2009 Join Date
    Sheffield (UK)Location
    270Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by Alexsh View Post
    Funny considering the fact that you basically just said the same thing about my bat file Hypocrite much?
    Hell yea ofcourse i am. This hasn't been released like 50x times. Starters/managers have.

  20. #20
    Cyclops-Network Owner Alexsh is offline
    MemberRank
    Sep 2009 Join Date
    New YorkLocation
    306Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by darkesthour123 View Post
    Hell yea ofcourse i am. This hasn't been released like 50x times. Starters/managers have.
    This is 20x more useless than my thread, it's a shell of what anyone could code. And as far as I'm concerned, wtf have you contributed to this community besides fail criticism upon which makes no sense whatsoever?

  21. #21
    Account Upgraded | Title Enabled! ryuchao009 is offline
    MemberRank
    Feb 2009 Join Date
    United StatesLocation
    601Posts

    Re: Logging your Website Actions(Logging in the Database)

    I have an idea. Those who don't have anything to contribute to the thread, GTFO.

    On topic: It's not very useful as-is. However, it's a decent base you could improve on to make a better logging system (with a backend added in if desired). For the leechers that copy-paste, this is sufficient.

  22. #22
    Account Upgraded | Title Enabled! darkesthour123 is offline
    MemberRank
    Oct 2009 Join Date
    Sheffield (UK)Location
    270Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by Alexsh View Post
    This is 20x more useless than my thread, it's a shell of what anyone could code. And as far as I'm concerned, wtf have you contributed to this community besides fail criticism upon which makes no sense whatsoever?
    Lol, if it takes me to create a bat file to be amazing in your books im all up for that /ridi. Yes it probably won't be used. Yes anyone could do it. The matter of fact is not every one wants to learn php or any other languages because there is a lot of shit out there "ready" made. People could use this if they wanted to and wouldn't have to know much php if any if they have commonsense.

    Quote Originally Posted by ryuchao009 View Post
    I have an idea. Those who don't have anything to contribute to the thread, GTFO.

    On topic: It's not very useful as-is. However, it's a decent base you could improve on to make a better logging system (with a backend added in if desired). For the leechers that copy-paste, this is sufficient.
    Ill take that.
    Last edited by darkesthour123; 16-06-10 at 07:08 PM.

  23. #23
    Ace of Hearts Reimniess is offline
    MemberRank
    Jul 2009 Join Date
    in your headLocation
    784Posts

    Re: Logging your Website Actions(Logging in the Database)

    break it up you two, fighting is not welcome, want to fight with them still? take it to msn or something instead of spamming the forums

  24. #24
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: Logging your Website Actions(Logging in the Database)

    -removed for flaming-
    Last edited by Reimniess; 16-06-10 at 07:13 PM.

  25. #25
    Ace of Hearts Reimniess is offline
    MemberRank
    Jul 2009 Join Date
    in your headLocation
    784Posts

    Re: Logging your Website Actions(Logging in the Database)

    Quote Originally Posted by apixen View Post
    tbh, This thread is a thread in which people all over servers will use.
    Alex, GTFO, I see you NEVER released my User Control Panel. Nice fail?

    You almost promised you would release it.
    You never did.
    The best you can do is DoS. Which is very kiddie.
    This thread holds a release that was released ONCE in RZ(FlyFF Section)
    You probably use this method anyway, or even the fail text file.

    GTFO and go learn some skills, not get people to do it for you.
    the flame war needs to end.



Page 1 of 2 12 LastLast

Advertisement