mirror of
https://github.com/gamaio/lobli.git
synced 2025-01-18 13:53:14 +00:00
Move token data to token.php
Since token requires db.php, I don't require it again. The token is no longer included in a GET request to process.php, use sessions instead.
This commit is contained in:
parent
f825c6bd29
commit
28e0ce013a
@ -16,19 +16,13 @@
|
|||||||
ip:
|
ip:
|
||||||
link id - list holding all visiting IPs for that link
|
link id - list holding all visiting IPs for that link
|
||||||
*/
|
*/
|
||||||
|
require('Include/PHP/token.php');
|
||||||
// Generate a token on the fly. This should prevent POST spam attacks directly into process.php
|
|
||||||
$token = substr(number_format(time() * mt_rand(),0,'',''),0,10);
|
|
||||||
$token = base_convert($token, 10, 36);
|
|
||||||
$_SESSION['token'] = $token;
|
|
||||||
|
|
||||||
$catchid = substr(number_format(time() * mt_rand(),0,'',''),0,10);
|
$catchid = substr(number_format(time() * mt_rand(),0,'',''),0,10);
|
||||||
$catchVal = hash('sha256', $catchid.mt_rand().time().substr(number_format(time() * mt_rand(),0,'',''),0,10));
|
$catchVal = hash('sha256', $catchid.mt_rand().time().substr(number_format(time() * mt_rand(),0,'',''),0,10));
|
||||||
$catchVal = base_convert($catchVal.$catchid, 10, 36);
|
$catchVal = base_convert($catchVal.$catchid, 10, 36);
|
||||||
$_SESSION['catch'] = $catchid.":".$catchVal;
|
$_SESSION['catch'] = $catchid.":".$catchVal;
|
||||||
|
|
||||||
require('Include/PHP/db.php');
|
|
||||||
|
|
||||||
function followLink($redis, $link){
|
function followLink($redis, $link){
|
||||||
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { // Get true IP of visiter if going through cloudflare
|
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { // Get true IP of visiter if going through cloudflare
|
||||||
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
|
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
|
||||||
@ -175,7 +169,7 @@
|
|||||||
$("#theLoader").fadeIn("fast");
|
$("#theLoader").fadeIn("fast");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$.post("process.php?token=<?php echo $token; ?>", $(this).serialize(), function(data){
|
$.post("process.php", $(this).serialize(), function(data){
|
||||||
$("#message").hide().html(data).slideDown("fast");
|
$("#message").hide().html(data).slideDown("fast");
|
||||||
$("#theLoader").hide();
|
$("#theLoader").hide();
|
||||||
if($('#danger').length){
|
if($('#danger').length){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user