all functionalities complete. graph remains

This commit is contained in:
abhishek_almighty 2017-10-18 19:01:00 +05:30
parent 9c7601308c
commit a5f43c739e
74 changed files with 5416 additions and 1125 deletions

View File

@ -12,4 +12,10 @@ Options +FollowSymLinks -Multiviews
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^My_Messages$ view_all_messages.php [NC,L]
RewriteRule ^My_Orders$ view_all_my_orders_list.php [NC,L]
RewriteRule ^My_Transactions$ view_all_my_transactions.php [NC,L]
RewriteRule ^Recent_Transactions$ view_all_recent_transactions.php [NC,L]
RewriteRule ^traders$ view_all_traders_list.php [NC,L]
</IfModule>

View File

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/exchange.iml" filepath="$PROJECT_DIR$/.idea/exchange.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,404 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="fd049eab-306f-4149-9fdf-bac2951d0859" name="Default" comment="" />
<ignored path="exchange.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path=".idea/dataSources.local.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="exchange" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="config.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="16" column="1" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="fbconfig.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/fbconfig.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/config/config.php" />
<option value="$PROJECT_DIR$/fbconfig.php" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1382" />
<option name="height" value="744" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="includes" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="config" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exchange" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="classes" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="js-jscs-nodeInterpreter" value="C:\Program Files\nodejs\node.exe" />
</component>
<component name="RunManager">
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
<method />
</configuration>
<configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="project" working-dir="">
<method />
</configuration>
<configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
<TestRunner />
<method />
</configuration>
<configuration default="true" type="PhpBehatConfigurationType" factoryName="Behat">
<BehatRunner />
<method />
</configuration>
<configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
<method />
</configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<node-interpreter>project</node-interpreter>
<node-options />
<gulpfile />
<tasks />
<arguments />
<envs />
<method />
</configuration>
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
<command value="run-script" />
<scripts />
<node-interpreter value="project" />
<envs />
<method />
</configuration>
<configuration default="true" type="mocha-javascript-test-runner" factoryName="Mocha">
<node-interpreter>project</node-interpreter>
<node-options />
<working-directory />
<pass-parent-env>true</pass-parent-env>
<envs />
<ui />
<extra-mocha-options />
<test-kind>DIRECTORY</test-kind>
<test-directory />
<recursive>false</recursive>
<method />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="fd049eab-306f-4149-9fdf-bac2951d0859" name="Default" comment="" />
<created>1505535005966</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1505535005966</updated>
<workItem from="1505535011108" duration="993000" />
<workItem from="1505552334195" duration="744000" />
<workItem from="1505564005211" duration="809000" />
<workItem from="1505571896277" duration="21000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2567000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2489019" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/config/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fbconfig.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="16" column="1" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fbconfig.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fbconfig.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/classes/Orders.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/includes/autoload.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/includes/defines.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="16" column="1" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/fbconfig.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -0,0 +1,97 @@
/**
* Created by Abhishek Kumar Sinha on 9/27/2017.
*/
$(document).ready(function(){
var loading = false;
$total_records = getTotalMyMessages();
$records_per_page = 2;
$number_of_pages = Math.ceil($total_records / $records_per_page);
$current_page = 1;
$start=($current_page*$records_per_page)-$records_per_page;
loadMoreMyMessagesInitial();
$current_page = 2;
$(window).scroll(function() {
// console.log($(window).scrollTop() + window.innerHeight, $(document).height() - 35);
if($(window).scrollTop() + window.innerHeight > $(document).height()-5) {
$start = ($current_page*$records_per_page)-$records_per_page;
if($current_page <= $number_of_pages && loading == false) {
loadMoreMyMessages($start,$records_per_page);
$current_page++;
}
}
});
});
function getTotalMyMessages() {
$total_records = 0;
var job = 'total_my_messages';
$.ajax({
url: "ajax/MyMessagesTotal.php",
data: {job: job},
async: false,
type:"post",
success: function(data) {
$total_records = data;
},
error: function(xhr) {
$total_records = 0;
}
});
return $total_records;
}
function loadMoreMyMessagesInitial() {
loadMoreMyMessages($start,$records_per_page);
}
function loadMoreMyMessages($start,$records_per_page) {
var loading = true;
$.ajax({
url: "ajax/loadMoreMyMessages.php",
type:"post",
data: {req: 'loadMoreMyMessages', records_per_page: $records_per_page, start: $start},
beforeSend: function(){
$('.ajax-loader-span').html("<img src='images/spinner.gif' class='ajax-loader'>");
},
complete: function() {
$('.ajax-loader-span').remove();
},
success: function(data) {
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
var v = '0 message';
if(isArray(d.msg) && d.msg.length != 0) {
v = '';
var si = 0;
for (var k=0; k<= d.msg.length-1; k++) {
si = k+1;
v += '<tr>';
v += '<td>'+d.msg[k].order_id+'</td>';
v += '<td>'+d.msg[k].messages+'</td>';
v += '<td>'+my_date_format(d.msg[k].datetime)+'</td>';
v += '</tr>';
}
}
$("#myMessagesTable").append(v);
}
},
error: function(xhr) {
//console.log(xhr);
}
});
loading = false;
}

74
JS/load_more_my_orders.js Normal file
View File

@ -0,0 +1,74 @@
/**
* Created by Abhishek Kumar Sinha on 9/27/2017.
*/
$(document).ready(function(){
var loading = false;
$total_records = getTotalMyOrders();
$records_per_page = 2;
$number_of_pages = Math.ceil($total_records / $records_per_page);
$current_page = 1;
$start=($current_page*$records_per_page)-$records_per_page;
loadMoreMyOrdersInitial();
$current_page = 2;
$(window).scroll(function() {
if($(window).scrollTop() + window.innerHeight > $(document).height()-5) {
$start = ($current_page*$records_per_page)-$records_per_page;
if($current_page <= $number_of_pages && loading == false) {
loadMoreMyOrders($start,$records_per_page);
$current_page++;
}
}
});
});
function getTotalMyOrders() {
$total_records = 0;
var job = 'total_my_orders';
$.ajax({
url: "ajax/MyOrdersTotal.php",
data: {job: job},
async: false,
type:"post",
success: function(data) {
$total_records = data;
},
error: function(xhr) {
$total_records = 0;
}
});
return $total_records;
}
function loadMoreMyOrdersInitial() {
loadMoreMyOrders($start,$records_per_page);
}
function loadMoreMyOrders($start,$records_per_page) {
var loading = true;
$.ajax({
url: "ajax/loadMoreMyOrders.php",
type:"post",
data: {req: 'loadMoreMyOrders', records_per_page: $records_per_page, start: $start},
beforeSend: function(){
$('.ajax-loader-span').html("<img src='images/spinner.gif' class='ajax-loader'>");
},
complete: function() {
$('.ajax-loader-span').remove();
},
success: function(data) {
if ($.trim(data) != '' || $.trim(data) != undefined) {
$('#view_all_orders_tb').append(data);
}
},
error: function(xhr) {
//console.log(xhr);
}
});
loading = false;
}

View File

@ -0,0 +1,96 @@
/**
* Created by Abhishek Kumar Sinha on 9/27/2017.
*/
$(document).ready(function(){
var loading = false;
$total_records = getTotalMyTransactions();
$records_per_page = 2;
$number_of_pages = Math.ceil($total_records / $records_per_page);
$current_page = 1;
$start=($current_page*$records_per_page)-$records_per_page;
loadMoreMyTransactionsInitial();
$current_page = 2;
$(window).scroll(function() {
if($(window).scrollTop() + window.innerHeight > $(document).height()-5) {
$start = ($current_page*$records_per_page)-$records_per_page;
if($current_page <= $number_of_pages && loading == false) {
loadMoreMyTransactions($start,$records_per_page);
$current_page++;
}
}
});
});
function getTotalMyTransactions() {
$total_records = 0;
var job = 'total_my_transactions';
$.ajax({
url: "ajax/MyTransactionsTotal.php",
data: {job: job},
async: false,
type:"post",
success: function(data) {
$total_records = data;
},
error: function(xhr) {
$total_records = 0;
}
});
return $total_records;
}
function loadMoreMyTransactionsInitial() {
loadMoreMyTransactions($start,$records_per_page);
}
function loadMoreMyTransactions($start,$records_per_page) {
var loading = true;
$.ajax({
url: "ajax/loadMoreMyTransactions.php",
type:"post",
data: {req: 'loadMoreMyTransactions', records_per_page: $records_per_page, start: $start},
beforeSend: function(){
$('.ajax-loader-span').html("<img src='images/spinner.gif' class='ajax-loader'>");
},
complete: function() {
$('.ajax-loader-span').remove();
},
success: function(data) {
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
var v = '0 transactions';
if(isArray(d.trade_list) && d.trade_list.length != 0) {
v = '';
for (var k=0; k<= d.trade_list.length-1; k++) {
v += '';
v += '<tr>';
v += '<td>'+d.trade_list[k].SELLER+'</td>';
v += '<td>'+d.trade_list[k].BUYER+'</td>';
v += '<td>$ '+d.trade_list[k].TRADE_PRICE+'</td>';
v += '<td>'+d.trade_list[k].TRADED_QTY+'</td>';
v += '<td>$ '+(d.trade_list[k].TRADED_QTY * d.trade_list[k].TRADE_PRICE).toFixed(5)+'</td>';
v += '<td>'+my_date_format(d.trade_list[k].InsertDate)+'</td>';
v += '</tr>';
}
}
$("#myTransactionsTable").append(v);
}
},
error: function(xhr) {
//console.log(xhr);
}
});
loading = false;
}

View File

@ -0,0 +1,99 @@
/**
* Created by Abhishek Kumar Sinha on 9/27/2017.
*/
$(document).ready(function(){
var loading = false;
$total_records = getTotalRecentTransactions();
$records_per_page = 2;
$number_of_pages = Math.ceil($total_records / $records_per_page);
$current_page = 1;
$start=($current_page*$records_per_page)-$records_per_page;
loadMoreRecentTransactionsInitial();
$current_page = 2;
$(window).scroll(function() {
if($(window).scrollTop() + window.innerHeight > $(document).height()-5) {
$start = ($current_page*$records_per_page)-$records_per_page;
console.log($current_page, $number_of_pages);
if($current_page <= $number_of_pages && loading == false) {
console.log('hello');
loadMoreRecentTransactions($start,$records_per_page);
$current_page++;
}
}
});
});
function getTotalRecentTransactions() {
$total_records = 0;
var job = 'total_recent_transactions';
$.ajax({
url: "ajax/recentTransactionsTotal.php",
data: {job: job},
async: false,
type:"post",
success: function(data) {
$total_records = data;
},
error: function(xhr) {
$total_records = 0;
}
});
return $total_records;
}
function loadMoreRecentTransactionsInitial() {
loadMoreRecentTransactions($start,$records_per_page);
}
function loadMoreRecentTransactions($start,$records_per_page) {
var loading = true;
$.ajax({
url: "ajax/loadMoreRecentTransactions.php",
type:"post",
data: {req: 'loadMoreRecentTransactions', records_per_page: $records_per_page, start: $start},
beforeSend: function(){
$('.ajax-loader-span').html("<img src='images/spinner.gif' class='ajax-loader'>");
},
complete: function() {
$('.ajax-loader-span').remove();
},
success: function(data) {
console.log(data);
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
var v = '0 transactions';
if(isArray(d.trade_list) && d.trade_list.length != 0) {
v = '';
for (var k=0; k<= d.trade_list.length-1; k++) {
v += '';
v += '<tr>';
v += '<td>'+d.trade_list[k].SELLER+'</td>';
v += '<td>'+d.trade_list[k].BUYER+'</td>';
v += '<td>$ '+d.trade_list[k].TRADE_PRICE+'</td>';
v += '<td>'+d.trade_list[k].TRADED_QTY+'</td>';
v += '<td>$ '+(d.trade_list[k].TRADED_QTY * d.trade_list[k].TRADE_PRICE).toFixed(5)+'</td>';
v += '<td>'+my_date_format(d.trade_list[k].InsertDate)+'</td>';
v += '</tr>';
}
}
$("#myTransactionsTable").append(v);
}
},
error: function(xhr) {
//console.log(xhr);
}
});
loading = false;
}

View File

@ -3,20 +3,30 @@ $(document).ready(function() {
market_order();
refresh_tables();
tradeList();
tradersList();
checkLoginStatusJS();
//MyOrders();
MyTransactions();
load_messages();
});
/* function to open a link with class popup in new window */
/*$(document).on('click', 'a.popup', function () {
newwindow=window.open($(this).attr('href'),'','height=300,width=600');
if (window.focus) {newwindow.focus()}
return false;
});*/
function displayError(msg) {
function displayNotice(msg, _type) {
var v = '<li>'+msg+'</li>';
//$('#MsgModel').find('h4#myModalLabelMsg').addClass('text-warning').text('Warning!');
$('#MsgModel').find('ul.msg-ul').removeClass('text-success').addClass('text-danger').html(v);
switch (_type) {
case 'success':
$('#MsgModel').find('ul.msg-ul').removeClass('text-danger text-warning').addClass('text-info').html(v);
break;
case 'failure':
$('#MsgModel').find('ul.msg-ul').removeClass('text-info text-warning').addClass('text-danger').html(v);
break;
case 'warning':
$('#MsgModel').find('ul.msg-ul').removeClass('text-danger text-info').addClass('text-warning').html(v);
break;
default:
$('#MsgModel').find('ul.msg-ul').removeClass('text-danger text-warning').addClass('text-info').html(v);
}
$('#MsgModel').modal('toggle');
}
@ -25,18 +35,27 @@ function buy() {
$('.process').on('click', function() {
var btn = $(this);
var id = btn.attr('id');
var item_qty = btn.parent().find('input[type=text]').first().val();
var item_price = btn.parent().find('input[type=text]').last().val();
var item_qty = null;
var item_price = null;
if($.trim(id)=="buy_btn") {
item_qty = $('#buy_btc').val();
item_price = $('#buy_btc_price').val();
} else if($.trim(id)=="sell_btn") {
item_qty = $('#sell_btc').val();
item_price = $('#sell_btc_price').val();
} else {
return false;
}
if(item_qty !== '' && item_qty !== undefined && item_qty !== null) {
if(item_price !== '' && item_price !== undefined && item_price !== null) {
placeOrder(id, item_qty, item_price);
} else {
//alert('Please insert a price.');
displayError('Please insert some price.');
displayNotice('Please insert some price.', "warning");
}
} else {
displayError('Please insert some quantity.');
displayNotice('Please insert some quantity.', "warning");
}
});
}
@ -52,8 +71,8 @@ function placeOrder(id, item_qty, item_price) {
method: 'post',
url: 'ajax/pending_orders.php',
data: { subject:subject, btn_id:btn_id, qty:qty, price:price },
error: function() {
console.log("An error occurred.");
error: function(xhr, status, error) {
console.log(xhr.responseText);
},
success: function(data) {
@ -66,21 +85,29 @@ function placeOrder(id, item_qty, item_price) {
}
if(IS_JSON) {
//console.log(d);
if(d.error == true) {
$msg = d.msg;
displayError($msg);
displayNotice($msg, "failure");
} else if(d.order != null && d.order.error == true && d.order.message != null) {
displayError(d.order.message);
displayNotice(d.order.message, "failure");
} else if(d.user == '') {
displayError('There was a problem in identifying the user.');
displayNotice('There was a problem in identifying the user.', "failure");
} else {
$('#empty_msg').hide();
var trade = "";
if($.trim(btn_id)=="buy_btn") {
trade = "buy";
} else if ($.trim(btn_id)=="sell_btn") {
trade = "sell";
}
displayNotice('You entered a '+trade+' order for '+qty+' token at $ '+price+'.', "success");
run_OrderMatcingAlgorithm();
MyOrders();
}
} else {
displayError('Something went wrong. Please contact the administrator.');
displayNotice('Something went wrong. Please contact the administrator.', "failure");
}
}
});
@ -90,6 +117,10 @@ function myTimeoutFunction()
{
run_OrderMatcingAlgorithm();
tradeList();
tradersList();
MyOrders();
MyTransactions();
load_messages();
setTimeout(myTimeoutFunction, 3000);
}
@ -104,10 +135,34 @@ function run_OrderMatcingAlgorithm() {
success: function(data) {
//console.log(data);
}
}).error(function() {
console.log('error')
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
load_fresh_table_data();
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
//console.log(d);
if (d.error == false && d.msg=="userLoggedIn") {
if (isArray(d.order) && d.order.length != 0) {
for (var k = 0; k <= d.order.length - 1; k++) {
$.notify({
title: "<strong>Congrats!:</strong> ",
message: d.order[k]
},{
type: 'success'
});
}
}
}
}
});
}
@ -119,8 +174,8 @@ function get_my_balance() {
success: function(data) {
// console.log(data);
}
}).error(function() {
console.log('error')
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
var IS_JSON = true;
try {
@ -151,8 +206,8 @@ function load_fresh_table_data() {
method:'post',
url:'ajax/refresh_table.php',
data: { task : 'refresh'}
}).error(function() {
console.log('error')
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
if(data !== '') {
var d = jQuery.parseJSON(data);
@ -163,9 +218,9 @@ function load_fresh_table_data() {
for (var j=0; j<=d.buys.length-1 ; j++) {
t += '';
t += '<tr id="'+d.buys[j].OrderId+'">';
t += '<td> '+d.buys[j].Price+'</td>';
t += '<td> $ '+d.buys[j].Price+'</td>';
t += '<td>'+d.buys[j].Quantity+'</td>';
t += '<td> '+d.buys[j].TOTAL_COST+'</td>';
t += '<td> $ '+d.buys[j].TOTAL_COST+'</td>';
t += '</tr>';
}
}
@ -176,9 +231,9 @@ function load_fresh_table_data() {
for (var k=0; k<=d.sells.length-1 ; k++) {
v += '';
v += '<tr id="'+d.sells[k].OrderId+'">';
v += '<td> '+d.sells[k].Price+'</td>';
v += '<td> $ '+d.sells[k].Price+'</td>';
v += '<td>'+d.sells[k].Quantity+'</td>';
v += '<td> '+d.sells[k].TOTAL_COST+'</td>';
v += '<td> $ '+d.sells[k].TOTAL_COST+'</td>';
v += '</tr>';
}
}
@ -189,16 +244,14 @@ function load_fresh_table_data() {
}
/**Market Order JS*/
function market_order() {
$('.market_submit_btn').on('click', function() {
var market_order_qty = $('#market_order').val();
var btn = $(this);
var market_order_type = btn.attr('id');
var market_order_type = $("input[name='marketOrder']:checked").val();
if(market_order_qty == '' || market_order_qty < 1) {
displayError('Please specify valid quantity!');
if(market_order_qty == '' || market_order_qty <= 0 || market_order_qty == undefined) {
displayNotice('Please specify valid quantity!', "warning");
return;
}
if (market_order_type == 'market_buy_btn' || market_order_type == 'market_sell_btn') {
@ -209,8 +262,8 @@ function market_order() {
success: function(data) {
//console.log(data);
}
}).error(function () {
console.log('Error');
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function (data) {
var IS_JSON = true;
try {
@ -222,19 +275,16 @@ function market_order() {
if(IS_JSON) {
if(d.error == true) {
displayError('Oops! Something went wrong. Your order was cancelled. Please enter a valid quantity.');
console.log(d.msg);
displayNotice('Oops! Something went wrong. Your order was cancelled. Please enter a valid quantity.', "failure");
} else{
var v = '';
if(isArray(d.order) && d.order.length != 0) {
if(d.order[0] == 'empty_buy_list') {
v += 'No buy orders available currently.';
//$('#MsgModel').find('h4#myModalLabelMsg').addClass('text-warning').text('Oops!');
$('#MsgModel').find('ul.msg-ul').removeClass('text-success').addClass('text-danger').html(v);
$('#MsgModel').modal('toggle');
} else if(d.order[0] == 'empty_sell_list') {
v += 'No sell orders available currently.';
//$('#MsgModel').find('h4#myModalLabelMsg').addClass('text-warning').text('Oops!');
$('#MsgModel').find('ul.msg-ul').removeClass('text-success').addClass('text-danger').html(v);
$('#MsgModel').modal('toggle');
} else {
@ -242,12 +292,12 @@ function market_order() {
for (var k=0; k<= d.order.length-1; k++) {
v += '<li>'+d.order[k]+'</li>';
}
//$('#MsgModel').find('h4#myModalLabelMsg').addClass('text-success').text('Congrats!');
$('#MsgModel').find('ul.msg-ul').removeClass('text-danger').addClass('text-info').html(v);
$('#MsgModel').modal('toggle');
}
}
load_fresh_table_data();
MyOrders();
}
}
});
@ -269,8 +319,8 @@ function tradeList() {
method:'post',
url:'ajax/tradeList.php',
data: { task : 'loadTradeList'}
}).error(function() {
console.log('error')
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
var IS_JSON = true;
@ -289,16 +339,57 @@ function tradeList() {
v += '<tr>';
v += '<td>'+d.trade_list[k].SELLER+'</td>';
v += '<td>'+d.trade_list[k].BUYER+'</td>';
v += '<td> ₹ '+d.trade_list[k].TRADE_PRICE+'</td>';
v += '<td>$ '+d.trade_list[k].TRADE_PRICE+'</td>';
v += '<td>'+d.trade_list[k].TRADED_QTY+'</td>';
v += '<td>$ '+(d.trade_list[k].TRADED_QTY * d.trade_list[k].TRADE_PRICE).toFixed(5)+'</td>';
v += '<td>'+my_date_format(d.trade_list[k].InsertDate)+'</td>';
v += '</tr>';
}
} else {
v += '<p class="text-info">No transactions.</p>';
}
$('#trade-list').html(v);
}
});
}
/*My Transactions*/
function MyTransactions() {
$.ajax({
method:'post',
url:'ajax/myTransactions.php',
data: { task : 'myTransactions'}
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
var v = '';
if(isArray(d.trade_list) && d.trade_list.length != 0) {
for (var k=0; k<= d.trade_list.length-1; k++) {
v += '';
v += '<tr>';
v += '<td>'+d.trade_list[k].SELLER+'</td>';
v += '<td>'+d.trade_list[k].BUYER+'</td>';
v += '<td>$ '+d.trade_list[k].TRADE_PRICE+'</td>';
v += '<td>'+d.trade_list[k].TRADED_QTY+'</td>';
v += '<td>$ '+(d.trade_list[k].TRADED_QTY * d.trade_list[k].TRADE_PRICE).toFixed(5)+'</td>';
v += '<td>'+my_date_format(d.trade_list[k].InsertDate)+'</td>';
v += '</tr>';
}
}
$('#my-transactions-list').html(v);
}
});
}
function checkLoginStatusJS() {
@ -314,4 +405,131 @@ var my_date_format = function(input){
var date = d.getDate() + " " + month[d.getMonth()] + ", " + d.getFullYear();
var time = d.toLocaleTimeString().toLowerCase().replace(/([\d]+:[\d]+):[\d]+(\s\w+)/g, "$1$2");
return (date + " " + time);
};
};
/*Rename market button name depending on radio btn*/
$(document).on("change", ".market_radio", function () {
var btn_id = $(this).attr('id');
var btn_name = "Trade Instantly";
if($.trim(btn_id)=="buy") {
btn_name = "Buy Instantly";
} else if($.trim(btn_id)=="sell") {
btn_name = "Sell Instantly";
}
$("#market_order_btn").prop("value",btn_name);
});
/*Traders List*/
function tradersList() {
$.ajax({
method:'post',
url:'ajax/tradersList.php',
data: { task : 'loadTradersList'}
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if(IS_JSON) {
var v = '';
if(isArray(d.traders_list) && d.traders_list.length != 0) {
for (var k=0; k<= d.traders_list.length-1; k++) {
v += '';
v += '<tr>';
v += '<td>'+d.traders_list[k].Name+'</td>';
v += '<td>'+d.traders_list[k].BTC+'</td>';
v += '<td> $ '+d.traders_list[k].CASH+'</td>';
v += '</tr>';
}
}
$('#traders-list').html(v);
}
});
}
/*My Orders*/
function MyOrders() {
$.ajax({
method:'post',
url:'ajax/myOrders.php',
data: { task : 'loadMyOrdersList'}
}).error(function(xhr, status, error) {
console.log(xhr.responseText);
}).success(function(data) {
if ($.trim(data) != '' && $.trim(data) != undefined && $.trim(data) != null) {
$('#myOrdersTable').html(data);
}
});
}
/*Delete Orders*/
$(document).on('click', '.del_order', function (e) {
e.preventDefault();
var id = $(this).attr("id");
$.ajax({
method:'post',
url:'ajax/delOrder.php',
data: { task : 'delOrder', id:id}
}).error(function(xhr, status, error) {
console.log(error);
}).success(function(data) {
//console.log(data);
if ($.trim(data) != '' && $.trim(data) != undefined && $.trim(data) != null) {
$.notify({
title: "<strong>Order Deleted!:</strong> ",
message: "You deleted the order successfully."
},{
type: 'success'
});
} else {
displayNotice("The order could not be deleted. Try again later.", "failure");
}
});
});
/*Messages*/
function load_messages() {
$.ajax({
method:'post',
url:'ajax/myMessages.php',
data: { task : 'loadMyMessagesList'}
}).error(function(xhr, status, error) {
console.log(error);
}).success(function(data) {
if ($.trim(data) != '' && $.trim(data) != undefined && $.trim(data) != null) {
var IS_JSON = true;
try {
var d = jQuery.parseJSON(data);
}
catch(err) {
IS_JSON = false;
}
if (IS_JSON) {
var v = '0 message';
if(isArray(d.msg) && d.msg.length != 0) {
v = '';
var si = 0;
for (var k=0; k<= d.msg.length-1; k++) {
si = k+1;
v += '<tr>';
v += '<td>'+si+'</td>';
v += '<td>'+d.msg[k].order_id+'</td>';
v += '<td>'+d.msg[k].messages+'</td>';
v += '<td>'+my_date_format(d.msg[k].datetime)+'</td>';
v += '</tr>';
}
}
$('#user_msg').html(v);
}
}
});
}

4
JS/notify.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,44 @@
# License
Copyright (c) 2017-2018 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# flo-exchange
This is an order matching algorithm website code inspired by "Bitcoin Exchange Project"
by David Veksler (http://automagical.rationalmind.net/2013/10/16/bitcoin-order-matching-algorithm/).
The algorithm, however, may not exactly work same as David's as it was modified a little to meet Ranchi Mall's
Florincoin Exchange project.
This is a code for setting up an online exchange or trading platform.
The script contains basic functionalities of buying, selling and market order of, in fact, any article that can be traded online
(Florincoin tokens in our case). The system also contains a basic Facebook authentication system to store users basic information.
It is currently a singe page website with basic display of users, transactions and other important features that an exchange site
is expected to have.
The website has basic display of users, transactions and other important features that an exchange site
is supposed to have.
# Getting started
To get started all you need to do is configure tow files:
1. config.php
- You can find this file in includes folder. Provide correct details of
DB_HOST i.e Database host (normally 127.0.0.1),
DB_NAME i.e Database name,
DB_USER i.e Database user,
DB_PASS i.e Database password
2. fbconfig.php
You need to setup a Facebook app on developer.facebook.com
Then provide app_id, app_secret and correct $loginUrl in fbconfig.php file
Once you have done this you are all set to go.

15
acc_deact.php Normal file
View File

@ -0,0 +1,15 @@
<div class="mt--4">
<?php
if (isset($_SESSION['user_id']) && $_SESSION['user_id'] != null) {
$is_activated = $UserClass->check_user($_SESSION['user_id']);
if(!$is_activated) { ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning" role="alert">Your account is not active. Please contact admin.</div>
</div>
</div>
</div>
<?php }} ?>
</div>

26
ajax/MyMessagesTotal.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 5:21 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['job']) && $_POST['job'] == 'total_my_messages') {
if (isset($UserClass, $OrderClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
echo $total_my_orders = (int) $OrderClass->total_my_messages();
}
}

27
ajax/MyOrdersTotal.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 5:21 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['job']) && $_POST['job'] == 'total_my_orders') {
if (isset($UserClass, $OrderClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
echo $total_my_orders = (int) $OrderClass->total_my_orders();
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 5:21 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['job']) && $_POST['job'] == 'total_my_transactions') {
if (isset($UserClass, $OrderClass)) {
echo $total_my_orders = (int) $OrderClass->total_my_transactions();
}
}

View File

@ -6,16 +6,46 @@
* Time: 11:13 AM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (isset($_POST['task']) && trim($_POST['task'])=='run_OrderMatcingAlgorithm') {
if (class_exists('Orders')) {
if (isset($OrderClass, $UserClass)) {
$order_matching = new Orders();
$refresh_orders = $order_matching->OrderMatchingService();
$refresh_orders = $OrderClass->OrderMatchingService();
/*If user is logged in user send him messages, if any*/
if (checkLoginStatus()) {
$std = new stdClass();
$std->user = null;
$std->order = null;
$std->error = false;
$std->msg = null;
if (isset($user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
$std->error = true;
$std->msg = "No such user exist. Please login again.";
echo json_encode($std);
return false;
}
$std->user = $validate_user;
$std->order = $refresh_orders;
$std->error = false;
$std->msg = "userLoggedIn";
echo json_encode($std);
} else {
return false;
}
}
}
} else {
return false;
}

35
ajax/delOrder.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/7/2017
* Time: 11:07 AM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if (isset($_POST['task'], $_POST['id']) && trim($_POST['task'])=="delOrder") {
$del_id = extract_int($_POST['id']);
if (isset($OrderClass, $UserClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
$del_order = $OrderClass->del_order($del_id);
if ($del_order) {
print_r($del_order);
//return true;
}
}
return false;
}

View File

@ -6,15 +6,11 @@
* Time: 8:36 PM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (!isset($_SESSION['user_id'])) {
if (!checkLoginStatus()) {
return false;
} else {
$user_id = $_SESSION['user_id'];
$user_name = $_SESSION['user_name'];
}
if (isset($_POST['task']) && trim($_POST['task'])=='get_my_balance') {
$std = new stdClass();
@ -24,14 +20,14 @@ if (isset($_POST['task']) && trim($_POST['task'])=='get_my_balance') {
$std->message = array();
$std->error = true;
if (class_exists('Users') && class_exists('Orders')) {
if (isset($OrderClass, $UserClass, $user_id)) {
$customer = new Users();
$validate_user = $customer->check_user($user_id);
$UserClass = new Users();
$validate_user = $UserClass->check_user($user_id);
$validate_balance = new Orders();
$cash_balance = $validate_balance->check_customer_balance($assetType = 'traditional', $user_id)->Balance;
$bit_balance = $validate_balance->check_customer_balance($assetType = 'btc', $user_id)->Balance;
$OrderClass = new Orders();
$cash_balance = $OrderClass->check_customer_balance($assetType = 'traditional', $user_id)->Balance;
$bit_balance = $OrderClass->check_customer_balance($assetType = 'btc', $user_id)->Balance;
$std->users = $validate_user;
$std->cash = $cash_balance;

View File

@ -0,0 +1,42 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/6/2017
* Time: 7:09 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['req']) && $_POST['req'] == 'loadMoreMyMessages') {
if (isset($UserClass, $OrderClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
$std = new stdClass();
$std->msg = array();
$std->error = true;
if (isset($_POST['records_per_page'], $_POST['start'])) {
$start = (int) $_POST['start'];
$records = (int) $_POST['records_per_page'];
$megs = $UserClass->list_messages_by_userId($user_id, $start, $records);
if (is_array($megs) && !empty($megs)) {
$std->msg = $megs;
$std->error = false;
}
}
echo json_encode($std);
}
}

88
ajax/loadMoreMyOrders.php Normal file
View File

@ -0,0 +1,88 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/6/2017
* Time: 7:09 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['req']) && $_POST['req'] == 'loadMoreMyOrders') {
if (isset($UserClass, $OrderClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
if (isset($_POST['records_per_page'], $_POST['start'])) {
$start = (int) $_POST['start'];
$records = (int) $_POST['records_per_page'];
$iter = "";
if (isset($OrderClass, $user_id)) {
$myOrders = $OrderClass->UserOrdersList($user_id, $start, $records);
if (is_array($myOrders) && !empty($myOrders)) {
foreach($myOrders as $myOrder):
switch ($myOrder->OrderStatusId) {
case '0':
$status = 'Cancelled';
break;
case '1':
$status = 'Successful';
break;
case '2':
$status = 'Pending';
break;
case '3':
$status = 'Pending';
break;
default:
$status = 'Pending';
}
if($myOrder->OrderStatusId == '1') {
$status = 'Successful';
} else if ($myOrder->OrderStatusId == '2') {
$status = 'Pending';
} else if ($myOrder->OrderStatusId == '3'){
$status = 'Pending';
}
if($myOrder->OrderTypeId == '1') {
$OrderType = 'Sell';
} elseif($myOrder->OrderTypeId == '0') {
$OrderType = 'Buy';
}
$iter .= "<tr>";
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
$iter .= "<td>$myOrder->Price</td>";
$iter .= "<td>$myOrder->Quantity</td>";
$iter .= "<td>$status</td>";
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
$iter .= "<td>";
if (trim($status) == 'Pending') {
$iter .= "<button class='btn btn-danger btn-xs del_order' id='del_$myOrder->OrderId'>Cancel</button></td>";
}
$iter .= "</td>";
$iter .= "</tr>";
endforeach;
}
}
echo $iter;
}
}
}

View File

@ -0,0 +1,42 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/6/2017
* Time: 7:09 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if(isset($_POST['req']) && $_POST['req'] == 'loadMoreMyTransactions') {
if (isset($UserClass, $OrderClass, $user_id)) {
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
return false;
}
$std = new stdClass();
$std->msg = array();
$std->error = true;
if (isset($_POST['records_per_page'], $_POST['start'])) {
$start = (int) $_POST['start'];
$records = (int) $_POST['records_per_page'];
$megs = $UserClass->displayUserTransaction($user_id, $start, $records);
if (is_array($megs) && !empty($megs)) {
$std->trade_list = $megs;
$std->error = false;
}
}
echo json_encode($std);
}
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/6/2017
* Time: 7:09 PM
*/
require_once '../includes/imp_files.php';
if(isset($_POST['req']) && $_POST['req'] == 'loadMoreRecentTransactions') {
if (isset($UserClass, $OrderClass)) {
$std = new stdClass();
$std->msg = array();
$std->error = true;
if (isset($_POST['records_per_page'], $_POST['start'])) {
$start = (int) $_POST['start'];
$records = (int) $_POST['records_per_page'];
$megs = $OrderClass->last_transaction_list($start, $records);
if (is_array($megs) && !empty($megs)) {
$std->trade_list = $megs;
$std->error = false;
}
}
echo json_encode($std);
}
}

View File

@ -6,13 +6,10 @@
* Time: 7:10 PM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (!isset($_SESSION['user_id'])) {
if (!checkLoginStatus()) {
return false;
} else {
$user_id = $_SESSION['user_id'];
$user_name = $_SESSION['user_name'];
}
if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
@ -23,10 +20,9 @@ if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
$std->error = false;
$std->msg = null;
if(class_exists('Orders') && class_exists('Users')) {
if (isset($OrderClass, $UserClass, $user_id)) {
$customer = new Users();
$validate_user = $customer->check_user($user_id);
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
$std->error = true;
@ -42,10 +38,10 @@ if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
$std->user = $validate_user;
if(isset($_POST['qty'], $_POST['type'])) {
$qty = (float)$_POST['qty'];
$qty = two_decimal_digit($_POST['qty']);
$order_type = $_POST['type'];
if($qty > 0) {
if($qty >= 0.01) {
if(is_string($order_type)) {
if(trim($order_type) == 'market_buy_btn' || trim($order_type) == 'market_sell_btn') {
@ -60,8 +56,7 @@ if(isset($_POST['job']) && $_POST['job'] == 'market_order') {
return false;
}
$Orders = new Orders();
$run_market_order = $Orders->market_order($order_type, $qty);
$run_market_order = $OrderClass->market_order($order_type, abs($qty));
$std->user = $validate_user;
$std->order = $run_market_order;

32
ajax/myMessages.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 10:44 AM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if (isset($_POST['task']) && $_POST['task']=='loadMyMessagesList') {
if (isset($UserClass, $OrderClass, $user_id) && $UserClass!=null && $OrderClass!=null) {
$std = new stdClass();
$std->msg = null;
$std->error = true;
$my_messages = $UserClass->list_messages_by_userId($user_id, 0, 10);
if (is_array($my_messages) && !empty($my_messages)) {
$std->msg = $my_messages;
$std->error = false;
}
echo json_encode($std);
}
}

78
ajax/myOrders.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 3:22 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if (isset($_POST['task']) && trim($_POST['task'])=='loadMyOrdersList') {
$iter = "";
if (isset($OrderClass, $user_id)) {
$myOrders = $OrderClass->UserOrdersList($user_id, 0, 10);
if (is_array($myOrders) && !empty($myOrders)) {
foreach($myOrders as $myOrder):
switch ($myOrder->OrderStatusId) {
case '0':
$status = 'Cancelled';
break;
case '1':
$status = 'Successful';
break;
case '2':
$status = 'Pending';
break;
case '3':
$status = 'Pending';
break;
default:
$status = 'Pending';
}
if($myOrder->OrderStatusId == '1') {
$status = 'Successful';
} else if ($myOrder->OrderStatusId == '2') {
$status = 'Pending';
} else if ($myOrder->OrderStatusId == '3'){
$status = 'Pending';
} else if($myOrder->OrderStatusId == '0') {
$status = 'Cancelled';
}
if($myOrder->OrderTypeId == '1') {
$OrderType = 'Sell';
} elseif($myOrder->OrderTypeId == '0') {
$OrderType = 'Buy';
}
$iter .= "<tr>";
$iter .= "<td>$myOrder->OfferAssetTypeId</td>";
$iter .= "<td>$myOrder->WantAssetTypeId</td>";
$iter .= "<td>$myOrder->Price</td>";
$iter .= "<td>$myOrder->Quantity</td>";
$iter .= "<td>$status</td>";
$iter .= "<td>".date('d M, Y h:i:sa', strtotime($myOrder->InsertDate))."</td>";
$iter .= "<td>";
if(trim($status) == 'Pending') {
$iter .= "<button class='btn-xs btn btn-danger del_order' id='del_$myOrder->OrderId'>Cancel</button>";
}
$iter .= "</td>";
$iter .= "</tr>";
endforeach;
}
}
echo $iter;
} else {
return false;
}

33
ajax/myTransactions.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Sinha
* Date: 6/24/2017
* Time: 8:38 PM
*/
require_once '../includes/imp_files.php';
if (!checkLoginStatus()) {
return false;
}
if (isset($_POST['task']) && trim($_POST['task'])=='myTransactions') {
$std = new stdClass();
$std->trade_list = array();
$std->error = true;
if (isset($UserClass, $user_id)) {
$tradeList = $UserClass->displayUserTransaction($user_id, 0, 10);
$std->trade_list = $tradeList;
$std->error = false;
}
echo json_encode($std);
} else {
return false;
}

View File

@ -6,43 +6,45 @@
* Time: 1:55 PM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (!isset($_SESSION['user_id'])) {
if (!checkLoginStatus()) {
return false;
} else {
$user_id = $_SESSION['user_id'];
$user_name = $_SESSION['user_name'];
}
if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
if (isset($_POST['btn_id'], $_POST['qty'], $_POST['price'])) {
$btn_id = $_POST['btn_id'];
$qty = (float) $_POST['qty'];
$item_price = (float) $_POST['price'];
$btn_id = trim($_POST['btn_id']);
$qty = two_decimal_digit($_POST['qty']);
$item_price = two_decimal_digit($_POST['price']);
$orderStatusId = 2; // 0 -> cancelled; 1 -> complete; 2 -> pending
if($btn_id == 'buy_btn') {
$orderTypeId = 0; // It is a buy
$OfferAssetTypeId= 'INR';
$WantAssetTypeId = 'FLO';
} else if($btn_id == 'sell_btn') {
$orderTypeId = 1; // It is a sell
$OfferAssetTypeId = 'FLO';
$WantAssetTypeId = 'INR';
}
$std = new stdClass();
$std->user = null;
$std->order = null;
$std->error = false;
$std->msg = null;
if ($qty == 0 || $item_price == 0) {
if($btn_id == 'buy_btn') {
$orderTypeId = 0; // It is a buy
$OfferAssetTypeId= 'USD';
$WantAssetTypeId = 'RTM';
} else if($btn_id == 'sell_btn') {
$orderTypeId = 1; // It is a sell
$OfferAssetTypeId = 'RTM';
$WantAssetTypeId = 'USD';
} else {
$std->error = true;
$std->msg = 'Please insert valid quantity and price.';
$std->msg = "Invalid button id.";
echo json_encode($std);
return false;
}
if ($qty < 0.01 || $item_price < 0.01) {
$std->error = true;
$std->msg = 'Please insert valid quantity and price. Minimum trade price is 1 cent.';
echo json_encode($std);
return false;
}
@ -50,10 +52,9 @@ if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
$validate_user = "";
$place_order = "";
if (class_exists('Users') && class_exists('Orders')) {
if (isset($OrderClass, $UserClass, $user_id)) {
$customer = new Users();
$validate_user = $customer->check_user($user_id);
$validate_user = $UserClass->check_user($user_id);
if($validate_user == "" || empty($validate_user)) {
$std->error = true;
@ -62,8 +63,7 @@ if (isset($_POST['subject']) && trim($_POST['subject'])=='placeOrder') {
return false;
}
$initial_orders = new Orders();
$place_order = $initial_orders->insert_pending_order($orderTypeId, $qty, $item_price, $orderStatusId, $OfferAssetTypeId, $WantAssetTypeId);
$place_order = $OrderClass->insert_pending_order($orderTypeId, abs($qty), abs($item_price), $orderStatusId, $OfferAssetTypeId, $WantAssetTypeId);
} else {
$std->error = true;

View File

@ -0,0 +1,17 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 5:21 PM
*/
require_once '../includes/imp_files.php';
if(isset($_POST['job']) && $_POST['job'] == 'total_recent_transactions') {
if (isset($UserClass, $OrderClass)) {
echo $total_my_orders = (int) $OrderClass->total_recent_transactions();
}
}

View File

@ -6,7 +6,7 @@
* Time: 6:22 PM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (isset($_POST['task']) && trim($_POST['task'])=='refresh') {
@ -16,11 +16,10 @@ if (isset($_POST['task']) && trim($_POST['task'])=='refresh') {
$std->message = array();
$std->error = true;
if (class_exists('Orders')) {
if (isset($OrderClass, $UserClass)) {
$refresh_orders = new Orders();
$buy_list = $refresh_orders->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC'); // buy
$sell_list = $refresh_orders->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC'); // sell
$buy_list = $OrderClass->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC'); // buy
$sell_list = $OrderClass->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC'); // sell
$std->buys = $buy_list;
$std->sells = $sell_list;

View File

@ -6,7 +6,7 @@
* Time: 8:38 PM
*/
require_once '../includes/autoload.php';
require_once '../includes/imp_files.php';
if (isset($_POST['task']) && trim($_POST['task'])=='loadTradeList') {
@ -14,10 +14,9 @@ if (isset($_POST['task']) && trim($_POST['task'])=='loadTradeList') {
$std->trade_list = array();
$std->error = true;
if (class_exists('Orders')) {
if (isset($OrderClass, $UserClass)) {
$OrderClass = new Orders();
$tradeList = $OrderClass->last_transaction_list();
$tradeList = $OrderClass->last_transaction_list(0,10);
$std->trade_list = $tradeList;
$std->error = false;

29
ajax/tradersList.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/27/2017
* Time: 2:41 PM
*/
require_once '../includes/imp_files.php';
if (isset($_POST['task']) && trim($_POST['task'])=='loadTradersList') {
$std = new stdClass();
$std->traders_list = array();
$std->error = true;
if (isset($OrderClass)) {
$tradersList = $OrderClass->UserBalanceList();
if (is_array($tradersList) && !empty($tradersList)) {
$std->traders_list = $tradersList;
$std->error = false;
}
}
echo json_encode($std);
} else {
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ class Users {
private $user_name = null;
private $email = null;
private $name = null;
private $mob = null;
private $is_active = null;
private $user_is_logged_in = false;
private $errors = array();
@ -85,13 +85,13 @@ class Users {
} else {
$this->user_name = $_SESSION['FIRSTNAME'].time();
$this->name = $_SESSION['FULLNAME'];
$this->email = $_SESSION['EMAIL'];
$this->user_name = $_SESSION['first_name'].time();
$this->name = $_SESSION['full_name'];
$this->email = $_SESSION['email'];
$query = $this->db_connection->prepare("
INSERT INTO $this->customers_table (`CustomerId`, `fb_id`, `Username`, `Email`, `Name`, `UpdateDate`, `InsertDate`, `SaveDate`, `Mobile`)
VALUES ('',:fb_id,:Username,:Email,:Name,NULL,NOW(),NULL,NULL)
INSERT INTO $this->customers_table (`CustomerId`, `fb_id`, `Username`, `Email`, `Name`, `UpdateDate`, `InsertDate`, `SaveDate`, `is_active`)
VALUES ('',:fb_id,:Username,:Email,:Name,NULL,NOW(),NULL,0)
");
$query->bindValue(':fb_id', $fb_id, PDO::PARAM_INT);
@ -107,7 +107,7 @@ class Users {
$crypto = $this->insert_balance($_SESSION['user_id'], $AssetTypeId, $Balance, $FrozenBalance);
$AssetTypeId = 'traditional';
$Balance = 1000.00;
$Balance = 100.00;
$FrozenBalance = 0.00;
$cash = $this->insert_balance($_SESSION['user_id'], $AssetTypeId, $Balance, $FrozenBalance);
@ -128,12 +128,12 @@ class Users {
if ($this->databaseConnection()) {
$query = $this->db_connection->prepare("SELECT * FROM $this->customers_table WHERE customerId = :customerId LIMIT 1");
$query = $this->db_connection->prepare("SELECT * FROM $this->customers_table WHERE customerId = :customerId AND is_active = 1 LIMIT 1");
$query->bindParam('customerId', $customerId);
if ($query->execute()) {
$row_count = $query->rowCount();
if ($row_count > 0) {
if ($row_count == 1) {
return $user_details = $query->fetchObject();
}
return false;
@ -144,16 +144,17 @@ class Users {
return false;
}
public function displayUserTransaction($user_id) {
public function displayUserTransaction($user_id, $start=0, $limit=10) {
if ($this->databaseConnection()) {
$transactions = array();
$query = $this->db_connection->prepare("
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT customer.Name FROM customer WHERE customer.CustomerId=BUYER_ID) AS BUYER, (SELECT customer.Name FROM customer WHERE customer.CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, transaction.InsertDate
SELECT TransactionId AS T_ID, a_buyer AS BUYER_ID, b_seller AS SELLER_ID, (SELECT customer.Name FROM customer WHERE customer.CustomerId=BUYER_ID) AS BUYER, (SELECT customer.Name FROM customer WHERE customer.CustomerId=SELLER_ID) AS SELLER, B_AMOUNT AS TRADE_PRICE, transaction.InsertDate, transaction.qty_traded AS TRADED_QTY
FROM transaction, customer
WHERE `a_buyer`= :u_id OR `b_seller`= :u_id
GROUP BY T_ID
ORDER BY T_ID DESC
LIMIT 50
LIMIT $start, $limit
");
$query->bindParam('u_id', $user_id);
if ($query->execute()) {
@ -169,5 +170,49 @@ class Users {
return false;
}
public function list_messages_by_userId($user_id, $start=0, $limit=10) {
if ($this->databaseConnection()) {
$messages = array();
$query = $this->db_connection->prepare("
SELECT * FROM `messages` WHERE `username_key`= :uk
ORDER BY order_id DESC
LIMIT $start, $limit
");
$query->bindParam("uk", $user_id);
if ($query->execute()) {
$rowCount = $query->rowCount();
if ($rowCount > 0) {
while ($tr = $query->fetchObject()) {
$messages[] = $tr;
}
}
}
return $messages;
}
return false;
}
public function actions_user($u_id, $act=1) {
if ($this->databaseConnection()) {
if (!empty($u_id)) {
$act = (int) $act;
$u_id = (int) $u_id;
$query = $this->db_connection->prepare("
UPDATE `customer` SET `is_active`= $act
WHERE CustomerId = :u_id
LIMIT 1
");
$query->bindParam('u_id', $u_id);
if ($query->execute()) {
return true;
}
}
}
return false;
}
}

View File

@ -1,17 +0,0 @@
<?php
/** NOTE: The session values must match DB values of users table */
define("DB_HOST", "localhost");
define("DB_NAME", "XXXX");
define("DB_USER", "XXXX");
define("DB_PASS", "XXXX");
define("MESSAGE_DATABASE_ERROR", "Failed to connect to database.");
try {
$db_connection = new PDO('mysql:host='. DB_HOST.';dbname='. DB_NAME. ';charset=utf8', DB_USER, DB_PASS);
return true;
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}

6
css/bootstrap.css vendored Normal file

File diff suppressed because one or more lines are too long

456
css/custom.css Normal file
View File

@ -0,0 +1,456 @@
h2 {
font-weight: bold;
font-size: 20px;
color: #383838;
letter-spacing: -0.23px;
}
h4 {
font-weight: bold;
font-size: 18px;
color: #4D80CF;
letter-spacing: -0.7px;
}
ul {
list-style-type: none;
}
ul.msg-ul li {
font-size: x-large;
}
.text--default {
font-family: "Open Sans";
font-weight: 300;
font-size: 14px;
color: #383838;
letter-spacing: -0.06px;
}
.text--bold {
font-weight: 700 !important;
}
.text--tiny {
font-size: 9px;
color: #D2D2D2;
letter-spacing: -0.23px;
}
.text--uppercase {
font-size: 14px;
text-transform: uppercase;
color: #FFFFFF;
letter-spacing: 0.2px;
}
hr {
width: 70%;
border-top: 1px solid #F8F8F8;
}
.logo {
width: 220px;
height: 25px;
cursor: pointer;
background: url('../images/logo.svg');
background-repeat: no-repeat;
display: block;
-webkit-transition: all 200ms ease-out;
-moz-transition: all 200ms ease-out;
-ms-transition: all 200ms ease-out;
-o-transition: all 200ms ease-out;
transition: all 200ms ease-out;
}
.logo:hover {
transform: scale(1.1);
}
.lazy-form label {
opacity: .6 !important;
-webkit-transition: all 200ms ease-out;
-moz-transition: all 200ms ease-out;
-ms-transition: all 200ms ease-out;
-o-transition: all 200ms ease-out;
transition: all 200ms ease-out;
}
.lazy-form:hover label {
opacity: 1 !important;
}
input[type=text] {
background: #FAFAFA;
border: 1px solid #F4F4F4;
border-radius: 3px;
display: block;
width: 100%;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
label {
display: block;
font-weight: 100;
color: #383838;
letter-spacing: -0.03px;
}
.radio-group {
text-align: center;
}
.radio-group label {
font-size: 12px;
font-weight: bold;
display: inline;
margin-right: 20px;
cursor: pointer;
}
table {
color: #5D5A5A !important;
}
table thead {
background: #5C99F6;
color: white;
font-weight: normal !important;
height: 50px;
vertical-align: center !important;
}
table thead th {
padding: 15px !important;
text-align: left;
}
table td {
height: 50px;
vertical-align: center !important;
font-weight: bold;
padding: 10px 15px !important;
border-top: 0px solid #fff !important;
}
table.sell td {
font-weight: bold;
background: #EEFFEE !important;
padding: 10px;
}
table.buy td {
font-weight: bold;
background: #FFF3F3 !important;
padding: 10px;
}
.btn--primary-2 {
background: #F4A606 !important;
box-shadow: 0 4px 0 0 #CC8A00 !important;
}
.btn--primary-1 {
background: #5C9AF7 !important;
box-shadow: 0 4px 0 0 #4987E4 !important;
}
.btn--primary-3 {
background: #46CDAB !important;
box-shadow: 0 4px 0 0 #29A586 !important;
}
.btn-white {
color: white;
}
.btn-white:hover {
color: white;
}
.btn {
box-shadow: 0 4px 0 0 ;
border-radius: 5px;
height: 45px;
width: 100%;
display: block;
font-weight: bold;
padding-top: 10px;
}
.btn.btn--facebook {
background: #FFFFFF;
box-shadow: 5px 5px 0 0 #3b5998;
font-size: 16px;
font-weight: bold;
color: #3b5998;
letter-spacing: -0.3px;
border-radius: 0px;
width: 360px;
display: inline-block;
padding-top: 9px;
}
.btn.btn--facebook-2 {
display: block;
background: #3b5998;
font-size: 16px;
font-weight: bold;
color: #FFFFFF;
letter-spacing: -0.3px;
border-radius: 0px;
width: 320px;
margin: 0 auto;
}
.btn.btn--facebook-2 a {
color: #FFFFFF;
}
.modal-content {
border-radius: 2px !important;
}
.modal-header {
padding: 15px;
border-bottom: 0px solid #e5e5e5;
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 0px solid #e5e5e5;
}
.radius--0 {
border-radius: 0px;
}
.mmt--15 {
margin-top: -15px !important;
}
.mt--1 {
margin-top: 10px !important;
}
.mt--2 {
margin-top: 20px !important;
}
.mt--3 {
margin-top: 30px !important;
}
.mt--4 {
margin-top: 40px !important;
}
.mt--5 {
margin-top: 50px !important;
}
.mt--6 {
margin-top: 60px !important;
}
.mt--7 {
margin-top: 70px !important;
}
.mt--8 {
margin-top: 80px !important;
}
.mt--9 {
margin-top: 90px !important;
}
.mt--10 {
margin-top: 100px !important;
}
.mb--1 {
margin-bottom: 10px !important;
}
.mb--2 {
margin-bottom: 20px !important;
}
.mb--3 {
margin-bottom: 30px !important;
}
.mb--4 {
margin-bottom: 40px !important;
}
.mb--5 {
margin-bottom: 50px !important;
}
.mb--6 {
margin-bottom: 60px !important;
}
.mb--7 {
margin-bottom: 70px !important;
}
.mb--8 {
margin-bottom: 80px !important;
}
.mb--9 {
margin-bottom: 90px !important;
}
.mb--10 {
margin-bottom: 100px !important;
}
.m--1 {
margin: 10px !important;
}
.m--2 {
margin: 20px !important;
}
.m--3 {
margin: 30px !important;
}
.m--4 {
margin: 40px !important;
}
.m--5 {
margin: 50px !important;
}
.m--6 {
margin: 60px !important;
}
.m--7 {
margin: 70px !important;
}
.m--8 {
margin: 80px !important;
}
.m--9 {
margin: 90px !important;
}
.m--10 {
margin: 100px !important;
}
.pt--1 {
padding-top: 10px !important;
}
.pt--2 {
padding-top: 20px !important;
}
.pt--3 {
padding-top: 30px !important;
}
.pt--4 {
padding-top: 40px !important;
}
.pt--5 {
padding-top: 50px !important;
}
.pt--6 {
padding-top: 60px !important;
}
.pt--7 {
padding-top: 70px !important;
}
.pt--8 {
padding-top: 80px !important;
}
.pt--9 {
padding-top: 90px !important;
}
.pt--10 {
padding-top: 100px !important;
}
.pb--1 {
padding-bottom: 10px !important;
}
.pb--2 {
padding-bottom: 20px !important;
}
.pb--3 {
padding-bottom: 30px !important;
}
.pb--4 {
padding-bottom: 40px !important;
}
.pb--5 {
padding-bottom: 50px !important;
}
.pb--6 {
padding-bottom: 60px !important;
}
.pb--7 {
padding-bottom: 70px !important;
}
.pb--8 {
padding-bottom: 80px !important;
}
.pb--9 {
padding-bottom: 90px !important;
}
.pb--10 {
padding-bottom: 100px !important;
}
.p--1 {
padding: 10px !important;
}
.p--2 {
padding: 20px !important;
}
.p--3 {
padding: 30px !important;
}
.p--4 {
padding: 40px !important;
}
.p--5 {
padding: 50px !important;
}
.p--6 {
padding: 60px !important;
}
.p--7 {
padding: 70px !important;
}
.p--8 {
padding: 80px !important;
}
.p--9 {
padding: 90px !important;
}
.p--10 {
padding: 100px !important;
}
.background--primary {
background: #5C99F6;
color: #ffffff !important;
}
.background--primary-1 {
background: #5C9AF7;
color: #ffffff !important;
}
.background--primary-2 {
background: #F4A606;
color: #ffffff !important;
}
.background--primary-3 {
background: #46CDAB;
color: #ffffff !important;
}
.background--primary-4 {
background: #5C9AF7;
color: #ffffff !important;
}
.background-white {
background: #FCFCFC !important;
}
.background-white-1 {
background: #F9F9F9 !important;
}
.box {
background: #FFFFFF;
box-shadow: 0 2px 10px 0 #E5E5E5;
overflow: hidden;
display: block;
-webkit-transition: all 200ms ease-out;
-moz-transition: all 200ms ease-out;
-ms-transition: all 200ms ease-out;
-o-transition: all 200ms ease-out;
transition: all 200ms ease-out;
}
.box:hover {
box-shadow: 0 2px 50px 0 #E5E5E5;
}
@media screen and (max-width: 768px) {
.container-fluid {
padding: 0px;
}
.container {
padding: 0px;
}
.btn.btn--facebook {
/* Rectangle 16: */
background: #FFFFFF;
box-shadow: 5px 5px 0 0 #3b5998 ;
font-size: 12px;
padding-top: 12px;
font-weight: bold;
color: #3b5998;
letter-spacing: -0.3px;
border-radius: 0px;
width: 100%;
display: block;
}
.logo {
margin: 0 auto;
}
.mt--1-m {
margin-top: 20px;
}
.text--center--mobile {
text-align: center;
font-size: 18px;
}
.text--center--mobile h6 {
font-size: 18px;
}
label {
font-size: 12px;
}
}

1579
css/mate.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@ if(!session_id()) {
}
require_once 'vendor/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => 'xxxxx',
'app_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'app_id' => 'xxxxxxxxxxxxxxxxx',
'app_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'default_graph_version' => 'v2.8',
]);
$helper = $fb->getRedirectLoginHelper();
@ -74,14 +74,14 @@ if (isset($accessToken)) {
//$gender = isset($profile['gender']) ? $profile['gender'] : null;
$fb_id = isset($profile['id']) ? $profile['id'] : null;
$_SESSION['FIRSTNAME'] = $first_name;
$_SESSION['FULLNAME'] = $name;
$_SESSION['EMAIL'] = $email;
$_SESSION['FBID'] = $fb_id;
$_SESSION['first_name'] = $first_name;
$_SESSION['full_name'] = $name;
$_SESSION['email'] = $email;
$_SESSION['fb_id'] = $fb_id;
// Now you can redirect to another page and use the access token from $_SESSION['facebook_access_token']
} else {
// replace your website URL same as added in the developers.facebook.com/apps e.g. if you used http instead of https and you used non-www version or www version of your website then you must add the same here
$loginUrl = $helper->getLoginUrl('http://ranchimall.net/exchange/fbconfig.php', $permissions);
$loginUrl = $helper->getLoginUrl('http://something.com/fbconfig.php', $permissions);
}

View File

@ -1,37 +1,22 @@
<div class="container-fluid no-padding">
<footer id="footer">
<ul class="icons">
<li><i class="fa fa-facebook-official" aria-hidden="true"></i></li>
<li><i class="fa fa-twitter-square" aria-hidden="true"></i></li>
<li><i class="fa fa-google-plus-square" aria-hidden="true"></i></li>
<li><i class="fa fa-linkedin-square" aria-hidden="true"></i></li>
<li><i class="fa fa-youtube-play" aria-hidden="true"></i></li>
</ul>
<ul class="copyright">
<li>© Ranchi Mall. All rights reserved.</li> <li>Florin Coin Exchange</li>
</ul>
</footer>
</div>
<?php if(isset($loginUrl)) { ?>
<div id="LoginModel" class="modal fade bs-login-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="top:33%; text-align: center;">
<div class="vertical-alignment-helper">
<div class="modal-dialog modal-lg vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">You are not logged in!</h4>
</div>
<div class="modal-body">
<a href="<?=$loginUrl?>" class="btn-login popup color-1 size-1 hover-1" name="fb_login"><i class="fa fa-facebook"></i>sign up via facebook</a>
<p style="color: #CCC;">Sign in to buy or sell Florincoins!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
<!-- Modal -->
<div id="LoginModel" class="modal animated fadeInDown" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header text-center">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Login to continue...</h4>
</div>
<p class="">
<a href="<?=$loginUrl?>"><div class="btn btn--facebook-2">Continue with Facebook</div></a>
</p>
</div>
</div>
</div>
<?php } ?>
<div id="MsgModel" class="modal fade bs-MsgModel-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="top:33%; text-align: center;">
@ -50,4 +35,7 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

31
gulpfile.js Normal file
View File

@ -0,0 +1,31 @@
var gulp = require('gulp');
var less = require('gulp-less');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var util = require('gulp-util');
/* Task to compile less */
gulp.task('compile-less', function() {
// console.log("comling less");
gulp.src('./less/custom.less').pipe(less().on('error', util.log)).pipe(gulp.dest('./css/'));
});
/* Task to watch less changes */
gulp.task('watch-less', function() {
console.log("watching less");
gulp.watch('./less/*.less' , ['compile-less']);
});
gulp.task('serve', function () {
// console.log("i am started");
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch("./less/*.less").on("change", reload);
gulp.watch("*.html").on("change", reload);
});
/* Task when running `gulp` from terminal */
gulp.task('default', ['watch-less', 'serve']);

Binary file not shown.

14
images/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/spinner.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,7 +1,6 @@
<?php
require_once '../config/config.php';
require_once 'defines.php';
require_once 'config.php';
function __autoload($class_name) {
$class = explode("_", $class_name);
$path = implode("/", $class).".php";

11
includes/config.php Normal file
View File

@ -0,0 +1,11 @@
<?php
/** NOTE: The session values must match DB values of users table */
/*Change these values according to your configurations*/
define("DB_HOST", "your-host");
define("DB_NAME", "Your-DB-Name");
define("DB_USER", "Your-User-Name");
define("DB_PASS", "Your-Password");
define("MESSAGE_DATABASE_ERROR", "Failed to connect to database.");

View File

@ -35,10 +35,10 @@ if(isset($_SESSION['user_name'])) {
//JS DIR
defined("JS_DIR") || define("JS_DIR", "JS");
defined("JS_DIR") || define("JS_DIR", "js");
//STYLE DIR
defined("STYLE_DIR") || define("STYLE_DIR", "style");
defined("STYLE_DIR") || define("STYLE_DIR", "css");
//add all above directories to the include path

29
includes/functions.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/3/2017
* Time: 6:33 PM
*/
function two_decimal_digit($num=0, $deci=2) {
$decimal = abs(number_format((float)$num, $deci, '.', ''));
return $decimal;
}
function redirect_to($url=null) {
header('Location: '.$url);
exit;
}
function checkLoginStatus() {
if(!isset($_SESSION['fb_id']) || !isset($_SESSION['user_id']) || !isset($_SESSION['user_name'])) {
return false;
}
return true;
}
function extract_int($string) {
$int = intval(preg_replace('/[^0-9]+/', '', $string), 10);
return $int;
}

36
includes/imp_files.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/3/2017
* Time: 7:49 PM
*/
if(!isset($_SESSION)) {
session_start();
}
include_once 'autoload.php';
include_once 'functions.php';
//if logged in store user DB details
$fb_id = null;
$user_name = null;
$user_id = null;
$log_fullName = null;
if (checkLoginStatus()) {
$fb_id = $_SESSION['fb_id'];
$user_name = $_SESSION['user_name'];
$user_id = $_SESSION['user_id'];
$log_fullName = $_SESSION['full_name'];
}
$UserClass = null;
$OrderClass = null;
if (class_exists('Users') && class_exists('Orders')) {
$UserClass = new Users();
$OrderClass = new Orders();
}

128
index.php
View File

@ -1,116 +1,26 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Sinha
* Date: 11/9/2016
* Time: 12:41 PM
*/
session_start();
<?php
ob_start();
date_default_timezone_set('Asia/Kolkata'); ?>
<?php $user_id = 0; ?>
<!--Bootstrap-->
<?php require_once 'views/header.php';?>
require_once 'config/config.php';
require_once 'classes/Orders.php';
require_once 'classes/Users.php';
<?php include_once 'acc_deact.php';?>
$buy_list = array();
$sell_list = array();
<!--Buy Sell div-->
<?php include_once 'views/buy_sell_div.php'; ?>
if (class_exists('Users') && class_exists('Orders')) {
<!--Buy Sell Lists-->
<?php include_once 'views/buy_sell_list.php'; ?>
$customer = new Users();
$validate_user = null;
if (isset($_SESSION['FBID'])):
$fb_id = $_SESSION['FBID'];
// check if user already registered
$validate_user = $customer->is_fb_registered($fb_id);
if($validate_user == "" || $validate_user == false) {
header('Location: views/messages.php?msg= No such user exist. Please register.');
exit;
}
endif;
<!--My Orders List-->
<?php include_once 'views/myOrdersList.php'; ?>
$customer_orders = new Orders();
$buy_list[] = $customer_orders->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC'); // buy
$sell_list[] = $customer_orders->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC'); // sell
}
<!--Traders and Transactions List-->
<?php include_once 'views/traders_trans_list.php'; ?>
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ranchi Mall FZE Tokens</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="style/main.css"/>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!--Messages-->
<?php include_once 'views/user_messages.php'; ?>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Crimson+Text" rel="stylesheet">
<script src="JS/main.js"></script>
</head>
<body>
<div class="container-fluid no-padding">
<header>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<span class="glyphicon glyphicon-xbt" aria-hidden="true"></span> <span class="text-danger">Ranchi Mall FZE Tokens</span>
</a>
</div>
<?php
include_once 'fbconfig.php';
if(isset($_SESSION['FBID'],$_SESSION['facebook_access_token'], $_SESSION['FULLNAME'], $_SESSION['EMAIL'])) { ?>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a><label for="my_bit_balance">FLO: </label><span id="my_bit_balance">No data</span>&nbsp;&nbsp;<label for="my_cash_balance">Cash: </label><span id="my_cash_balance">No data</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?=$_SESSION['FULLNAME'];?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.php">Log Out</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
<?php } else if(isset($loginUrl)):?>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="<?=$loginUrl?>" role="button" class="pull-right popup" name="fb_login">Login with Facebook</a>
</li>
</ul>
<?php endif;?>
</div><!-- /.container-fluid -->
</nav>
</header>
</div>
<?php
$user_logged_in = false;
if(isset($_SESSION['FBID'],$_SESSION['facebook_access_token'], $_SESSION['FULLNAME'], $_SESSION['EMAIL'])) {
$user_logged_in = true;
}
include_once 'views/logged_in.php';
include_once 'footer.php';
?>
</body>
</html>
<!--footer-->
<?php include_once 'footer.php'; ?>

551
less/custom.less Normal file
View File

@ -0,0 +1,551 @@
// VARIABLES
// 1. Variables
@color--primary:#5C99F6;
@color--primary-1:#5C9AF7;
@color--primary-2:#F4A606;
@color--primary-3:#46CDAB;
@color--primary-4:#5C9AF7;
@color--white:#FCFCFC;
@color--white-1:#F9F9F9;
@onDark:#ffffff;
@transition--speed:200ms;
// Typography
h2{
font-weight: bold;
font-size: 20px;
color: #383838;
letter-spacing: -0.23px;
}
h4{
font-weight: bold;
font-size: 18px;
color: #4D80CF;
letter-spacing: -0.7px;
}
// FONT
.text--default{
font-family: "Open Sans";
font-weight: 300;
font-size: 14px;
color: #383838;
letter-spacing: -0.06px;
}
.text--bold{
font-weight:700 !important;
}
.text--tiny{
font-size: 9px;
color: #D2D2D2;
letter-spacing: -0.23px;
}
.text--uppercase{
font-size: 14px;
text-transform: uppercase;
color: #FFFFFF;
letter-spacing: 0.2px;
}
// MISC
hr{
width: 70%;
border-top:1px solid #F8F8F8;
}
.logo{
width: 220px;
height: 25px;
cursor: pointer;
background: url('../images/logo.svg');
background-repeat: no-repeat;
display: block;
-webkit-transition: all @transition--speed ease-out;
-moz-transition: all @transition--speed ease-out;
-ms-transition: all @transition--speed ease-out;
-o-transition: all @transition--speed ease-out;
transition: all @transition--speed ease-out
}
.logo:hover{
transform:scale(1.1);
}
.lazy-form{
label{
opacity:.6 !important;
-webkit-transition: all @transition--speed ease-out;
-moz-transition: all @transition--speed ease-out;
-ms-transition: all @transition--speed ease-out;
-o-transition: all @transition--speed ease-out;
transition: all @transition--speed ease-out
}
}
.lazy-form:hover{
label{
opacity:1 !important;
}
}
input[type=text]{
background: #FAFAFA;
border: 1px solid #F4F4F4;
border-radius: 3px;
display: block;
width: 100%;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
label{
display: block;
font-weight: 100;
color: #383838;
letter-spacing: -0.03px;
}
.radio-group {
text-align: center;
label{
font-size: 12px;
font-weight: bold;
display: inline;
margin-right: 20px;
cursor: pointer;
}
input[type=radio]{
}
}
table{
color:#5D5A5A !important;
thead{
background: @color--primary;
color: white;
font-weight: normal !important;
height:50px;
vertical-align: center !important;
th{
padding: 15px !important;
text-align: left;
}
}
td{
height: 50px;
vertical-align: center !important;
font-weight: bold;
padding: 10px 15px !important;
border-top: 0px solid #fff !important;
}
}
table.sell{
td{
font-weight: bold;
background: #EEFFEE !important;
padding: 10px;
}
}
table.buy{
td{ font-weight: bold;
background: #FFF3F3 !important;
padding: 10px;
}
}
// BUTTON
.btn--primary-2{
background: @color--primary-2 !important;
box-shadow: 0 4px 0 0 #CC8A00 !important;
}
.btn--primary-1{
background: @color--primary-1 !important;
box-shadow: 0 4px 0 0 #4987E4 !important;
}
.btn--primary-3{
background: @color--primary-3 !important;
box-shadow: 0 4px 0 0 #29A586 !important;
}
.btn-white{
color: white;
}
.btn-white:hover{
color:white;
}
.btn{
box-shadow: 0 4px 0 0 ;
border-radius: 5px;
height: 45px;
width: 100%;
display: block;
font-weight: bold;
padding-top: 10px;
}
.btn.btn--facebook{
background: #FFFFFF;
box-shadow: 5px 5px 0 0 #3b5998;
font-size: 16px;
font-weight: bold;
color: #3b5998;
letter-spacing: -0.3px;
border-radius: 0px;
width: 360px;
display: inline-block;
padding-top: 9px;
}
.btn.btn--facebook-2{
display: block;
background: #3b5998;
font-size: 16px;
font-weight: bold;
color: #FFFFFF;
letter-spacing: -0.3px;
border-radius: 0px;
width: 320px;
margin: 0 auto;
}
.modal-content {
border-radius: 2px !important;
}
.modal-header {
padding: 15px;
border-bottom: 0px solid #e5e5e5;
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 0px solid #e5e5e5;
}
// Radius
.radius--0{
border-radius: 0px;
}
// MARGIN
.mmt--15{
margin-top: -15px !important;
}
.mt--1{
margin-top: 10px !important;
}
.mt--2{
margin-top: 20px !important;
}
.mt--3{
margin-top: 30px !important;
}
.mt--4{
margin-top: 40px !important;
}
.mt--5{
margin-top: 50px !important;
}
.mt--6{
margin-top: 60px !important;
}
.mt--7{
margin-top: 70px !important;
}
.mt--8{
margin-top: 80px !important;
}
.mt--9{
margin-top: 90px !important;
}
.mt--10{
margin-top: 100px !important;
}
.mb--1{
margin-bottom: 10px !important;
}
.mb--2{
margin-bottom: 20px !important;
}
.mb--3{
margin-bottom: 30px !important;
}
.mb--4{
margin-bottom: 40px !important;
}
.mb--5{
margin-bottom: 50px !important;
}
.mb--6{
margin-bottom: 60px !important;
}
.mb--7{
margin-bottom: 70px !important;
}
.mb--8{
margin-bottom: 80px !important;
}
.mb--9{
margin-bottom: 90px !important;
}
.mb--10{
margin-bottom: 100px !important;
}
.m--1{
margin: 10px !important;
}
.m--2{
margin: 20px !important;
}
.m--3{
margin: 30px !important;
}
.m--4{
margin: 40px !important;
}
.m--5{
margin: 50px !important;
}
.m--6{
margin: 60px !important;
}
.m--7{
margin: 70px !important;
}
.m--8{
margin: 80px !important;
}
.m--9{
margin: 90px !important;
}
.m--10{
margin: 100px !important;
}
// PADDING
.pt--1{
padding-top: 10px !important;
}
.pt--2{
padding-top: 20px !important;
}
.pt--3{
padding-top: 30px !important;
}
.pt--4{
padding-top: 40px !important;
}
.pt--5{
padding-top: 50px !important;
}
.pt--6{
padding-top: 60px !important;
}
.pt--7{
padding-top: 70px !important;
}
.pt--8{
padding-top: 80px !important;
}
.pt--9{
padding-top: 90px !important;
}
.pt--10{
padding-top: 100px !important;
}
.pb--1{
padding-bottom: 10px !important;
}
.pb--2{
padding-bottom: 20px !important;
}
.pb--3{
padding-bottom: 30px !important;
}
.pb--4{
padding-bottom: 40px !important;
}
.pb--5{
padding-bottom: 50px !important;
}
.pb--6{
padding-bottom: 60px !important;
}
.pb--7{
padding-bottom: 70px !important;
}
.pb--8{
padding-bottom: 80px !important;
}
.pb--9{
padding-bottom: 90px !important;
}
.pb--10{
padding-bottom: 100px !important;
}
.p--1{
padding: 10px !important;
}
.p--2{
padding: 20px !important;
}
.p--3{
padding: 30px !important;
}
.p--4{
padding: 40px !important;
}
.p--5{
padding: 50px !important;
}
.p--6{
padding: 60px !important;
}
.p--7{
padding: 70px !important;
}
.p--8{
padding: 80px !important;
}
.p--9{
padding: 90px !important;
}
.p--10{
padding: 100px !important;
}
// BACKGROUND
.background--primary{
background: @color--primary;
color: @onDark !important;
}
.background--primary-1{
background: @color--primary-1;
color: @onDark !important;
}
.background--primary-2{
background: @color--primary-2;
color: @onDark !important;
}
.background--primary-3{
background: @color--primary-3;
color: @onDark !important;
}
.background--primary-4{
background: @color--primary-4;
color: @onDark !important;
}
.background-white{
background: @color--white !important;
}
.background-white-1{
background: @color--white-1 !important;
}
// BOX
.box{
background: #FFFFFF;
box-shadow: 0 2px 10px 0 #E5E5E5;
overflow: hidden;
display: block;
-webkit-transition: all @transition--speed ease-out;
-moz-transition: all @transition--speed ease-out;
-ms-transition: all @transition--speed ease-out;
-o-transition: all @transition--speed ease-out;
transition: all @transition--speed ease-out;
}
.box:hover{
box-shadow: 0 2px 50px 0 #E5E5E5;
}
// MEDIA QUERY
@media screen and (max-width: 768px){
.container-fluid{
padding: 0px;
}
.container{
padding: 0px;
}
.btn.btn--facebook{
/* Rectangle 16: */
background: #FFFFFF;
box-shadow: 5px 5px 0 0 #3b5998 ;
font-size: 12px;
padding-top:12px;
font-weight: bold;
color: #3b5998;
letter-spacing: -0.3px;
border-radius: 0px;
width: 100%;
// padding-top: 10px;
display: block;
}
.logo{
margin:0 auto;
}
.mt--1-m{
margin-top: 20px;
}
.text--center--mobile{
text-align: center;
font-size: 18px;
h6{
font-size: 18px;
}
}
label{
font-size: 12px;
}
}

View File

@ -1,8 +1,5 @@
<?php
session_start();
session_unset();
$_SESSION['FBID'] = NULL;
$_SESSION['FULLNAME'] = NULL;
$_SESSION['EMAIL'] = NULL;
session_destroy();
header("Location: index.php"); // you can enter home page here ( Eg : header("Location: " ."http://www.krizna.com");
?>

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "frontend-ranchimall",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.18.13",
"gulp": "^3.9.1"
},
"dependencies": {
"gulp-less": "^3.3.2"
}
}

View File

@ -1,175 +0,0 @@
body {
width: 100%;
height: auto;
font-family: 'Crimson Text', serif;
font-size: large;
}
ul {
list-style: none;
}
footer {
height: 75px;
}
.no-padding {
padding-right: 0;!important;
padding-left: 0;!important;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
.margin-top-10 {
margin-top: 10px;
}
@media (min-width: 768px) {
.navbar {
border-radius: 0;
margin-bottom: 0;
}
}
.page-header > h2 {
color: #ffffff;
text-align: center;
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 700;
}
.buy_region {
//background-color: #ffffff;
//border: 1px solid #e8e8e8;
//border-radius: 4px;
}
.sell_region {
//background-color: #ffffff;
//border: 1px solid #E8E8E8;
//border-radius: 4px;
}
.glyphicon.glyphicon-bitcoin {
font-size: 50px;
}
.table-borderless > tbody > tr > td,
.table-borderless > tbody > tr > th,
.table-borderless > tfoot > tr > td,
.table-borderless > tfoot > tr > th,
.table-borderless > thead > tr > td,
.table-borderless > thead > tr > th {
border: none;
}
.cover-price {
-moz-transform: translate(0,0);
-webkit-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0);
-moz-transition: -moz-transform 1s ease, opacity 1s ease;
-webkit-transition: -webkit-transform 1s ease, opacity 1s ease;
-ms-transition: -ms-transform 1s ease, opacity 1s ease;
transition: transform 1s ease, opacity 1s ease;
background: rgba(23, 24, 32, 0.95);
//border-style: solid;
opacity: 1;
//position: absolute;
height: 100px;
}
.cover {
background: url(../images/pic04.jpg);
background-size: cover;
background-repeat: no-repeat;
//background-color: #e44c65;
padding-top: 40px;
padding-bottom: 80px;
}
.box-green {
background-color: #B4D5A8;
}
.box-blue {
background-color: #bdffdc;
}
.box-sea-green {
background-color: darkseagreen;
}
.margin-padd-2 {
margin: 0 2px 0 2px;
padding: 2px 5px 2px 5px;
}
#footer {
color: #ffffff;
background: #272833;
padding: 6em 0;
text-align: center;
}
#footer ul.copyright {
display: flex;
justify-content: center;
}
#footer ul.copyright > li {
margin-left: 5px;
}
#footer ul.icons {
cursor: default;
list-style: none;
padding-left: 0;
}
#footer ul.icons li {
display: inline-block;
height: 2.5em;
line-height: 2.5em;
padding: 0 0.5em;
}
#footer .icons .icon.alt {
text-decoration: none;
}
#footer ul.icons li i {
font-size: 1.5em;
color: #ffffff;
}
.input-types {
height: 3em;
transition: border-color 0.2s ease-in-out;
background: transparent;
border-radius: 4px;
border: solid 1px rgba(255, 255, 255, 0.3);
color: inherit;
display: block;
outline: 0;
padding: 0 1em;
text-decoration: none;
width: 100%;
}
input[type="submit"], input[type="reset"], input[type="button"], .button {
-moz-appearance: none;
-webkit-appearance: none;
-ms-appearance: none;
appearance: none;
-moz-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
-webkit-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
-ms-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
background-color: transparent;
border-radius: 4px;
border: 0;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
color: #ffffff !important;
cursor: pointer;
display: inline-block;
font-weight: 600;
font-size: 16px;
height: 2.75em;
line-height: 2.75em;
padding: 0 2.00em;
text-align: center;
text-decoration: none;
white-space: nowrap;
}
input[type="submit"]:hover, input[type="submit"]:active, input[type="reset"]:hover, input[type="reset"]:active, input[type="button"]:hover, input[type="button"]:active, .button:hover, .button:active {
box-shadow: inset 0 0 0 1px #e44c65;
color: #e44c65 !important;
}
.align-center {
text-align: center;
}

23
view_all_messages.php Normal file
View File

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:46 AM
*/
ob_start();
require_once 'views/header.php';
if (!checkLoginStatus()) {
redirect_to('index.php?msg=Please login!');
}
include_once VIEWS_DIR.'/buy_sell_div.php';
include_once VIEWS_DIR.'/buy_sell_list.php';
include_once VIEWS_DIR.'/view_all_messages.php';
include_once 'footer.php';
?>
<script src="js/load_more_my_messages.js"></script>

View File

@ -0,0 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 4:57 PM
*/
ob_start();
require_once 'views/header.php';
if (!checkLoginStatus()) {
redirect_to('index.php?msg=Please login!');
}
include_once VIEWS_DIR.'/buy_sell_div.php';
include_once VIEWS_DIR.'/buy_sell_list.php';
include_once VIEWS_DIR.'/view_all_my_orders_list.php';
include_once 'footer.php';
?>
<script src="js/load_more_my_orders.js"></script>

View File

@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 4:57 PM
*/
ob_start();
require_once 'views/header.php';
if (!checkLoginStatus()) {
redirect_to('index.php?msg=Please login!');
}
include_once VIEWS_DIR.'/buy_sell_div.php';
include_once VIEWS_DIR.'/buy_sell_list.php';
include_once VIEWS_DIR.'/view_all_my_transactions.php';
include_once 'footer.php';?>
<script src="js/load_more_my_transactions.js"></script>

View File

@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:46 AM
*/
ob_start();
require_once 'views/header.php';
include_once VIEWS_DIR.'/buy_sell_div.php';
include_once VIEWS_DIR.'/buy_sell_list.php';
include_once VIEWS_DIR.'/view_all_recent_transactions.php';
include_once 'footer.php';
?>
<script src="js/load_more_recent_transactions.js"></script>

17
view_all_traders_list.php Normal file
View File

@ -0,0 +1,17 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 5:20 PM
*/
ob_start();
require_once 'views/header.php';
include_once VIEWS_DIR.'/buy_sell_div.php';
include_once VIEWS_DIR.'/buy_sell_list.php';
include_once VIEWS_DIR.'/view_all_traders_list.php';
include_once 'footer.php';
?>

90
views/buy_sell_div.php Normal file
View File

@ -0,0 +1,90 @@
<div class="container-fluid background--white animated fadeInUp">
<div class="container">
<div class="col-sm-4 ">
<div class="box p--2 mt--4">
<div class="row">
<h2 class="text-center">Buy or Sell immediately</h2>
<hr>
<div class="col-lg-12 lazy-form">
<label for="market_order">Quantity</label>
<input type="text" name="market" id="market_order">
</div>
<div class="col-lg-12 mt--3 lazy-form">
<div class="radio-group">
<input type="radio" class="market_radio" name="marketOrder" id="buy" value="market_buy_btn"> <label for="buy">Buy</label>
<input type="radio" class="market_radio" name="marketOrder" id="sell" value="market_sell_btn"> <label for="sell">Sell</label>
</div>
</div>
<div class="col-lg-12 mt--2">
<input id="market_order_btn" type="submit" class="btn btn--primary-2 btn-white <?=$action_class_market?>" value="Trade Instantly">
<p class="text--tiny mt--2">
* Disclaimer will be shown here
</p>
</div>
</div>
</div>
</div>
<div class="col-sm-4 ">
<div class="box p--2 mt--4">
<div class="row">
<h2 class="text-center">Buy</h2>
<hr>
<div class="col-lg-12 lazy-form">
<label for="buy_btc">Quantity</label>
<input type="text" name="buy_btc" id="buy_btc">
</div>
<div class="col-lg-12 lazy-form">
<label for="buy_btc_price">Price</label>
<input type="text" name="buy_btc_price" id="buy_btc_price">
</div>
<div class="col-lg-12">
<input type="submit" id="buy_btn" class="btn btn--primary-1 btn-white <?=$action_class_buy_sell?>" value="Buy">
<!-- <input type="submit" class="btn background--primary-1" value="Buy"> -->
<p class="text--tiny mt--1">
* Disclaimer will be shown here
</p>
</div>
</div>
</div>
</div>
<div class="col-sm-4 ">
<div class="box p--2 mt--4">
<div class="row">
<h2 class="text-center">Sell</h2>
<hr>
<div class="col-lg-12 lazy-form">
<label for="sell_btc">Quantity</label>
<input type="text" name="sell_btc" id="sell_btc">
</div>
<div class="col-lg-12 lazy-form">
<label for="sell_btc_price">Price</label>
<input type="text" name="sell_btc_price" id="sell_btc_price">
</div>
<div class="col-lg-12">
<input type="submit" id="sell_btn" class="btn btn--primary-3 btn-white <?=$action_class_buy_sell?>" value="Sell">
<p class="text--tiny mt--1">
* Disclaimer will be shown here
</p>
</div>
</div>
</div>
</div>
</div>
</div>

60
views/buy_sell_list.php Normal file
View File

@ -0,0 +1,60 @@
<div class="container-fluid background-white-1 mt--4 p--2">
<div class="container">
<div class="col-lg-6">
<h4 class="mt--2">Buy Orders List</h4>
<div class="table-responsive mt--2">
<table class="table table-striped buy" cellpadding="10">
<thead>
<tr>
<th> Price: </th>
<th> Quantity: </th>
<th>Total:</th>
</tr>
</thead>
<tbody id="buying-list"></tbody>
</table>
</div>
</div>
<div class="col-lg-6">
<h4 class="mt--2">Sell Orders List</h4>
<div class="table-responsive mt--2">
<table class="table table-striped sell" cellpadding="10">
<thead>
<tr>
<th> Price: </th>
<th> Quantity: </th>
<th>Total:</th>
</tr>
</thead>
<tbody id="selling-list"></tbody>
</table>
</div>
</div>
</div>
</div>

117
views/header.php Normal file
View File

@ -0,0 +1,117 @@
<?php
// Turn off error reporting
error_reporting(0);
@ini_set('display_errors', 0);
require_once('includes/defines.php');
require_once INCLUDES_DIR.'/imp_files.php';
$tradersList = array();
$buy_list = array();
$sell_list = array();
include_once 'fbconfig.php';
$validate_user = null;
if (isset($UserClass)) {
if (isset($fb_id)):
// check if user already registered
$validate_user = $UserClass->is_fb_registered($fb_id);
if($validate_user == "" || $validate_user == false) {
redirect_to('index.php');
}
endif;
$tradersList = $OrderClass->UserBalanceList();
$buy_list[] = $OrderClass->get_top_buy_sell_list($top_table='active_buy_list', $asc_desc='DESC'); // buy
$sell_list[] = $OrderClass->get_top_buy_sell_list($top_table='active_selling_list', $asc_desc='ASC'); // sell
}
$user_logged_in = false;
$action_class_market = 'fb_log_in';
$action_class_buy_sell = 'fb_log_in';
if(checkLoginStatus()) {
$user_logged_in = true;
$action_class_market = 'market_submit_btn';
$action_class_buy_sell = 'process';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?=STYLE_DIR?>/bootstrap.css">
<link rel="stylesheet" href="<?=STYLE_DIR?>/custom.css">
<link rel="stylesheet" href="<?=STYLE_DIR?>/mate.css">
<link href="https://fonts.googleapis.com/css?family=Crimson+Text" rel="stylesheet">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="<?=JS_DIR?>/notify.js"></script>
<script src="<?=JS_DIR?>/main.js"></script>
</head>
<?php
if(isset($_GET['msg']) && $_GET['msg'] !== '') {
$err_msg = (string)$_GET['msg'];
$type = isset($_GET['type']) ? trim($_GET['type']) : 'danger';
?>
<div id="error_msg">
<script>
$.notify({
title: "<strong>Notice:</strong> ",
message: "<?=$err_msg?>"
},{
type: '<?=$type?>'
});
</script>
</div>
<?php }?>
<body class="text--default">
<div class="container-fluid background--primary p--3">
<div class="container">
<div class="col-sm-6">
<a href="http://ranchimall.net/exchange"><div class="logo mt--1"></div></a>
</div>
<div class="col-sm-6 text-right mt--1-m">
<?php if($user_logged_in) { ?>
<a href="logout.php">
<div class="btn btn--facebook ">
Log Out
</div>
</a>
<?php } elseif(isset($loginUrl)) {?>
<a href="<?=$loginUrl?>" role="button" class="pull-right popup" name="fb_login">
<div class="btn btn--facebook ">
Continue with Facebook
</div>
</a>
<?php } ?>
</div>
</div>
</div>
<div class="container-fluid background--primary-1 p--1">
<div class="container">
<div class="col-sm-6">
<?php if (isset($OrderClass)) {
$LastTradedPrice = $OrderClass->LastTradedPrice();
$LastTradedPrice = ($LastTradedPrice !=Null) ? '$ '. $LastTradedPrice->B_Amount : 'No Data';?>
<h5 class="mt--2 text--uppercase text--bold text--center--mobile">Last Traded Price: <?=$LastTradedPrice;?></h5>
<?php } ?>
</div>
<?php if($user_logged_in) { ?>
<div class="col-sm-6 text-right text--uppercase text--center--mobile ">
<h6 class="text--bold">Token Balance: <span id="my_bit_balance">loading...</span> </h6>
<h6 class="text--bold">Cash Balance: $ <span id="my_cash_balance">loading...</span> </h6>
</div>
<?php } ?>
</div>
</div>

View File

@ -41,4 +41,4 @@ if(isset($_GET['msg'])) {
</body>
</html>
<?php } else {echo "kjhkh";} ?>
<?php } ?>

56
views/myOrdersList.php Normal file
View File

@ -0,0 +1,56 @@
<?php
if ($user_logged_in) { ?>
<div class="container-fluid background-white-1 mt--4 p--2">
<div class="container">
<div class="col-lg-6">
<h4 class="mt--2">My Orders</h4>
<h5><a href="My_Orders" target="_blank">View All</a></h5>
<div class="table-responsive mt--2">
<table class="table table-striped" cellpadding="10" cellspacing="0" width="100%">
<thead>
<tr>
<th>Item Sold</th>
<th>Item Bought</th>
<th>Price ($)</th>
<th>Quantity</th>
<th>Status</th>
<th>Date</th>
<th>Cancel Order</th>
</tr>
</thead>
<tbody id="myOrdersTable"></tbody>
</table>
</div>
</div>
<div class="col-lg-6">
<h4 class="mt--2">My Transactions: </h4>
<h5><a href="My_Transactions" target="_blank">View All</a></h5>
<div class="table-responsive mt--2">
<table class="table table-striped" cellpadding="10">
<thead>
<tr>
<th>Seller: </th>
<th>Buyer: </th>
<th>Trade Price: </th>
<th>Quantity Traded: </th>
<th>Transaction Amount: </th>
<th>Trade Date: </th>
</tr>
</thead>
<tbody id="my-transactions-list"></tbody>
<?php if(isset($user_id) && $user_id !=null) {
$MyTransactions = $OrderClass->displayUserTransaction($user_id, 0, 10);?>
<?php if ($MyTransactions == null || !is_array($MyTransactions) || empty($MyTransactions)) { ?>
<p class="text-info">No transactions!</p>
<?php }} ?>
</table>
</div>
</div>
</div>
</div>
<?php } ?>

27
views/traders_list.php Normal file
View File

@ -0,0 +1,27 @@
<?php if (isset($OrderClass)) { ?>
<h4>Trader's list</h4>
<h5><a href="traders" target="_blank">View All</a></h5>
<?php if ( isset($tradersList) && is_array($tradersList) && !empty($tradersList)) { ?>
<table class="table table-striped " cellpadding="10">
<thead>
<tr>
<th> Trader Name</th>
<th> Tokens</th>
<th> Cash</th>
</tr>
</thead>
<tbody id="traders-list"></tbody>
</table>
<?php } else {
echo '<h4>No traders found!</h4>';
}} ?>

View File

@ -0,0 +1,40 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/3/2017
* Time: 5:07 PM
*/
if (isset($tradersList) && is_array($tradersList) && !empty($tradersList)) { ?>
<div class="container-fluid p--2 background-white-1 mt--4">
<div class="container">
<div class="col-lg-6">
<h4>Recent Transactions</h4>
<h5><a href="Recent_Transactions" target="_blank">View All</a></h5>
<div class="table-responsive mt--2">
<table class="table table-borderless table-striped">
<thead>
<tr>
<th>Seller: </th>
<th>Buyer: </th>
<th>Trade Price: </th>
<th>Trade Qty: </th>
<th>Transaction Amount: </th>
<th>Trade Date: </th>
</tr>
</thead>
<tbody id="trade-list"></tbody>
</table>
</div>
</div>
<div class="col-lg-6">
<?php include_once 'traders_list.php'; ?>
</div>
</div>
</div>
<?php }

34
views/user_messages.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 9/28/2017
* Time: 4:58 PM
*/
?>
<?php
if($user_logged_in) {?>
<div class="container-fluid background-white-1 mt--4 p--2">
<div class="container">
<div class="col-lg-12">
<h4 class="mt--2">My Messages</h4> <h5><a href="My_Messages" target="_blank">View All</a></h5>
<div class="table-responsive mt--2">
<table class="table table-striped" cellpadding="10">
<thead>
<tr>
<th>S.No</th>
<th>Order No.</th>
<th>Message</th>
<th>Date</th>
</tr>
</thead>
<tbody id="user_msg"></tbody>
</table>
</div>
</div>
</div>
</div>
<?php } ?>

View File

@ -0,0 +1,27 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:19 AM
*/
?>
<div class="container">
<div class="col-lg-12">
<h2 class="mt--2">My Messages</h2>
<div class="table-responsive mt--2">
<table class="table table-striped table-bordered" id="messages-datatable" cellspacing="0" width="100%" cellpadding="10">
<thead>
<tr>
<th>Order No.</th>
<th>Message</th>
<th>Date</th>
</tr>
</thead>
<tbody id="myMessagesTable"></tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:19 AM
*/
?>
<div class="container">
<div class="col-lg-12">
<h2 class="mt--2">My Orders</h2>
<div class="table-responsive mt--2">
<table class="table table-striped table-bordered" id="messages-datatable" cellspacing="0" width="100%" cellpadding="10">
<thead>
<tr>
<th>Item Sold</th>
<th>Item Bought</th>
<th>Price ($)</th>
<th>Quantity</th>
<th>Status</th>
<th>Date</th>
<th>Cancel Order</th>
</tr>
</thead>
<tbody id="view_all_orders_tb"></tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,30 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:19 AM
*/
?>
<div class="container">
<div class="col-lg-12">
<h2 class="mt--2">My Transactions</h2>
<div class="table-responsive mt--2">
<table class="table table-striped table-bordered" id="messages-datatable" cellspacing="0" width="100%" cellpadding="10">
<thead>
<tr>
<th>Seller</th>
<th>Buyer</th>
<th>Trade Price</th>
<th>Quantity Traded</th>
<th>Transaction Amount</th>
<th>Trade Date</th>
</tr>
</thead>
<tbody id="myTransactionsTable"></tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,28 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:19 AM
*/
?>
<div class="container">
<div class="col-lg-12">
<h2 class="mt--2">Recent Transactions</h2>
<div class="table-responsive mt--2">
<table class="table table-striped table-bordered" id="messages-datatable" cellspacing="0" width="100%" cellpadding="10">
<thead>
<tr>
<th>Seller</th>
<th>Buyer</th>
<th>Trade Price</th>
<th>Quantity Traded</th>
<th>Transaction Amount</th>
<th>Trade Date</th>
</tr>
</thead>
<tbody id="myTransactionsTable"></tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,45 @@
<?php
/**
* Created by PhpStorm.
* User: Abhishek Kumar Sinha
* Date: 10/5/2017
* Time: 11:19 AM
*/
$tradersList = array();
if(isset($OrderClass)) {
$tradersList = $OrderClass->UserBalanceList();
}
if(!empty($tradersList)) { ?>
<div class="container">
<div class="col-lg-12">
<h2 class="mt--2">Traders List</h2>
<div class="table-responsive mt--2">
<table class="table table-striped table-bordered" id="messages-datatable" cellspacing="0" width="100%" cellpadding="10">
<thead>
<tr>
<th> Trader Name</th>
<th> RMT Tokens</th>
<th> Cash</th>
</tr>
</thead>
<tbody>
<?php foreach ($tradersList as $index=>$trader) { ?>
<tr>
<td><?=$trader->Name?></td>
<td><?=$trader->BTC?></td>
<td><?=$trader->CASH?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php } ?>