xyn Posted September 28, 2006 Share Posted September 28, 2006 Hey guys,I have been advices to use a timestamp, and to get that i needto 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 128Would that affect anything? or could i mute that with '@' and itwill still work...Code:[code=php:0]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'); } } }}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22405-mktime-errors/ Share on other sites More sharing options...
Fehnris Posted September 29, 2006 Share Posted September 29, 2006 $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 ? Quote Link to comment https://forums.phpfreaks.com/topic/22405-mktime-errors/#findComment-100720 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.