Ejemplo n.º 1
0
<?php

session_start();
include "mysql_connect.php";
include "member_handle.php";
$mem = new Member_handle();
if (isset($_POST['buttons'])) {
    if ($mem->check($_POST['id'], $_POST['pwd']) == false) {
        // if( empty($_POST['id']) ||  empty($_POST['pwd'])){
        echo '<script>alert("帳密不得為空值") </script>';
        echo '<meta http-equiv="refresh" CONTENT="1; url=../index.php">';
    } else {
        $id = $_POST['id'];
        $pwd = $_POST['pwd'];
        $sql = "select * from login where username = '******'";
        $result = mysql_query($sql);
        $row = @mysql_fetch_row($result);
        if ($row[1] == $id && $row[2] == md5($pwd)) {
            $_SESSION['username'] = $id;
            $_SESSION['tel'] = $row[3];
            $_SESSION['addr'] = $row[4];
            $_SESSION['other'] = $row[5];
            echo "登入成功";
            echo '<meta http-equiv="refresh" CONTENT="1; url=../view/member.php">';
        } else {
            echo "登入失敗";
            echo '<meta http-equiv="refresh" CONTENT="1; url=../index.php">';
        }
    }
} else {
    exit;
Ejemplo n.º 2
0
<?php

session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
include "mysql_connect.php";
include "member_handle.php";
$id = $_POST['id'];
$tel = $_POST['tel'];
$mem = new Member_handle();
if ($mem->check($id, $tel) == false) {
    // if( empty($_POST['id']) ||  empty($_POST['pwd'])){
    echo '<script>alert("帳密不得為空值") </script>';
    echo '<meta http-equiv="refresh" CONTENT="1; url=../view/forgetpwd.php">';
} else {
    if ($mem->telprove($id, $tel)) {
        echo '確定OK';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../view/repwd.php">';
    } else {
        echo '此電話與ID不相符';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
    }
}
Ejemplo n.º 3
0
<?php

session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
include "mysql_connect.php";
include "member_handle.php";
$id = $_POST['id'];
$pw = $_POST['pw'];
$pw2 = $_POST['pw2'];
$telephone = $_POST['telephone'];
$address = $_POST['address'];
$other = $_POST['other'];
if ($id != null && $pw != null && $pw2 != null && $pw == $pw2) {
    $mem = new Member_handle();
    $result = $mem->register($id, $pw, $telephone, $address, $other);
    if ($result) {
        echo '新增成功!';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
    } else {
        echo $result;
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
    }
} else {
    echo '您無權限觀看此頁面!';
    echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
}
Ejemplo n.º 4
0
<?php

session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
include "mysql_connect.php";
include "member_handle.php";
$id = $_POST['id'];
if ($_SESSION['username'] != null && $_SESSION['username'] == "admin") {
    if ($id == "admin") {
        echo '不可以刪除最高權限者!';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../view/member.php">';
    } else {
        $mem = new Member_handle();
        $result = $mem->delete($id);
        if ($result) {
            echo '刪除成功!';
            echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
        } else {
            echo '刪除失敗!';
            echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
        }
    }
} else {
    echo '您無權限觀看此頁面!';
    echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
}
Ejemplo n.º 5
0
<?php

session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
include "mysql_connect.php";
include "member_handle.php";
$pwd1 = $_POST['pwd'];
$pwd2 = $_POST['pwd2'];
$mem = new Member_handle();
if ($pwd1 == $pwd2) {
    $result = $mem->newpwd($_SESSION['username'], $pwd1);
    if ($result) {
        echo '密碼已更新';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
    } else {
        echo 'error';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
    }
}
Ejemplo n.º 6
0
<?php

session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
include "mysql_connect.php";
include "member_handle.php";
$id = $_POST['id'];
$pw = $_POST['pw'];
$pw2 = $_POST['pw2'];
$telephone = $_POST['telephone'];
$address = $_POST['address'];
$other = $_POST['other'];
//紅色字體為判斷密碼是否填寫正確
if ($_SESSION['username'] != null && $pw != null && $pw2 != null && $pw == $pw2) {
    $mem = new Member_handle();
    $result = $mem->update($id, $pw, $telephone, $address, $other);
    if ($result) {
        echo '修改成功!';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../view/member.php">';
    } else {
        echo '修改失敗!';
        echo '<meta http-equiv=REFRESH CONTENT="2;url=../view/member.php">';
    }
} else {
    echo '您無權限觀看此頁面!';
    echo '<meta http-equiv=REFRESH CONTENT="2;url=../index.php">';
}