Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/65964-solved-php-java-script/
Share on other sites

<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>

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>

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.