phpͶƱϵͳ

2018-06-22 05:30:23À´Ô´£ºÎ´Öª ÔĶÁ ()

ÐÂÀÏ¿Í»§´ó»ØÀ¡,ÔÆ·þÎñÆ÷µÍÖÁ5ÕÛ

ͶƱ·ÖÀà

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<?php
$db= new Mysqli("localhost","root","root","db_0808");
$sql= "select * from fenlei";
$result=$db->query($sql);
$data_c= $result->fetch_all();
?>
<table border="1">
    <?php
    foreach ($data_c as $i){
    echo" <tr><th><a href='vote.php?id={$i[0]}&is_radio={$i[2]}'>{$i[1]}</a></th></tr>";
    }
?>
</table>
</body>
</html>

ͶƱ½çÃæ

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<?php

$id=$_GET['id'];
$is_radio=$_GET['is_radio'];
$db= new Mysqli("localhost","root","root","db_0808");
$sql= "select * from toupiao WHERE category_id='{$id}'";
$result=$db->query($sql);
$data=$result->fetch_all();
?>
<form action="tongji.php" method="post">
<table>
    <tr>

        <td>Ãû×Ö</td>

        <td>ͶƱ</td>
    </tr>
    <?php
    if ($is_radio==1){
    foreach ($data as $i){
        echo "<tr>
              <td>{$i[1]}</td>

              <td><input type='radio' name='r' value='{$i[0]}'></td>
              </tr>";
    }
    }else{
        foreach ($data as $i){
            echo "<tr>
              <td>{$i[1]}</td>
              <td><input type='checkbox' name='r[]' value='{$i[0]}'></td>
              </tr>";
        }
    }
    ?>
</table>
    <input type="submit" value="Ìá½»">
</form>
</body>
</html>

ͶƱ´¦Àí

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table>
    <tr>
        <td>Ãû×Ö</td>
        <td>ƱÊý</td>
    </tr>
<?php
//$db= new Mysqli("localhost","root","root","db_0808");
require_once "../ZY/YIN.class.php";
$db = new YIN();
$ip=$_SERVER['REMOTE_ADDR'];//»ñÈ¡ip
$sql="select count(*) from table2 where ip='{$ip}'";
$data = $db->StrQuery($sql);

if($data!='0'){
    echo "ÿ¸öÈËÒ»ÌìÖ»ÄÜͶһ´Î";
$r=$_POST['r'];
        if (is_array($r)){
            $s=implode(',',$r);
            $sq="select * from toupiao where id in ({$s})";
        }else{
            $sq="select * from toupiao where id = {$r}";
        }

        $qurle=$db->Query($sq);
        foreach ($qurle as $i){
            echo "<tr><td>{$i[1]}</td><td>{$i[2]}</td></tr>";
        }



}else{
    $sql = "INSERT INTO table2 VALUES (null,'{$ip}',DEFAULT)";
    $squel=$db->strQuery($sql,0);
    if($squel){
//    $upsql=update table_name set votes = votes + 1 where ...
//È»ºó°ÑÊý¾Ýinsert into µ½table2ÖÐ

$r=$_POST['r'];

if (is_array($r)){
    $s=implode(',',$r);
    $sql="update toupiao set count=(count+1) where id in ({$s})";
}else{
$sql="update toupiao set count=(count+1) where id = {$r}";
}

$data=$db->query($sql,0);

if ($data){
//echo "success";
    if (is_array($r)){
        $s=implode(',',$r);
        $sq="select * from toupiao where id in ({$s})";
    }else{
        $sq="select * from toupiao where id = {$r}";
}

    $qurle=$db->Query($sq);

    foreach ($qurle as $i){
        echo "<tr><td>{$i[1]}</td><td>{$i[2]}</td></tr>";
    }
}
    }
}

?>
</table>
</body>
</html>

 

±êÇ©£º

°æȨÉêÃ÷£º±¾Õ¾ÎÄÕ²¿·Ö×ÔÍøÂ磬ÈçÓÐÇÖȨ£¬ÇëÁªÏµ£ºwest999com@outlook.com
Ìرð×¢Ò⣺±¾Õ¾ËùÓÐתÔØÎÄÕÂÑÔÂÛ²»´ú±í±¾Õ¾¹Ûµã£¬±¾Õ¾ËùÌṩµÄÉãÓ°ÕÕƬ£¬²å»­£¬Éè¼Æ×÷Æ·£¬ÈçÐèʹÓã¬ÇëÓëÔ­×÷ÕßÁªÏµ£¬°æȨ¹éÔ­×÷ÕßËùÓÐ

ÉÏһƪ£º°²×°php

ÏÂһƪ£ºphp ÀûÓÃGd¿âÌí¼ÓÎÄ×ÖˮӡÂÒÂëµÄÎÊÌâ¼°½â¾ö·½°¸