View Single Post
Old 03-14-2009, 07:02 AM   #3 (permalink)
Seraskier
The Contributor
 
Join Date: Mar 2008
Posts: 62
Thanks: 2
Seraskier is on a distinguished road
Default

Okay, fresh code.

Code:
<!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">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Dumping Unverified Users...</title>
</head>

<body>
<?php
//gain access to database
define("access",true);
require("database.php");


//logging directory & filename
$file=date("y-H i").".txt";
$dir="logs/UserDumps/".date("M")."/".date("d")."/".$file;

//query users who have not logged in
//retrieve information and count users
$query=mysql_query("SELECT * FROM users WHERE lastlogin='Never'");
$count=mysql_num_rows($query);

//retrieve settings
$settings=mysql_query("SELECT * FROM settings");
while($setting=mysql_fetch_array($settings))
	{ $loginwindow=$setting['loginwindow']; }

//current date and time
$current=strtotime("now");

//users registration date and time
while($row=mysql_fetch_array($query))
{
	list($hour,$minute,$second)=split(":",$row['signuptime']);
	list($month,$day,$year)    =split(" ",$row['signupdate']);
	$signup=mktime(($hour+$loginwindow),$minute,$second,$month,$day,$year);

	//determine if the user needs to be deleted
	//if so, add the user to the array
	if($signup < $current)
	{
		$array[]=$row['id'];
	}
}

//delete users contained in the array
foreach($array as $id)
{
	$i=mysql_query("SELECT * FROM users WHERE id='{$id}'");
	while($row2=mysql_fetch_array($i))
	{
		echo "<br />".$row2['username']." | ".$row2['signupdate']." - ".$row2['signuptime'];
	}
}
?>
</body>
</html>
From what I tested it works great.
Send a message via MSN to Seraskier
Seraskier is offline  
Reply With Quote
The Following User Says Thank You to Seraskier For This Useful Post:
hello-world (03-15-2009)