<cfparam name="form.mode" default="start">

<cfif session.UserID NEQ 0>

<cfif form.mode eq "start">

	<CFQUERY name="get_verified_users" datasource="#application.datasource#">
		SELECT 				U.UserID, U.UserEmailAddress, U.UserContactNumber,U.UserAddedOn
		FROM 				Users U
		WHERE				U.UserIsEmailVerified = 1
								AND
							U.UserIsCOntactVerified > 0
								AND
							U.UserID > 435
		ORDER BY			U.UserID DESC
	</cfquery>
	
	
	
	<table border="0" cellspacing="5" cellpadding="5">
		<tr>
			<th>UserID</th>
			<th>Email</th>
			<th>Mobile</th>
			<th>Added On</th>
			<th>Order(s)</th>
		</tr>
	
	<cfoutput query="get_verified_users">
			
		<tr>
			<td>
			
				<script language="JavaScript">
					function submitformUserTraffic#UserID#()
					{
					document.myformUserTraffic#UserID#.submit();
					}
				</script>
				
				<form action="#request.cgipath#" method="post" name="myformUserTraffic#UserID#" id="myformUserTraffic#UserID#" style="display:inline;">
					
					<a href="javascript: submitformUserTraffic#UserID#()">#UserID#</a>
					
					<input type="hidden" name="mode" value="user_traffic">
					<input type="hidden" name="chip" value="#UserID#">
				
				</form>
				
			</td>
			<td>#UserEmailAddress#</td>
			<td>#UserContactNumber#</td>
			<td>#dateformat(UserAddedOn, "mmmm dd, YYYY")# at #timeformat(UserAddedOn, "hh:nn tt")#</td>
			<td>
			
				<CFQUERY name="get_orders" datasource="#application.datasource#">
					SELECT 				O.OrderUUID
					FROM 				Orders O
					WHERE				O.OrderUserID = #get_verified_users.UserID#
					ORDER BY			O.OrderID DESC
				</cfquery>
				
				<cfparam name="looper" default="">
				
				<cfset looper=0>
				
				<cfloop query="get_orders">
					<cfset looper=incrementvalue(looper)>
					<a href="https://payfr.it/show_order.cfm?OrderUUID=#get_orders.OrderUUID#&is_admin_view=1" target="_blank">#looper#</a>, &nbsp;
				</cfloop>
			
			</td>
		</tr>
	
	</cfoutput>
	
	</table>
	
<cfelseif form.mode eq "user_traffic">

	<CFQUERY name="get_user_traffic" datasource="#application.datasource#">
		SELECT 				V.VisitorTrackingPageMode, V.VisitorTrackingAddedOn
		FROM 				VisitorTracking V
		WHERE				V.VisitorTrackingUserID = #form.chip#
		ORDER BY			V.VisitorTrackingAddedOn DESC
	</cfquery>
	
	<table>
		<tr>
			<td>mode</td>
			<td>date/time</td>
		</tr>
		<cfoutput query="get_user_traffic">
		<tr>
			<td>#VisitorTrackingPageMode#</td>
			<td>#VisitorTrackingAddedOn#</td>
		</tr>
		</cfoutput>
	</table>


<cfelse>

	no mode provided!<br>

</cfif>

<cfelse>

	please login!<br>

</cfif>