Beispiel #1
0
function get_row($query)
{
    $result = transmit_query($query);
    if (!$result) {
        echo "Query Error";
    } else {
        return mysql_num_rows($result);
    }
}
Beispiel #2
0
 function login($argId, $argPasswd)
 {
     DB_connect();
     $query = "select * from user_info where id = '" . $argId . "'";
     $query_Result = getDB_value(transmit_query($_SESSION['conn'], $query));
     if ($query_Result['id'] === $argId) {
         if ($query_Result['passwd'] === $argPasswd) {
             return 0;
         } else {
             return 1;
         }
     } else {
         return 2;
     }
 }
Beispiel #3
0
$row = mysql_fetch_array($result);
$info['mode'] = isset($_POST['mode']) ? $_POST['mode'] : null;
$info['subject'] = isset($row['subject']) ? $row['subject'] : null;
$info['contents'] = isset($row['contents']) ? $row['contents'] : null;
$url = "view.php?page=" . $page . "&pid=" . $pid;
if ($info['mode'] === "modify") {
    $info['id'] = isset($row['user_id']) ? $row['user_id'] : null;
    $info['name'] = isset($row['user_name']) ? $row['user_name'] : null;
    $info['subject'] = isset($_POST['subject']) ? $_POST['subject'] : null;
    $info['contents'] = isset($_POST['contents']) ? $_POST['contents'] : null;
    $info['date'] = date("Y-m-d H:i:s");
    //var_dump($info);
    if (!strlen($info['subject']) == 0) {
        $ddl = "update " . TABLE_NAME . " set subject ='" . $info['subject'] . "' , contents = '" . $info['contents'] . "', reg_date = '" . $info['date'] . "' where board_id = " . $pid;
        //echo $ddl."<br>";
        $result = transmit_query($ddl);
        echo "<script> alert('수정 했어양!')</script>";
    } else {
        echo "<script> alert('제목은 없으면 안되양!')</script>";
    }
    echo "<script>location.replace('{$url}')</script>";
}
?>


<html>
<head>
    <title>글써용</title>


</head>
Beispiel #4
0
$page = isset($_GET['page']) ? $_GET['page'] : null;
$keyword = isset($_GET['keyword']) ? $_GET['keyword'] : null;
$conn = DB_conn(DB_NAME);
$sql = "select * from " . TABLE_NAME . " where board_id = " . "{$pid}";
//echo $sql;
$result = transmit_query($sql);
$row = mysql_fetch_array($result);
$info['num'] = isset($row['board_id']) ? $row['board_id'] : null;
$info['subject'] = isset($row['subject']) ? $row['subject'] : null;
$info['name'] = isset($row['user_name']) ? $row['user_name'] : null;
$info['date'] = isset($row['reg_date']) ? $row['reg_date'] : null;
$info['contents'] = isset($row['contents']) ? $row['contents'] : null;
$info['hits'] = isset($row['hits']) ? $row['hits'] + 1 : null;
//var_dump($info);
$sql = "update " . TABLE_NAME . " set hits = '" . $info['hits'] . "' where board_id =" . $pid;
$result = transmit_query($sql);
?>

<html>
    <head>
        <title>글 내YONG</title>
        <style>
            table{
                width: 1000px;
                border-collapse: collapse;
            }
            tr.bg{
                background-color: lightgray;
            }
            th{
                width: 250px;
Beispiel #5
0
    $numbOfArticle = get_numb_rows($DBvalue);
} else {
    if ($mode === "write") {
        $date = date("Y:m:d H:i:s");
        $nick = isset($_POST['nick']) ? $_POST['nick'] : null;
        $subject = isset($_POST['subject']) ? $_POST['subject'] : null;
        $contents = isset($_POST['contents']) ? $_POST['contents'] : null;
        /*echo "<script>alert('$_SESSION[id]')</script>";
          echo "<script>alert('$nick')</script>";
          echo "<script>alert('$date')</script>";
          echo "<script>alert('$subject')</script>";
          echo "<script>alert('$contents')</script>";*/
        $rq_query = "insert into {$_SESSION['board']} (board_id, user_id, user_name, subject, contents, reg_date)";
        $rq_query .= " values ('{$_SESSION['board_id']}', '{$_SESSION['id']}','{$nick}','{$subject}','{$contents}','{$date}')";
        //echo "<script>alert('$rq_query')</script>";
        transmit_query($conn, $rq_query);
    }
    if ($mode === "delete") {
    }
    if ($mode === "modify") {
    }
    $rq_query = select_page_nation($conn, $_SESSION['board'], null, null, null);
    $numbOfArticle = get_numb_rows(select($conn, $_SESSION['board'], null));
}
while ($DBvalue = mysqli_fetch_array($rq_query)) {
    $date = substr($DBvalue['reg_date'], 2, 2) . "년 " . substr($DBvalue['reg_date'], 5, 2) . "월 " . substr($DBvalue['reg_date'], 8, 2) . "일&nbsp&nbsp" . (int) substr($DBvalue['reg_date'], -8, 2) . "시 " . substr($DBvalue['reg_date'], -5, 2) . "분";
    echo "<tr>";
    echo "<td>{$DBvalue['contents_id']}</td>";
    echo "<td><a href ='view.php?page=" . $page . "&pid=" . $DBvalue['contents_id'] . "'>" . $DBvalue['subject'] . "</a></td>";
    echo "<td>{$DBvalue['user_name']}</td>";
    echo "<td>{$date}</td>";