L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 11:31:36 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Getting expire time
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Getting expire time  (Read 242 times)
0 Members and 1 Guest are viewing this topic.
Temar
BeBot Developer
Grandmaster
********
Offline Offline

Gender: Male
Posts: 877



WWW
Getting expire time
« on: September 07, 2007, 12:36:31 PM »

This doesnt seem to be working correctly
Code:
<?
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:
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:
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
Cheesy
Logged

MSN messenger: chris_smith96 at hotmain dot com
Xfire: chriss96
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Getting expire time
« previous next »
 
Jump to:  

Recent
!items database
by Zeephonz
[Today at 08:05:21 PM]

Log playtime from buddys ...
by IKShadow
[Today at 06:48:12 AM]

[request] Raid timers
by Elesar1
[December 01, 2008, 04:41:09 PM]

Shared DB online list
by Temar
[December 01, 2008, 01:55:47 AM]

relay colors
by Temar
[December 01, 2008, 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]
Stats
Members
Total Members: 1244
Latest: Armonkens
Stats
Total Posts: 11146
Total Topics: 1505
Online Today: 25
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 17
Total: 19
Elesar1
Vain

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.395 seconds with 28 queries. (Pretty URLs adds 0.023s, 4q)
Loading...