supermerc Posted August 21, 2007 Share Posted August 21, 2007 Hey, I have this script in java, and I want to add php in it. This is my java script; <?php session_start(); require("config.php"); require("functions.php"); if (!$_SESSION['s_logged_n']) { header("Location: index.php"); exit(); } ?> <title>Hitlist </title> <body bgcolor="black"> <style type="text/css"> a{ text-decoration: none } </style> <script> var numa=0; var maxa=100; var atkn=new Array(maxa); var atkn=new Array("xDissolution","bigwHiStLe","DarkMagician","MysteryMan","DrunkMonkey9","BigPaPy","GiuseppE","AssAssInX","Trxx","RampagePIMP","Teknikal","DeViLNouR","Haplo","xSyndicate","nighthunter","Metak","Sley","TheXile","Dante69","Outrage","mweso","Playa03","BaByTuPaC20016","sweettundra","sntlouisrams","JIMLORENZETTI","jimbob2","jeffreydoom","HeinrichHimmler","Tibersaw","xXBlizzardXx","Etheralto","LuDa","EnlightenedOne","YearningCorpse","Ducati","ThexXxBarbarian","MarikIshtar","Sagat","SharpedEye","Blinkyx","NightWear","BlackCloud","Insert","xXRASALXx","Rith","OneHitWonder","shitter","TheDividedReunited","Elusion","WarriorOfLight","Astari","Bullet2Hart88","BobtheMaula","Waldo","SKNIFER","canofclone","Inuyasha","Scam","MASTERMIND666","Ozzo1","electric","Duggalo","AmmoMammal","JohnnyDrama","afjustinsane","Bowman","DynastyWarrior","Shorm777","dododo","mikegd","DoubleA","et133et","aj85608","Minelator","SouthSideGangster13","Slanger03","TfJsmn","DeStr0yeR","D0iNiT3iG","DarkKnightSqueaky","xPolishxHitmanx"); var alvl=new Array(maxa); var alvl=new Array(); function umsg() { document.getElementById("amessage").innerHTML = "Currently: " + eval(numa+1) + " / " + maxa; document.getElementById("aname").innerHTML = atkn[numa]; } function opena() { iframe.location.href = 'http://zimbob.outwar.com/attack.php?attackname=' + atkn[numa]; numa=eval(numa+1); if (numa>=maxa) { numa="0"; } umsg(); } function backa() { numa=eval(numa-1); if (numa<0) { numa=eval(maxa-1); } umsg(); } </script> <script language="JavaScript"> var SetFocus=window.setInterval('Focus()',1000); function Focus() { window.focus(); document.Text1.select(); } document.onkeyup = function(event) { if (!event && window.event) event = window.event; if (String.fromCharCode(event.keyCode).toLowerCase() == 'n') { opena(); } } </script> </head> <body bgcolor='red' text='red' topmargin='0' leftmargin='0' marginheight='0' onload="umsg()"> <table border="0" bordercolor="#000000" width="100%"> <tr> <td width="100%"align="center"><font color="#FF0000"><font size="2"> - Dark Plague -'s hitlist <br>WE OWN<br><div align="center"><br>Press N to move to next name.</div></font></td> </tr> </table> <table border="0" bordercolor="#000000" width="100%" height="100%"> <tr> <td width="16%"> <center><font size="4"><span id='amessage'></span></font><br><br><a href="#" onclick="opena()"><font size="3"><span id='aname'></span></font><br><font size="4">NEXT</font></a><br><br><a href="#" onclick="backa()"><font size="4">BACK</font></a><br> </center> </td> <td width="94%"> <iframe id="framer" name="iframe" src="" width="95%" height="95%"/> <br><DIV ALIGN="CENTER"><font size="8">WE OWN</font></DIV> </td> </tr> </table> <INPUT id="Text1" type="text" name="Text1"> </body> </html> And this part var atkn=new Array("xDissolution","bigwHiStLe","DarkMagician","MysteryMan","DrunkMonkey9","BigPaPy","GiuseppE","AssAssInX","Trxx","RampagePIMP","Teknikal","DeViLNouR","Haplo","xSyndicate","nighthunter","Metak","Sley","TheXile","Dante69","Outrage","mweso","Playa03","BaByTuPaC20016","sweettundra","sntlouisrams","JIMLORENZETTI","jimbob2","jeffreydoom","HeinrichHimmler","Tibersaw","xXBlizzardXx","Etheralto","LuDa","EnlightenedOne","YearningCorpse","Ducati","ThexXxBarbarian","MarikIshtar","Sagat","SharpedEye","Blinkyx","NightWear","BlackCloud","Insert","xXRASALXx","Rith","OneHitWonder","shitter","TheDividedReunited","Elusion","WarriorOfLight","Astari","Bullet2Hart88","BobtheMaula","Waldo","SKNIFER","canofclone","Inuyasha","Scam","MASTERMIND666","Ozzo1","electric","Duggalo","AmmoMammal","JohnnyDrama","afjustinsane","Bowman","DynastyWarrior","Shorm777","dododo","mikegd","DoubleA","et133et","aj85608","Minelator","SouthSideGangster13","Slanger03","TfJsmn","DeStr0yeR","D0iNiT3iG","DarkKnightSqueaky","xPolishxHitmanx"); Is where I would like to be able to pull from database this way I can have a page to add names to the code instead of having to manually add them everytime. Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/ Share on other sites More sharing options...
supermerc Posted August 21, 2007 Author Share Posted August 21, 2007 bump Also could it be done to make the variable go to like something.txt and then have a page that adds names to something.txt? Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329862 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 it can be done, just have php script echo the details of the array.. also this is JavaSCRIPT not JAVA.. Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329865 Share on other sites More sharing options...
supermerc Posted August 21, 2007 Author Share Posted August 21, 2007 ya i know i wasnt thinking when i wrote title, but how would i have to echo it? I tried before but it didnt work Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329892 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 post your attempt and were take a look Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329899 Share on other sites More sharing options...
supermerc Posted August 21, 2007 Author Share Posted August 21, 2007 <script> var numa=0; var maxa=100; var atkn=new Array(maxa); var atkn=new Array(<? $all_members = mysql_query("SELECT outwarname FROM hitlist ORDER BY id ASC") or die(mysql_error()); if(mysql_num_rows($all_members) > 0) { //create a loop, because there are rows in the DB while($row = mysql_fetch_assoc($all_members)) { echo '"'.$row[outwarname].'", '; } } else { echo "No members to display."; } ?>"" ); <!-- End php --> var alvl=new Array(maxa); var alvl=new Array(); function umsg() { document.getElementById("amessage").innerHTML = "Currently: " + eval(numa+1) + " / " + maxa; document.getElementById("aname").innerHTML = atkn[numa]; } function opena() { iframe.location.href = 'http://zimbob.outwar.com/attack.php?attackname=' + atkn[numa]; numa=eval(numa+1); if (numa>=maxa) { numa="0"; } umsg(); } function backa() { numa=eval(numa-1); if (numa<0) { numa=eval(maxa-1); } umsg(); } </script> <script language="JavaScript"> var SetFocus=window.setInterval('Focus()',1000); function Focus() { window.focus(); document.Text1.select(); } document.onkeyup = function(event) { if (!event && window.event) event = window.event; if (String.fromCharCode(event.keyCode).toLowerCase() == 'n') { opena(); } } </script> Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329911 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 try this <script> var numa=0; var maxa=100; var atkn=new Array(maxa); <?php $all_members = mysql_query("SELECT outwarname FROM hitlist ORDER BY id ASC") or die(mysql_error()); $members = array(); while($row = mysql_fetch_assoc($all_members)) { $members[] = $row['outwarname']; } $allMembers = '"'.implode('","',$members).'"'; ?> var atkn=new Array(<?php echo $allMembers; ?>); var alvl=new Array(maxa); var alvl=new Array(); function umsg() { document.getElementById("amessage").innerHTML = "Currently: " + eval(numa+1) + " / " + maxa; document.getElementById("aname").innerHTML = atkn[numa]; } function opena() { iframe.location.href = 'http://zimbob.outwar.com/attack.php?attackname=' + atkn[numa]; numa=eval(numa+1); if (numa>=maxa) { numa="0"; } umsg(); } function backa() { numa=eval(numa-1); if (numa<0) { numa=eval(maxa-1); } umsg(); } </script> <script language="JavaScript"> var SetFocus=window.setInterval('Focus()',1000); function Focus() { window.focus(); document.Text1.select(); } document.onkeyup = function(event) { if (!event && window.event) event = window.event; if (String.fromCharCode(event.keyCode).toLowerCase() == 'n') { opena(); } } </script> Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329915 Share on other sites More sharing options...
supermerc Posted August 21, 2007 Author Share Posted August 21, 2007 seems to be working thx Quote Link to comment https://forums.phpfreaks.com/topic/65964-solved-php-java-script/#findComment-329925 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.