הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 15-09-10, 13:36   # 1
Megnum
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: May 2007
מיקום: אשד
הודעות: 1,308

Megnum לא מחובר  

מדוע זה לא סופר לי את המספר נסיונות?

אהלן, בניתי את הדבר הבא:

PHP קוד:

<?php
############################################# 
# Class Login
#############################################
include 'class_sql.php';
session_start();
$_SESSION['logged']= isset($_SESSION['logged'])? $_SESSION['logged'] : false;
$_SESSION['try_enter']= isset($_SESSION['try_enter'])? $_SESSION['try_enter'] : false;
global 
$html;

$_GET['users']=isset($_GET['users']) ? mysql_escape_string($_GET['users']) : null;
$_POST['username']=isset($_POST['username']) ? mysql_escape_string($_POST['username']) : null;
$_POST['password']=isset($_POST['password']) ? mysql_escape_string($_POST['password']) : null;

class 
Users extends Connect_db {


private 
$user;
private 
$pass;
private 
$db;

#login
function Login($username,$password) {

 global 
$html;
 
 
$this->user=$username;
 
$this->pass=$password;
 
$this->db=Connect_db::Checke_details("select * from users_mode where `username`='{$username}' and `password`='{$password}'"); 

 if (
ltrim(rtrim($username)) ==null || ltrim(rtrim($password)) ==null)
  
$message[1001]='Some input is missing';
  
 if (
$this->db==true
 { 
header("Location: login.php"); $_SESSION['logged']=true; }
 else
 { 
$message[1002]="Login incorrect";  $_SESSION['try_enter']++; }
 
 if (
$username==$password and !isset($message[1001]))
   
$message[1003]="Identical data";
 elseif(
$_SESSION['try_enter']==5
   
$message[1004]="Too many tryes, try again later";
 
 
//Display Message
 
foreach ($message as $key=>$msg) {
  global 
$count;
  
$count++;
  !empty(
$msg) ? $html.= "<strong>Err {$key}:</strong> {$msg}<br/>"   :  $count--; 
 }
 
 return 
$html;
 
 
}

}

switch (
$_GET['users']) {
 
#Login area
 
case 'login':
 
$login=new Users;
 
$html=$login->Login($_POST['username'], $_POST['password']);
 if (
$_SESSION['logged']==trueheader("Location: login.php");
 break;
 
 case 
'logout':
 unset(
$_SESSION['logged']);
 
header("Location: index.php?users=index");
 
 break;
}



echo 
$html;



?>

אני בטוח מפספס משהו שאני מנסה 5 פעמים להתחבר זה לא סופר לי משום מה בסשן , אפשר עזרה?
כאילו זה אמור להוציא את המשפט הבא Too many tryes, try again later
אני גרוע בלשים לב לפרטים הקטנים =]
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 11:22.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ