Jump to content

Can't Insert Title Into Database (Split From Existing Thread)


Nina555

Recommended Posts

Hi, I am newbie in PHP and I got some script which I just can't get to insert title in database. I would be very thankful if you could help me with this. Here is the code. I hope that trg86 doesn't mind I got in his topic.

 

$surl = $_SERVER['HTTP_HOST'] ;

 

if (strip_tags($_POST['add'])){

$vidid=mysql_real_escape_string(strip_tags($_POST['vidid']));

 

$url = "$vidid";

parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars);

 

$t1=mysql_real_escape_string(strip_tags($_POST['tit1']));

$title="$t1";

parse_str( $title, $my_vars );

 

mysql_query("INSERT INTO `videos` (`id`, `videoid`, `views`, `title`) VALUES ('', '".$my_array_of_vars['v']."', '0', '".$my_vars['v']."');") or die (mysql_error());

$message="<img src=\"../img/tick-icon.jpg\">";

}

if (strip_tags($_POST['rem'])){

$vidid2=mysql_real_escape_string(strip_tags($_POST['vidid2']));

 

$url = "$vidid2";

parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );

 

mysql_query("DELETE FROM videos WHERE id=".$my_array_of_vars['v']."");

 

$message2="<img src=\"../img/tick-icon.jpg\">";

}

?><head>

<html xmlns:fb="http://ogp.me/ns/fb#">

<title>Admin Panel</title>

<META name="robots" content="NOINDEX,NOFOLLOW" />

<link type="text/css" rel="stylesheet" href="../css/admin.css" />

<link href="../img/favicon.ico" rel="icon" type="image/x-icon" />

 

<body>

 

<a href="index.php"><img src="../img/logo.png" border="0"></a>

<div class="banner"><a href="index.php">Delete</a> - <a href="add.php">Add & Remove</a> - <a href="logout.php">Logout</a></div>

 

<div align="center"><form id="form1" method="post" action="">

 

Youtube URL: <input type="text" name="vidid" id="vidid">

Title: <input type="text" name="tit1" id="tit1">

<input name='add' type='submit' id='add' value='Add Video' /> <? echo"$message";?><br><br>

 

Website URL: <input type="text" name="vidid2" id="vidid2">

<input name='rem' type='submit' id='rem' value='Remove Video' /> <? echo"$message2";?><br><br>

Example: <strong>http://<? echo"$surl"; ?>/watch.php?v=25</strong>

</div>

</form>

</body>

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.