[英]How to hide images from unregistered users
我創建了一個網站來共享電影等圖片,但隱私方面存在問題。 當您創建攝影膠片時,您可以與其他人共享其網址,但未登錄我的網站的人仍然可以觀看我的影片http://thephotofilm.com/films/1002947
SELECT path FROM images WHERE img_id=(id)
if($type=="ole")
$type=1;
else
$type=1;
if(!is_numeric($imageIndex) || $imageIndex<0)
invalidImage();
如果用戶未登錄,則顯示空白圖片
感謝您的放心!
您可以使用$_session['username']
。
if(isset($_session['username'])){ //change this session to your session name.
echo 'show image here';
}
else{
echo 'tell him wtf are you doing here';
}
我將使用會話變量進行檢查。 如果用戶具有有效的會話,請顯示圖像。 如果不是,則不顯示圖像。
像這樣:
if ($_SESSION['my-session-var']
{
echo '<img src="my-image.jpg" />';
}
else
{
echo '<p>You gotta log in first, ya \'doofis!</p>';
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.