C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\gridtip\gridtip_dev\gridtip.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<!DOCTYPE html>
<html>
<head>
<title>GRID TIP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//mamnaslim.dsmynas.net/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

<style type="text/css">

#menu__toggle {
  opacity: 0;
}
#menu__toggle:checked + .menu__btn > span {
  transform: rotate(45deg);
}
#menu__toggle:checked + .menu__btn > span::before {
  top: 0;
  transform: rotate(0deg);
}
#menu__toggle:checked + .menu__btn > span::after {
  top: 0;
  transform: rotate(90deg);
}
#menu__toggle:checked ~ .menu__box {
  left: 0 !important;
}
.menu__btn {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  z-index: 1;
}
.menu__btn > span,
.menu__btn > span::before,
.menu__btn > span::after {
  display: block;
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: #616161;
  transition-duration: .25s;
}
.menu__btn > span::before {
  content: '';
  top: -8px;
}
.menu__btn > span::after {
  content: '';
  top: 8px;
}
.menu__box {
  display: block;
  position: fixed;
  top: 0;
  left: -100%;
  width: 300px;
  height: 100%;
  margin: 0;
  padding: 40px 0;
  list-style: none;
  background-color: #ECEFF1;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, .4);
  transition-duration: .25s;
  overflow: auto;
}
.menu__item {
  display: block;
  padding: 12px 24px;
  color: #333;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  text-decoration: none;
  transition-duration: .25s;
}
.menu__item:hover {
  background-color: #CFD8DC;
  text-decoration: none;
}
.menu__home {
  position: fixed;
  top: 7px;
  right: 17px;
}

.leaderboard {
//  column-count: 3;
//  column-gap: 10px;
  column-count: auto;
  column-width: 10rem;
}
ol,
li {
  list-style-type: 1;
  margin: 0;
  padding: 0;
}

// Mode Buttons Styles Start

.btn-container {
            display: flex;
            gap: 10px;
            padding: 20px;
        }
        
        .btn {
            padding: 6px 16px;
            background-color: #999999;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 14px;
            font-weight: normal;
            color: white;
            text-decoration: none;
            transition: background-color 0.2s ease;
        }

        .btn:hover {
            background-color: #666666;
        }

        .btn.active {
            background-color: #1c7cd6;
        }

        #mode-display {
            margin-top: 0px;
            font-size: 20px;
            font-weight: bold;
            color: #333;
//            min-height: 40px;


// Mode Buttons Styles End

</style>

</head>

<body bgcolor="#FFFFFF" text="#000000" link='#000000' alink='#000000' vlink='#000000'>

<link href="shoutbox/style.css" rel="stylesheet" type="text/css" />

<div class="hamburger-menu">
    <input id="menu__toggle" type="checkbox" />
    <label class="menu__btn" for="menu__toggle">
      <span></span>
    </label>

   <ul class="menu__box">
          <li><h1>&nbsp;&nbsp;GRID TIP</h></li>

            <li><a class="menu__item" href="login.php" target="mainFrame">Login</a></li>
            <li><a class="menu__item" href="tipsresults.php" target="mainFrame">Tips & Results</a></li>
            <li><a class="menu__item" href="schedule.php" target="mainFrame">Schedule</a></li>
            <li><a class="menu__item" href="rules.php" target="mainFrame">Rules</a></li>
            <li><a class="menu__item" href="members.php" target="mainFrame">Members List</a></li>
            <li><a class="menu__item" href="halloffame.php" target="mainFrame">Hall of Fame</a></li>
            <li><a class="menu__item" href="statistics.php" target="mainFrame">Statistics</a></li>
            <li><a class="menu__item" href="archive.php" target="mainFrame">Archive</a></li>
            <li><a class="menu__item" href="../gridtip_2024/" target="_blank">Last Season</a></li>
            <li><a class="menu__item" href="https://median.co/share/molnwl#apk" target="_blank">App</a></li>
            <li><a class="menu__item" href="admin/admin.html" target="mainFrame">Admin</a></li>
            <li><a class="menu__item" href="impressum_en.php" target="mainFrame">Legal Notice</a></li>
    </ul>

<div class="menu__home">
    <a href="gridtip.php" target="mainFrame"><img src="images/home.png" width="32" height="28"></a>
</div>

</div>

<div align=center>

<form action="https://www.paypal.com/donate" method="post" target="top">
<input type="hidden" name="business" value="PMXYBUCUJHJXW" />
<input type="hidden" name="no_recurring" value="0" />
<input type="hidden" name="item_name" value="Your voluntary donation to support GRID TIP" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="Your voluntary donation to support GRID TIP" />
<img alt="" border="0" src="https://www.paypal.com/en_AT/i/scr/pixel.gif" width="1" height="1" />
</form>


</div>

<br>

<table width="80%" border="0" align="center">
  <tr>
    <td width="60%" align="center"><font face="Arial, Helvetica, sans-serif" size="6"><b>Leaderboard</b></font></td>
    <td width="40%" align="center"><font face="Arial, Helvetica, sans-serif" size="6"><b>Shoutbox</b></font></td>
  </tr>
  <tr>
    <td width="60%" align="center"><font face="Arial, Helvetica, sans-serif" size="3"><BR>

    <div class="btn-container">
            <!-- Add 'active' class to Button 1 by default -->
        &nbsp;&nbsp;&nbsp;<button class="btn active" onclick="showNormalMode()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Normal Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>
        &nbsp;&nbsp;&nbsp;<button class="btn" onclick="showNostradamusMode()">Nostradamus Mode</button>
    </div>

    </font></td>
    <td width="40%" align="center"><font face="Arial, Helvetica, sans-serif" size="3"><BR>&nbsp;</font></td>
  </tr>
  <tr> 
   <td width="60%" valign="top"><div align="center"><font face="Arial, Helvetica, sans-serif" size="5"><br>Overall score (and won GP weekends score in brackets)<br><br></font></div>

<?php
      
require("dbconnect.php");
    
dbconnect();
?>

<div id="leaderboard-normal" class="leaderboard" style="display:block" align="left"> 

<?php
    
                           $created
=mysql_query("create table temp_score as select t_g_id,t_u_Id,sum(t_score) t_score from tips where t_g_id < 100 group by t_g_id,t_u_id;");
                    
$created=mysql_query("create table temp_max_score as select t_g_id,max(t_score) t_max_score from temp_score group by t_g_id;");

//                    $created=mysql_query("create table temp_g_u as select ts.t_g_id,ts.t_u_id,ms.t_max_score from temp_score ts,temp_max_score ms where ts.t_g_id=ms.t_g_id and ts.t_score=ms.t_max_score group by ts.t_g_id having count(*)=1 and ms.t_max_score>0;");
                    
$created=mysql_query("create table temp_g_u as select ts.t_g_id,ts.t_u_id,ms.t_max_score from temp_score ts,temp_max_score ms where ts.t_g_id=ms.t_g_id and ts.t_score=ms.t_max_score and ms.t_max_score>0;");
                    
$created=mysql_query("create table temp_coffees as select t_u_id,count(*) t_coffees from temp_g_u group by t_u_id");

                    
$x=0;
                    
$scores=mysql_query("select t.t_u_id,u_name,sum(t.t_score) points,tc.t_coffees coffees from users left join tips t on u_id=t.t_u_id and t_g_id < 100 left join temp_coffees tc on t.t_u_id=tc.t_u_id group by t.t_u_id,u_name order by points desc, coffees desc, u_name asc;");
                    while  (
$user_scores=mysql_fetch_array($scores)) {
                        
$user_names[$x]=$user_scores['u_name'];
                        
$user_points[$x]=$user_scores['points'];
                        
$user_coffees[$x]=$user_scores['coffees'];
                        if (
$user_coffees[$x]==""$user_coffees[$x]=0;
                        
$x=$x+1;
                    }
                    echo 
"<ol type='1'>";
                    
$j=0;
                    for (
$i=0;$i<$x;$i++)
                    {
                        echo 
"<font face='Arial, Helvetica, sans-serif' size='4' color='#0099CC'><b><li>".$user_names[$i].":&nbsp;&nbsp;<font color='#FF0000'>".$user_points[$i]."&nbsp;(".$user_coffees[$i].")&nbsp;&nbsp;<br><br></li></b></font></font>";
                        
$j=$j+1;
                        
//if ($j==10) { echo "<br>"; $j=0;}

                    
}
                    echo 
"</ol>";

                    
$deleted=mysql_query("drop table temp_score;");
                    
$deleted=mysql_query("drop table temp_max_score;");
                    
$deleted=mysql_query("drop table temp_g_u;");
                    
$deleted=mysql_query("drop table temp_coffees;");

    
?>
</div>

<div id="leaderboard-nostradamus" class="leaderboard" style="display:none" align="left"> 

<?php
    
                           $created
=mysql_query("create table temp_score as select t_g_id,t_u_Id,sum(t_score) t_score from tips where t_g_id = 100 group by t_g_id,t_u_id;");
                    
                    
$x=0;
                    
                    
$scores=mysql_query("select t.t_u_id,u_name,sum(t.t_score) points from users left join tips t on u_id=t.t_u_id and t_g_id = 100 group by t.t_u_id,u_name order by points desc, u_name asc;");
                    
                    while  (
$user_scores=mysql_fetch_array($scores)) {
                        
                        
$user_names[$x]=$user_scores['u_name'];
                        
$user_points[$x]=$user_scores['points'];
                        
$x=$x+1;
                    }
                    
                    echo 
"<ol type='1'>";
                    
$j=0;
                    
                    for (
$i=0;$i<$x;$i++)
                    {
                        echo 
"<font face='Arial, Helvetica, sans-serif' size='4' color='#6d9bc3'><b><li>".$user_names[$i].":&nbsp;&nbsp;<font color='#FF0000'>".$user_points[$i]."&nbsp;&nbsp;&nbsp;<br><br></li></b></font></font>";
                        
$j=$j+1;
                    }
                    
                    echo 
"</ol>";

                    
$deleted=mysql_query("drop table temp_score;");
                    
              
?>
</div>

<script>
        const buttons = document.querySelectorAll('.btn');

        buttons.forEach(button => {
            button.addEventListener('click', (e) => {
                e.preventDefault();
                
                // Remove active class from all buttons
                buttons.forEach(btn => btn.classList.remove('active'));
                
                // Add active class to clicked button
                button.classList.add('active');
            });
        });
</script>

<script>
    
        // Initial setup on page load
//        window.onload = function() {
//            document.getElementById('leaderboard-normal').style.display = 'block';
//            document.getElementById('leaderboard-nostradamus').style.display = 'none';
//        };

        function showNormalMode() {
            document.getElementById('leaderboard-normal').style.display = 'block';
            document.getElementById('leaderboard-nostradamus').style.display = 'none';
        }

        function showNostradamusMode() {
            document.getElementById('leaderboard-normal').style.display = 'none';
            document.getElementById('leaderboard-nostradamus').style.display = 'block';
        }

</script>

          </td>
<td width="40%" valign="top" align="center"><br><br> 

<?php
// Glens shoutbox script using files and sessions
?>
      <table width="300" border="0" bordercolor="#000000" cellpadding="0" cellspacing="0">
        <tr> 
          <td bgcolor="#CCCCCC"> 
            <p><div align="center"><IFRAME SRC="shoutbox/shouts.php" WIDTH=94% HEIGHT=250 scrolling=auto frame-border=0></IFRAME></div></p>
          </td>
        </tr>
        <tr> 
          <td bgcolor="#99CCFF"> 
            <form id="shoutbox" name="shoutbox" method="post" action="">
        <br>
        <font face="Arial, Helvetica, sans-serif" size="3">
        <b>&nbsp;&nbsp;Name:<br><br>
        <div align="center"><input name="name" type="text" id="name" size="35" maxlength="50"></div>
        <br>&nbsp;&nbsp;Message:<br><br>
        <div align="center"><input name="message" type="text" id="message" size="35" maxlength="500"></div></b></font>
        <br>
                  <p align="center">
        <input type="submit" id="shout" name="shout" value="." class="submit"><br><br><a href="<?php echo $_SERVER['PHP_SELF']; ?>"><font size="2"><b>refresh</b></font></a>
           </p>
            </form>
          </td>
        </tr>
      </table>
      <?php

// Start coding new entrys on post

if ($_POST['shout']) {

$file "shoutbox/shouts.html";
$handle fopen($file"a") or die ("Cant open file");
$message $_POST['message'];
$message htmlentities($message);
$name $_POST['name'];
$name htmlentities($name);
$date date("Y-m-d - H:i:s");

$name_l strlen($name);
$message_l strlen($message);
$nl chr(13) . chr(10);

if (
$name_1 50) {
echo 
"<span class='error'>Name must be less than 50</span>";
//exit;
}
if (
$message_1 500) {
echo 
"<span class='error'>Message must be less than 500</span>";
//exit;
}

if (
$name == '') {
echo 
"<span class='error'>You must enter a name</span><br>";
//exit;
}else{
$true++;
}
if (
$message == '') {
echo 
"<span class='error'>You must enter a message</span><br>";
//exit;
}else{
$true++;
if (
$name == "name") {
echo 
"<span class='error'>You must enter your name</span><br>";
//exit;
}
if (
$message == "message") {
echo 
"<span class='error'>You must enter a message</span><br>";
//exit;
//if ($name == "name" and $message == "message") {
//echo "Please enter your name and message";
//exit;
//}
}
}
if (
$true == 2) {

$data "<span class='first'>$date</span><br><span class='second'>$name:</span><br><span class='third'>$message</span><br><br>$nl";
fwrite ($handle$data) or die ("Cant write new message");
fclose($handle);
//echo '<meta http-equiv="Refresh" content="0">';
}
}

?>
    </td>
  </tr>
</table>

<br>

<div align='center'><font face='Arial, Helvetica, sans-serif' size='3'>&copy; 2023-2025 - GRID TIP</font></div>

</body>
</html>