Jump to content
  • 0
Sign in to follow this  
Yum

Ban Account using PHP/MYSQL

Question

Hello,

 

I'm trying to make the ban on an account through my php. I am not knowing generate the correct value for unban_time ...

 

Using the basis of Ceres I got this:

 

DEFINE('PARTNER_BAN', "UPDATE `login` SET `unban_time` = NOW() + '%d' WHERE `account_id` = '%d' AND `unban_time` = '0'");

 

What is the value of %d?

if (isset($GET_frm_name) && isset($GET_id)) {	$query = sprintf(ACCOUNTS_SEARCH_ACCOUNT_ID, trim($GET_id));	$result = execute_query($query, 'adminaccban.php');	if ($line = $result->fetch_row()) {		$today = getdate();				if (notnumber($GET_id))			alert($lang['INCORRECT_CHARACTER']);		if ($GET_bday == $today['mday'] && $GET_bmonth == $today['mon'] && $GET_byear == $today['year'])			$ban = 0;		else 			$ban = truedate($GET_bday, $GET_bmonth, $GET_byear);		if ($ban <= time())			$ban = 0;				if ($GET_block == 5)			$ban = 0;		if ($_SESSION[$CONFIG_name.'level'] <= $line[4] || ($line[4] >= $_SESSION[$CONFIG_name.'level'] && $_SESSION[$CONFIG_name.'level'] != 99)) {			$ban = $line[6];			$GET_block = $line[7];		}		$query = sprintf(ACCBAN_UPDATE, $ban, $GET_block, trim($GET_id));		$result = execute_query($query, 'adminaccban.php');		alert("Account Updated");	}}[/code][code]function truedate($day, $month, $year) {	$diames = array (		1  => 31,		2  => 28,		3  => 31,		4  => 30,		5  => 31,		6  => 30,		7  => 31,		8  => 31,		9  => 30,		10 => 31,		11 => 30,		12 => 31,	);	if (($year % 4) === 0)		$diames[2] = 29;	if ($day > $diames[$month])		return 0;	return mktime(0, 0, 0, $month, $day, $year);}
Edited by Yum

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Solved!
 

$dias = $_POST['days'];
$days = $dias * 86400;
$today = getdate();
$ban = $today['0'] + $days;
Edited by Yum

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.