<?php require_once('../Connections/dbmiuser.php'); ?>
<?php require_once('../Connections/dbmiadmin.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "003/invalid.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
// saves the value and type of the to be inserted data into variables
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
// POSTS the form using the PHP by sending a request to the server
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
// unique id of the col_exit in the frm_closeSignal, needed to make time form dynamic
// closes the signal by inserting the date + close price into the signal column
/*if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == $formID)) {
$updateSQL = sprintf("
UPDATE tbl_signal
SET col_dtoe=%s, col_exit=%s, col_pips=%s
WHERE col_ouID=%s",
GetSQLValueString($_POST['col_dtoe'], "date" ),
GetSQLValueString($uniqueID, "double"),
GetSQLValueString($_POST['col_pips'], "int"),
GetSQLValueString($_POST['close'], "int")
);
mysql_select_db($database_dbmiuser, $dbmiuser);
$Result1 = mysql_query($updateSQL, $dbmiuser) or die(mysql_error());*/
// closes the signal by inserting the date + close price into the signal column
if ((isset($_POST["MM_reload"])) && ($_POST["MM_reload"] == $reloadID)) {
$reloadSQL = sprintf("
UPDATE tbl_signal
SET col_dtor=%s, col_reload=%s
WHERE col_ouID=%s",
GetSQLValueString($_POST['col_dtor'], "date" ),
GetSQLValueString($rUID, "double"),
GetSQLValueString($_POST['reload'], "int")
);
mysql_select_db($database_dbmiuser, $dbmiuser);
$Result2 = mysql_query($reloadSQL, $dbmiuser) or die(mysql_error());
$updateGoTo = "Closed.php?id=".$_GET['id']."";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
// RS that contains all open positions
mysql_select_db($database_dbmiuser, $dbmiuser);
$query_rsOpen = "SELECT * FROM tbl_signal WHERE col_exit = 0";
$rsOpen = mysql_query($query_rsOpen, $dbmiuser) or die(mysql_error());
$row_rsOpen = mysql_fetch_assoc($rsOpen);
$totalRows_rsOpen = mysql_num_rows($rsOpen);
// app admins userid, needed to get the tz, passed on from the log in
$userid = "-1";
if (isset($_GET['id'])) {
$userid = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
// selects all data from db for the app admin, basically gets the timezone
mysql_select_db($database_dbmiadmin, $dbmiadmin);
$query_rsApdm = sprintf("SELECT * FROM tbl_appadmin WHERE col_id = %s", $userid);
$rsApdm = mysql_query($query_rsApdm, $dbmiadmin) or die(mysql_error());
$row_rsApdm = mysql_fetch_assoc($rsApdm);
$totalRows_rsApdm = mysql_num_rows($rsApdm);
// gets the timezone from the db by what the user has registered it as
$timezone_identifier = $row_rsApdm['tz'];
// sets the timezone for the user so he posts or views data in his time
date_default_timezone_set($timezone_identifier);
// is a date and time array - use as $dtoe[0]
$dtoe = getdate();
// defines the format date & time are displayed as on the page
$format = "y-m-d h:i:s ";
// gets the current time and date from the server
$timestamp = $_SERVER['REQUEST_TIME'];
// uses the date function to insert todays date in right format
$today = date($format, $timestamp);
// closed positions
function closedPositions($numX, $col_id) {
return $numX + $col_id; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/003.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>aquaregia - Opened Signals</title>
<style type="text/css">
.Normal {background-color: ;}
.Highlight {background-color: #000000;}
</style>
<!-- InstanceEndEditable -->
<LINK rel="stylesheet" href="../css/layout.css" type="text/css" />
<script type="text/javascript" src="../Templates/js/formvalidation.js"></script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<DIV ID="page_holder">
<DIV ID="page_header">
<SPAN ID="logo_img">
<img src="../images/logoAquaRegia2.png" width="75" height="80" border="0" usemap="#ar_icon" />
<map name="ar_icon" id="ar_icon">
<area shape="circle" coords="38,41,29" href="http://aquaregiafx.com" target="_self" alt="AquaRegiaFX" />
</map>
</SPAN>
<SPAN ID="header_logo"></SPAN>
</DIV>
<!-- #BeginLibraryItem "/Library/003menu.lbi" -->
<div id="page_menu">
<span id="ml_home"><a href="../001/0001_home.php">Home</a></span>
<span id="ml_about"><a href="../001/0002_about.php">About Us</a></span>
<span id="ml_registration"><a href="../001/0003_registration.php">Registration</a></span>
<span id="ml_contact"><a href="../001/0004_contact.php">Contact Us</a></span> </div><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/003sm.lbi" -->
<div id="page_submenu">
<span id="sm_title"></span>
<span id="smls">
<a href="Create.php?id=<?php echo $userid; ?>">
<span id="sml">Create</span></a>
<a href="Reload.php?id=<?php echo $userid; ?>">
<span id="sml">Reload</span>
</a>
<a href="Opened.php?id=<?php echo $userid; ?>">
<span id="sml">Opened</span>
</a>
<a href="Closed.php?id=<?php echo $userid; ?>">
<span id="sml">Closed</span>
</a>
</span>
</div>