我们将其设置为用户可以选中框以表明内容是成熟内容的位置。上传的未经检查的照片会上传并存储在数据库中,但如果他们选中此框以将其标记为成人,则仍会上传到服务器,但表格中不会创建任何字段。
$mature=$HTTP_POST_VARS["mature"];
if($mature=="on") {
// $adult=1; // has no function, could be useful?
}
else {
// $adult=0; // has no function, could be useful?
// ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE
$sql="select photo_id as a from user_pics where user_id = $_SESSION[user_id]";
$result2 = mysql_query($sql);
$pic=mysql_num_rows($result2);
if($pic==0) {
// if no photos found within the database table user_pics
// Identify if adult or not.
$mature_content=$HTTP_POST_VARS["mature"];
if($mature_content=="on") {
$adult_rated=1;
}
else {
$adult_rated=0;
}
// Identify if adult or not.
$sql="insert into user_pics";
$sql.="(user_id";
$sql.=", caption";
$sql.=", mature";
$sql.=", photo_url";
$sql.=", medium_photos";
$sql.=", small_photos)";
$sql.=" values($_SESSION[user_id]";
$sql.=", '$caption'";
$sql.=", $adult_rated";
$sql.=", '$picture_url'";
$sql.=", '$med_picture_url'";
$sql.=", '$small_picture_url')";
$result=mysql_query($sql);
$photo_id = mysql_insert_id();
} else {
// if one or more than one photo
// Identify if adult or not.
$mature_content=$HTTP_POST_VARS["mature"];
if($mature_content=="on") {
$adult_rated=1;
}
else {
$adult_rated=0;
}
// Identify if adult or not.
$sql="insert into user_pics";
$sql.="(user_id";
$sql.=", caption";
$sql.=", mature";
$sql.=", photo_url";
$sql.=", medium_photos";
$sql.=", small_photos)";
$sql.=" values($_SESSION[user_id]";
$sql.=", '$caption'";
$sql.=", $adult_rated";
$sql.=", '$picture_url'";
$sql.=", '$med_picture_url'";
$sql.=", '$small_picture_url')";
$result=mysql_query($sql);
$photo_id = mysql_insert_id();
}
// ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE
}
答案 0 :(得分:0)
如果$mature=="on"
,那么您正在跳过可能在数据库中插入内容的整个代码块。如果这是真的,那么什么都不会插入。除非我误解了你的要求。