Jump to content


Photo

MKTime(); Errors :/


  • Please log in to reply
1 reply to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 28 September 2006 - 07:04 PM

Hey guys,
I have been advices to use a timestamp, and to get that i need
to convert my current times, well the code i was given returns:
Warning: mktime() expects parameter 4 to be long, string given in /home/eumod/public_html/en/global/login.php on line 128

Would that affect anything? or could i mute that with '@' and it
will still work...

Code:
include "../db/db.php";
	$result = mysql_query("SELECT pri_active,adm_ban FROM accounts WHERE usr_user='".strtolower($_POST['user'])."'");
	while( $dat = @mysql_fetch_array($result, MYSQL_NUM))
	{
	$ban = $dat[1];
	$active = $dat[0];
	
	if($ban=="y")
	{
		$SQL = mysql_query("SELECT * FROM ban WHERE user='".strtolower($_POST['user'])."'");
		while( $data = mysql_fetch_row( $SQL ))
	{
		$Now = date("j, m, Y - H:i.s", strtotime("now"));
		
		// get current timestamp
    	$today = time();
	
    	// create an array from your date format
    	$datearr = explode(",",str_replace(array(" ","-",":","."), array("",",",",",","), $data[4])); 
	
    	// create a timestamp from the array
    	$bandate = mktime($datearr[3],$datearr[4],$datearr[5],$datearr[1],$datearr[0],$datearr[2]); 
	
    	//compare the timestamps
    	if( $today >= $bandate )
    {
    	echo "unbanned";
    	exit;
    }
    else
    {
    	if( $data[4] == "never" )
    {
    	die('perm ban');
    }
    else
    {
    	die('Temp Ban');
	  }
	}		
  }
}


#2 Fehnris

Fehnris
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 29 September 2006 - 08:36 AM

$data[4] from looking at your code, is that a date field in your database?  If so what type of date format are you using ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users