Jump to content

Flag Error


Boxerman

Recommended Posts

Hi guys..

 

I've got a problem im trying to issue where when a user clicks Broken it does not work..

 

here is the php for it:

 

<h2 class="title2">Recently Added</h2>
<p>
<?PHP
$con = mysql_connect("localhost","*******","*********");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("movies", $con);
/*  function to return the first N words of a string */
function shorten_string($string, $wordsreturned) {
$retval = $string;
$array = explode(" ", $string);
if (count($array)<=$wordsreturned) {
$retval = $string;
}else{
array_splice($array, $wordsreturned);
$retval = implode(" ", $array)." ...";
}
return $retval;
}
/* check to see if an article has been selected */
if(!$_GET['id']) {
$id = 0;
}else{
$id = (int) $_GET['id'];
}
/* set the number of words for the brief */
$N = 15;
/* if id is set display the news */
if($id>0) {
$query = "SELECT * FROM movies WHERE id='$id' ORDER BY id DESC";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$title = $row['title'];
$timestamp = $row["added"];
$format='F j, Y, g:i a';
$formatedTime = date($format, strtotime($timestamp));
?><p>
<b><font size="5"><?PHP echo $title; ?></font> </b><br />
Story: <?PHP echo $row['desc'] ?></p><br>
<?php
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($iphone || $ipod == true)
{
echo "<iframe width='200' height='150' src='movies/".$row['filename']."' frameborder='0' allowfullscreen></iframe><br>";
}
ELSE {
echo "<video id='video' autobuffer height='240' width='360' controls='controls' autoplay='autoplay'><source src='movies/".$row['filename']."'></video>";
}
?>
Posted At: <?php echo $formatedTime ?>
<br><br>
<?php
if(isset($_POST['flag']))
{
$con = mysql_connect("localhost","*******","*********");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
mysql_select_db("movies", $con);
$id = (int) $_GET['id'];
$sql = "UPDATE movies SET flag = 1 WHERE id = $id";
if (!mysql_query($sql,$con))
 {
 die('Error: ' . mysql_error());
 }
echo "<font color='green'>Thanks for reporting!</font><br><br>";
mysql_close($con);
}
?>
<a href="watchtest.php?id=<? echo $id ?>?flag"><img src="img/flag_red.png" />Broken</a>
<BR><BR><BR>
<?PHP
}else{
echo "nothing here";
}
?>

 

Im aware of the badness of the coding, i will rewrite soon.. but hope the code helps you on the FLAG section

Link to comment
https://forums.phpfreaks.com/topic/269460-flag-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.