collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Getting expire time  (Read 1616 times)

0 Members and 1 Guest are viewing this topic.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Getting expire time
« on: September 07, 2007, 07:36:31 pm »
This doesnt seem to be working correctly
Code: [Select]
<?
function check_expire($expire)
{
echo "expire = ".$expire."\n";
if ($expire == '0')
Return ("0");
echo "meeeep\n";
echo "expire2 = ".$expire."\n";
// if (preg_match("/^([0-9]+(:[0-9][0-9]){0,3}) (.*)/$i", $msg, $info))
if (preg_match("/^([0-9]+(:[0-9][0-9]){0,3})$/i", $expire, $info))
{
echo "match\n";
echo "0 - ".$info[0]."\n";
echo "1 - ".$info[1]."\n";
echo "2 - ".$info[2]."\n";
echo "3 - ".$info[3]."\n";
echo "4 - ".$info[4]."\n";
echo "5 - ".$info[5]."\n";
$d = $info[1] * 24 * 60 * 60;
$h = $info[2] * 60 * 60;
$m = $info[3] * 60;
$expire = time() + $d + $h + $m;
$expireex = $expire - time();
echo "expireR = ".$expireex."\n";
Return $expire;
}
if (preg_match("/^([1-9][0-9]*[mhd]?)$/i", $expire, $info))
{
echo "match2\n";
$expirenum = substr($expire, -1);
echo "expirenum = ".$expirenum."\n";
if (stristr($expire, 'm'))
$expire = time() + ($expirenum * 60);
else if (stristr($expire, 'h'))
$expire = time() + ($expirenum * 60 * 60);
else if (stristr($expire, 'd'))
$expire = time() + ($expirenum * 24 * 60 * 60);
$expireex = $expire - time();
echo "expireR = ".$expireex."\n";
Return $expire;
}
else
Return FALSE;
}
console says when going !automsg add 00:01:30 test
Code: [Select]
expire = 00:01:30
meeeep
expire2 = 00:01:30
match
0 - 00:01:30
1 - 00:01:30
2 - :30
3 -
4 -
5 -
expireR = 0
expires now
and with !automsg add 30 test
Code: [Select]
expire = 30
meeeep
expire2 = 30
match
0 - 30
1 - 30
2 -
3 -
4 -
5 -
expireR = 2592000
it expires in 30 days not mins

What i want is for the user to use just MM or HH:MM or DD:HH:MM or nothing if no expire also 0 = no expire, and 2 digits not requires so like H:MM or D:H:MM
:D

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 679
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal