Jump to content

Interface.php.htm voting scripts


babygurl

Recommended Posts

Hello, i'm new to the scene and started a project 4 months back and have learned a lot along the way i originally had help with this project but over time have lost team members, so i'm having to learn a lot more then anticipated. I've been stuck on this problem for about month now and am seeking some help please:)

:confused: the following code is a voting interface  for a website, most this code was done by a user that has left the team and cannot help anymore:(

 

i have to figure out how to write two .php scripts Vote.interface.php and do_vote.php, however i cannot figure out how what to write and how the values are carried to the sql and returned

 

$(function(){$("#accordion").accordion({header:"h4"});$("#dialog").dialog({autoOpen:!1,width:600,buttons:{Ok:function(){$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}});$("#dialog_link").click(function(){$("#dialog").dialog("open");return!1});$("#dialog_link, ul#icons li").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})});
$(document).ready(function(){$("#loginButton").click(function(){document.getElementById("userInput");return!1});$("#logoutButton").click(function(){$("#logoutPane").slideToggle("medium");$("#loginPane").slideToggle("medium");return!1})});
function dryQuery(){var a;a=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");a.onreadystatechange=function(){4==a.readyState&&200==a.status&&processResponce(!0,a.responseText)};a.open("POST","vote_interface.php",!0);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send("action=query")}
function loginUser(a){if("Minecraft Username"!=a){document.getElementById("displayUser1").innerHTML=a;document.getElementById("displayUser2").innerHTML=a;var b;b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");b.onreadystatechange=function(){4==b.readyState&&200==b.status&&processResponce(!0,b.responseText)};"Bot"==a||3<=a.split(".").length?b.open("POST","vote_interface.php",!1):b.open("POST","vote_interface.php",!0);b.setRequestHeader("Content-type","application/x-www-form-urlencoded");
b.send("action=login&user="+a)}}
function logoutUser(){document.getElementById("displayUser1").innerHTML="<a color='red'>Logged Out!</a>";document.getElementById("displayUser2").innerHTML="<a color='red'>Logged Out!</a>";document.getElementById("userInput").value="Minecraft Username";var a;a=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");a.onreadystatechange=function(){};a.open("POST","vote_interface.php",!1);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send("action=logout");
location.reload(!0)}function updateQuery(){var a;a=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");a.onreadystatechange=function(){4==a.readyState&&200==a.status&&processResponce(!1,a.responseText)};a.open("POST","vote_interface.php",!0);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send("action=query")}
function processResponce(a,b){var c=b.split("|");if("false"!=c[0]){$user=c[0];document.getElementById("displayUser1").innerHTML=$user;document.getElementById("displayUser2").innerHTML=$user;document.getElementById("userInput").value=$user;if(3<=$user.split(".").length||"Override"==$user)document.getElementById("link1").target="_self",document.getElementById("link2").target="_self",document.getElementById("link3").target="_self";$gtop100_secsLeft=c[1].split(":")[1];$mcservers_secsLeft=c[2].split(":")[1];
xtremetop100_secsLeft=c[3].split(":")[1];"false"!=$gtop100_secsLeft?(document.getElementById("gtop100_vote_button").disabled=!0,document.getElementById("gtop100_handIcon").style.visibility="hidden",$("#gtop100_countdown").countdown({until:+$gtop100_secsLeft,compact:!0,layout:"{hnn}{sep}{mnn}{sep}{snn}",onExpiry:updateQuery})):document.getElementById("gtop100_vote_button").disabled=!1;"false"!=$mcservers_secsLeft?(document.getElementById("mcservers_vote_button").disabled=!0,document.getElementById("mcservers_handIcon").style.visibility=
"hidden",$("#mcservers_countdown").countdown({until:+$mcservers_secsLeft,compact:!0,layout:"{hnn}{sep}{mnn}{sep}{snn}",onExpiry:updateQuery})):document.getElementById("mcservers_vote_button").disabled=!1;"false"!=xtremetop100_secsLeft?(document.getElementById("xtremetop100_vote_button").disabled=!0,document.getElementById("xtremetop100_handIcon").style.visibility="hidden",$("#xtremetop100_countdown").countdown({until:+xtremetop100_secsLeft,compact:!0,layout:"{hnn}{sep}{mnn}{sep}{snn}",onExpiry:updateQuery})):
document.getElementById("xtremetop100_vote_button").disabled=!1;a&&($("#loginPane").slideToggle("medium"),$("#logoutPane").slideToggle("medium"),$("#step2").click())}}function checkSubmit(){if(window.event&&13==window.event.keyCode)document.getElementById("loginButton").click();else return!0}dryQuery();setInterval("updateQuery()",3E4);

 

 

Link to comment
Share on other sites

so ive read up on some ajax and some php/mysql and understand a little better however this style of coding is nothing like what i've seen on the net a lot of values are flopped and split..

 

im also confused on another part:

<a id="link1" target='_blank' href="vote.php?site=gtop100" onclick="trackVote("Gtop100")"><button id="gtop100_vote_button" width="108">

 

is the link to the site stored in MYsql and when it ?site=gtop100 is their something in the vote.php and what does

onlick="trackvote do is that custom function?

..so i guess i'm trying to figure out the order< html sends $user and ID=link1 to vote.php and post info into the tables?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.