The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
modify table with external php
so me and KH99 got my confirm password working, but we were thinking, to make it more secure i need to have something that triggers it to change a table.
I have created the most simple product (for testing purposes) that only adds the column we need the install code is as follows: Code:
$db->query(" ALTER TABLE `" . TABLE_PREFIX . "session` ADD COLUMN `idle` smallint(5) DEFAULT '0' "); ok from there, i created a script that triggers after set amount of time: Code:
$.ajax({ url: 'script.php' }); PHP Code:
in chrome while loading my page, (watching network tab in the console) i can see after set time script.php trigger, this leaves me to believe i fudged something up in the text of script.php cause after it triggers and refreshing the DB i see no change in the idle column. later ill need to make it so submitting a form reverse's this back to 0 so if anyone can kill 2 birds with one stone im throwing that out there too. --------------- Added [DATE]1424887890[/DATE] at [TIME]1424887890[/TIME] --------------- i figured i'd update this since its still needed but the issue didnt lie in the php, it works great! the issue is in my ajax call i need a way to trigger this file without reloading the page are there any other methods i can do THAT WONT RELOAD THE PAGE. --------------- Added [DATE]1424888239[/DATE] at [TIME]1424888239[/TIME] --------------- this is what i used when it set the idle column properly: HTML Code:
$.ajax({ type: "GET", url: "script.php" , success : function() { location.reload(); } }); removing: Code:
success : function() { location.reload(); } also the script seems to execute every set interval this is partial of the full snippet, any way i can kill it after it runs once: Code:
if (idleTime > 2) { $.ajax({ type: "GET", url: "script.php" }); $("#idle").removeClass("hide"); $( ".background-image" ).removeClass("hide"); idleTime = 0; $('body').children().each(function(){ if($(this).attr('id')!="idle"){ $(this).css("-webkit-filter","blur(15px)"); } }); } --------------- Added [DATE]1424888499[/DATE] at [TIME]1424888499[/TIME] --------------- now even re adding the reload doesnt update the table -_- back to square one --------------- Added [DATE]1424889825[/DATE] at [TIME]1424889825[/TIME] --------------- ok i got it all working EXCEPT it re runs every 3 seconds(testing time) but still if i set it to not trigger for 5 minutes i only want it to trigger on the first 5 mins not every 5 mins after its already triggered this is my javascript: Code:
function timerIncrement() { idleTime++; if (idleTime > 2) { $.ajax({ type: "GET", url: "script.php" }); $("#idle").removeClass("hide"); $( ".background-image" ).removeClass("hide"); idleTime = 0; $('body').children().each(function(){ if($(this).attr('id')!="idle"){ $(this).css("-webkit-filter","blur(15px)"); } }); } } Code:
$.ajax({ type: "GET", url: "script.php" }); |
#2
|
|||
|
|||
I hardly know anything about jquery, but as for th query to modify the table, I think you'd want:
Code:
$vbulletin->db->query(" UPDATE `" . TABLE_PREFIX . "session` SET idle = '1' WHERE dbsessionhash = {$vbulletin->session['vars']['dbsessionhash']} "); |
#3
|
||||
|
||||
sweet thanks, as for the rest i got everything sorted out =) and ill probally start product fying this when i wake up.
thanks for all your help and suggestions kev, you better believe you'll have credit on this --------------- Added [DATE]1424893001[/DATE] at [TIME]1424893001[/TIME] --------------- oh heres a screen but the close button wont be there --------------- Added [DATE]1424893035[/DATE] at [TIME]1424893035[/TIME] --------------- still needs some work but its a pretty sexy screen to get trapped on lol --------------- Added [DATE]1424920959[/DATE] at [TIME]1424920959[/TIME] --------------- so ive been playing with this and seems like the session table is reset after some time, creating a vulnerability to this mod. if i get the idle set to 1 after some time the table is creating a new table for my id with the default of idle being 0, I believe moving this column to user table will solve this problem, but im not sure if it will achieve the desired effect --------------- Added [DATE]1424921132[/DATE] at [TIME]1424921132[/TIME] --------------- also using Code:
$vbulletin->db->query(" UPDATE `" . TABLE_PREFIX . "session` SET idle = '1' WHERE dbsessionhash = {$vbulletin->session['vars']['dbsessionhash']} "); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|