php MySQL text blog needs multi media functionality

Codes here !

Moderators: macek, egami, gesf

victoryhawk
New php-forum User
New php-forum User
Posts: 2
Joined: Wed May 23, 2012 8:43 am

php MySQL text blog needs multi media functionality

Postby victoryhawk » Wed May 23, 2012 11:07 am

i'd like to modify this blog php mysql script , so that i can upload video files , image files, links & embedded YouTube vids. it currently only supports text. if anyone could point me in the right direction i'd greatly appreciate it.

MySQL version
Server: localhost via TCP/IP
Server version: 5.5.16
Protocol version: 10
User: root@localhost
MySQL charset: UTF-8 Unicode (utf8)

thank u for your time !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

homepage.php

Code: Select all

<?php error_reporting (E_ALL ^ E_NOTICE); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>untitled-3.jpg</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">td img {display: block;}</style>
<!--Fireworks CS3 Generic target.  Created Fri Jan 20 17:14:29 GMT-0500 (Eastern Standard Time) 2012-->
<script language="JavaScript1.2" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//-->
</script>
</head>
<center>
<body style="overflow:hidden;" bgcolor="#ffffff" onload="MM_preloadImages('images/untitled-3_r2_c2_s2.jpg','images/untitled-3_r2_c4_s2.jpg','images/untitled-3_r4_c2_s2.jpg','images/untitled-3_r6_c2_s2.jpg','images/untitled-3_r8_c2_s2.jpg','images/untitled-3_r10_c2_s2.jpg','images/untitled-3_r12_c2_s2.jpg','images/untitled-3_r12_c4_s2.jpg');">
<table border="0" cellpadding="0" cellspacing="0" width="1200">
<!-- fwtable fwsrc="Untitled" fwpage="Page 1" fwbase="untitled-3.jpg" fwstyle="Generic" fwdocid = "153907550" fwnested="0" -->
  <tr>
   <td><img src="images/spacer.gif" width="25" height="1" border="0" alt="" /></td>
   <td><img src="images/spacer.gif" width="199" height="1" border="0" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
   <td><img src="images/spacer.gif" width="929" height="1" border="0" alt="" /></td>
   <td><img src="images/spacer.gif" width="46" height="1" border="0" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
  </tr>

  <tr>
   <td colspan="5">&nbsp;</td>
   <td><img src="images/spacer.gif" width="1" height="31" border="0" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="12"><img name="untitled3_r2_c1_s1" src="images/untitled-3_r2_c1_s1.jpg" width="25" height="669" border="0" id="untitled3_r2_c1_s1" alt="" /></td>
   <td><a href="http://gmail.com" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r2_c2_s1','','images/untitled-3_r2_c2_s2.jpg',1);"><img name="untitled3_r2_c2_s1" src="images/untitled-3_r2_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r2_c2_s1" alt="" /></a></td>
   <td rowspan="12"><img name="untitled3_r2_c3_s1" src="images/untitled-3_r2_c3_s1.jpg" width="1" height="669" border="0" id="untitled3_r2_c3_s1" alt="" /></td>
   <td><a href="homepage.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r2_c4_s1','','images/untitled-3_r2_c4_s2.jpg',1);"><img name="untitled3_r2_c4_s1" src="images/untitled-3_r2_c4_s1.jpg" width="929" height="100" border="0" id="untitled3_r2_c4_s1" alt="" /></a></td>
   <td rowspan="12"><img name="untitled3_r2_c5_s1" src="images/untitled-3_r2_c5_s1.jpg" width="46" height="669" border="0" id="untitled3_r2_c5_s1" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r3_c2_s1" src="images/untitled-3_r3_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r3_c2_s1" alt="" /></td>
   <td rowspan="9">&nbsp;</td>
   <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><a href="http://www.youtube.com" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r4_c2_s1','','images/untitled-3_r4_c2_s2.jpg',1);"><img name="untitled3_r4_c2_s1" src="images/untitled-3_r4_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r4_c2_s1" alt="" /></a></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r5_c2_s1" src="images/untitled-3_r5_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r5_c2_s1" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><a href="http://jacksonville.craigslist.org/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r6_c2_s1','','images/untitled-3_r6_c2_s2.jpg',1);"><img name="untitled3_r6_c2_s1" src="images/untitled-3_r6_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r6_c2_s1" alt="" /></a></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r7_c2_s1" src="images/untitled-3_r7_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r7_c2_s1" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><a href="http://www.pandora.com/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r8_c2_s1','','images/untitled-3_r8_c2_s2.jpg',1);"><img name="untitled3_r8_c2_s1" src="images/untitled-3_r8_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r8_c2_s1" alt="" /></a></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r9_c2_s1" src="images/untitled-3_r9_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r9_c2_s1" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><a href="http://www.lynda.com/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r10_c2_s1','','images/untitled-3_r10_c2_s2.jpg',1);"><img name="untitled3_r10_c2_s1" src="images/untitled-3_r10_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r10_c2_s1" alt="" /></a></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r11_c2_s1" src="images/untitled-3_r11_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r11_c2_s1" alt="" /></td>
   <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><a href="bookmarks.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r12_c2_s1','','images/untitled-3_r12_c2_s2.jpg',1);"><img name="untitled3_r12_c2_s1" src="images/untitled-3_r12_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r12_c2_s1" alt="" /></a></td>
   <td><a href="contacts.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r12_c4_s1','','images/untitled-3_r12_c4_s2.jpg',1);"><img name="untitled3_r12_c4_s1" src="images/untitled-3_r12_c4_s1.jpg" width="929" height="100" border="0" id="untitled3_r12_c4_s1" alt="" /></a></td>
   <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="untitled3_r13_c2_s1" src="images/untitled-3_r13_c2_s1.jpg" width="199" height="54" border="0" id="untitled3_r13_c2_s1" alt="" /></td>
   <td>&nbsp;</td>
   <td><img src="images/spacer.gif" width="1" height="54" border="0" alt="" /></td>
  </tr>
</table>







<div id="databox" style="position:absolute; top:135px;
left:307px; overflow:auto; height:400px; width:910px; font-family:'bankGothic Md BT'; text-shadow:1px 1px 1px #000; color:#3399FF;">


<?php include("comment.php"); ?>



</div>













</body>
</center>
</html>


comment.php

Code: Select all

<?php
require('connect.php');

$comment=$_POST['comment'];
$submit=$_POST['submit'];
if($submit)
{
    if($comment)
    {
    $query=mysql_query("INSERT INTO comment (id,comment) VALUES ('','$comment')");
    header("Location: success.php");
    }
    else
    {
        echo "Please fill out all the fields.";
    }
}
?>
<html>
<head></head>
<body>
<form action="comment.php" method="POST">
<br /><br />
<label>Enter Data:  </label><br /><textarea name="comment" cols="80" rows="1"></textarea><br/>
<input type="submit" name="submit" value="Post" />

</form>

</body>
<?php
require('connect.php');
$query=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
     $id=$rows['id'];
   
     $dcomment=$rows['comment'];
     $linkdel="<a href=\"delete.php?id=" . $rows['id'] . "\">Delete Data</a>";
     echo '<br />' . '<font color="#000099">Data:</font>  ' . '<br />' . $dcomment . '&nbsp' . '&nbsp' .
      '&nbsp' . '&nbsp' .  $linkdel  ;   
}
?>
</html>



connect.php

Code: Select all


<?php
$connect=mysql_connect("localhost","root","") or die('mysql_error()');
$database=mysql_select_db("comment") or die('mysql_error()');
?>


delete.php

Code: Select all

<?php
require('connect.php');
$deleteid=$_GET['id'];
mysql_query("DELETE FROM comment WHERE id='$deleteid'");
header("location: success.php");
?>



success.php

Code: Select all

<?php
header("Location: homepage.php");
?>


comment.sql

Code: Select all

-- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 07, 2011 at 03:27 PM
-- Server version: 5.1.53
-- PHP Version: 5.3.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `comment`
--

-- --------------------------------------------------------

--
-- Table structure for table `comment`
--

CREATE TABLE IF NOT EXISTS `comment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `comment` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `comment`
--

INSERT INTO `comment` (`id`, `name`, `comment`) VALUES
(1, 'hi'),
(2, 'bye');

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: php MySQL text blog needs multi media functionality

Postby Nullsig » Wed May 23, 2012 11:39 am

Who will have access to the upload? Is this uploading behind a login or can anyone upload to your server?

victoryhawk
New php-forum User
New php-forum User
Posts: 2
Joined: Wed May 23, 2012 8:43 am

Re: php MySQL text blog needs multi media functionality

Postby victoryhawk » Wed May 23, 2012 4:01 pm

for now, just for educational purposes, i'm not concerned about security / log in . this is just a independent study for my own edification . thank u for your response. if u could help me out on this 1 id severely appreciate it

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: php MySQL text blog needs multi media functionality

Postby Nullsig » Thu May 24, 2012 5:32 am

Okay you have requested two separate things here.

1.To upload files (vido, image, documents, etc.) you would use a script similar to this:
http://www.tizag.com/phpT/fileupload.php

In general if you are the only one that is going to be uploading and you have FTP access, I suggest just using FTP. It is much more reliable and secure.



2. To embed links and Youtube videos:

From the looks of the linked code you have some sort of Content Management System that you are using. The majority of these allow you to manually enter HTML or just type in plain text when creating posts for the blog. If you have access to manually coding the HTML for a post or page then you can simply just use the related HTML code to include links and YouTube embeds.


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest