Help out this newb =\

This is a discussion on "Help out this newb =\" within the PHP Forum section. This forum, and the thread "Help out this newb =\ are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 21st, 2005, 15:51
New Member
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Help out this newb =\

Okay, I have 2 bits of code, a friend helped me right this:

Code: Select all
<?php
// Get the ip of the person viewing.
$ip = $_SERVER['REMOTE_ADDR'];
// Get the current time in seconds
$current_time = time();

// This is the time that must have past since the last action in seconds.
// So now, its set to 60 sec = 1 minute.
$no_action_time = 60;
// Here, the cutoff is set. If you where last active after $min_time, you can't handle yet.
$min_time = $current_time - $no_action_time;


// File Handling
// Select a File.
$file = 'somefile.txt';
// Open the file
$handle = fopen($file,'r');
// Read the content from the file
$read = fread($handle,filesize($file));

// Data Handling
// Make it into an array
$ip_list = explode("%&%\n",$read);
foreach($ip_list as $tracked_ip)
{
	$no_action_info = explode('%%',$tracked_ip);
	if($ip == $no_action_info[0] && $min_time > $no_action_info[1])
	{
		$forbidden = true;
	}
	// DO NOT put an else statement here, it would just be overwriten with the next set of ip-time.
}

if($forbidden == true)
{
	echo 'Sorry, you may not take this action yet';
}
else
{
	/*
	
			YOUR SCRIPT COMES HERE
	
	*/
	// Just echoing something random here, to not have a blank screen
	echo 'Script done';
	
	$handle = fopen($file,'a');
	$input = $ip . '%%' . $current_time . "%&%\n";
	fwrite($handle,$input);
}
?>
And I want to add in a reputation script so that I have a restriction on the ammount in secondes someone can change another persons reputation, I can get the script to show you.

Here: http://jakeh.goldeye.info/reputation.txt

How could I do it? I tried adding the script where it says but it didn't work =\[/code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 23rd, 2005, 16:58
New Member
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Well it should work, I don't see anything wron with the preceeding code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 24th, 2005, 17:30
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Can you show us all the code together..?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 30th, 2005, 18:04
New Member
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Okay, give me a moment....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
help, newb

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash newb please help!! cullinanweb Flash & Multimedia Forum 3 May 1st, 2007 15:30
Newb needs help! pgrooveweb Web Page Design 10 Apr 12th, 2004 10:26


All times are GMT. The time now is 13:21.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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