$5 USD for a working script

SpaceshipSpaceship
Watch

user-7256

VIP Member
Impact
111
Hello,

I need a PHP script that goes through all rows in a table and:

A) If the field "last_login" is 20 days old or more, it sends an email to the user, email field being "email" notifying that he/she has 10 days to do login to his/her account to keep it from being deleted.

B) DELETES the row if the "last_login" field is 30 days old or more.

The catch? This must be tested on YOUR OWN SERVER!

I want to see a WORKING SAMPLE - this script is for www.VirtualDN.com - and I simply cannot risk a script glitch on my own server.

The dates are stored in this PHP date() format: F d, Y

That's:

February 02, 2005

...similar to that. Convert it if you must but I need it to be bug-free.

Thanks for anybody who can do this... $5 will be sent via PayPal to a working script.
-Matt
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You didn't give enough information (name of the user, mysql type of the date, database type, ...) but you can use this to create your own script:

PHP:
<?

$link = mysql_connect('localhost', 'root', '');

if (!$link)
{
	die("Can't connect: " . mysql_error());
}
else
{
	mysql_select_db('foo');

	echo "Deleting users who didn't log in during the last 30 days<br />";
	
	mysql_query("delete from user_table where date_sub(curdate(), interval 30 day) > last_login");
	
	$result = mysql_query("select id, email from user_table where date_sub(curdate(), interval 20 day) > last_login");
	
	if (!$result)
	{
		die("Error: Invalid query: " . mysql_error());
	}
	
	echo "Sending mail top users who didn't log in during the last twenty days:<br />";
	
	while ($row = mysql_fetch_assoc($result))
	{
		if (mail($row['email'], "Log in", "Or your account is killed"))
		{
			echo 'Sent mail to user with ID ' . $row['id'] . "<br />";
		}
		else
		{
			echo 'Mailing user with ID ' . $row['id'] . " failed <br />";
		}
	}
}

?>
 
1
•••
I told you the type of date - F d, Y which really only fits in VARCHAR... use some logic. Database type... MySQL .... really: What other database system implements w/ PHP so well and is used so commonly?

I am not willing to buy a script from somebody that does not know what they're doing. Please write an original script for you to get your $5 - again it must be tested on your own server.
 
0
•••
compuXP said:
I am not willing to buy a script from somebody that does not know what they're doing.
I really appreciate 15 year olds who store timedate stamps in varchar fields telling me I don't know what I'm doing. The script works well (assuming you knew how to set up database tables, which you unfortunately don't) and it's tested on my server.

Edit: Here, because I'm a nice guy: Look into the MySQL cast operator to create a workaround for your horrible table design. Something like "select cast(last_login as date) from table". Maybe you're lucky and that works.
 
Last edited:
0
•••
I'm glad you appreciate the fact that I told you that you don't know what you're doing. Your welcome.

And, obviously you don't know what you're doing since I specifically ask that I see a sample of it.

Now bug off and I would appreciate it if somebody else could follow my criteria.
 
0
•••
lol

lol, after talking to him like that ... do you really expect someone to help you ???
 
0
•••
Yeah, you need to post the table structure at least. And honestly, if this is such a critical thing for you (and obviously it is and you can't risk screwing up your server/database/site), I think you should offer more.

BTW, sjp's solutions looks fine to me (different coding style, though ;)).
 
0
•••
Table structure ... why? I give you the fields that are used ...
 
0
•••
Wow, very interesting thread. Let me get right on this for you.
 
0
•••
THANK you! :xf.love: Many thanks again. I look forward to seeing your results :)
 
0
•••
Any progress?

Btw, jdk, how am I supposed to reply to your PM when you have disabled Private Messages?
 
0
•••
I sent an email to tech to find out why since in my options it says they are enabled.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back