i'd like to modify this blog php mysql script , so that i could upload multi media
i'd like to modify this blog php mysql script ( in the uploaded .zip) , so that i can upload video files , image files & embedded YouTube vids. it currently only supports text. if anyone could point me in the right direction i'd greatly appreciate it.
Server: localhost via TCP/IP
Server version: 5.5.16
Protocol version: 10
User: root@localhost
MySQL charset: UTF-8 Unicode (utf8)
Attached Files
Last edited by VictoryHawk; 05-23-2012 at 10:22 AM .
You would certainly get more response if you just paste the specific PHP code here. I would like to help but downloading files other than txt files make me nervous. Just a friendly suggestion.
homepage.php
Code:
<?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"> </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"> </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> </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:
<?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 . ' ' . ' ' .
' ' . ' ' . $linkdel ;
}
?>
</html>
connect.php
Code:
<?php
$connect=mysql_connect("localhost","root","") or die('mysql_error()');
$database=mysql_select_db("comment") or die('mysql_error()');
?>
delete.php
Code:
<?php
require('connect.php');
$deleteid=$_GET['id'];
mysql_query("DELETE FROM comment WHERE id='$deleteid'");
header("location: success.php");
?>
Last edited by VictoryHawk; 05-24-2012 at 02:24 AM .
success.php
Code:
<?php
header("Location: homepage.php");
?>
comment.sql
Code:
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');
Last edited by VictoryHawk; 05-24-2012 at 02:20 AM .
To be able to upload files via a web form you need to send the attribute enctype="multipart/form-data" in your form tag and add an <input type="file" name="myfile"> field in your form.
Then you need a PHP script to copy the uploaded file from the default temp folder to its final destination in your web hosting account.
You can quickly find a php file uploader with a quick Google search or check PHP documentation on file upload; it will be more instructive.
By the way after you save the uploaded file in a folder all you need is save the filename, folder and its title in your database. This will allow you to manage those media assets from your back-end CMS
Last edited by holyhttp; 05-24-2012 at 02:33 AM .
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks