<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
session_start();
if(!isset($_SESSION['user_id'])){
header('Location: login.php');
exit();
}
include('includes/db_connect.php');
$userid = $_SESSION['user_id'];
$sql = ("SELECT file_id FROM files WHERE user_id='$userid'");
$query = $db->query($sql);
if($query->num_rows ===1){
echo "<a href="index.php">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";
}else{
echo "you can upload a file";
}
?>
以上检查用户是否上传了文件。它通过查看它们是否是具有用户ID的文件来实现此目的。某些原因导致页面在加载时只是空白。
包括只需按住连接字符串
多年来一直在关注这个问题,我们将不胜感激,谢谢你们,答案 0 :(得分:1)
此行有语法错误:
echo "<a href="index.php">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";
如果使用双引号("
)定义字符串,则必须转义字符串中包含的所有双引号。
替换为:
echo "<a href=\"index.php\">Sorry you have already uploaded a file, to delete the current file and upload another please select retieve file from the homepage</a>";