$ccRow = pg_fetch_object($ccRes);
$rVal[0]->query_status = 1;
$rVal[0]->channel_id = $ccRow->id;
- $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=now()::abstime::int4 AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
+ $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
if ($match_pattern != "*") {
$match_string = str_replace("?","_",str_replace("*","%",str_replace("%","\%",str_replace("_","\_",$match_pattern))));
$cQuery .= " AND lower(users.user_name) LIKE '" . strtolower($match_string) . "'";
$dRes = pg_safe_exec($dQuery);
if (pg_numrows($dRes)==0) { return(-3); }
$dUser = pg_fetch_object($dRes);
- $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=now()::abstime::int4,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
+ $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
if ($log_line) {
$user_id = $cUser->id;
log_user($dUser->id,3,"- Maxlogins (SOAP)");
$ccRow = pg_fetch_object($ccRes);
$rVal[0]->query_status = 1;
$rVal[0]->channel_id = $ccRow->id;
- $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=now()::abstime::int4 AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
+ $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
if ($match_pattern != "*") {
$match_string = str_replace("?","_",str_replace("*","%",str_replace("%","\%",str_replace("_","\_",$match_pattern))));
$cQuery .= " AND lower(users.user_name) LIKE '" . strtolower($match_string) . "'";
$dRes = pg_safe_exec($dQuery);
if (pg_numrows($dRes)==0) { return(-3); }
$dUser = pg_fetch_object($dRes);
- $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=now()::abstime::int4,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
+ $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
if ($log_line) {
$user_id = $cUser->id;
log_user($dUser->id,3,"- Maxlogins (SOAP)");
$query .= "'" . $isstaff . "',";
$query .= "'" . $flags . "',";
$query .= "'" . $xtra . "',";
- $query .= "now()::abstime::int4,";
+ $query .= "date_part('epoch', CURRENT_TIMESTAMP)::int,";
$query .= "'" . $user_id . "',";
$query .= "'0','0','0')";
$query .= "isstaff='" . $isstaff . "',";
$query .= "flags='" . $flags . "',";
$query .= "xtra='" . $xtra . "',";
- $query .= "last_updated=now()::abstime::int4,";
+ $query .= "last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,";
$query .= "last_updated_by='" . $user_id . "' ";
$query .= " WHERE user_id='" . $userid . "'";
die;\r
}\r
\r
- if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (4,now()::abstime::int4," . $user_id . ")"); }\r
+ if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (4,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='4'"); }\r
\r
header("Location: redir.php?RET=index.php");\r
\r
if ($mode=="reset") { $nbsup = DEFAULT_REQUIRED_SUPPORTERS; }\r
\r
- pg_safe_exec("UPDATE variables SET contents='" . $nbsup . "',last_updated=now()::abstime::int4 WHERE var_name='REQUIRED_SUPPORTERS'");\r
+ pg_safe_exec("UPDATE variables SET contents='" . $nbsup . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE var_name='REQUIRED_SUPPORTERS'");\r
\r
header("Location: index.php\n\n");\r
die;\r
die;\r
} \r
\r
- if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (2,now()::abstime::int4," . $user_id . ")"); }\r
+ if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (2,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='2'"); }\r
\r
header("Location: redir.php?RET=index.php");\r
die;\r
}\r
\r
- if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (3,now()::abstime::int4," . $user_id . ")"); }\r
+ if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (3,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='3'"); pg_safe_exec("DELETE FROM counts WHERE count_type='1'"); }\r
\r
header("Location: redir.php?RET=index.php");\r
die;\r
}\r
\r
- if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (1,now()::abstime::int4," . $user_id . ")"); }\r
+ if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (1,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='1'"); }\r
\r
header("Location: index.php");\r
$flags = $oldflags&~MIA_TAG_FLAG;
break;
}
- pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+ pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
} else {
$oldflags = -1;
$query .= "users.id=levels.user_id AND ";
$query .= "levels.channel_id=channels.id AND ";
$query .= "users.id=users_lastseen.user_id AND ";
- $query .= "users_lastseen.last_seen<=(now()::abstime::int4-25*24*60*60) AND ";
+ $query .= "users_lastseen.last_seen<=(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) AND ";
$query .= "channels.registered_ts>0 AND ";
// warning: works only on pgsql version 7.2+ (!) If you see SQL errors, this comes from here, just comment the two lines below.
$query .= "(channels.flags & 1)!=1 AND "; // NOPURGE
$query .= "levels.channel_id=channels.id AND ";
$query .= "users.id=users_lastseen.user_id AND ";
$query .= "(";
- $query .= "users_lastseen.last_seen>(now()::abstime::int4-25*24*60*60) ";
+ $query .= "users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) ";
$query .= "OR ";
$query .= "lower(users.user_name)='nopurge') ";
$query .= "AND ";
$flags = $oldflags&~MIA_TAG_FLAG;
}
if ($debug==on)
- echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$data[1]."'<br>";
+ echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$data[1]."'<br>";
else
- pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$data[1]."'");
+ pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$data[1]."'");
} else
{
$oldflags = -1;
break;
}
if ($debug==on)
- echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'<br>";
+ echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'<br>";
else
- pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+ pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
} else {
$oldflags = -1;
{
if ($manager==on)
{
- $query .= " AND users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1))) AND ";
+ $query .= " AND users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1))) AND ";
$query .= "levels.access=500 ";
- $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
+ $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
if ($nopurgeuser==on)
$query.=" AND channels.id IN ( SELECT channels.id FROM users,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND lower(users.user_name)='".$nopurge_username."' AND channels.registered_ts>0 AND levels.access=500)";
if ($manager==on)
{
$query .= "AND levels.access=500 ";
- $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
+ $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
if ($nopurgeuser==on)
$query.=" AND channels.id IN ( SELECT channels.id FROM users,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND lower(users.user_name)='".$nopurge_username."' AND channels.registered_ts>0 AND levels.access=500)";
if ($nousers==on)
$flags = $oldflags&~MIA_TAG_FLAG;
break;
}
- pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+ pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
} else {
$oldflags = -1;
$query .= "users.id=levels.user_id AND ";
$query .= "levels.channel_id=channels.id AND ";
$query .= "users.id=users_lastseen.user_id AND ";
- $query .= "users_lastseen.last_seen<=(now()::abstime::int4-25*24*60*60) AND ";
+ $query .= "users_lastseen.last_seen<=(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) AND ";
$query .= "channels.registered_ts>0 AND ";
// warning: works only on pgsql version 7.2+ (!) If you see SQL errors, you are using an obsolete version: UPGRADE!!!
$query .= "(channels.flags & 1)!=1 AND "; // NOPURGE
$query .= "levels.channel_id=channels.id AND ";
$query .= "users.id=users_lastseen.user_id AND ";
$query .= "(";
- $query .= "users_lastseen.last_seen>(now()::abstime::int4-25*24*60*60) ";
+ $query .= "users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) ";
$query .= "OR ";
$query .= "lower(users.user_name)='nopurge') ";
$query .= "AND ";
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$res=pg_safe_exec("select channellog.ts as ts, channels.name as name, channellog.message as message from channellog,channels where channellog.ts>=" . $start_ts . " AND channellog.ts<=" . $end_ts . " AND channellog.event=11 and channellog.channelid=channels.id and channels.registered_ts>0 order by channellog.ts desc");
$count = pg_numrows($res);
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$res = @pg_safe_exec("SELECT * FROM channels WHERE last_updated>=" . $start_ts . " AND last_updated<=" . $end_ts_db . " AND (flags::int4 & 16)=16 ORDER BY last_updated DESC");
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$res = @pg_safe_exec("SELECT * FROM users,userlog WHERE userlog.ts>=" . $start_ts . " AND userlog.ts<=" . $end_ts_db . " AND (users.flags::int4 & 1)=1 AND userlog.user_id=users.id AND userlog.event=1 ORDER BY userlog.ts");
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$q = "SELECT users.id,users.user_name,adminlog.timestamp AS ts,adminlog.* FROM users,adminlog ";
<?
$ENABLE_COOKIE_TABLE = 1;
- pg_safe_exec("DELETE FROM webcookies WHERE expire<now()::abstime::int4");
+ pg_safe_exec("DELETE FROM webcookies WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
$r1 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin>0");
$r2 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0");
$active_mins = 2;
- $r3 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0 AND expire>(now()::abstime::int4+" . $active_mins . "*60)");
+ $r3 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0 AND expire>(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $active_mins . "*60)");
$s1 = pg_fetch_object($r1,0);
$s2 = pg_fetch_object($r2,0);
$s3 = pg_fetch_object($r3,0);
echo "Login timeout : <b>" . round((COOKIE_EXPIRE/3600),0) . "</b> hour(s).<br>\n";
- $query = "SELECT * FROM webcookies WHERE is_admin>0 AND expire>=now()::abstime::int4 ORDER BY expire DESC";
+ $query = "SELECT * FROM webcookies WHERE is_admin>0 AND expire>=date_part('epoch', CURRENT_TIMESTAMP)::int ORDER BY expire DESC";
//echo "<b>SQL Query:</b><br>" . $query . ";<br><br>";
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$res = pg_safe_exec("SELECT channels.id AS chanid,channels.registered_ts AS ts,channels.name AS name,users.id AS uid,users.user_name AS uname,users_lastseen.last_hostmask AS hostmask,users_lastseen.last_seen AS lastseen_ts FROM levels,channels,users,users_lastseen WHERE levels.access=500 AND levels.added_by='The Judge' AND channels.id=levels.channel_id AND channels.registered_ts>=" . $start_ts . " AND channels.registered_ts<=" . $end_ts . " AND users.id=levels.user_id AND users_lastseen.user_id=levels.user_id");
$count = pg_numrows($res);
\r
\r
$ENABLE_COOKIE_TABLE=1;\r
-pg_safe_exec("DELETE FROM newu_ipcheck WHERE expiration<now()::abstime::int4");\r
+pg_safe_exec("DELETE FROM newu_ipcheck WHERE expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");\r
$res = pg_safe_exec("SELECT * FROM newu_ipcheck ORDER BY " . $order);\r
$num = pg_numrows($res);\r
\r
<?
$ENABLE_COOKIE_TABLE = 0;
- pg_safe_exec("DELETE FROM pendingusers WHERE expire<now()::abstime::int4");
+ pg_safe_exec("DELETE FROM pendingusers WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
$r1 = pg_safe_exec("SELECT COUNT(*) AS count FROM pendingusers");
$x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
$start_ts = $x_days_ago_start;
$end_ts = time();
- $end_ts_db = "now()::abstime::int4";
+ $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
}
$suspends = pg_safe_exec("SELECT * FROM users,userlog WHERE userlog.ts>=" . $start_ts . " AND userlog.ts<=" . $end_ts_db . " AND users.id=userlog.user_id AND (userlog.event=1 OR userlog.event=2) ORDER BY userlog.ts DESC");
"or " .
" channellog.event = 10 " .
") and " .
- " channellog.ts > now()::abstime::int4-(14*24*60*60) " .
+ " channellog.ts > date_part('epoch', CURRENT_TIMESTAMP)::int-(14*24*60*60) " .
"order by channellog.ts desc");
if (pg_numrows($res)<1) {
if ($o1 = @pg_fetch_object($r1,0)) {
if ($ccrc == md5($iid . "modFP" . CRC_SALT_0015 . $o1->new_crypt)) {
// confirmation of password change
- $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->new_crypt . "',last_updated=now()::abstime::int4,last_updated_by='forgotten password (" . cl_ip() . ")' WHERE id='" . $iid . "'");
+ $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->new_crypt . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='forgotten password (" . cl_ip() . ")' WHERE id='" . $iid . "'");
if ($rez) {
$ru = pg_safe_exec("SELECT * FROM users WHERE id='" . $iid . "'");
$user = pg_fetch_object($ru,0);
" url = '" . $c_url . "'," .
" description = '" . $c_desc . "'," .
" keywords = '" . $c_keywords . "'," .
- " last_updated = now()::abstime::int4, " .
+ " last_updated = date_part('epoch', CURRENT_TIMESTAMP)::int, " .
" channel_mode = '" . $c_mode . "' " .
" WHERE id = " . $channel->id;
" last_modif,last_modif_by,last_updated,deleted) " .
" values " .
" (" . $channel->id . "," . $user2->id . "," .
- "$add_access ,0,now()::abstime::int4," .
+ "$add_access ,0,date_part('epoch', CURRENT_TIMESTAMP)::int," .
" '" . $user->user_name . " (via web)'," .
- " now()::abstime::int4,'" .$user->user_name . " (via web)'," .
- " now()::abstime::int4,0)");
+ " date_part('epoch', CURRENT_TIMESTAMP)::int,'" .$user->user_name . " (via web)'," .
+ " date_part('epoch', CURRENT_TIMESTAMP)::int,0)");
//pg_safe_exec($query);
}
}
echo("</table>");
-$bans = pg_safe_exec("SELECT channel_id,id,banmask,set_by,set_ts,level,expires,reason FROM bans WHERE (expires=0 OR expires>now()::abstime::int4) AND channel_id=$channel->id order by set_ts desc");
+$bans = pg_safe_exec("SELECT channel_id,id,banmask,set_by,set_ts,level,expires,reason FROM bans WHERE (expires=0 OR expires>date_part('epoch', CURRENT_TIMESTAMP)::int) AND channel_id=$channel->id order by set_ts desc");
if (pg_numrows($bans)!=0) {
echo(" <br><br>
\r
}\r
\r
-$q = "UPDATE pending SET reviewed='N',reviewed_by_id=1,last_updated=now()::abstime::int4 WHERE channel_id='$channel_id' AND created_ts='$created_ts'";\r
+$q = "UPDATE pending SET reviewed='N',reviewed_by_id=1,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$channel_id' AND created_ts='$created_ts'";\r
pg_safe_exec($q);\r
review_count_rem($user_id);\r
log_channel($channel_id,18,"Cleared Application Review");\r
$q = "DELETE FROM complaints WHERE id='" . (int)$_POST["compid"] . "'";
// To be checked for bugs (referenced keys) !@#
} else {
- $q = "UPDATE complaints SET current_owner='" . (int)$user_id . "',reviewed_by_id='" . (int)$user_id . "',reviewed_ts=now()::abstime::int4,status='" . $_POST["switchto"] . "' WHERE id='" . (int)$_POST["compid"] . "'";
+ $q = "UPDATE complaints SET current_owner='" . (int)$user_id . "',reviewed_by_id='" . (int)$user_id . "',reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,status='" . $_POST["switchto"] . "' WHERE id='" . (int)$_POST["compid"] . "'";
}
pg_safe_exec($q);
echo "<a href=\"admin.php\"><b>< back</b></a><br><br>\n";
$lo = @pg_fetch_object($lr);
$q1_more = "";
if ((int)$lo->id == 0) { // so if you transfer it when never replied, it doesnt "bug"
- $q1_more = "status=2,reviewed_by_id='" . (int)$user_id . "',reviewed_ts=now()::abstime::int4,";
+ $q1_more = "status=2,reviewed_by_id='" . (int)$user_id . "',reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,";
}
$q1 = "UPDATE complaints SET " . $q1_more . "current_owner='" . (int)$_POST["newowner"] . "' WHERE id='" . (int)$_POST["compid"]. "'";
- $q2 = "INSERT INTO complaints_reference (complaints_ref,referenced_by,referenced_to,reference_ts,is_new) VALUES ('" . (int)$_POST["compid"] . "','" . (int)$user_id . "','" . (int)$_POST["newowner"] . "',now()::abstime::int4,1)";
+ $q2 = "INSERT INTO complaints_reference (complaints_ref,referenced_by,referenced_to,reference_ts,is_new) VALUES ('" . (int)$_POST["compid"] . "','" . (int)$user_id . "','" . (int)$_POST["newowner"] . "',date_part('epoch', CURRENT_TIMESTAMP)::int,1)";
$nr = pg_safe_exec("SELECT user_name FROM users WHERE id='" . (int)$_POST["newowner"] . "'");
$no = pg_fetch_object($nr);
- $q3 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$_POST["compid"] . "'," . (int)$user_id . ",now()::abstime::int4,'','*** CHANGED TICKET OWNERSHIP TO : " . $no->user_name . " ***'," . (int)$lo->id . ")";
+ $q3 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$_POST["compid"] . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'','*** CHANGED TICKET OWNERSHIP TO : " . $no->user_name . " ***'," . (int)$lo->id . ")";
//echo $q0 . "<br>\n";
//echo $q1 . "<br>\n";
$cTheme = get_theme_info();
std_theme_styles(1);
std_theme_body();
-pg_safe_exec("DELETE FROM complaints WHERE status=0 AND crc_expiration<now()::abstime::int4");
-$r = @pg_safe_exec("SELECT id,from_email FROM complaints WHERE created_crc='" . $_GET["ID"] . "' AND status=0 AND crc_expiration>=now()::abstime::int4");
+pg_safe_exec("DELETE FROM complaints WHERE status=0 AND crc_expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
+$r = @pg_safe_exec("SELECT id,from_email FROM complaints WHERE created_crc='" . $_GET["ID"] . "' AND status=0 AND crc_expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (!$r) { echo "<h2>Invalid ID</h2>"; } else {
if ($o = pg_fetch_object($r)) {
$ticket_number = strtoupper($o->id . "-" . substr(md5( $o->id . CRC_SALT_0007 . "ticket" ),0,10));
/* Check if the maximum complaints per user id / email hasnt been reached */
- $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(now()::abstime::int4-" . MAX_CONCURRENT_TIME . ") AND status<=2 AND (lower(from_email)='" . strtolower($_POST["from_mail"]) . "' OR lower(inrec_email)='" . strtolower($_POST["from_mail"]) . "' OR (from_id='" . ($user_id+0) . "' AND from_id>0))");
+ $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(date_part('epoch', CURRENT_TIMESTAMP)::int-" . MAX_CONCURRENT_TIME . ") AND status<=2 AND (lower(from_email)='" . strtolower($_POST["from_mail"]) . "' OR lower(inrec_email)='" . strtolower($_POST["from_mail"]) . "' OR (from_id='" . ($user_id+0) . "' AND from_id>0))");
$sso = pg_fetch_object($ssq);
if ($sso->count >= MAX_CONCURRENT) { // yes !
echo $back_lnk;
unset($ssq); unset($sso);
/* Check if the maximum complaints per IP hasnt been reached */
- $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(now()::abstime::int4-" . MAX_CONCURRENT_IP_TIME . ") AND status<=2 AND created_ip='" . cl_ip() . "'");
+ $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(date_part('epoch', CURRENT_TIMESTAMP)::int-" . MAX_CONCURRENT_IP_TIME . ") AND status<=2 AND created_ip='" . cl_ip() . "'");
$sso = pg_fetch_object($ssq);
if ($sso->count >= MAX_CONCURRENT_IP) { // yes !
echo $back_lnk;
$query .= "'" . post2db($da_channel2_name) . "', ";
$query .= "" . (int)$da_users_id . ", ";
-$query .= "0, 0, 0, 0, now()::abstime::int4, '" . cl_ip() . "', '" . $da_crc . "', (now()::abstime::int4+172800), '', 0";
+$query .= "0, 0, 0, 0, date_part('epoch', CURRENT_TIMESTAMP)::int, '" . cl_ip() . "', '" . $da_crc . "', (date_part('epoch', CURRENT_TIMESTAMP)::int+172800), '', 0";
$query .= " )";
echo "<br>";
$res = @pg_safe_exec($query);
$da_cmt .= "**** AUTOMATIC ****<br><br>";
$da_cmt .= "<b>An anonymous objection has been posted through the Complaints System.</b><br>";
$da_cmt .= "<a href=\"complaints/admin.php?view=" . $ticket_number . "\">click here</a> to go to that complaint.<br><br>";
- $notif_q = "INSERT INTO objections (channel_id,user_id,comment,created_ts,admin_only) VALUES ('" . (int)$da_channel1_id . "','" . (int)$issuer_id . "','" . post2db($da_cmt) . "',now()::abstime::int4,'Y')";
+ $notif_q = "INSERT INTO objections (channel_id,user_id,comment,created_ts,admin_only) VALUES ('" . (int)$da_channel1_id . "','" . (int)$issuer_id . "','" . post2db($da_cmt) . "',date_part('epoch', CURRENT_TIMESTAMP)::int,'Y')";
pg_safe_exec($notif_q);
}
$mmsg .= "\nThe " . NETWORK_NAME . " Channel Service.\n\n";
custom_mail($_POST["from_mail"],"[" . NETWORK_NAME . " CService Complaints] Confirmation request",$mmsg,"From: " . NETWORK_NAME . " Channel Service <" . OBJECT_EMAIL . ">\nReply-to: DO.NOT@REPLY.THANKS\nX-Mailer: " . NETWORK_NAME . " CService Complaint Module\n\n");
}
-$dq = pg_safe_exec("SELECT id FROM complaints WHERE (status=0 OR status=99) AND crc_expiration<now()::abstime::int4");
+$dq = pg_safe_exec("SELECT id FROM complaints WHERE (status=0 OR status=99) AND crc_expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
while ($do = pg_fetch_object($dq)) {
pg_safe_exec("DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$do->id . "'");
pg_safe_exec("DELETE FROM complaints_threads WHERE complaint_ref='" . (int)$do->id . "'");
$r1 = pg_safe_exec("SELECT id,from_id FROM complaints WHERE status!=4 AND id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'");
if ($o1 = pg_fetch_object($r1)) {
$q = "UPDATE complaints SET current_owner=0,status=4 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
- $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,now()::abstime::int4,'** TICKET CLOSED **','',0)";
+ $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET CLOSED **','',0)";
$q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
$r = pg_safe_exec($q);
$updated=0;
if (strlen($da_reply)>30720) {
echo "<big>your 'reply' section is too big ( above 30KB )</big>.";
} else {
- $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,now()::abstime::int4,'" . $da_reply . "',''," . (int)$_GET["RT"] . ")";
+ $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $da_reply . "',''," . (int)$_GET["RT"] . ")";
echo "<h2>Complaint Manager (reply to admin)";
echo "</h2>\n";
switch ($_GET["A"]) {
case 'cancel':
$q = "UPDATE complaints SET current_owner=0,status=4 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
- $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET CANCELLED **','',0)";
+ $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET CANCELLED **','',0)";
$q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
$r = pg_safe_exec($q);
$updated=0;
}
if ($do_the_reply == 1) {
if ($da_reply == "") { $do_notify_user = 0; }
- $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'" . $da_reply . "','" . $da_actions . "'," . (int)$_GET["RT"] . ")";
+ $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $da_reply . "','" . $da_actions . "'," . (int)$_GET["RT"] . ")";
$qx = ""; $qs = "";
if ($_GET["RT"]==0 && $_POST["newstatus"]==0) {
- $qx = "UPDATE complaints SET current_owner=" . (int)$user_id . ",reviewed_by_id=" . (int)$user_id . ",reviewed_ts=now()::abstime::int4,status=2 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
+ $qx = "UPDATE complaints SET current_owner=" . (int)$user_id . ",reviewed_by_id=" . (int)$user_id . ",reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,status=2 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
}
if ($_POST["newstatus"]>2) {
$somemore = "";
if ($_GET["RT"]==0) {
- $somemore = "current_owner=0,reviewed_by_id=" . (int)$user_id . ",reviewed_ts=now()::abstime::int4,";
+ $somemore = "current_owner=0,reviewed_by_id=" . (int)$user_id . ",reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,";
} else {
$somemore = "current_owner=0,";
}
if ($qs!="") {
pg_safe_exec($qs);
// echo $qs . "<br>";
- $qq = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'*** TICKET " . strtoupper($cmp_status[$_POST["newstatus"]]) . " ***','',0)";
+ $qq = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'*** TICKET " . strtoupper($cmp_status[$_POST["newstatus"]]) . " ***','',0)";
// echo $qq . "<br>";
pg_safe_exec($qq);
}
break;
case 'resolve':
$q = "UPDATE complaints SET status=3 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
- $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET RESOLVED **','',0)";
+ $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET RESOLVED **','',0)";
$q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
$r = pg_safe_exec($q);
$updated=0;
}
break;
case 'delete':
- $q = "UPDATE complaints SET status=99,created_crc='',crc_expiration=(now()::abstime::int4+(86400*15)) WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
- $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET REMOVED/DELETED **','',0)";
+ $q = "UPDATE complaints SET status=99,created_crc='',crc_expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+(86400*15)) WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
+ $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET REMOVED/DELETED **','',0)";
$q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
$r = pg_safe_exec($q);
$updated=0;
$verificationdata = prepare_dbtext_db( $user->verificationdata );
$q = "INSERT INTO users (user_name, password, flags, email, last_updated, last_updated_by, language_id, question_id, verificationdata, post_forms, signup_ts, signup_ip, maxlogins)";
- $q .= sprintf(" VALUES ('%s', '%s', %d, '%s', %s, '%s', %d, %d, '%s', %s, %s, '%s', %d)", $user->user_name, $crypt, 4, $user->email, "now()::abstime::int4", "Web Page New User", $user->language, $user->question_id, $verificationdata, "(now()::abstime::int4+432000)", "now()::abstime::int4", cl_ip(), DEFAULT_MAX_LOGINS);
+ $q .= sprintf(" VALUES ('%s', '%s', %d, '%s', %s, '%s', %d, %d, '%s', %s, %s, '%s', %d)", $user->user_name, $crypt, 4, $user->email, "date_part('epoch', CURRENT_TIMESTAMP)::int", "Web Page New User", $user->language, $user->question_id, $verificationdata, "(date_part('epoch', CURRENT_TIMESTAMP)::int+432000)", "date_part('epoch', CURRENT_TIMESTAMP)::int", cl_ip(), DEFAULT_MAX_LOGINS);
$res=pg_safe_exec($q);
local_seclog("New user confirmation for `" . $user->user_name . "`");
$uobj=pg_fetch_object($ucount,0);
$newcount = $uobj->count_count+1;
if ($newcount==$MAX_ALLOWED_USERS) {
- pg_safe_exec("INSERT INTO locks VALUES (3,now()::abstime::int4,0)");
+ pg_safe_exec("INSERT INTO locks VALUES (3,date_part('epoch', CURRENT_TIMESTAMP)::int,0)");
}
pg_safe_exec("UPDATE counts SET count_count='" . ($newcount+0) . "' WHERE count_type='1'");
}
if ($o1 = @pg_fetch_object($r1,0)) {
if ($ccrc == md5($iid . "modFP" . CRC_SALT_0015 . $o1->new_crypt)) {
// cancellation of password change
- $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->old_crypt . "',last_updated=now()::abstime::int4,last_updated_by='forgotten password (" . cl_ip() . ") cancel' WHERE id='" . $iid . "'");
+ $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->old_crypt . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='forgotten password (" . cl_ip() . ") cancel' WHERE id='" . $iid . "'");
if ($rez) {
pg_safe_exec("DELETE FROM pending_passwordchanges WHERE user_id='" . $user->id . "'");
echo "<h1>Success !<br><br>\n";
die;
} else {
$Xcrc = md5($user->id . "modFP" . CRC_SALT_0015 . $crypt);
- pg_safe_exec("INSERT INTO pending_passwordchanges VALUES ('" . post2db($Xcrc) . "','" . $user->id . "','" . $user->password . "','" . $crypt . "','" . post2db($password) . "',now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO pending_passwordchanges VALUES ('" . post2db($Xcrc) . "','" . $user->id . "','" . $user->password . "','" . $crypt . "','" . post2db($password) . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
if (LOCK_ON_PWCHG) { $crypt = "*"; } else { $crypt = $user->password; }
$ss = "[Forgotten Password] Confirmation request for '" . $user->username . "'";
$mm = "";
}
if (!$doconf || LOCK_ON_PWCHG) {
$res=pg_safe_exec("update users set password='" . $crypt . "', " .
- " last_updated = now()::abstime::int4, " .
+ " last_updated = date_part('epoch', CURRENT_TIMESTAMP)::int, " .
" last_updated_by = 'forgotten password (" . cl_ip() . ")' " .
" where " .
" id='". $user->id . "'");
log_user($user->id,9," ");
}
pg_safe_exec("delete from lastrequests where ip='" . cl_ip() . "'");
- pg_safe_exec("insert into lastrequests (ip,last_request_ts) values ('" . cl_ip() . "',now()::abstime::int4)");
+ pg_safe_exec("insert into lastrequests (ip,last_request_ts) values ('" . cl_ip() . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
?>
<html>
if ($ID!="" && strlen($ID)<=128) {
std_connect();
- $res=pg_safe_exec("select * from pending_emailchanges where phase=1 AND cookie='$ID' AND expiration>=now()::abstime::int4");
+ $res=pg_safe_exec("select * from pending_emailchanges where phase=1 AND cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (pg_numrows($res)==0) {
std_theme_styles(1); std_theme_body("../");
echo "<h1>Error</h1> The URL entered is not valid. Please check it ";
echo "</body></html>";
exit;
} else {
- pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+ pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
$email=pg_fetch_object($res,0);
$userid = $email->user_id;
$nmail = $email->new_email;
// change email
$cookieval = md5(CRC_SALT_0020 . uniqid("",1) . time() . $nmail);
- pg_safe_exec("update pending_emailchanges SET expiration=(now()::abstime::int4+21600),phase=2,cookie='$cookieval' WHERE phase=1 AND cookie='$ID'");
+ pg_safe_exec("update pending_emailchanges SET expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+21600),phase=2,cookie='$cookieval' WHERE phase=1 AND cookie='$ID'");
$confirm_url = gen_server_url() . LIVE_LOCATION . "/forms/confirm_emailchange2.php?ID=$cookieval";
if ($ID!="" && strlen($ID)<=128) {
std_connect();
- $res=pg_safe_exec("select * from pending_emailchanges where phase=2 AND cookie='$ID' AND expiration>=now()::abstime::int4");
+ $res=pg_safe_exec("select * from pending_emailchanges where phase=2 AND cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (pg_numrows($res)==0) {
std_theme_styles(1); std_theme_body("../");
echo "<h1>Error</h1> The URL entered is not valid. Please check it ";
echo "</body></html>";
exit;
} else {
- pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+ pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
$email=pg_fetch_object($res,0);
$userid = $email->user_id;
$nmail = $email->new_email;
// change email
- $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=now()::abstime::int4,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
+ $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
$user_id = $userid;
log_user($userid,7,"Changed email-in-record from: $omail(old) to: $nmail(new) - cookie was: $ID");
$user_id = 0;
if ($ID!="" && strlen($ID)<=128) {
std_connect();
- pg_safe_exec("delete from pending_mgrchange where expiration<now()::abstime::int4 AND confirmed='0'");
- $res=pg_safe_exec("select * from pending_mgrchange where crc='$ID' AND expiration>=now()::abstime::int4 AND confirmed='0'");
+ pg_safe_exec("delete from pending_mgrchange where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int AND confirmed='0'");
+ $res=pg_safe_exec("select * from pending_mgrchange where crc='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int AND confirmed='0'");
if (pg_numrows($res)==0) {
std_theme_styles(1); std_theme_body("../");
echo "<h1>Error</h1> The URL entered is not valid. Please check it ";
if ($ID!="" && strlen($ID)<=128) {
std_connect();
- $res=pg_safe_exec("select * from pending_pwreset where cookie='" . $ID . "' AND expiration>=now()::abstime::int4");
+ $res=pg_safe_exec("select * from pending_pwreset where cookie='" . $ID . "' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (pg_numrows($res)==0) {
std_theme_styles(1); std_theme_body("../");
echo "<h1>Error</h1> The URL entered is not valid. Please check it ";
echo "</body></html>";
exit;
} else {
- pg_safe_exec("delete from pending_pwreset where expiration<now()::abstime::int4");
+ pg_safe_exec("delete from pending_pwreset where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
$pwreset=pg_fetch_object($res,0);
$userid = $pwreset->user_id;
$qid = $pwreset->question_id;
// change verifdata
$gor=pg_safe_exec("SELECT verificationdata FROM users WHERE id='" . (int)$userid . "'");
$goro=pg_fetch_object($gor);
- $res=pg_safe_exec("UPDATE users SET question_id='" . (int)$qid . "',verificationdata='" . post2db($vdata) . "',post_forms=(now()::abstime::int4+86400*10),last_updated=now()::abstime::int4,last_updated_by='Verif Q/A Reset' WHERE id='" . (int)$userid . "'");
+ $res=pg_safe_exec("UPDATE users SET question_id='" . (int)$qid . "',verificationdata='" . post2db($vdata) . "',post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10),last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Verif Q/A Reset' WHERE id='" . (int)$userid . "'");
$user_id = $userid;
log_user($userid,8,"Cookie was: " . $ID . ", Old V/A was: " . $goro->verificationdata);
$user_id = 0;
$cookieval = md5(CRC_SALT_0020 . uniqid("",1) . time() . $da_newmail);
- pg_safe_exec("INSERT INTO pending_emailchanges (cookie,user_id,old_email,new_email,expiration,phase) VALUES ('$cookieval',$user_id,'$da_emailaddy','$da_newmail',now()::abstime::int4+21600,1)");
+ pg_safe_exec("INSERT INTO pending_emailchanges (cookie,user_id,old_email,new_email,expiration,phase) VALUES ('$cookieval',$user_id,'$da_emailaddy','$da_newmail',date_part('epoch', CURRENT_TIMESTAMP)::int+21600,1)");
$confirm_url = gen_server_url() . LIVE_LOCATION. "/forms/confirm_emailchange.php?ID=$cookieval";
$the_msg = "If you would like to confirm that the new email-in-record for '$da_username' should be '$da_newmail',\n";
custom_mail($da_emailaddy,"E-Mail change request 1/2",$the_msg,"From: " . NETWORK_NAME . " E-Mail Change Request <" . OBJECT_EMAIL . ">\nReply-To: no.reply@thank.you\nX-Mailer: " . NETWORK_NAME . " Channel Service");
/* make the user can re-port in 10 days. */
- pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id=" . $user_id);
+ pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id=" . $user_id);
echo "<h2>";
echo "Please check your e-mail at '$da_emailaddy',<br>then click on the URL to continue the email change to phase 2/2.<br><br>\n";
if (!$mailres) { local_seclog("custom_mail() failed for " . $user->email . " from: " . $x_at_email); }
- pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id='" . $user_id . "'");
+ pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id='" . $user_id . "'");
echo "<h2>";
echo "Please read your email at '$user->email'<br>and click on the link to CONFIRM your request<br>within <b>6 hours</b>\n";
<textarea name=mcreason cols=40 rows=5></textarea>
<li>Username of new manager : <?
if ($multiple_ok == 0) { $forcechannel_I=$channel->id; }
- $res3 = pg_safe_exec("SELECT users.user_name,users.id FROM users,users_lastseen,levels WHERE users.id=levels.user_id AND levels.channel_id='" . $forcechannel_I . "' AND levels.access=499 AND users_lastseen.user_id=users.id AND users_lastseen.last_seen>(now()::abstime::int4-86400*20) ORDER BY users.user_name");
+ $res3 = pg_safe_exec("SELECT users.user_name,users.id FROM users,users_lastseen,levels WHERE users.id=levels.user_id AND levels.channel_id='" . $forcechannel_I . "' AND levels.access=499 AND users_lastseen.user_id=users.id AND users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*20) ORDER BY users.user_name");
if (pg_numrows($res3)==0) {
echo "<b>No user with level 499 on that channel seen in the last 20 days.</b><br>\n";
$nouser=1;
if ($ID!="" && strlen($ID)<=128) {
std_connect();
- $res=pg_safe_exec("select * from pending_emailchanges where cookie='$ID' AND expiration>=now()::abstime::int4");
+ $res=pg_safe_exec("select * from pending_emailchanges where cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (pg_numrows($res)==0) {
std_theme_styles(1); std_theme_body("../");
echo "<h1>Error</h1> The URL entered is not valid. Please check it ";
echo "</body></html>";
exit;
} else {
- pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+ pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
$email=pg_fetch_object($res,0);
$userid = $email->user_id;
$nmail = $email->new_email;
// change email
- $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=now()::abstime::int4,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
+ $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
$user_id = $userid;
log_user($userid,7,"Changed email-in-record from: $omail(old) to: $nmail(new) - cookie was: $ID");
$user_id = 0;
}
/* make the user can re-port in 10 days. */
- pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id=" . $user_id);
+ pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id=" . $user_id);
echo "<h2>";
echo "Please allow 3-5 days for your request to be processed.\n";
die;
}
-pg_safe_exec("DELETE FROM pending_pwreset WHERE expiration<now()::abstime::int4");
+pg_safe_exec("DELETE FROM pending_pwreset WHERE expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
$blo2 = pg_safe_exec("SELECT * FROM pending_pwreset WHERE user_id='$da_id'");
if (pg_numrows($blo2)>0) {
echo "<h2>\n";
$cookieval = md5(CRC_SALT_0015 . uniqid("",1) . time() . $da_emailaddy . $verifdata);
- pg_safe_exec("INSERT INTO pending_pwreset (cookie,user_id,question_id,verificationdata,expiration) VALUES ('$cookieval',$uid,'$verifq','$verifdata',now()::abstime::int4+21600)");
+ pg_safe_exec("INSERT INTO pending_pwreset (cookie,user_id,question_id,verificationdata,expiration) VALUES ('$cookieval',$uid,'$verifq','$verifdata',date_part('epoch', CURRENT_TIMESTAMP)::int+21600)");
$confirm_url = gen_server_url() . LIVE_LOCATION . "/forms/confirm_pwreset.php?ID=$cookieval";
$the_msg = "If you would like to confirm that the new verification question/answer for '$da_username' should be changed as requested,\n";
$the_msg .= "then click on the link below within 6 hours :\n\n";
$fontList = get_font_face_list();
unset($dFID); $dFID = rand(0,(count($fontList)-1)); // random available font face
- pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+ pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
$r = pg_safe_exec("SELECT code FROM gfxcodes WHERE crc='" . $_GET["crc"] . "'");
if ($o = pg_fetch_object($r)) {
$code_gen = $o->code;
// start applications list...
$x = $xstart;
- $oldest_ts = "(now()::abstime::int4-86400*$nb_days)";
+ $oldest_ts = "(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*$nb_days)";
if (acl(XWEBAXS_2) || acl(XWEBAXS_3)) {
if ($force_all=="OK") {
$oldest_ts="0";
// $err .= "<li> You entered an invalid code from the picture.\n";
//} else { // CRC logic is fine, now check with the database temporary record...
//$ENABLE_COOKIE_TABLE = 1;
- //pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+ //pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
//$r = pg_safe_exec("SELECT expire FROM gfxcodes WHERE crc='" . $gfxcode_crc . "' AND code='" . strtoupper($gfxcode_val) . "'");
//if (pg_numrows($r)==0) {
// $err .= "<li> You entered an invalid/expired code from the picture.\n";
}
$crypt=$salt . md5($salt . $password);
$res=pg_safe_exec("update users set password='" . $crypt . "', " .
- " last_updated=now()::abstime::int4, " .
+ " last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, " .
" last_updated_by='<b>Password Changed by SYSTEM</b> (" . date("YmdHis") . $user_id . ")' " .
" where " .
" id='" . $user->id . "'");
$err .= "<li> You entered an invalid code from the picture.\n";
} else { // CRC logic is fine, now check with the database temporary record...
$ENABLE_COOKIE_TABLE = 1;
- pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+ pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
$r = pg_safe_exec("SELECT expire FROM gfxcodes WHERE crc='" . $gfxcode_crc . "' AND code='" . strtoupper($gfxcode_val) . "'");
if (pg_numrows($r)==0) {
$err .= "<li> You entered an invalid/expired code from the picture.\n";
if ($for_review!=1) { $for_review=0; }
$query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
- $query = $query . "values ('$user_name','$email','$channel_name','$type','$never_reg','$for_review',(now()::abstime::int4+" . (int)$exp_in_sec . "),now()::abstime::int4,'$set_by','$reason')";
+ $query = $query . "values ('$user_name','$email','$channel_name','$type','$never_reg','$for_review',(date_part('epoch', CURRENT_TIMESTAMP)::int+" . (int)$exp_in_sec . "),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
//echo "<b>DEBUG</b>(query): $query<br><br>\n";
} else {
$newflags = (int)$flags|0x0008; // Fraud tag.
- $queryb = "update users set last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . (int)$newflags . "' where id='" . (int)$userid . "'";
+ $queryb = "update users set last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . (int)$newflags . "' where id='" . (int)$userid . "'";
$query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
- $query = $query . "values ('$user_name','$email','',4,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+ $query = $query . "values ('$user_name','$email','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
//echo "<b>DEBUG</b>(query): $query<br><br>\n";
} else {
$query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
- $query = $query . "values ('" . $user_name . "','','',5,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+ $query = $query . "values ('" . $user_name . "','','',5,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
//echo "<b>DEBUG</b>(query): $query<br><br>\n";
} else {
if ($ignorecase == 1) { $dava = strtolower($user_name); $csens = "NO"; $user_name = "!" . strtolower($user_name); } else { $dava = $user_name; $csens = "YES"; }
$query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
- $query = $query . "values ('" . $user_name . "','','',6,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+ $query = $query . "values ('" . $user_name . "','','',6,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
//echo "<b>DEBUG</b>(query): $query<br><br>\n";
$uflags = (int)$uflags&~0x0008; // Untag the FRAUD.
$query = "delete from noreg where id='" . (int)$id . "' and type=4";
- $queryb = "update users set last_updated=now()::abstime::int4,last_updated_by='*** UNTAGGED FRAUD ***',flags='" . (int)$uflags . "' where id='" . (int)$u_id . "'";
+ $queryb = "update users set last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** UNTAGGED FRAUD ***',flags='" . (int)$uflags . "' where id='" . (int)$u_id . "'";
pg_safe_exec($query);
// write new note to database.
if ($final_msg!="" && ($rcpt_id+0)>0) {
- pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
header("Location: " . urldecode($BACK_PAGE) . "\n\n");
} else {
die("Internal Error !@#");
pg_safe_exec("DELETE FROM notes WHERE message_id='" . $id . "'");
}
- pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
$notesl = pg_safe_exec("SELECT * FROM notes WHERE user_id='" . $user_id . "'");
$notes_left = pg_numrows($notesl);
if ($notes_left>0) { // any notes left ? go back to notes list
$salt=$salt . $valid[rand(0,strlen($valid)-1)];
}
$crypt=$salt . md5($salt . $pass1);
- $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='** Password Change **',password='" . $crypt . "' WHERE id=" . ($user_id+0);
+ $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='** Password Change **',password='" . $crypt . "' WHERE id=" . ($user_id+0);
pg_safe_exec($query);
// send email
// do nothing, the record IS here ( heh ?! )
} else {
// insert a new record
- pg_safe_exec("INSERT INTO users_lastseen (user_id, last_seen, last_updated, last_hostmask) VALUES ( " . (int)$_GET["id"] . ", now()::abstime::int4, now()::abstime::int4, '')");
+ pg_safe_exec("INSERT INTO users_lastseen (user_id, last_seen, last_updated, last_hostmask) VALUES ( " . (int)$_GET["id"] . ", date_part('epoch', CURRENT_TIMESTAMP)::int, date_part('epoch', CURRENT_TIMESTAMP)::int, '')");
}
header("Location: users.php?id=" . $_GET["id"] . "\n\n");
die;
- $quer2 = "UPDATE pending SET status=3,last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='$decision2' WHERE channel_id='$c'";
+ $quer2 = "UPDATE pending SET status=3,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='$decision2' WHERE channel_id='$c'";
pg_safe_exec($quer2);
$res = pg_safe_exec("SELECT manager_id FROM pending WHERE channel_id='$c'");
$row = pg_fetch_object($res,0);
$m_id = $row->manager_id;
- pg_safe_exec("UPDATE channels SET registered_ts=now()::abstime::int4,last_updated=now()::abstime::int4,comment='' WHERE id='$c'");
- pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($c,$m_id,500,now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4)");
- pg_safe_exec("UPDATE users_lastseen SET last_updated=now()::abstime::int4,last_seen=now()::abstime::int4 WHERE user_id='$m_id'");
+ pg_safe_exec("UPDATE channels SET registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='' WHERE id='$c'");
+ pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($c,$m_id,500,date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int)");
+ pg_safe_exec("UPDATE users_lastseen SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_seen=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE user_id='$m_id'");
$qqq = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id' WHERE channel_id='$c'";
pg_safe_exec($qqq);
log_channel($c,7,"to $mgr_name");
review_count_add($user_id);
/*
- $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($m_id,$c,now()::abstime::int4,3,'','','','','')";
+ $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($m_id,$c,date_part('epoch', CURRENT_TIMESTAMP)::int,3,'','','','','')";
pg_safe_exec($quer3);
*/
//$decision2 = "by <b>$user_name</b> (CService Admin)<br>" . $decision;
$decision2 = "by CService Admin<br>" . $decision;
- $quer2 = "UPDATE pending SET status='9',last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='$decision2' WHERE channel_id='$c' AND (status='0' OR status='1' OR status='2' OR status='8') AND created_ts='$id'";
+ $quer2 = "UPDATE pending SET status='9',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='$decision2' WHERE channel_id='$c' AND (status='0' OR status='1' OR status='2' OR status='8') AND created_ts='$id'";
//echo "$quer2<br><br>\n";
//$res = pg_safe_exec($quer2);
pg_safe_exec($quer2);
$uid = $tmp2->manager_id;
/*
- $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($uid,$c,now()::abstime::int4,2,'" . str_replace("<br>","\n",$decision) . "','','','','')";
+ $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($uid,$c,date_part('epoch', CURRENT_TIMESTAMP)::int,2,'" . str_replace("<br>","\n",$decision) . "','','','','')";
pg_safe_exec($quer3);
*/
if ($noapplicant==0) {
if ($put_channel==1) {
if ($NR_type==4) { $NR_type2 = 2; $def_reason = "Abusive application (Fraud Usernames/Applicant) (" . str_replace("'","\\'",$c_name) . ")"; } else { $NR_type2 = $NR_type; }
- $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',$NR_type2,$NR_never_reg,$NR_for_review,(now()::abstime::int4+86400*$nb_days),now()::abstime::int4,'$set_by','$def_reason')";
+ $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',$NR_type2,$NR_never_reg,$NR_for_review,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
//echo $quer3 . "<br><br>\n";
pg_safe_exec($quer3);
}
$p_flags = $prow4->flags;
if ($NR_type==4) { $p_flags = $p_flags|0x0008; // Fraud TAG
}
- $quer4b = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
- $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',$NR_type,$NR_never_reg,$NR_for_review,(now()::abstime::int4+86400*$nb_days),now()::abstime::int4,'$set_by','$def_reason')";
+ $quer4b = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
+ $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',$NR_type,$NR_never_reg,$NR_for_review,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
//echo $quer4 . "<br><br>\n";
pg_safe_exec($quer4);
pg_safe_exec($quer4b);
}
if ($$suptype_t==1) { //Abuse (2)
$nbdays = $$supdays_t+0;
- $expire_at = "(now()::abstime::int4+86400*$nb_days)";
+ $expire_at = "(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days)";
$NR_type = 2;
$NR_neverreg = 0;
} else if ($$suptype_t==2) { //Fraud Username (4)
$p_flags = $prow->flags;
if ($NR_type==4) { $p_flags = $p_flags|0x0008; // Fraud TAG
}
- $queryb = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
+ $queryb = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
$query = "INSERT INTO NOREG (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ";
- $query .= "('" . $$supname_t . "','$supporter_email','',$NR_type,$NR_neverreg,0,$expire_at,now()::abstime::int4,'$set_by','$reason')";
+ $query .= "('" . $$supname_t . "','$supporter_email','',$NR_type,$NR_neverreg,0,$expire_at,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
pg_safe_exec($query);
pg_safe_exec($queryb);
}
if (($crc==md5("$HTTP_USER_AGENT" . $ts . CRC_SALT_0013)) && $mode=="remove" && $c>0 && isset($c) && $id>0 && isset($id)) {
// write decision.
$datime=time();
- $query = "UPDATE pending SET status=4,last_updated=now()::abstime::int4,decision='Cancelled by applicant',decision_ts=now()::abstime::int4 WHERE channel_id='$c' AND created_ts='$id'";
+ $query = "UPDATE pending SET status=4,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='Cancelled by applicant',decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$c' AND created_ts='$id'";
pg_safe_exec($query);
//echo htmlspecialchars($query); die;
$applicant = $user_name . " (" . $user_id . ")";
$row = pg_fetch_object($res,0);
$c_name = $row->name;
- pg_safe_exec("UPDATE pending SET reg_acknowledged='Y',last_updated=now()::abstime::int4 WHERE status=3 AND channel_id='$c_id'");
+ pg_safe_exec("UPDATE pending SET reg_acknowledged='Y',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE status=3 AND channel_id='$c_id'");
echo "You <b>ACKNOWLEDGED</b> registration for <b>$c_name</b><br>\n";
if (REGPROC_IDLECHECK) {
$check_invalid=0;$s_index=0;
for ($x=0;$x<REQUIRED_SUPPORTERS;$x++) {
- //$res = pg_safe_exec("SELECT users.id AS id FROM users,users_lastseen WHERE users.id=users_lastseen.user_id AND users_lastseen.last_seen<(now()::abstime::int4-86400*21) AND lower(users.user_name)='" . strtolower($supporters[$x]) . "'");
+ //$res = pg_safe_exec("SELECT users.id AS id FROM users,users_lastseen WHERE users.id=users_lastseen.user_id AND users_lastseen.last_seen<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*21) AND lower(users.user_name)='" . strtolower($supporters[$x]) . "'");
//if (pg_numrows($res)>0) {
$res = pg_safe_exec("SELECT id FROM users WHERE lower(user_name)='" . strtolower($supporters[$x]) . "'");
$row = pg_fetch_object($res,0);
if ($reusechan) {
$channel_id=$cc_id;
if (REQUIRED_SUPPORTERS>0) {
- $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=0,channel_ts=0,channel_mode='',comment='',last_updated=now()::abstime::int4 WHERE id='$channel_id'";
+ $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=0,channel_ts=0,channel_mode='',comment='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='$channel_id'";
} else {
- $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=now()::abstime::int4,channel_ts=0,channel_mode='',comment='',last_updated=now()::abstime::int4 WHERE id='$channel_id'";
+ $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,channel_ts=0,channel_mode='',comment='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='$channel_id'";
}
$lastreq = pg_safe_exec($channels_q);
} else {
if (REQUIRED_SUPPORTERS>0) {
- $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',0,0,'','',now()::abstime::int4,0,0,0,3,20,1,0,0)";
+ $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',0,0,'','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,0,0,3,20,1,0,0)";
} else {
- $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',now()::abstime::int4,0,'','',now()::abstime::int4,0,0,0,3,20,1,0,0)";
+ $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,'','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,0,0,3,20,1,0,0)";
}
$lastreq = pg_safe_exec($channels_q);
$res = pg_safe_exec("SELECT id FROM channels WHERE name='$channel_nameF'");
}
if (REQUIRED_SUPPORTERS>0) {
- $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts) VALUES ($channel_id,$manager_id,now()::abstime::int4,0,'','','$description',now()::abstime::int4,'N',0)";
+ $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts) VALUES ($channel_id,$manager_id,date_part('epoch', CURRENT_TIMESTAMP)::int,0,'','','$description',date_part('epoch', CURRENT_TIMESTAMP)::int,'N',0)";
} else {
- $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts,status) VALUES ($channel_id,$manager_id,now()::abstime::int4,now()::abstime::int4,'** INSTANT REGISTRATION **','','$description',now()::abstime::int4,'Y',0,3)";
+ $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts,status) VALUES ($channel_id,$manager_id,date_part('epoch', CURRENT_TIMESTAMP)::int,date_part('epoch', CURRENT_TIMESTAMP)::int,'** INSTANT REGISTRATION **','','$description',date_part('epoch', CURRENT_TIMESTAMP)::int,'Y',0,3)";
}
$lastreq = pg_safe_exec($pending_q);
$res = pg_safe_exec("SELECT id FROM users WHERE lower(user_name)='" . strtolower($supporters[$x]) . "'");
$row = pg_fetch_object($res,0);
$sup_id = $row->id;
- $supporters_q[$x] = "INSERT INTO supporters (channel_id,user_id,reason,last_updated) VALUES ($channel_id,$sup_id,'',now()::abstime::int4)";
+ $supporters_q[$x] = "INSERT INTO supporters (channel_id,user_id,reason,last_updated) VALUES ($channel_id,$sup_id,'',date_part('epoch', CURRENT_TIMESTAMP)::int)";
pg_safe_exec($supporters_q[$x]);
}
} else {
// INSTANT REGISTRATION :: Finish registering the channel properly (ie. add the manager)
- pg_safe_exec("UPDATE channels SET registered_ts=now()::abstime::int4,last_updated=now()::abstime::int4,comment='' WHERE id='$channel_id'");
- pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($channel_id,$manager_id,500,now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4)");
- pg_safe_exec("UPDATE users_lastseen SET last_updated=now()::abstime::int4,last_seen=now()::abstime::int4 WHERE user_id='$manager_id'");
+ pg_safe_exec("UPDATE channels SET registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='' WHERE id='$channel_id'");
+ pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($channel_id,$manager_id,500,date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int)");
+ pg_safe_exec("UPDATE users_lastseen SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_seen=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE user_id='$manager_id'");
-// pg_safe_exec("UPDATE pending SET status=3,last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='** INSTANT REGISTRATION **' WHERE channel_id='$channel_id' AND created_ts=''");
+// pg_safe_exec("UPDATE pending SET status=3,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='** INSTANT REGISTRATION **' WHERE channel_id='$channel_id' AND created_ts=''");
}
pg_safe_exec("COMMIT WORK");
echo "</form>\n";
} else {
$tts = time();
- $query = "UPDATE supporters SET support='N',reason='" . str_replace("\\"",""",str_replace("\n","<br>",htmlspecialchars($comments))) . "',last_updated=now()::abstime::int4 WHERE channel_id='$id' AND user_id='$user_id'";
+ $query = "UPDATE supporters SET support='N',reason='" . str_replace("\\"",""",str_replace("\n","<br>",htmlspecialchars($comments))) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$id' AND user_id='$user_id'";
pg_safe_exec($query);
- $quer2 = "UPDATE pending SET status='9',last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='--AUTOMATIC (REGPROC)-- NON-SUPPORT' WHERE channel_id='$id' AND status='0'";
+ $quer2 = "UPDATE pending SET status='9',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='--AUTOMATIC (REGPROC)-- NON-SUPPORT' WHERE channel_id='$id' AND status='0'";
pg_safe_exec($quer2);
$res = pg_safe_exec("SELECT manager_id FROM pending WHERE channel_id='$id' AND status='9'");
$def_reason = "-NON SUPPORT-";
$set_by = "* REGPROC";
- $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',1,(now()::abstime::int4+86400*3),now()::abstime::int4,'$set_by','$def_reason')";
+ $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',1,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*3),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
pg_safe_exec($quer3);
- $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',1,(now()::abstime::int4+86400*3),now()::abstime::int4,'$set_by','$def_reason')";
+ $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',1,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*3),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
pg_safe_exec($quer4);
die;
}
-$q = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id',last_updated=now()::abstime::int4 WHERE channel_id='$channel_id' AND created_ts='$created_ts'";
+$q = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$channel_id' AND created_ts='$created_ts'";
pg_safe_exec($q);
review_count_add($user_id);
log_channel($channel_id,17,"Reviewed Application");
die;
}
$default_gopage = "users.php?id=".$user_id;
- $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$user_id' AND channels.registered_ts=0 AND pending.status<4 AND ( pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-(86400*5) ) AND (supporters.support IS NULL OR supporters.support='?') ORDER BY pending.created_ts DESC";
+ $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$user_id' AND channels.registered_ts=0 AND pending.status<4 AND ( pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-(86400*5) ) AND (supporters.support IS NULL OR supporters.support='?') ORDER BY pending.created_ts DESC";
$levels = pg_safe_exec($req00);
if (pg_numrows($levels)>0) { // user has some channels to support.
if (pg_numrows($levels)>1) { $c_addy = "s"; } else { $c_addy = ""; }
echo "</body></html>\n\n";
die;
} else { // user doesnt need to confirm any support on any channel
- $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$user_id' AND channels.registered_ts=0 AND pending.status<9 AND pending.status!=4 AND pending.reg_acknowledged='N' AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+ $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$user_id' AND channels.registered_ts=0 AND pending.status<9 AND pending.status!=4 AND pending.reg_acknowledged='N' AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
$levels = pg_safe_exec($req00);
if (pg_numrows($levels)>0) { // user has one or more pending applications
header("Pragma: no-cache");
}
$set_by=$d_username;
$fraudchg = 1;
- pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','$u_email','',4,1,0,0,now()::abstime::int4,'$set_by','$fraudreason')");
+ pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','$u_email','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$fraudreason')");
//set_flag(1,$row->flags,0x0008,"on");
$new_flags = (int)$new_flags|0x0008;
$fchanged=1;
}
$unrchg = 1;
$set_by=$d_username;
- pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','','',2,1,0,0,now()::abstime::int4,'$set_by','$unregreason')");
+ pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','','',2,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$unregreason')");
}
$enrchg = 0;
}
$enrchg = 1;
$set_by=$d_username;
- pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','$u_email','',2,1,0,0,now()::abstime::int4,'$set_by','$enregreason')");
+ pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','$u_email','',2,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$enregreason')");
}
//echo $new_flags." / " . $row->flags . " / $noteacc <br>\n";
$query .= "post_forms=" . $new_pforms . ", ";
}
-$query .= "last_updated=now()::abstime::int4, ";
+$query .= "last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, ";
if ($fraudt==2) {
$query .= "last_updated_by='*** TAGGED AS FRAUD ***' WHERE id=$id";
} else {
$salt=$salt . $valid[rand(0,strlen($valid)-1)];
}
$crypt=$salt . md5($salt . $pass1);
- $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='** Password Secured **',password='" . $crypt . "' WHERE id='" . $user_id . "'";
+ $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='** Password Secured **',password='" . $crypt . "' WHERE id='" . $user_id . "'";
pg_safe_exec($query);
// send email
$tz_countrycode = $tz_temp[0];
$tz_name = $tz_temp[1];
if ($tz_name!="") {
- $query = "INSERT INTO timezones (tz_name,tz_countrycode,tz_acronym,deleted,last_updated) VALUES ('$tz_name','$tz_countrycode','',0,now()::abstime::int4)";
+ $query = "INSERT INTO timezones (tz_name,tz_countrycode,tz_acronym,deleted,last_updated) VALUES ('$tz_name','$tz_countrycode','',0,date_part('epoch', CURRENT_TIMESTAMP)::int)";
pg_safe_exec($query);
}
}
$flags = $oldflags;
$flags = $oldflags|TOTP_USR_FLAG;
//echo $oldflags.'->'.$flags;
- pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".($user_id+0)."'");
+ pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".($user_id+0)."'");
log_user($user_id, 13, "TOTP enabled");
$ENABLE_COOKIE_TABLE = 0;
$temp_totp_hash=gen_totp_cookie($totp_key);
echo '<a href ="users.php">Click here</a> to go back to your info page.';
die;
} else {
- $sql = sprintf("UPDATE users SET maxlogins=%d, last_updated=now()::abstime::int4, last_updated_by='Web Interface (%s (%d))' WHERE id=%d", $user_max_login, $o->user_name, $o->id, $o->id);
+ $sql = sprintf("UPDATE users SET maxlogins=%d, last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, last_updated_by='Web Interface (%s (%d))' WHERE id=%d", $user_max_login, $o->user_name, $o->id, $o->id);
pg_safe_exec($sql);
echo "You've succesfully set maxlogins to <strong>" . $user_max_login . "</strong> !<br>";
{
$oldflags = $o->flags; $flags = $oldflags;
$flags = $oldflags&~TOTP_USR_FLAG;
- pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$totp_id."'");
+ pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$totp_id."'");
$oldtotp=$o->totp_key;
// log_user($totp_id,14,"TOTP disabled for %U. Old TOTP key: ".$oldtotp." (%I)");
log_user($totp_id,14,"TOTP disabled for %U. (%I)");
if ($days_noreg_with_del < 1) { //forever
$nr_q .= "1,0,0,";
} else {
- $nr_q .= "0,0,now()::abstime::int4+(86400*" . $days_noreg_with_del . "),";
+ $nr_q .= "0,0,date_part('epoch', CURRENT_TIMESTAMP)::int+(86400*" . $days_noreg_with_del . "),";
}
- $nr_q .= "now()::abstime::int4,'" . $adm_user . " (Toaster)','" . $dreason_ok . "')";
+ $nr_q .= "date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $adm_user . " (Toaster)','" . $dreason_ok . "')";
if (!$debug_me) { // take the action
for ($z=0;$z<count($del_q);$z++) {
@pg_safe_exec($del_q[$z]);
if (pg_numrows($bla)>0) { $notalready=0; }
if ($$fraud==1 && $notalready) {
if ($debug_me) { echo $$fraud; }
- $daq = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('" . $username[$x] . "','" . $email[$x] . "','',4,1,0,0,now()::abstime::int4,'" . $adm_user . "','" . $freason_ok . "')";
+ $daq = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('" . $username[$x] . "','" . $email[$x] . "','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $adm_user . "','" . $freason_ok . "')";
$prereq = "SELECT flags FROM users WHERE id='" . $id[$x] . "'";
$preres = pg_safe_exec($prereq);
$prerow = pg_fetch_object($preres,0);
$uflags = $prerow->flags;
$newflags = (int)$uflags|0x0008; // Fraud TAG.
- $da2q = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $newflags . "' WHERE id='" . $id[$x] . "'";
+ $da2q = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $newflags . "' WHERE id='" . $id[$x] . "'";
if (!$debug_me) { // take the action.
pg_safe_exec($daq);
pg_safe_exec($da2q);
if ($debug_me) { echo "1"; }
if ($send_mail) { $mmsg .= $t_mmsg; }
$new_u_flags = (int)$ols->flags|0x0001; // global Suspension tag
- $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='Suspended by Toaster',flags='" . $new_u_flags . "' WHERE id='" . $id[$x] . "'";
+ $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Suspended by Toaster',flags='" . $new_u_flags . "' WHERE id='" . $id[$x] . "'";
if (!$debug_me) { // take action
unset($raction);
$raction = pg_safe_exec($query);
}
$ENABLE_COOKIE_TABLE = 1;
- $res = pg_safe_exec("SELECT * FROM webcookies WHERE user_id='" . $user->id . "' AND expire>=now()::abstime::int4");
+ $res = pg_safe_exec("SELECT * FROM webcookies WHERE user_id='" . $user->id . "' AND expire>=date_part('epoch', CURRENT_TIMESTAMP)::int");
if (pg_numrows($res) > 0 && $user_id != $user->id) {
echo "<tr><td colspan=2><font color=#" . $cTheme->main_yes . "><b>User is currently logged in on the website</b></font></td></tr>\n";
}
/* start proc */
$type = array(0 => "Incoming", 1 => "Pending (Traffic Check)", 2 => "Pending (Notification)", 3 => "Accepted", 8 => "Ready for review");
- $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+ $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
$levels = pg_safe_exec($req00);
echo ("<br>
<TABLE WIDTH=100% border=1 cellspacing=1 cellpadding=2 BGCOLOR=#" . $cTheme->table_bgcolor . ">
/* start proc */
$type = array(0 => "Incoming", 1 => "Pending (Traffic Check)", 2 => "Pending (Notification)", 3 => "Accepted", 8 => "Ready for review");
- $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id,supporters.support FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+ $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id,supporters.support FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
$levels = pg_safe_exec($req00);
echo ("<br>
<TABLE WIDTH=100% border=1 cellspacing=1 cellpadding=2 BGCOLOR=#" . $cTheme->table_bgcolor . ">
ip_check($user_name,1);
// totp_ip_add( cl_ip(), $user_name);
- //pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+ //pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
}
}
echo "<br><br>\n";
$nb_days_history = 30;
- $tmpr = pg_safe_exec("SELECT COUNT(event) AS count FROM channellog WHERE channelid=" . ($channel_id+0) . " AND event=15 AND ts>=(now()::abstime::int4-(86400*" . $nb_days_history . "))");
+ $tmpr = pg_safe_exec("SELECT COUNT(event) AS count FROM channellog WHERE channelid=" . ($channel_id+0) . " AND event=15 AND ts>=(date_part('epoch', CURRENT_TIMESTAMP)::int-(86400*" . $nb_days_history . "))");
$tmpo = pg_fetch_object($tmpr,0);
$tc = $tmpo->count;
if ($tc>=1) { $tc--; } // dont count the "current registration".
\r
//echo $the_email; die;\r
$s_duration = 86400*372; // max duration : 372 days.\r
- pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***',suspend_expires=(now()::abstime::int4+" . $s_duration . "),suspend_by='*** MANAGER CHANGE ***',suspend_level=1 WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
- pg_safe_exec("UPDATE levels SET access=500,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
- $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=now()::abstime::int4,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+ pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***',suspend_expires=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $s_duration . "),suspend_by='*** MANAGER CHANGE ***',suspend_level=1 WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+ pg_safe_exec("UPDATE levels SET access=500,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+ $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
pg_safe_exec($chan_update);\r
\r
custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Accepted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
\r
\r
- pg_safe_exec("UPDATE pending_mgrchange SET opt_duration=(now()::abstime::int4+" . ($pending->opt_duration+0) . "),confirmed='3' WHERE id='$id'");\r
+ pg_safe_exec("UPDATE pending_mgrchange SET opt_duration=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . ($pending->opt_duration+0) . "),confirmed='3' WHERE id='$id'");\r
\r
log_channel($pending->channel_id,12,"Temporary Change Accepted. From " . $usr1->user_name . " (" . $usr1->id . ") to " . $usr2->user_name . " (" . $usr2->id . ").");\r
\r
\r
//echo $the_email; die;\r
\r
- pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
- pg_safe_exec("UPDATE levels SET access=500,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
- $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=now()::abstime::int4,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+ pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+ pg_safe_exec("UPDATE levels SET access=500,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+ $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
pg_safe_exec($chan_update);\r
\r
custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Accepted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
\r
//echo $the_email; die;\r
\r
- pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
- pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
- $chan_update = "UPDATE channels SET last_updated=now()::abstime::int4,comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+ pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+ pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+ $chan_update = "UPDATE channels SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
pg_safe_exec($chan_update);\r
\r
custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Turned Permanent)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
\r
//echo $the_email; die;\r
\r
- pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
- pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
- $chan_update = "UPDATE channels SET last_updated=now()::abstime::int4,flags='" . $new_flags . "',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+ pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+ pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+ $chan_update = "UPDATE channels SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='" . $new_flags . "',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
pg_safe_exec($chan_update);\r
\r
custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Reverted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
$ENABLE_COOKIE_TABLE = 0;
return(1);
} else {
- pg_safe_exec("INSERT INTO newu_ipcheck VALUES (now()::abstime::int4,'" . cl_ip() . "',(now()::abstime::int4+86400))");
+ pg_safe_exec("INSERT INTO newu_ipcheck VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int,'" . cl_ip() . "',(date_part('epoch', CURRENT_TIMESTAMP)::int+86400))");
$ENABLE_COOKIE_TABLE = 0;
return(1);
}
$ENABLE_COOKIE_TABLE=0;
return(1);
}
- pg_safe_exec("UPDATE newu_ipcheck SET ts=now()::abstime::int4,expiration=(now()::abstime::int4+86400) WHERE ip='" . cl_ip() . "'");
+ pg_safe_exec("UPDATE newu_ipcheck SET ts=date_part('epoch', CURRENT_TIMESTAMP)::int,expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400) WHERE ip='" . cl_ip() . "'");
$ENABLE_COOKIE_TABLE = 0;
return(1);
} else {
$ENABLE_COOKIE_TABLE = 1;
if ($cid) {
- pg_safe_exec("DELETE FROM ips WHERE (expiration>0 AND expiration<now()::abstime::int4) OR (set_on>0 AND set_on<(now()::abstime::int4-86400) AND expiration=0)"); // removed expired entries.
+ pg_safe_exec("DELETE FROM ips WHERE (expiration>0 AND expiration<date_part('epoch', CURRENT_TIMESTAMP)::int) OR (set_on>0 AND set_on<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400) AND expiration=0)"); // removed expired entries.
$res = pg_safe_exec("SELECT * FROM exclusions WHERE excluded='" . cl_ip() . "'");
if (pg_numrows($res)==0) { // IP shall be checked.
$check = pg_safe_exec("SELECT * FROM ips WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
if (pg_numrows($check)==0) { // IP is not existing, add it.
if (!$mode) { $ENABLE_COOKIE_TABLE = 0; return (1); } // check passed. (checkonly mode).
- pg_safe_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
if ($debug_proc) { echo "ADDED<br>\n"; }
$ENABLE_COOKIE_TABLE = 0;
return (1); // check passed.
$newcount = $row->hit_counts+1;
if ($newcount>=$max_hits) { $newexpire = "" . (time()+$next_delay) . ""; } else { $newexpire = "0"; }
- pg_safe_exec("UPDATE ips SET expiration='" . (int)$newexpire . "',set_on=now()::abstime::int4,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+ pg_safe_exec("UPDATE ips SET expiration='" . (int)$newexpire . "',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
if ($debug_proc) { echo "UPDATED (HIT=$newcount,EXP=$newexpire)<br>\n"; }
$ENABLE_COOKIE_TABLE = 0;
return (1); // check passed.
$ENABLE_COOKIE_TABLE = 1;
if ($cid) {
- pg_safe_exec("DELETE FROM totp_ips WHERE (expiration>0 AND expiration<now()::abstime::int4) OR (set_on>0 AND set_on<(now()::abstime::int4-86400) AND expiration=0)"); // removed expired entries.
+ pg_safe_exec("DELETE FROM totp_ips WHERE (expiration>0 AND expiration<date_part('epoch', CURRENT_TIMESTAMP)::int) OR (set_on>0 AND set_on<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400) AND expiration=0)"); // removed expired entries.
$res = pg_safe_exec("SELECT * FROM exclusions WHERE excluded='" . cl_ip() . "'");
if (pg_numrows($res)==0) { // IP shall be checked.
$check = pg_safe_exec("SELECT * FROM totp_ips WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
if (pg_numrows($check)==0) { // IP is not existing, add it.
if (!$mode) { $ENABLE_COOKIE_TABLE = 0; return (1); } // check passed. (checkonly mode).
- pg_safe_exec("INSERT INTO totp_ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO totp_ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
if ($debug_proc) { echo "ADDED<br>\n"; }
$ENABLE_COOKIE_TABLE = 0;
return (1); // check passed.
$newcount = $row->hit_counts+1;
if ($newcount>=$max_hits) { $newexpire = "" . (time()+$next_delay) . ""; } else { $newexpire = "0"; }
- pg_safe_exec("UPDATE totp_ips SET expiration='" . (int)$newexpire . "',set_on=now()::abstime::int4,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+ pg_safe_exec("UPDATE totp_ips SET expiration='" . (int)$newexpire . "',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
if ($debug_proc) { echo "UPDATED (HIT=$newcount,EXP=$newexpire)<br>\n"; }
$ENABLE_COOKIE_TABLE = 0;
return (1); // check passed.
function get_channel_access($database,$userid,$channelid)
{
- $user = pg_safe_exec("SELECT suspend_expires>=now()::abstime::int4 as suspended,access".
+ $user = pg_safe_exec("SELECT suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int as suspended,access".
" from ".
" levels".
" where".
}
if ($user_id>0 && $channel_name!="") {
- $res = pg_safe_exec("SELECT levels.suspend_expires as suspend FROM channels,levels WHERE levels.suspend_expires>now()::abstime::int4 AND lower(channels.name)='" . strtolower($channel_name) . "' AND levels.channel_id=channels.id AND levels.user_id='" . (int)$user_id . "'");
+ $res = pg_safe_exec("SELECT levels.suspend_expires as suspend FROM channels,levels WHERE levels.suspend_expires>date_part('epoch', CURRENT_TIMESTAMP)::int AND lower(channels.name)='" . strtolower($channel_name) . "' AND levels.channel_id=channels.id AND levels.user_id='" . (int)$user_id . "'");
if (pg_numrows($res)==0) {
$err = 1;
$ret = -4; // user_id has no access on channel_name.
$rt = pg_safe_exec($qtest);
if (!$rt) { return false; }
if (pg_numrows($rt)==0) {
- $qcr = "INSERT INTO statistics (users_id,stats_type,stats_value_int,stats_value_chr,last_updated) VALUES ('" . (int)$UID . "',1,1,'',now()::abstime::int4)";
+ $qcr = "INSERT INTO statistics (users_id,stats_type,stats_value_int,stats_value_chr,last_updated) VALUES ('" . (int)$UID . "',1,1,'',date_part('epoch', CURRENT_TIMESTAMP)::int)";
$rcr = pg_safe_exec($qcr);
if (!$rcr) { return false; }
return($rcr);
} else {
$ro = pg_fetch_object($rt);
- $qupd = "UPDATE statistics SET stats_value_int='" . ($ro->stats_value_int+1) . "',last_updated=now()::abstime::int4 WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
+ $qupd = "UPDATE statistics SET stats_value_int='" . ($ro->stats_value_int+1) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
$rupd = pg_safe_exec($qupd);
return($rupd);
}
if (!$rt) { return false; }
if (pg_numrows($rt)==0) { return false; } else {
$ro = pg_fetch_object($rt);
- $qupd = "UPDATE statistics SET stats_value_int='" . (($ro->stats_value_int)-1) . "',last_updated=now()::abstime::int4 WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
+ $qupd = "UPDATE statistics SET stats_value_int='" . (($ro->stats_value_int)-1) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
$rupd = pg_safe_exec($qupd);
return($rupd);
}
return(0);
}
$message = "[Web]: $user_name!unknown@$uhost" . $auser . " ($user_name) " . $msg;
- $query = "INSERT INTO channellog (ts,channelid,event,message,last_updated,deleted) VALUES (now()::abstime::int4," . (int)$channel_id . "," . (int)$event_id . ",'$message',now()::abstime::int4,0)";
+ $query = "INSERT INTO channellog (ts,channelid,event,message,last_updated,deleted) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int," . (int)$channel_id . "," . (int)$event_id . ",'$message',date_part('epoch', CURRENT_TIMESTAMP)::int,0)";
//echo $query;
$res = pg_safe_exec($query);
return($res);
$msg = str_replace("%U","$uname",$msg);
$message = "[Web]: " . $user_name . "!unknown@" . $uhost . $auser . " (" . $user_name . ") " . $msg;
if (($event_id == 5)) { $message = $msg . " (by " . $user_name . ")"; }
- $query = "INSERT INTO userlog (ts,user_id,event,message,last_updated) VALUES (now()::abstime::int4," . (int)$uid . "," . (int)$event_id . ",'$message',now()::abstime::int4)";
+ $query = "INSERT INTO userlog (ts,user_id,event,message,last_updated) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int," . (int)$uid . "," . (int)$event_id . ",'$message',date_part('epoch', CURRENT_TIMESTAMP)::int)";
//echo $query;
$res = pg_safe_exec($query);
return($res);
$msgToWrite = "[Web] " . N_get_pure_string($username) . " (" . (int)$user_id . ") ";
$msgToWrite .= $logMessage;
$msgToWrite .= "\n";
- @pg_safe_exec("INSERT INTO webnotices (created_ts,contents) VALUES (now()::abstime::int4,'" . post2db($msgToWrite) . "')");
+ @pg_safe_exec("INSERT INTO webnotices (created_ts,contents) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int,'" . post2db($msgToWrite) . "')");
return 1;
}
if ($authz[5]!=md5($authz[4] . CRC_SALT_EXT1 . $authcook)) { return 0; }
- $query="SELECT user_id,tz_setting FROM webcookies WHERE cookie='" . $authcook . "' AND expire>now()::abstime::int4";
+ $query="SELECT user_id,tz_setting FROM webcookies WHERE cookie='" . $authcook . "' AND expire>date_part('epoch', CURRENT_TIMESTAMP)::int";
$ENABLE_COOKIE_TABLE = 1;
$auth=pg_safe_exec($query);
$ENABLE_COOKIE_TABLE = 0;
}
$USER_TZ = $user->tz_setting;
$sexpire=get_custom_session($user->user_id);
- $query="UPDATE webcookies SET expire=(now()::abstime::int4+" . $sexpire . ") WHERE user_id='" . (int)$user_id . "' AND cookie='" . $authcook . "'";
+ $query="UPDATE webcookies SET expire=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $sexpire . ") WHERE user_id='" . (int)$user_id . "' AND cookie='" . $authcook . "'";
$dynts = time();
$cook2 = md5( $dynts . CRC_SALT_EXT1 . $authcook );
$web_s_c=time()+$sexpire;
$x_at_email = XAT_EMAIL;
$purge_at_email = PURGE_EMAIL;
$ipchk_dbuser = LOCALDB_USER;
-define("CLEAR_COOKIES_QUERY","DELETE FROM webcookies WHERE expire<now()::abstime::int4");
+define("CLEAR_COOKIES_QUERY","DELETE FROM webcookies WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
$mail_from_new=FROM_NEWUSER;
$mail_subject_new=FROM_NEWUSER_SUBJECT;
$mail_from_pass=FROM_FPASS;
die;
}
if (pg_numrows($res)==0) {
- pg_safe_exec("INSERT INTO variables VALUES ('REQUIRED_SUPPORTERS','" . DEFAULT_REQUIRED_SUPPORTERS . "',now()::abstime::int4)");
+ pg_safe_exec("INSERT INTO variables VALUES ('REQUIRED_SUPPORTERS','" . DEFAULT_REQUIRED_SUPPORTERS . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
$reqsup = DEFAULT_REQUIRED_SUPPORTERS;
} else {
$row = pg_fetch_object($res,0);
$ip_check = pg_exec("SELECT * FROM ips WHERE ipnum='" . $ip . "' AND lower(user_name)='" . strtolower($user_name) . "'");
if (pg_numrows($ip_check) == 0) {
$ENABLE_COOKIE_TABLE = 1;
- pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+ pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
$ENABLE_COOKIE_TABLE = 0;
} else {
$ENABLE_COOKIE_TABLE = 1;
$row = pg_fetch_object($ip_check);
$newcount = $row->hit_counts + 1;
- pg_exec("UPDATE ips SET expiration='0',set_on=now()::abstime::int4,hit_counts='" . (int) $newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+ pg_exec("UPDATE ips SET expiration='0',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int) $newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
$ENABLE_COOKIE_TABLE = 0;
}
}
$oldflags = $o->flags;
$flags = $oldflags;
$flags = $oldflags & ~TOTP_USR_FLAG;
- pg_safe_exec("UPDATE users SET flags='" . $flags . "',last_updated=now()::abstime::int4 WHERE id='" . (int) $totp_id . "'");
+ pg_safe_exec("UPDATE users SET flags='" . $flags . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='" . (int) $totp_id . "'");
$oldtotp = $o->totp_key;
// log_user($totp_id,14,"TOTP disabled for %U. Old TOTP key: ".$oldtotp." (by %U)");
log_user($totp_id, 14, "TOTP disabled for %U");