Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สร้างเว็บศิษย์เก่า มีการสมัครสมาชิกจาก รหัสนักศึกษา ที่มีในฐานข้อมูลแล้ว



 

สร้างเว็บศิษย์เก่า มีการสมัครสมาชิกจาก รหัสนักศึกษา ที่มีในฐานข้อมูลแล้ว

 



Topic : 112048



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์




ตามโค๊ด พอผมใส่รหัสไป มันจะไปโชว์ ข้อมูลแรกสุดในดาต้าเบส ไม่ได้แสดงข้อมูลที่ต้องการจะอัพเดทครับ ผมใส่ 540510 มันจะโชว์ ข้อมูลแรกคือ 41051 พอจะมีวิธีแก้ไหมครับ

หน้าตรวจสอบ รหัส
Code (PHP)
<?php require_once('Connections/DbConnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['txt1'])) {
  $loginUsername=$_POST['txt1'];
  $password=$_POST['txt2'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "profile.php";
  $MM_redirectLoginFailed = "register.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_DbConnect, $DbConnect);
  
  $LoginRS__query=sprintf("SELECT al_no, al_pass FROM member WHERE al_no=%s AND al_pass=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $DbConnect) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

$checkid = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['txt3'])) {
  $loginUsername=$_POST['txt3'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "register2.php";
  $MM_redirectLoginFailed = "register.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_DbConnect, $DbConnect);
  
  $LoginRS__query=sprintf("SELECT al_no FROM member WHERE al_no=%s",
    GetSQLValueString($loginUsername, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $DbConnect) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MD_Usernames'] = $loginUsername;
    $_SESSION['MD_UserGroups'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

?>
<!DOCTYPE HTML>
<html>
<head>
    <title>register</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">    
    <link rel="stylesheet" type="text/css" href="css/form.css" />
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-theme.css"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script src="phonegap.js"></script> 
    <script src="jquery.mobile-1.3.2.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
</head>




<body>



<nav class="navbar navbar-inverse" role="navigation">

<div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li><a href="#contact"></a></li>
            <li class="active"><a href="#">หน้าหลัก</a></li>
            <li><a href="#contact">เกี่ยวกับเรา</a></li>
            <li><a href="#contact">เว็บบอร์ด</a></li>
            <li><a href="#contact">กิจกรรม</a></li>
          </ul>

          <form action="<?php echo $loginFormAction; ?>" onSubmit="return  validate_form(this)" method="POST"class="navbar-form navbar-right" role="form">
            <div class="form-group">
              <label class="sr-only" for="exampleInputUsername">Username</label>
              <input name="txt1" type="Username" class="form-control" id="55" placeholder="ID">
            </div>

            <div class="form-group">
              <label class="sr-only" for="exampleInputPassword2">Password</label>
              <input name="txt2" type="password" class="form-control" id="55" placeholder="Password">
            </div>

            <button type="submit" class="btn btn-default">Login</button>
          </form>


        </div>

</nav>
 </div>



  


<!--  ====================================================================================================================================== -->



<br></br>

<center>      

<div class="col-sm-6 col-md-4 "></div>

 <div class="col-sm-6 col-md-4">
        <div class="thumbnail">
<form action="<?php echo $checkid; ?>" onSubmit="return  validate_form(this)" method="POST" class="form-horizontal" role="form">

            <h2 class="page-header">สมัครสมาชิก</h2>
    
            <div class="form-group form-group-sm">
              <label class="col-sm-4 control-label" for="formGroupInputSmall" >รหัสนักศึกษา :</label>
              <div class="col-sm-8">
                <input name="txt3" type="text" class="form-control" id="55" placeholder="รหัสนักศึกษา" required autofocus>
              </div>
            </div>
<button type="submit" class="btn btn-default">ตรวจสอบ</button>
        </div>
          </form>
  </div>
      </div>
 </div
    >
<p>&nbsp;</p>
</center>  
</body>
</html>



หน้าอัพเดท (หลังจาก ตรวจสอบได้แล้ว)

Code (PHP)
<?php session_start(); ?>
<?php require_once('Connections/DbConnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['txt1'])) {
  $loginUsername=$_POST['txt1'];
  $password=$_POST['txt2'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "profile.php";
  $MM_redirectLoginFailed = "register.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_DbConnect, $DbConnect);
  
  $LoginRS__query=sprintf("SELECT al_no, al_pass FROM member WHERE al_no=%s AND al_pass=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $DbConnect) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE HTML>
<html>
<head>
    <title>register</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">    
    <link rel="stylesheet" type="text/css" href="css/form.css" />
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-theme.css"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="phonegap.js"></script> 
<script src="jquery.mobile-1.3.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>




<body>



<nav class="navbar navbar-inverse" role="navigation">

<div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li><a href="#contact"></a></li>
            <li class="active"><a href="#">หน้าหลัก</a></li>
            <li><a href="#contact">เกี่ยวกับเรา</a></li>
            <li><a href="#contact">เว็บบอร์ด</a></li>
            <li><a href="#contact">กิจกรรม</a></li>
          </ul>

          <form action="<?php echo $loginFormAction; ?>" onSubmit="return  validate_form(this)" method="POST"class="navbar-form navbar-right" role="form">
            <div class="form-group">
              <label class="sr-only" for="exampleInputUsername">Username</label>
              <input name="txt1" type="Username" class="form-control" id="55" placeholder="ID">
            </div>

            <div class="form-group">
              <label class="sr-only" for="exampleInputPassword2">Password</label>
              <input name="txt2" type="password" class="form-control" id="55" placeholder="Password">
            </div>

            <button type="submit" class="btn btn-default">Login</button>
          </form>


  </div>

</nav>
 </div>



  


<!--  ====================================================================================================================================== -->



<br></br>

<center>
<div class="col-sm-6 col-md-4 "></div>
<div class="col-sm-6 col-md-4">
  <div class="thumbnail">
    <form name="form" onSubmit="return  validate_form(this)" method="POST" class="form-horizontal" role="form">
      <h2 class="page-header">สมัครสมาชิก</h2>
      <div class="form-group form-group-sm">
        <label class="col-sm-4 control-label" for="formGroupInputSmall" >รหัสนักศึกษา :</label>
        <div class="col-sm-8">
          <input name="al_no" type="text" disabled class="form-control" id="al_no" placeholder="รหัสนักศึกษา" required="required" autofocus="autofocus">
        </div>
      </div>
      <div class="form-group form-group-sm">
        <label class="col-sm-4 control-label" for="formGroupInputSmall" >Password :</label>
        <div class="col-sm-8">
          <input name="al_pass" type="text" class="form-control" id="al_pass" placeholder="" required autofocus>
        </div>
      </div>
      <div class="form-group">
        <label for="inputEmail3" class="col-sm-4 control-label">Email :</label>
        <div class="col-sm-8">
          <input name="email" type="email" class="form-control" id="inputEmail3" placeholder="Email">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label" for="formGroupInputSmall">Confirm Email :</label>
        <div class="col-sm-8">
          <input name="conemail" type="email" class="form-control" id="inputEmail3" placeholder="Confirm Email address">
        </div>
      </div>
      <div class="form-group form-group-sm">
        <label class="col-sm-4 control-label" for="formGroupInputSmall" for="disabledTextInput" >
        คำถาม :
        </label>
        <div class="col-sm-8">
          <select name="q1" class="form-control" id="q1" >
            <option>คำถาม</option>
            <option>คุณชื่ออะไร</option>
            <option selected>คุณจบสาขาอะไร</option>
            <option>คุณชอบกินอะไร</option>
            <option>คุณชอบสัตว์อะไร</option>
          </select>
        </div>
      </div>
      <div class="form-group form-group-sm">
        <label class="col-sm-4 control-label" for="formGroupInputSmall">คำตอบ :</label>
        <div class="col-sm-8">
          <input name="anwser" type="text" class="form-control" id="anwser" placeholder="คำตอบ">
        </div>
      </div>
      <div class="form-group form-group-sm">
        <label class="col-sm-4 control-label" for="formGroupInputSmall"></label>
        <div class="col-sm-8">
          <button type="submit" class="btn btn-default">ยืนยัน</button>
          <button type="reset" class="btn btn-default">ยกเลิก</button>
        </div>
      </div>
    </form>
    <form method="post" name="form1">
    </form>
    <p>&nbsp;</p>
  </div>
</div>
</div>
</div
    >
<p>&nbsp;</p>
</center>
</body>
<html>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-10-20 02:41:03 By : peekungbaba View : 1174 Reply : 2
 

 

No. 1

Guest


Fuck ThaiCreate

จริงหรือเปล่าแอดมิน อย่างนี้คุณเอาพาสสมาชิกไปแอบ Login แอคเค้าอื่นได้สบายๆเลยดิ คนส่วนใหญ่ใช้พาสเดียวกันหมดอยู่แล้ว






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-10-21 12:43:59 By : ทำไมทำแบบนี้
 


 

No. 2

Guest


ตอบความคิดเห็นที่ : 1 เขียนโดย : ทำไมทำแบบนี้ เมื่อวันที่ 2014-10-21 12:43:59
รายละเอียดของการตอบ ::
แบบนี้น่ากลัวครับ ลองคิดดูถ้า thaicreate.com โดนแฮค DB หรือถ้า admin อยากจะลองใช้ password ที่ไม่ได้เข้ารหัสเข้าไปแอบดู email ของสมาชิก นี่เรื่องใหญ่เลยครับ

เว็บที่น่าเชื่อถือเค้ามักจะมีเพจ Privacy Policy ที่รับประกันว่าจะไม่เก็บข้อมูล password ที่ไม่ได้เข้ารหัสไว้

เว็บที่ไม่เคารพ user privacy ยังมีอยู่มาก จึงไม่ควรใช้ password ซ้ำกันทุกเว็บ โดยเฉพาะกับบริการ e-mail และ social

ที่คนทั่วไปโดนแฮคเฟสแฮค email ส่วนหนึ่งก็เป็นเพราะเว็บที่ไม่เคารพ user privacy

ถ้าเว็บไหนเก็บ password ที่ไม่เข้ารหัสของผู้ใช้เอาไว้ มันก็คิดได้หลายแง่ครับ

ถ้าเป็นมือใหม่ทำ ก็อาจจะพอคิดในแง่ดีได้ เพราะอาจจะยังไม่รู้จักการเข้ารหัส

แต่ถ้าเป็นมืออาชีพก็คงต้องคิดหนักหน่อย เรื่องอย่างนี้มันอยู่ที่สามัญสำนึกของคนทำเว็บแหละครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-10-21 16:14:02 By : ผ่านมา
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สร้างเว็บศิษย์เก่า มีการสมัครสมาชิกจาก รหัสนักศึกษา ที่มีในฐานข้อมูลแล้ว
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่