<?php include 'functions.php'; $title = htmlspecialchars($_POST['title']); $body = strip_tags($_POST['postbody'], "<a>"); if (!postIsOkay($title, $body)) { $_SESSION['errors'] = ['error' => 'Title and body cannot be empty!']; return header('Location: frontPage.php'); } submitPost($title, $body); $url = "frontPage.php"; header('Location: ' . $url);
$error_msg .= "<li>Image #" . $index . " is invalid.</li>"; } else { $size = filesize($_FILES[$image_name]['tmp_name']); if ($size > MAX_SIZE * 1024) { $error = 1; $error_msg .= "<li>Image #" . $index . " exceeds size limit.</li>"; } $image_nm = $index . "_" . $user_id . '_' . time() . '.' . $extension; $newname = "Post_images/" . $image_nm; $copied = copy($_FILES[$image_name]['tmp_name'], $newname); if (!$copied) { $error = 1; $error_msg .= "<li>Image #" . $index . " was not saved properly.</li>"; } else { $ad_photo[$index] = $newname; } } } } if ($ad_photo[0] == NULL) { $ad_photo[0] = "Post_images/photo_not_available.jpg"; } $result = submitPost($category, $subcategory, $locality, $city, $state, $country, $price, $free, $negotiable, $desc, $title, $uid, $ad_photo[0], $ad_photo[1], $ad_photo[2], $ad_photo[3], $ad_photo[4]); if ($result) { $udetails = getUserDetails($uid); $user = mysqli_fetch_array($udetails); $_SESSION['umail'] = $user['user_email']; header('Location: myprofile.php'); } else { header('Location: post.php?err=1'); }