I know how to write an ip to a textfile and use cron to reset it every day but ho do you make the script chaeck if the person has used it before?

    Before you go too far with this, you do realize that there are people (such as AOL users) who may have a different IP address on each request, and therefore you could have two different users from different locations each access your page with the same IP address on the same day?

      What are you trying to archive? If we knew we could perhaps suggest a better approach.

        You can store the info in a database IP, DateStamp then PHP can check to see if that IP has been used today already and take the appropriate actions.

        But I agree with dagon we'd need to know what you're trying to accomplish.

          NogDog wrote:

          Before you go too far with this, you do realize that there are people (such as AOL users) who may have a different IP address on each request, and therefore you could have two different users from different locations each access your page with the same IP address on the same day?

          Then there are people who share the same IP address, and so you could have users who simply cannot use the functionality provided because by some misfortune they are forever not the first user with that IP address to visit your website.

            It is a proccessor intensive task so i would like to limit it to one use per day, it doesn't matter if someone uses it twice but if everyone did th eserver might crash,
            heres the code ive got, its styled to look like my blog at rallan.org.

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
            
            <head profile="http://gmpg.org/xfn/11">
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            
            <title>Money Maker! | rallan.org</title>
            
            <meta name="generator" content="WordPress 2.6.3" /> <!-- leave this for stats -->
            
            <link rel="stylesheet" href="http://rallan.org/wp-content/themes/sad-fish-10/style.css" type="text/css" media="screen" />
            <link rel="alternate" type="application/rss+xml" title="rallan.org RSS Feed" href="http://rallan.org/?feed=rss2" />
            <link rel="pingback" href="http://rallan.org/xmlrpc.php" />
            
            <style type="text/css" media="screen">
            
            #page {  }
            
            
            </style>
            
            <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://rallan.org/xmlrpc.php?rsd" />
            <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://rallan.org/wp-includes/wlwmanifest.xml" /> 
            <meta name="generator" content="WordPress 2.6.3" />
            
            
            <!-- all in one seo pack 1.4.6.15 [307,369] -->
            <meta name="description" content="As of now this is the ONLY working online club penguin money maker! To use it type your username in the top box and your password in the bottom box! It will" />
            <!-- /all in one seo pack -->
            </head>
            <body>
            <div id="page">
            
            
            <div id="header">
            	<div id="headerimg">
            
            	<h1><a href="http://rallan.org/">rallan.org</a></h1>
            	<div class="description">Club Penguin Hacks</div>
            </div>
            
            </div>
            <hr />
            
            <!-- <div id="content" class="narrowcolumn"> -->
            <table class="page_t" width="100%">
            
            <tr>
            
            <td>
            
            <div id="content" class="widecolumn">
            
            
            	<div class="navigation">
            		<div class="alignleft">&laquo; <a href="http://rallan.org/?p=1">Hello world!</a></div>
            		<div class="alignright"><a href="http://rallan.org/?p=14">How to Make Bots!</a> &raquo;</div>
            	</div>
            
            	<div class="post" id="post-3">
            		<h2><a href="http://rallan.org/?p=3" rel="bookmark" title="Permanent Link: Money Maker!">Money Maker!</a></h2>
            
            		<div class="entry">
            			<div class="announcement_post"><p>As of now this is the ONLY working online club penguin money maker! To use it type your username in the top box and your password in the bottom box! It will give you a random amount of coins between 800 and 2100!</p>
            
            
            
            <?php
            require "core.php";
            require "tasks.php";
            
            $Username = $_GET['Username']; 
            $Password = $_GET['Password'];
            $Server = 411;
            
            
            
            echo "$Username Is logging in.\n\n"; //Show it on the command line
            ?>
            <br />
            <?php
            if (connect($Server, $Username, $Password, true)) { //Connects to the server, and on success...
            echo "$Username has successfully been logged in.\n\n"; //Show it on the command line
            gotoRoom(810, 0, 0);
            ?>
            <br />
            
            <?php
            sleep(4);
            sendrawpacket("%xt%s%j#jr%13%912%0%0%");
            sleep(4); //Waits one second
            ?>
            <br />
            
            
            <?php
            $coins = rand(800, 2100);
            
            
            sendRawPacket("%xt%z%zo%47%$coins%"); //Hacks 5000 coins to the account specified by $Username
            
            
            sleep(4); //Waits one second
            echo "$coins coins have been added to $Username\n"; //Show it on the command line
            ?>
            <br />
            
            
            <?php
            sendrawpacket("%xt%s%j#jr%47%810%0%0%");
            echo "Disconnecting $username from the server\n";
            }
            ?>	
            
            
            
            
            
            
            
            <p>To go to the club penguin hacking discussion form where you can post your<strong> own </strong>cheats and hacks click <a title="Discussion Forum" href="http://forum.rallan.org" target="_blank">here</a> , the person who  has posted the most useful topics by  the end of the month will get a free membership for a month! <img src='http://rallan.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  To go to the old blog click <a href="http://blog.rallan.org">here</a> To view the old blog and its contents click <a title="Old Blog" href="http://blog.rallan.org" target="_blank">here</a></p>
            
            </div>
            
            
            			<p class="postmetadata alt">
            				<small>
            					This entry was posted
            											on Friday, November 7th, 2008 at 10:11 am						and is filed under <a href="http://rallan.org/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a>.
            					You can follow any responses to this entry through the <a href='http://rallan.org/?feed=rss2&amp;p=3'>RSS 2.0</a> feed.
            
            												You can <a href="#respond">leave a response</a>, or <a href="http://rallan.org/wp-trackback.php?p=3" rel="trackback">trackback</a> from your own site.
            
            					<a href="http://rallan.org/wp-admin/post.php?action=edit&amp;post=3" title="Edit post">Edit this entry.</a>
            
            				</small>
            			</p>
            
            		</div>
            	</div>
            
            
            <!-- You can start editing here. -->
            
            
            		<!-- If comments are open, but there are no comments. -->
            
            
            
            
            
            
            
            
            
            
            <!--<p><small><strong>XHTML:</strong> You can use these tags: <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></small></p>-->
            
            
            
            
            <hr />
            <div id="footer">
            <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
            	<p>
            		Brought to you by <a href="http://www.gomvents.com/" style="color:#fff;">search engine placement</a> Downloaded from <a href="http://www.blogstheme.com/" title="free Wordpress Themes" style="color:#fff;">Wordpress Themes</a>
            
            </p>
            </div>
            </div>
            
            <!-- Test theme -->
            
            	<p id='supercache'>rallan.org is Digg proof thanks to caching by <a href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a>!</p></body>
            </html>
            

            also this is the input form

            <body>
            <form method="get" action="money.php">
            <input type="text" name="Username"><br />
            <input type="password" name="Password"><br />
            <input type="submit" value="Start money making">
            </form>
            </body>
            </html>

            and these are the required files,
            core.php
            (too big for one post)

              Clearly, your script accepts usernames as input. An easy solution is to record in a database the fact that a particular username has been used with the script once the script has been successfully ran with that given username. This way, you merely check the database for the username and the last use time. If the last use time is too recent, you deny the use of the script.

                I'll do that, but I still don't know how to read it out of the text file and do the check(i know how to write it and use a cron job to reset it once per day)

                  Why not use a relational database? That way you only need to update or insert the record with the current time, so no crob job is needed.

                    laserlight is right... probably check out LAMP or WAMP systems and get your self a MySQL database or something... Then create a table that stores UserName and LastLogon

                    In your PHP you query the database and you can use the PHP date() - LastLogin < NextAllowableAccess then tell the user they can log onto your system at NextAllowableAccess date() -LastLogin

                    Example:
                    Table has
                    FijiSmithy 11/6/2008
                    and I am only allowed to logon once a week
                    Then your PHP should tell me I have 7days - (11/7/2008 - 11/7/2008) = 6 days until I can log in again.

                      I should explain what the script does lol.
                      It logs onto a game( called club penguin) then gives the user coins.
                      I have a slight problem with doing what you said there, I don't know how to do it 🙁
                      (i'm not very good with php)

                        rallan;10892340 wrote:

                        I should explain what the script does lol.
                        It logs onto a game( called club penguin) then gives the user coins.
                        I have a slight problem with doing what you said there, I don't know how to do it 🙁
                        (i'm not very good with php)

                        Which part don't you know how to do?

                        Install MySQL?
                        Create the database?
                        Create the Tables?
                        Use PHP to write to the Database?
                        Or Use PHP to determine if someone is allowed back into your site?

                          I don't know how to write to it or to check if the user has logged in before on that day.

                            rallan;10892414 wrote:

                            I don't know how to write to it or to check if the user has logged in before on that day.

                            To get the user's IP
                            $ip=$_SERVER['REMOTE_ADDR'];

                            Have you installed a database yet? Do you know how to write database procedures? You can write a DB procedure to clear out entries at midnight.

                            Or

                            You can query the db and if the LastLogon = Today then tell the user to come back tomorrow. If the entry is yesterday or later then update the entry to today.

                            You can even use this table as a list of allowed users who can access your site.

                            If you haven't installed a Database yet then check out MySQL and PHP.net mysql library of functions on how to connect to the DB and query the database

                              I have a database but what is the php function used to write to a database?
                              also what is the function to read( and how would I use this function to check if the user had used it yet?)

                                I have a database but what is the php function used to write to a database?

                                It depends, and it really is not just one function, but a library of functions. For example, you could use the PDO extension.

                                  Write a Reply...