ArcEmu: Need help with avs - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need help with avs Help

#1 User is offline   eatos92 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 193
  • Joined: 06-May 09
  • Gender:Male
  • Location:Serbia, Devil WoW

Posted 21 November 2009 - 11:29 AM

In last 48 hours i was trying to figure out why reward.php script dont work...
I am using avs voting system and php 5.3.0 version on windows 7
It was working good every thing before i instaled windows 7 and now the only thing is that it says there is no rewards, characters or realms...But there is and every thing is configure right
I am not pro at php scripting but i am trying to learn it and understand it
this is the script where i have problem
<?php

class Rewards
{
	function Title()
	{
		?>
        	Rewards
        <?php
	}

	function GetRealmData()
	{
		//Get data to use in the form.
		$Con = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,true);
		mysql_select_db(MYSQL_DB,$Con);
		
		$RealmInfo = "{";
		//get each realm
		$res = mysql_query("SELECT id,name,sqlhost,sqluser,sqlpass,chardb FROM realms",$Con);
		echo mysql_error();
		while($Row = mysql_fetch_array($res))
		{
			$RealmInfo .= $Row['id'].":{name:\"".$Row['name']."\"},";
		}
		if(strlen($RealmInfo) > 1)
			$RealmInfo = substr($RealmInfo,0,strlen($RealmInfo)-1)."}";
		else
			$RealmInfo .='}';
		mysql_close($Con);
		return $RealmInfo;
	}
	
	function GetCharData()
	{
		//get data that will be used to select the character.
		$Con = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,true);
		mysql_select_db(MYSQL_DB,$Con);
		
		$CharInfo = "{";
		$Index = 0;
		$res = mysql_query("SELECT id,sqlhost,sqluser,sqlpass,chardb FROM realms");
		while($Row = mysql_fetch_array($res))
		{
			$Con2 = mysql_connect($Row['sqlhost'],$Row['sqluser'],$Row['sqlpass'],true);
			mysql_select_db($Row['chardb'],$Con2);
			$res2 = mysql_query("SELECT guid,name FROM characters WHERE acct = '{$_SESSION['vcp']['id']}'",$Con2);
			while($Row2 = mysql_fetch_array($res2))
			{
				$CharInfo .= $Index.":{guid:".$Row2['guid'].",realm:".$Row['id'].",name:\"".$Row2['name']."\"},";
				$Index++;
			}
			mysql_close($Con2);
		}
		if(strlen($CharInfo) > 1)
			$CharInfo = substr($CharInfo,0,strlen($CharInfo)-1)."}";
		else
			$CharInfo .='}';
		mysql_close($Con);
		return $CharInfo;
	}
	
	function GetRewardData()
	{
		//rewards.. etc.
		$Con = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,true);
		mysql_select_db(MYSQL_DB,$Con);
		
		$RewardInfo = "{";
		
		$res = mysql_query("SELECT id,realm,name,description,points FROM voterewards");
		while($Row = mysql_fetch_array($res))
		{
			$RewardInfo .= $Row['id'].":{realm:".$Row['realm'].",name:\"".$Row['name']."\",description:\"".$Row['description']."\",cost:".$Row['points']."},";
		}
		if(strlen($RewardInfo) > 1)
			$RewardInfo = substr($RewardInfo,0,strlen($RewardInfo)-1)."}";
		else
			$RewardInfo .='}';
		$RewardInfo = str_replace("\r\n","<br />",$RewardInfo);
		mysql_close($Con);
		return $RewardInfo;
	}

	function Form()
	{
		?>
			<table>
				<tr>
					<td valign="top">
						<table cellspacing="2px">
							<tr valign="top">
								<td colspan="2">Select A Reward</td>
							</tr>
							<tr valign="top">
								<td>Points:</td>
								<td><span id="points"><?php echo $_SESSION['vcp']['points']; ?></span></td>
							</tr>
							<tr valign="top">
								<td width="75px">Realm:</td>
								<td><select name="realm" id="realm" size="1" style="width:150px;" onchange="getCharacters(); getRewards();"><option value="0">Your browser is outdated.</option></select></td>
							</tr>
							<tr valign="top">
								<td>Character:</td>
								<td><select name="character" id="character" size="1" style="width:150px;"><option value="0">Your browser is outdated.</option></select></td>
							</tr>
							<tr valign="top">
								<td>Reward:</td>
								<td><select name="reward" size="1" id="reward" style="width:150px;" onchange="getInfo();"><option value="0">Your browser is outdated.</option></select></td>
							</tr>
							<tr valign="top">
								<td>Cost:</td>
								<td><span id="cost"></span> rp</td>
							</tr>
							<tr valign="top">
								<td colspan="2" align="right"><input id="purchase" type="button" value="Purchase" onclick="onPurchase();" /></td>
							</tr>
						</table>
					</td>
					<td valign="top">
						<div id="description" style="width:200px; height:200px; border:#000000 solid 1px; padding:2px;"></div>
					</td>
				</tr>
			</table>
			<script type="text/javascript">
				var Realm = document.getElementById("realm");
				var Character = document.getElementById("character");
				var Reward = document.getElementById("reward");
				var Description = document.getElementById("description");
				var Cost = document.getElementById("cost");
				var Points = document.getElementById("points");
				var Purchase = document.getElementById("purchase");
				
				var Realms = <?php echo $this->GetRealmData(); ?>;
				var Characters = <?php echo $this->GetCharData(); ?>;
				var Rewards = <?php echo $this->GetRewardData(); ?>;
				
				var PointCount = <?php echo $_SESSION['vcp']['points']; ?>;
				
				function getCharacters()
				{
					var i=0;
					Character.options.length = 0;
					for(var r in Characters)
					{
						if(Characters[r].realm == parseInt(Realm.value))
						{
							Character.options[i] = new Option(Characters[r].name,Characters[r].guid);
							i++;
						}
					}
				}
				
				function getRewards()
				{
					var i=0;
					Reward.options.length = 0;
					for(var r in Rewards)
					{
						if(Rewards[r].realm == parseInt(Realm.value))
						{
							Reward.options[i] = new Option(Rewards[r].name,r);
							i++;
						}
					}
					getInfo();
				}
				
				function getInfo()
				{
					Description.innerHTML = Rewards[Reward.value].description;
					Cost.innerHTML = Rewards[Reward.value].cost;
				}
				
				function onPurchase()
				{
					if(Character.options.length == 0)
					{
						alert("You don't have a character on that realm!");
						return false;
					}
					if(Rewards[Reward.value].cost > PointCount)
					{
						alert("You don't have enough points!");
						return false;
					}
					if(!confirm("Are you sure you wish to spend\r\n"+Rewards[Reward.value].cost+" reward points?"))
						return false;
					Purchase.disabled = true;
					
					var R;
					var Sub = Rewards[Reward.value].cost;
					if(window.XMLHttpRequest)
					{
						R = new XMLHttpRequest();
					}
					else if(window.ActiveX)
					{
						R = new ActiveXObject("Microsoft.XMLHTTP");
					}
					R.onreadystatechange = function()
					{
						if(R.readyState == 4)
						{
							Purchase.disabled = false;
							if(R.responseText != "1")
							{
								alert("Transaction failed:\r\n"+R.responseText);
							}
							else
							{
								PointCount -= Sub;
								Points.innerHTML = PointCount;
							}
						}
					}
					R.open("POST","?act=spend",true);
					var params = "realm="+Realm.value+"&reward="+Reward.value+"&character="+Character.value;
					R.setRequestHeader("Content-type","application/x-www-form-urlencoded");
					R.setRequestHeader("Content-length",params.length);
					R.setRequestHeader("Connection","close");
					R.send(params);
				}
				
				function Initialize()
				{
					// Setup realm list, char list, etc.
					var i = 0;
					for(var r in Realms)
					{
						Realm.options[i] = new Option(Realms[r].name,r);
						i++;
					}
					
					i=0;
					for(var r in Characters)
					{
						if(Characters[r].realm == parseInt(Realm.value))
						{
							Character.options[i] = new Option(Characters[r].name,Characters[r].guid);
							i++;
						}
					}
					
					i=0;
					for(var r in Rewards)
					{
						if(Rewards[r].realm == parseInt(Realm.value))
						{
							Reward.options[i] = new Option(Rewards[r].name,r);
							i++;
						}
					}
					getCharacters();
					getRewards();
					getInfo();
				}
				Initialize();
				
			</script>
		<?php

	}

	function Content()
	{
		$this->Form();
	}

	function __construct()
	{
		include("html/main.php");
	}

}

?>

Posted Image
0

#2 User is offline   Bob Herman 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 452
  • Joined: 11-October 08
  • Gender:Male

Posted 21 November 2009 - 11:51 AM

If I remember right, the database structure has changed. I don't quite remember what, but if I remember right there's one thing that's used to be a text field which is now an integer field.
0

#3 User is offline   eatos92 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 193
  • Joined: 06-May 09
  • Gender:Male
  • Location:Serbia, Devil WoW

Posted 21 November 2009 - 11:54 AM

Now got this error
Warning: Rewards::include(indexphp) [function.Rewards-include]: failed to open stream: No such file or directory in G:\Light Hope\Server\htdocs\Voting\pages\rewards.php on line 282

Warning: Rewards::include() [function.include]: Failed opening 'indexphp' for inclusion (include_path='.;\Light Hope\Server\php\pear\') in G:\Light Hope\Server\htdocs\Voting\pages\rewards.php on line 282

Posted Image
0

#4 User is offline   Bob Herman 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 452
  • Joined: 11-October 08
  • Gender:Male

Posted 21 November 2009 - 06:52 PM

From the error, I would guess you gotta make it 'index.php' instead of indexphp
0

#5 User is offline   eatos92 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 193
  • Joined: 06-May 09
  • Gender:Male
  • Location:Serbia, Devil WoW

Posted 22 November 2009 - 07:29 AM

But where to change that in reward.php there is no that line
Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users