Jump to content

Need Help on php coding

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Mastspace

Mastspace

    Newbie

  • Members
  • Pip
  • 8 posts
Hi All
I aM New in this forum hope i post in right place.

i want to have a option to enter and youtube video link and then there should be a button to click like submit then after that it should appear in my video gallery just like i upload video and it appears
and here is pic what i have and what i am looking for,
Posted Image
and this is what i need . my script is from able space.
Posted Image

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Moved to the correct forum.

Screenshots do not tell us what database structure you have, how your form is set up, etc. What is the code for this?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Mastspace

Mastspace

    Newbie

  • Members
  • Pip
  • 8 posts
Hi Wingedpanther
thnx for your reply.
please tell me wich section is the correct section to move it over ther.
i am new in the forum and i don't now anything about it, sorry for that,
1- you wan me to remove the screen shot?
2- you ask me about code is that ok if i post my video gullry secton code for you ?

#4
banker

banker

    Newbie

  • Members
  • PipPip
  • 24 posts
I think what WingedPanther meant was that if you don't post your php code or give us more details about your database structure, it is hard to help you.

#5
Mastspace

Mastspace

    Newbie

  • Members
  • Pip
  • 8 posts
Hi banker thnx for your replay this is the video gullary section code.

<?php
$area = "login";
include("./_include/core/main_start.php");

payment_check('videogallery_upload');
if (isset($g['options']['videogallery']) and $g['options']['videogallery'] == "N") redirect('home.php');
$adsense = false;
class CPhotoEdit extends CHtmlBlock
{
function parseBlock(&$html)
{
global $l;
global $g;
global $g_user;

//if (empty($_POST['title'])||empty($_POST['description'])||empty($_POST['tags'])||empty($_POST['runtime']))
if (isset($_GET['end'])) {
if (get_session("upload_video_sql") != '') {
DB::execute(get_session("upload_video_sql"));
set_session("upload_video_sql", '');
}
redirect('videogallery_myvideo_view.php');
}
elseif (empty($_POST['title'])||empty($_POST['description'])||empty($_POST['tags']))
{
$result_channels=DB::query("SELECT id, name FROM videogallery_channels ORDER BY name");
$num_channels=DB::num_rows();
$channels="<table width=100% border=0 align=center cellpadding=0 cellspacing=0><tr>";
$logic=0;
while ($row_channels=DB::fetch_row())
{
if (isset($l['all'][to_php_alfabet($row_channels['name'])])) {
$name = $l['all'][to_php_alfabet($row_channels['name'])];
} else {
$name = $row_channels['name'];
}
$channels.="<td><input type=checkbox name=channel_".$row_channels['id']."> " . $name . "</td>";
$logic++;
if ($logic==2)
{
$channels.="</tr><tr>";
$logic=0;
}
}
$channels.="</tr></table>";
$html->setvar("channels", $channels);
$html->setvar("num_cat", $num_channels);
$html->setvar("title", "UPLOAD VIDEO");
$html->parse("upload_1", true);
}
//elseif (!empty($_POST['title'])&&!empty($_POST['description'])&&!empty($_POST['tags'])&&!empty($_POST['runtime']))
elseif (!empty($_POST['title'])&&!empty($_POST['description'])&&!empty($_POST['tags']))
{
$result_channels=DB::query("SELECT id, name FROM videogallery_channels ORDER BY name");
$num_channels=DB::num_rows();
$channels="<table width=100% border=0 align=center cellpadding=0 cellspacing=0><tr>";
$logic=0;
$error=0;
$sel_channels="";
while ($row_channels=DB::fetch_row())
{
if (!empty($_POST['channel_'.$row_channels['id'].'']) && $_POST['channel_'.$row_channels['id'].'']=='on')
{
$error++;
$sel_channels.=$row_channels['name'].", ";
}

if (isset($l['all'][to_php_alfabet($row_channels['name'])])) {
$name = $l['all'][to_php_alfabet($row_channels['name'])];
} else {
$name = $row_channels['name'];
}
$channels.="<td><input type=checkbox name=channel_".$row_channels['id']."> " . $name . "</td>";$logic++;
if ($logic==2)
{
$channels.="</tr><tr>";
$logic=0;
}
}
$channels.="</tr></table>";

if ($error==0)
{
$html->setvar("channels", $channels);
$html->setvar("num_cat", $num_channels);
$html->parse("error", true);
}
else
{
/* $result=DB::execute("INSERT INTO videogallery_video (title, user_id, featured, channels, tags, runtime, brodcast, embed_html, video_date, status, featured_r) VALUES
(".to_sql($_POST['title']).", '".$g_user['user_id']."', 'NO', ".to_sql($sel_channels).", ".to_sql($_POST['tags']).", ".to_sql($_POST['runtime']).", ".to_sql($_POST['visible']).", ".to_sql($_POST['description']).", '".date('Y-m-d')."', 'INACTIVE', 'NO')");*/
$tmpfname = rand(100000, 999999);
while (file_exists($g['path']['dir_files'] . "video/" . $tmpfname . ".dat")) $tmpfname = rand(100000, 999999);
set_session("upload_video_sql",
"INSERT INTO videogallery_video
(title, user_id, featured, channels, tags, runtime, brodcast, embed_html, video_date, status, featured_r, video_image, video)
VALUES
(".to_sql($_POST['title']).",
'".$g_user['user_id']."', 'NO', ".to_sql($sel_channels).",
".to_sql($_POST['tags']).", 0,
".to_sql($_POST['visible']).",
".to_sql($_POST['description']).",
'".date('Y-m-d')."', 'INACTIVE', 'NO', '" . $tmpfname . ".jpg', '" . $tmpfname . ".flv')"
);
$html->setvar("fn", $tmpfname);
$html->setvar("MAX_FILE_SIZE", $this->max_file_size());
$html->setvar("file_size", $this->file_size());
$html->setvar("url_absolute", $this->url_abs());

$html->parse("no_error", true);
}
$html->setvar("title", "UPLOAD VIDEO: STEP 2");
$html->parse("upload_2", true);
}

parent::parseBlock($html);
}
function max_file_size()
{
$post_max_size = ini_get("post_max_size");
$upload_max_filesize = ini_get("upload_max_filesize");
if (intval($post_max_size) < intval($upload_max_filesize)) {
$size = $post_max_size;
} else {
$size = $upload_max_filesize;
}
$val = substr($size,0,strlen($size)-1);
if ($val = 'M') {
$size = intval($size) * 1024 * 1024;
} elseif ($val = 'K') {
$size = intval($size) * 1024;
} else {
$size = intval($size);
}
return $size;
}
function file_size()
{
$post_max_size = ini_get("post_max_size");
$upload_max_filesize = ini_get("upload_max_filesize");
if (intval($post_max_size) < intval($upload_max_filesize)) {
$size = $post_max_size;
} else {
$size = $upload_max_filesize;
}
$size = $size . 'b';
return $size;
}
function url_abs()
{
$s = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/';
$s = str_replace("//", "/", $s);
$s = str_replace("\\", "", $s);
$s = "http://" . $s;
return $s;
}
}

class VidoHeader extends CHtmlBlock
{
function parseBlock(&$html)
{
global $g;
global $g_user;

$html->parse("navy", true);

parent::parseBlock($html);
}
}

$page = new CPhotoEdit("", $g['tmpl']['dir_tmpl_main'] . "videogallery_upload.html");
$header = new CHeader("header", $g['tmpl']['dir_tmpl_main'] . "_header.html");
$page->add($header);
$footer = new CFooter("footer", $g['tmpl']['dir_tmpl_main'] . "_footer.html");
$page->add($footer);

$users_ims = new CIms("ims", $g['tmpl']['dir_tmpl_main'] . "_ims.html");
$page->add($users_ims);

$vidoheader = new VidoHeader("videogallery_vido_header", $g['tmpl']['dir_tmpl_main'] . "videogallery_vido_header.html");
$page->add($vidoheader);

include("./_include/core/main_close.php");

?>

Edited by Orjan, 19 April 2010 - 03:14 PM.


#6
Mastspace

Mastspace

    Newbie

  • Members
  • Pip
  • 8 posts
Please Guys Have Look My Post I Realy Need Help I Have tO fix this section to release my website i am just witing and waiting......