Jump to content

MKTime(); Errors :/


xyn

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   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.

×
×
  • Create New...

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.