온라인 사용자를 어떻게 표시합니까? 일단 로그인하면 회원 페이지에 표시되기를 원하지만 현재 사용자 수는 얼마입니까? 나는 또한 ... 온라인 사용자 표시
<?
if ($_GET[user] != "") {
$check_query = mysql_query("SELECT * FROM users WHERE username='$lowerusername'");
if (mysql_num_rows($check_query) != "0") {
} else {
header("Location: /usernotfound.php");
}
}
?>
<?
$username = $_SESSION['membersusername'];
$check_query3 = mysql_query("SELECT * FROM users WHERE username='$username'");
while ($display = mysql_fetch_array($check_query3)) {
$bio = $display['bio'];
}
?>
<?
if ($_GET[user] != ""){
$check_query = mysql_query("SELECT * FROM users WHERE username='$lowerusername'");
while ($display = mysql_fetch_array($check_query)) {
$twitter = $display['twitter'];
$facebook = $display['facebook'];
$tinychat = $display['tinychat'];
$vaughnlive= $display['vaughnlive'];
$uploadbanner = $display['uploadbanner'];
$uploadbg= $display['uploadbg'];
$backgroundcolor = $display['backgroundcolor'];
$bgp = $display['bgp'];
$bgr = $display['bgr'];
$bga = $display['bga'];
$btc = $display['btc'];
$image = $display['image'];
$status1 = $display['status'];
$djname2 = ":: $djname2 Profile";
$djname3 = "$djname3";
$djname = "<strong>Name:</strong> $name";
$age = "<strong>DOB:</strong> $age1";
$email = "<strong>E-Mail:</strong> <a href='mailto:$email1'>$email1</a>";
$year = date('d/m/Y');
$totalage = $year-$age1;
}}
?>
<?
if ($_GET[user] != ""){
$check_query = mysql_query("SELECT * FROM profiles WHERE username='$lowerusername'");
while ($display = mysql_fetch_array($check_query)) {
$twitter = $display['twitter'];
$facebook = $display['facebook'];
$tinychat = $display['tinychat'];
$vaughnlive= $display['vaughnlive'];
$uploadbanner = $display['uploadbanner'];
$uploadbg= $display['uploadbg'];
$backgroundcolor = $display['backgroundcolor'];
$bgp = $display['bgp'];
$bgr = $display['bgr'];
$bga = $display['bga'];
$btc = $display['btc'];
$username = $display['username'];
$image = $display['image'];
}}
?>
<? $check_query = mysql_query("SELECT * FROM profiles WHERE username='$_SESSION[membersusername]'");
while ($display = mysql_fetch_array($check_query)) {
$image1 = $display['image'];
if ($image1 == "") {
$image1 = "profile/nophoto.gif";
} else {
$image1 = "profile/$username/$image1";
}}
?>
<?
$check_query_all = mysql_query("SELECT * FROM users WHERE hiddenauth='no' AND auth='yes' ORDER BY id DESC");
while ($display = mysql_fetch_array($check_query_all)) {
$allmembers = $display['name'];
$allusername = $display['username'];
$allbio = $display['bio'];
$allage = $display['age'];
// get more stuff above if u need
$check_query_all2 = mysql_query("SELECT * FROM profiles WHERE username='$allusername'");
while ($display = mysql_fetch_array($check_query_all2)) {
$allimage = $display['image'];
$alllocation = $display['location'];
// Check Album Photo's
$check_amount = mysql_query("SELECT * FROM users WHERE hiddenauth='no' AND auth='yes'");
$num_djs_total = mysql_num_rows($check_amount);
// CHECK IF IMAGE OR NOT
if ($allimage == "") {
$allcheckedimage = "nopic.gif"; }
// CHECK IF IMAGE OR NOT
if ($allimage != "") {
$allcheckedimage = "$allusername/$allimage"; }
// CHECK IF location OR NOT
if ($alllocation == "") {
$allcheckedlocation = "No Idea"; }
// CHECK IF location OR NOT
if ($alllocation != "") {
$allcheckedlocation = "$alllocation"; }
// CHECK IF mini bio OR NOT
if ($allbio == "") {
$allcheckedbio = "Something about your show."; }
// CHECK IF mini bio OR NOT
if ($allbio != "") {
$allcheckedbio = "$allbio"; }
$listalldjs .= "<table class='inlineTable' width='452' border='0'>
<tr>
<td width='20%'><img src='$domain/profile/$allcheckedimage' width='180' height='173'/></td>
<td width='83%'><b>Username:</b> $allusername<br /><b>Location:</b> $allcheckedlocation<br /><b>Show Description:</b><br>$allcheckedbio<div align='right'><a href='$domain/$allusername'/>View Channel</a>
</div> </td>
</tr>
</table>";
}}
?>
이
는 로그인 코드입니다 ... 사용자가 브라우저를 종료하거나 모든 온라인 사용자에게 표시되지 않습니다 로그 아웃 경우 타임 아웃이이 전체 구성원에 대한 코드입니다 원하는<?php session_start(); ?>
<? include "includes/dbconfig.php"; ?>
<? include "includes/loggedin_config.php"; ?>
<?
$lowerusername = strtolower($_POST[username]);
// MEMBERS LOGIN CHECK IF USER EXISTS :D
if ($_GET[action] == "login") {
$check_query = mysql_query("SELECT * FROM users WHERE username='$lowerusername' AND password='$_POST[password]' AND auth='yes'");
if (mysql_num_rows($check_query) != "1") {
$error = "Incorrect details! or You have not authorized your account!";
} else {
$_SESSION[ipaddress] = $_SERVER['REMOTE_ADDR'];
$_SESSION[membersusername] = $lowerusername;
header('Location: main.php');
}
}
?>
누구나 온라인 회원 전용 스크립트를 만들 수 있도록 도와 줄 수 있습니까? 그렇다면 MySQL 테이블에 무엇을 추가해야합니까?
감사
참고 : 필터링없이 쿼리에서 입력 데이터를 사용하고있는 것처럼 보이기 때문에 login-SQL-query는 SQL-injection-safe가 아닙니다 : 'AND password ='$ _ POST [password] ''. –
어디에서 추가 할 수 있습니까? – MBell86
데이터베이스 쿼리에서 사용하고자하는 모든 사용자 정의 변수를 필터링해야합니다. 즉, XSS-Attacks를 방지하고'addslashes() '를 사용하여 따옴표를 마스킹하지 않으려면'strip_tags()'를 사용하여 html 및 php 태그를 제거해야합니다. SQL-Injections : '$ username = strip_tags (addslashes ($ username)); ' 더 나은 방법이 있지만 기본적으로 쿼리를 보호합니다. –