[Help] Vote System with zen

enemysss

New Member
Joined
Jan 27, 2009
Messages
392
Reaction score
54
здравейте всички някой може ли да ми помогне да си направя вот системата с зен а не с кредити?
 
code

<?php
if($links[$_GET['vote_id']][3])
{
if(isset($_POST['doVote']))
{
$data = array();
$data['accountName'] = $_POST['uss'];
$data['password'] = $_POST['pass'];
$data['character'] = $_POST['character'];
$data['credits'] = $links[$_GET['vote_id']][1];
$data['voteLink'] = $links[$_GET['vote_id']][2];

if(empty($data['accountName']) || empty($data['password']) || empty($data['character']))
{
echo "Please fill all fields .";
}
else
{
//Checks start :)
$check['account'] = mssql_fetch_array(mssql_query("SELECT AccountID FROM Character Where Name='".$data['character']."'"));
if($check['account']['AccountID'] == $data['accountName'])
{
$check['password'] = mssql_num_rows(mssql_query("select * from MEMB_INFO where memb___id='".$data['accountName']."'"));
if($check['password'] > 0)
{
$check['vote']['accChar'] = mssql_query("select * from votes where accName='".$data['accountName']."' and voteLink='".$_GET['vote_id']."'");
if(mssql_num_rows($check['vote']['accChar']) > 0)
{
header("Location:".$data['voteLink']);
}
else
{
$lastVoteDate = time()+(12*60*60);
$query['getData'] = mssql_fetch_array(mssql_query("select * from memb_info where memb___id='".$data['accountName']."'"));
$query['insertAcc'] = mssql_query("insert into votes(accName, lastVoteDate, voteLink) values('".$data['accountName']."','".$lastVoteDate."', '".$_GET['vote_id']."')");

//Reward
$query['checkCredits'] = mssql_query("select * from MEMB_CREDITS where memb___id='".$data['accountName']."'");
if(mssql_num_rows($query['checkCredits']) < 1)
{
$query['addCredits'] = mssql_query("insert into memb_credits(memb___id, credits) values('".$data['accountName']."', '".$data['credits']."')");
}
else
{
$query['credFetch'] = mssql_fetch_array($query['checkCredits']);
$query['addCredits'] = mssql_query("update MEMB_CREDITS set credits='".($query['credFetch']['credits']+$data['credits'])."' where memb___id='".$data['accountName']."'");
}

$query['insertVotes'] = mssql_query("update memb_info set votes='".($query['getData']['votes']+1)."' where memb___id='".$data['accountName']."'");
header("Location:".$data['voteLink']);
}
}
}
else
{
echo "Incorect account / character .";
}
}
}
?>
<form action="" method="post">
<table cellpadding="0" cellspacing="4" border="0" style="border: 1px outset #000000;" width="250">
<tr>
<td align="left" width="100">Username:</td>
<td align="left"><input type="text" name="uss" length="20">
</tr>
<tr>
<td align="left">Password:</td>
<td align="left"><input type="password" name="pass" length="20">
</tr>
<tr>
<td align="left">Character:</td>
<td align="left"><input type="text" name="character" length="20">
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="doVote" value="Vote Now!"></td>
</tr>
<tr>
<td colspan="2" align="left"><a href="javascript:history.go(-1)">Go back to vote list</a></td>
</tr>
</table>
</form>
<?php
}
?>
това е кода

а за сяла сам сложил това:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MEMB_Zen]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MEMB_Zen]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[votes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[votes]
GO

CREATE TABLE [dbo].[MEMB_CREDITS] (
[memb___id] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[money] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[votes] (
[accName] [varchar] (14) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[lastVoteDate] [int] NOT NULL ,
[voteLink] [int] NULL
) ON [PRIMARY]
GO

alter table memb_info add votes int not null default 0
 
PHP:
<form action="" method="post">
<table cellpadding="0" cellspacing="4" border="0" style="border: 1px outset #000000;" width="250">
<tr>
<td align="left" width="100">Username:</td>
<td align="left"><input type="text" name="uss" length="20">
</tr>
<tr>
<td align="left">Password:</td>
<td align="left"><input type="password" name="pass" length="20">
</tr>
<tr>
<td align="left">Character:</td>
<td align="left"><input type="text" name="character" length="20">
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="doVote" value="Vote Now!"></td>
</tr>
<tr>
<td colspan="2" align="left"><a href="javascript:history.go(-1)">Go back to vote list</a></td>
</tr>
</table>
</form>
<?php
if($links[$_GET['vote_id']][3])
{
if(isset($_POST['doVote']))
{
$data = array();
$data['accountName'] = $_POST['uss'];
$data['password'] = $_POST['pass'];
$data['character'] = $_POST['character'];
$data['money'] = $links[$_GET['vote_id']][1];
$data['voteLink'] = $links[$_GET['vote_id']][2];

if(empty($data['accountName']) || empty($data['password']) || empty($data['character']))
{
echo "Please fill all fields .";
}
else
{
//Checks start 
$check['account'] = mssql_fetch_array(mssql_query("SELECT AccountID FROM Character Where Name='".$data['character']."'"));
if($check['account']['AccountID'] == $data['accountName'])
{
$check['password'] = mssql_num_rows(mssql_query("select * from MEMB_INFO where memb___id='".$data['accountName']."'"));
if($check['password'] > 0)
{
$check['vote']['accChar'] = mssql_query("select * from votes where accName='".$data['accountName']."' and voteLink='".$_GET['vote_id']."'");
if(mssql_num_rows($check['vote']['accChar']) > 0)
{
header("Location:".$data['voteLink']);
}
else
{
$lastVoteDate = time()+(12*60*60);
$query['getData'] = mssql_fetch_array(mssql_query("select * from memb_info where memb___id='".$data['accountName']."'"));
$query['insertAcc'] = mssql_query("insert into votes(accName, lastVoteDate, voteLink) values('".$data['accountName']."','".$lastVoteDate."', '".$_GET['vote_id']."')");

//Reward
$query['Money'] = mssql_query("select * from Character where AccoundID='".$data['accountName']."'");
if(mssql_num_rows($query['Money']) < 1)
{
$query['addmoney'] = mssql_query("insert into Character(AccoundID, Money) values('".$data['accountName']."', '".$data['money']."')");
}
else
{
$query['moneyy'] = mssql_fetch_array($query['money']);
$query['addmoney'] = mssql_query("update Character set Money='".($query['moneyy']['Money']+$data['Money'])."' where AccountID='".$data['accountName']."'");
}

$query['insertVotes'] = mssql_query("update memb_info set votes='".($query['getData']['votes']+1)."' where memb___id='".$data['accountName']."'");
header("Location:".$data['voteLink']);
}
}
}
else
{
echo "Incorect account / character .";
}
}
}
?>
<?php
}
?>

пробвай този и кажи бачка ли не съм сигурен защото на бързо го направих така че го виж и кажи бачка ли
 
  • Like
Reactions: enemysss
някаква грешка дава ли ти ?
 
някаква грешка дава ли ти ?

$query['addmoney'] = mssql_query("insert into Character(AccoundID, Money) values('".$data['accountName']."', '".$data['money']."')");

мойто момче пише се AccountID ne AccoundID, до тука спрях да търся грешки и също така ако ги добавя там ще добави на първия герой в този акаунт парите и ше му изтрие неговите, чакай че не са изказах хубаво ако имаш 100 милиона а тва е нагласено да дава 5 милиона ще имаш само 5 милиона на 105... сещаш са за кво ти говоря
 
Last edited:
не ми дава грешка но не ми дава никакви пари на героя нито в сандъка - има отчетени гласувания в сяла гледах но няма зен..
 
PHP:
<form action="" method="post">
<table cellpadding="0" cellspacing="4" border="0" style="border: 1px outset #000000;" width="250">
<tr>
<td align="left" width="100">Username:</td>
<td align="left"><input type="text" name="uss" length="20">
</tr>
<tr>
<td align="left">Password:</td>
<td align="left"><input type="password" name="pass" length="20">
</tr>
<tr>
<td align="left">Character:</td>
<td align="left"><input type="text" name="character" length="20">
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="doVote" value="Vote Now!"></td>
</tr>
<tr>
<td colspan="2" align="left"><a href="javascript:history.go(-1)">Go back to vote list</a></td>
</tr>
</table>
</form>
<?php
if($links[$_GET['vote_id']][3])
{
if(isset($_POST['doVote']))
{
$data = array();
$data['accountName'] = $_POST['uss'];
$data['password'] = $_POST['pass'];
$data['character'] = $_POST['character'];
$data['money'] = $links[$_GET['vote_id']][1];
$data['voteLink'] = $links[$_GET['vote_id']][2];

if(empty($data['accountName']) || empty($data['password']) || empty($data['character']))
{
echo "Please fill all fields .";
}
else
{
//Checks start 
$check['account'] = mssql_fetch_array(mssql_query("SELECT AccountID FROM Character Where Name='".$data['character']."'"));
if($check['account']['AccountID'] == $data['accountName'])
{
$check['password'] = mssql_num_rows(mssql_query("select * from MEMB_INFO where memb___id='".$data['accountName']."'"));
if($check['password'] > 0)
{
$check['vote']['accChar'] = mssql_query("select * from votes where accName='".$data['accountName']."' and voteLink='".$_GET['vote_id']."'");
if(mssql_num_rows($check['vote']['accChar']) > 0)
{
header("Location:".$data['voteLink']);
}
else
{
$lastVoteDate = time()+(12*60*60);
$query['getData'] = mssql_fetch_array(mssql_query("select * from memb_info where memb___id='".$data['accountName']."'"));
$query['insertAcc'] = mssql_query("insert into votes(accName, lastVoteDate, voteLink) values('".$data['accountName']."','".$lastVoteDate."', '".$_GET['vote_id']."')");

//Reward
$query['Money'] = mssql_query("select * from werehouse where AccountID='".$data['accountName']."'");
if(mssql_num_rows($query['Money']) < 1)
{
$query['addmoney'] = mssql_query("insert into warehouse(AccountID, Money) values('".$data['accountName']."', '".$data['money']."')");
}
else
{
$query['moneyy'] = mssql_fetch_array($query['money']);
$query['addmoney'] = mssql_query("update warehouse set Money='".($query['moneyy']['Money']+$data['Money'])."' where AccountID='".$data['accountName']."'");
}

$query['insertVotes'] = mssql_query("update memb_info set votes='".($query['getData']['votes']+1)."' where memb___id='".$data['accountName']."'");
header("Location:".$data['voteLink']);
}
}
}
else
{
echo "Incorect account / character .";
}
}
}
?>
<?php
}
?>

пробвай този и кажи бачка ли не съм сигурен защото на бързо го направих така че го виж и кажи бачка :)
 
Last edited:

пак не бачка както трябва, даже и като си прочел каквото съм написал да го беше прочел до край не само за акаунтид
 
Ами аз само това съм поправил и знам че неработи и така защото съм сигурен че zen не се записва в таблицата character :)
 
PHP:
<form action="" method="post">
<table cellpadding="0" cellspacing="4" border="0" style="border: 1px outset #000000;" width="250">
<tr>
<td align="left" width="100">Username:</td>
<td align="left"><input type="text" name="uss" length="20">
</tr>
<tr>
<td align="left">Password:</td>
<td align="left"><input type="password" name="pass" length="20">
</tr>
<tr>
<td align="left">Character:</td>
<td align="left"><input type="text" name="character" length="20">
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="doVote" value="Vote Now!"></td>
</tr>
<tr>
<td colspan="2" align="left"><a href="javascript:history.go(-1)">Go back to vote list</a></td>
</tr>
</table>
</form>
<?php
if($links[$_GET['vote_id']][3])
{
if(isset($_POST['doVote']))
{
$data = array();
$data['accountName'] = $_POST['uss'];
$data['password'] = $_POST['pass'];
$data['character'] = $_POST['character'];
$data['money'] = $links[$_GET['vote_id']][1];
$data['voteLink'] = $links[$_GET['vote_id']][2];

if(empty($data['accountName']) || empty($data['password']) || empty($data['character']))
{
echo "Please fill all fields .";
}
else
{
//Checks start 
$check['account'] = mssql_fetch_array(mssql_query("SELECT AccountID FROM Character Where Name='".$data['character']."'"));
if($check['account']['AccountID'] == $data['accountName'])
{
$check['password'] = mssql_num_rows(mssql_query("select * from MEMB_INFO where memb___id='".$data['accountName']."'"));
if($check['password'] > 0)
{
$check['vote']['accChar'] = mssql_query("select * from votes where accName='".$data['accountName']."' and voteLink='".$_GET['vote_id']."'");
if(mssql_num_rows($check['vote']['accChar']) > 0)
{
header("Location:".$data['voteLink']);
}
else
{
$lastVoteDate = time()+(12*60*60);
$query['getData'] = mssql_fetch_array(mssql_query("select * from memb_info where memb___id='".$data['accountName']."'"));
$query['insertAcc'] = mssql_query("insert into votes(accName, lastVoteDate, voteLink) values('".$data['accountName']."','".$lastVoteDate."', '".$_GET['vote_id']."')");

//Reward
$query['Money'] = mssql_query("select * from warehouse where AccountID='".$data['accountName']."'");
if(mssql_num_rows($query['Money']) < 1)
{
$query['addmoney'] = mssql_query("insert into warehouse(AccountID, Money) values('".$data['accountName']."', '".$data['money']."')");
}
else
{
$query['moneyy'] = mssql_fetch_array($query['money']);
$query['addmoney'] = mssql_query("update warehouse set Money='".($query['moneyy']['Money']+$data['Money'])."' where AccountID='".$data['accountName']."'");
}

$query['insertVotes'] = mssql_query("update memb_info set votes='".($query['getData']['votes']+1)."' where memb___id='".$data['accountName']."'");
header("Location:".$data['voteLink']);
}
}
}
else
{
echo "Incorect account / character .";
}
}
}
?>
<?php
}
?>

пробвай този и кажи бачка ли не съм сигурен защото на бързо го направих така че го виж и кажи бачка :)