รบกวนด้วยคะ กดโหวตส่งค่าไปอีกไฟล์ได้ แต่เพิ่มแนนโหวตไม่ตรง Id คะ
<?
include('connect_song.php');
$sql = "SELECT * FROM $tb_name1 ORDER BY VOTE DESC LIMIT 0,10 ";
$result = mysql_db_query($dbname,$sql);
$no = 1;
$check = 1;
echo "<table class='content' width='100%' valign='center' cellspacing='2' border = '0' bordercolor='#ffffff' >";
while($r = mysql_fetch_array($result))
{
$id_song = $r[id_song];
$vote = $r[vote];
$counter = $r[counter];
$name_ori = $r[name_ori];
$music_song = $r[music_song];
$photo_song = $r[photo_song];
if ($check%2 == 1 )
{
echo "<tr>";
}
echo "
<td>
<table width='250' border='0' cellspacing='0'>
<tr>
<td width='53'><img src='photo/$photo_song' width='100' height='110' /></td>
<td width='181' colspan='2' rowspan='3'>
<object id='player' name='player' width='200' height='180' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media player components...' type='application/x-oleobject'>
<param name='url' value='music/$music_song'>
<param name='uiMode' value='full'>
<param name='autoStart' value='false'>
<param name='loop' value='true'>
<embed src='music/$music_song' type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' showcontrols='true' uimode='full' width='240' height='320' autostart='false' loop='3' name ='$name_ori'>
</object>
</td>
</tr>
<tr>
<td height='17' class = 'style10'> "; ?>
<?
$id_song1 = "$id_song";
if($_SERVER["HTTP_X_FORWARD_FOR"] )
{
$ipaddress1 = $_SERVER["HTTP_X_FORWARD_FOR"];
}
else
{
$ipaddress1 = $_SERVER["REMOTE_ADDR"];
}// id_song1 + ipaddress1
include('connect_song.php');
$sql0 = "SELECT * FROM $tb_name3 WHERE ref_id_song = '$id_song1' and ipaddress = '$ipaddress1' ";
$result0 = mysql_db_query($dbname,$sql0) or die ("ไม่ได้");
$row0 = mysql_fetch_array($result0);
$ref_id_song = $row0[0];
$ipaddress = $row0[1];
if($ipaddress != $ipaddress1)
{
$sql1 = "INSERT INTO $tb_name3 VALUES ('$id_song1','$ipaddress1',' ','no') ";
$result1 = mysql_db_query($dbname,$sql1);
$sql2 = "SELECT * FROM $tb_name3 WHERE ref_id_song = '$id_song1' and ipaddress = '$ipaddress1' ";
$result2 = mysql_db_query($dbname,$sql2);
$row2 = mysql_fetch_array($result2);
$id_song = $row2["0"];
$ipaddress = $row2["1"];
$timeip = $row2["2"];
$status = $row2["3"];
$dateip = $row2["4"]; //
if($timeip == '0000-00-00 00:00:00')
{
echo "<input name='yok' type='image' src='images/vote2.png' align ='absmiddle' alt='Vote' width='80' height='27' border='0' />";
echo"
<input type='hidden' name='id_song' value='$id_song' />
<input type='hidden' name='ipaddress' value='$ipaddress' />";
}
else
{
echo "ระบบเมา";
}
}
//--------------------------------------------------------------------------------------------------------------------
else if($ipaddress == $ipaddress1)
{
$sql12 = "SELECT * FROM $tb_name3 WHERE ref_id_song = '$id_song1' and ipaddress = '$ipaddress1' ";
$result12 = mysql_db_query($dbname,$sql12);
$row12 = mysql_fetch_array($result12);
$id_song = $row12["0"];
$ipaddress = $row12["1"];
$timeip12 = $row12["2"];
$status = $row12["3"];
$dateip = $row12["4"];
if($timeip12 == '0000-00-00 00:00:00')
{
if (isset($_COOKIE['krotron']))
{
$yokky = $_COOKIE['krotron'];
echo "IP $yokky โหวตไปแล้วคะ";
}
else
{
echo "<input name='yok' type='image' src='images/vote2.png' align ='absmiddle' alt='Vote' width='80' height='27' border='0' />";
echo"
<input type='hidden' name='id_song' value='$id_song' />
<input type='hidden' name='ipaddress' value='$ipaddress' />";
}
}
else
{
if (isset($_COOKIE['krotron']))
{
$yokky = $_COOKIE['krotron'];
echo "IP $yokky โหวตไปแล้วคะ";
}
else
{
echo "<input name='yok' type='image' src='images/vote2.png' align ='absmiddle' alt='Vote' width='80' height='27' border='0' />";
echo"
<input type='hidden' name='id_song' value='$id_song' />
<input type='hidden' name='ipaddress' value='$ipaddress' />";
}
}
}
else
{
echo "พลาด อะ";
}
mysql_close();?>
</td>
</tr>
<tr>
<td height='17' class="style10" ><? echo "Vote : $vote"; ?></td>
</tr>
<tr> </tr>
<tr>
<td height='17' colspan='3' class="style11"><? echo "โดย $name_song"; ?><br><br></td>
</tr>
</table>
<?
if ($check%2 == 0)
{
echo "</tr><tr> </td></tr>";
$check = 0 ;
}
$check++;
$no++;
}
echo "</table>";
?>
****** กดโหวตส่งค่าไปอีกไฟล์ได้ สามารถเพิ่มคะแนนโหวตได้
แต่ว่าคะแนนโหวตไม่ตรงกับ id ที่กด แต่จะไล่ 15 14 13 12 ... 1 ไปเรื่อยๆคะ
****** แสดงค่า ค่าก็ออกมาตรง id คะ แต่พอแสดงค่าอีกหน้าที่รับค่า กลับแสดงค่าจากมาก - น้อยคะTag : PHP, MySQL
ประวัติการแก้ไข 2011-01-27 10:16:22
Date :
2011-01-27 10:13:48
By :
YOK_A_DI
View :
694
Reply :
1
ช่วยหน่อยนะคะ ทำไม่ได้จริงๆ .. มือใหม่คะ
Date :
2011-01-27 21:17:08
By :
Rainbow
Load balance : Server 00