-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.php
executable file
·66 lines (55 loc) · 1.93 KB
/
history.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<html>
<head>
<link rel="stylesheet" type="text/css" href="signup.css">
</head>
<font size='6' color="#6B8E23">The History</font>
<a href="home.php">Back</a>
<a href="costcruncher.php">The Cost Cruncher</a>
<a href="main.php">Logout</a>
<hr>
<p><Click to view></p>
<?php
session_start();
$mid=$_SESSION['mid'];
mysql_connect("localhost","pool","pool") or die(mysql_error());
mysql_select_db("pool") or die(mysql_error());
error_reporting(~E_NOTICE);
$getpid=mysql_query("select pid,pool_count from belongs_to where mid='$mid' and pid in (select pid from belongs_to where pool_count>1)") or die(mysql_error());
if(mysql_num_rows($getpid)!=0)
{
while($row=mysql_fetch_array($getpid))
{
$pid=$row['pid'];
$getdate=mysql_query("select date from pool where pid='$pid'");
$row=mysql_fetch_array($getdate);
$date=$row['date'];
$array[$date]=$pid;//create associative array on date to store the pid of the pool the mid was in on that day...otherwise the same query will have to be written again...which is better?
$date=date('d F Y',strtotime($date));
echo "<a href='#' onclick='check(this)'>".$date."</a><br><br>";
}
}
?>
<form name="form" id="form" method="post" action="history.php">
<input type="hidden" id="temp" name="temp" value="">
</form>
<script type="text/javascript">
function check(element)
{
//var date=element.innerHTML.split("on ");
document.getElementById('temp').value=element.innerHTML;
alert(document.getElementById('temp').value);
document.form.submit();
}
</script>
<?php
if($_POST['temp']!="")
{
$date=$_POST['temp'];
$date=date("Y-m-d",strtotime($date));
$_SESSION['pid']=$array[$date];
header("location:pool.php");
}
?>