Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

MKTime(); Errors :/

Recommended Posts

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:
[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]

Share this post


Link to post
Share on other sites
$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 ?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.