Index: trunk/extensions/ContributionReporting/cc-reporting.php |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +<?php |
| 3 | +if(isset ($_REQUEST['load'])){ |
| 4 | + handleLoad(); |
| 5 | +} |
| 6 | +else if(isset ($_REQUEST['submit'])){ |
| 7 | + handleSubmit(); |
| 8 | +} |
| 9 | + |
| 10 | +function handleLoad(){ |
| 11 | + $cc_id = randomCookie(); |
| 12 | + |
| 13 | + if(!isset($_COOKIE['cc-cookie'])){ |
| 14 | + $cc_id = $_REQUEST['cc-cookie']; |
| 15 | + } |
| 16 | + else{ |
| 17 | + //set cookie to expire in maybe about a year or so... 300 days |
| 18 | + setcookie('cc-cookie', $cc_id, time() + (60 * 60 * 24 * 300), '/', "payments.wikimedia.org"); |
| 19 | + } |
| 20 | + |
| 21 | + //if not exist insert into DB |
| 22 | +} |
| 23 | + |
| 24 | +function handleSubmit(){ |
| 25 | + $cc_id = "NULL"; |
| 26 | + if(isset($_COOKIE['cc-cookie'])){ |
| 27 | + $cc_id = $_COOKIE['cc-cookie']; |
| 28 | + } |
| 29 | + |
| 30 | + //donations++ |
| 31 | +} |
| 32 | + |
| 33 | +function randomCookie(){ |
| 34 | + return md5(mt_rand() + time()); |
| 35 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/ContributionReporting/cc-reporting.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 36 | + native |