Original image width.
$height -> Original image height.
$target -> Target resizing as a percentage.
Output: Returns the new sizes in html image tag format.
*****************************************************************/
function imageResize($width, $height, $target)
{
if ($width > $height)
{
$percentage = ($target / $width);
}
else
{
$percentage = ($target / $height);
}
$width = round($width * $percentage);
$height = round($height * $percentage);
return "width=\"$width\" height=\"$height\"";
}
$mysqli = mysqli_connect("localhost", "skillini_Ann", "bbalsk94544", "skillini_hatcreek");
if (mysqli_connect_errno())
{
echo "Your request cannot be processed at this time. Please try again later.";
exit();
}
else
{
if (!isset($_SESSION["id"]))
{
$_SESSION["error"] = "The action requested is not allowed. Please log in or sign up.";
header("Location: Login.html");
exit();
}
$user_id = $_SESSION["id"];
$sql = "SELECT COUNT(*) FROM feedback WHERE to_uid = '$user_id'";
$res = mysqli_query($mysqli, $sql);
$row = mysqli_fetch_row($res);
$num_feedbacks = $row[0];
mysqli_free_result($res);
//echo "Number of feedbacks: $num_feedbacks
";
}
//mysqli_close($mysqli);
?>
Skillinity - Feedback
|
|
0)
{
while($row = mysqli_fetch_array($res))
{
$date = $row['date'];
$regex_pattern = "/(.+)-(.+)-(.+)\s.*/";
preg_match_all($regex_pattern, $date, $matches);
switch ($matches[2][0])
{
case "01": $month = "January"; break;
case "02": $month = "February"; break;
case "03": $month = "March"; break;
case "04": $month = "April"; break;
case "05": $month = "May"; break;
case "06": $month = "June"; break;
case "07": $month = "July"; break;
case "08": $month = "August"; break;
case "09": $month = "September"; break;
case "10": $month = "October"; break;
case "11": $month = "November"; break;
case "12": $month = "December"; break;
default: $month = "Error";
}
switch ($matches[3][0])
{
case "01": $day = "1"; break;
case "02": $day = "2"; break;
case "03": $day = "3"; break;
case "04": $day = "4"; break;
case "05": $day = "5"; break;
case "06": $day = "6"; break;
case "07": $day = "7"; break;
case "08": $day = "8"; break;
case "09": $day = "9"; break;
default: $day = $matches[3][0];
}
$year = $matches[1][0];
$from_uid = $row['from_uid'];
$sql = "SELECT user_name,profile_photo FROM profiles WHERE user_id = '$from_uid'";
$res2 = mysqli_query($mysqli, $sql);
if ($res2)
{
$row2 = mysqli_fetch_array($res2);
$from_name = $row2['user_name'];
$from_photo = $row2['profile_photo'];
$mysock = getimagesize("uploads/$from_photo");
$image_size = imageResize($mysock[0], $mysock[1], 75);
mysqli_free_result($res2);
}
echo "";
echo " | ";
echo "".$row['comment']." ";
echo "Comment by $from_name | ";
echo "$month $day, $year |
| | ";
}
}
}
mysqli_free_result($res);
mysqli_close($mysqli);
?>
|