Jump to content
Sign in to follow this  
decapper

Current Auctions

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

Share this post


Link to post
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 >

Share this post


Link to post
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

Share this post


Link to post
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 >

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×