Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Current Auctions


decapper

Recommended Posts

I have installed this contribution http://addons.oscommerce.com/info/1443 which was pretty straight forward.

 

I have a problem on the current auctions page being displayed saying

 

Warning: mktime() expects parameter 2 to be long, string given in /home/pricelessweddings/includes/modules/current_auctions_module.php on line 116

 

Warning: mktime() expects parameter 4 to be long, string given in /home/pricelessweddings/includes/modules/current_auctions_module.php on line 116

 

 

The coding is as follows

 

	// mktime is the marked time, and time() is the current time. 
$target = mktime($hour,$minute,$second,$month,$day,$year); 
$diff = $target - time(); 

$days = ($diff - ($diff % 86400)) / 86400; 
$diff = $diff - ($days * 86400); 
$hours = ($diff - ($diff % 3600)) / 3600; 
$diff = $diff - ($hours * 3600); 
$minutes = ($diff - ($diff % 60)) / 60; 
$diff = $diff - ($minutes * 60); 
$seconds = ($diff - ($diff % 1)) / 1;

 

Would someone be able to help.. I have very limited knowledge of PHP

 

Thanks

Edited by decapper
Link to comment
Share on other sites

Try this for that one line of code:

 

$target = mktime($hour,(int)$minute,$second,(int)$month,$day,$year);

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Try this for that one line of code:

 

$target = mktime($hour,(int)$minute,$second,(int)$month,$day,$year);

 

 

Once I put your new code in it asked me for other positions so in the end I ended up with this that fixed it

 

$target = mktime($hour,(int)$minute,(int)$second,(int)$month,(int)$day,(int)$year);

 

Not sure what it does but it seems to have fixed the problem.. Thanks

Link to comment
Share on other sites

It's called "casting" a type onto a variable.

 

I looked at the contribution and I see the problem.

 

This code:

 

	$month = $seperate[0];
$day = $seperate[1];
$year = $seperate[2];
$hour = $seperate[3] + AUCTION_TIMEZONE; 
$minute = $seperate[4];
$second = $seperate[5];

// mktime is the marked time, and time() is the current time. 
$target = mktime($hour,$minute,$second,$month,$day,$year);

Should have been:

 

	$month = (int)$seperate[0];
$day = (int)$seperate[1];
$year = (int)$seperate[2];
$hour = (int)$seperate[3] + AUCTION_TIMEZONE; 
$minute = (int)$seperate[4];
$second = (int)$seperate[5];

// mktime is the marked time, and time() is the current time. 
$target = mktime($hour,$minute,$second,$month,$day,$year);

If it was like that you probably wouldn't have gotten the error.

 

seperate gets initialized a few lines earlier as a string array:

 

	$seperate = split('[- :]', $End);

PHP is pretty forgiving when it comes to variable types, most of the time it will just convert to the right type and keep on chugging.

 

You just ran into an exception.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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