Jump to content

studiosx

Members
  • Posts

    3
  • Joined

  • Last visited

studiosx's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. studiosx

    foreach() error

    This is all whole code: <?phpheader( 'content-type: text/xml' );require_once( 'config/con_db.class.php' );require_once( 'function/function.php' );$db = new db( );$hostedServer = ishostedserver( );$level = 38;$admin_delete = false;if (isset( $_COOKIE['userid'] )) { $userid = get_uid_fromusers( safe_string( $_COOKIE['userid'] ) ); $level = check_if_admin( $userid ); if ($level == 1) { $admin_delete = true; }}$channels = safe_string( $_GET['channels'] );if (strpos( $channels, ',' )) { $channels = explode( ',', $channels );}else { $channels = array( $channels );}$todayforsql = date( 'Y-m-d H:i:s', mktime( date( 'H' ), date( 'i' ), 0, date( 'm' ), date( 'd' ), date( 'Y' ) ) );$category = safe_string( $_GET['category'] );if (strpos( $category, ',' )) { $category = explode( ',', $category );}else { $category = array( $category );}$_GET['start'] = ($_GET['start'] ? intval( $_GET['start'] ) : 0);$limit = ($_GET['limit'] ? ' LIMIT ' . intval( $_GET['start'] ) . ', ' . intval( $_GET['limit'] ) : ' LIMIT 50');$limit = (intval( $_GET['limit'] ) <= 500 ? $limit : ' LIMIT ' . intval( $_GET['start'] ) . ', 500');if (( $admin_delete && $_GET['limit'] )) { $limit = ' LIMIT ' . intval( $_GET['start'] ) . ', ' . intval( $_GET['limit'] );}if ($_GET['recent']) { $limit = 'limit 0,50';}else { $recent = null;}$path = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];$path = str_replace( 'xml.php', '', $path );$catIDS = null;$chaIDS = null;$tagArray = array( );$urlArray = array( );$vidArray = array( );$imgArray = array( );$partOneSQL = null;$partTwoSQL = null;$partThreeSQL = null;$partFourSQL = null;if (0 < $category[0]) { $catIDS = '('; foreach ($category as $v) { $catIDS .= $v . ','; } $catIDS = trim( $catIDS, ',' ) . ')';}if (0 < $channels[0]) { $chaIDS = '('; foreach ($channels as $v) { $chaIDS .= $v . ','; } $chaIDS = trim( $chaIDS, ',' ) . ')';}$maxdatequery = 'select max(`date_added`) as da from videos v, channels ch ';$maxdatequery .= ($catIDS ? ', hostedgals_niche n, hostedgals_cats c ' : null);$maxdatequery .= ' WHERE 1';$maxdatequery .= ($chaIDS ? ' and v.channel IN ' . $chaIDS . ' ' : null);$maxdatequery .= ($catIDS ? ' and n.cat_id IN ' . $catIDS . ' AND n.cat_id = c.uid AND n.hostedgal_id = v.uid' : null);$maxdatequery .= ' AND v.date_added <= '' . $todayforsql . '' ';$maxdatequery .= ' AND v.channel = ch.uid ';$maxdatequery .= ' AND v.active = 1 ';$maxdatequery .= ' AND v.queue = 1';$getmaxdate = mysql_query( '' . $maxdatequery );$timeforupdate = strtotime( mysql_result( $getmaxdate, 0, 'da' ) );$partOneSQL = 'SELECT v.uid AS vid_id, v.description, v.tag, v.duration, v.height, v.hotlink_id, v.width, v.date_added, v.hotlinkimg_id, v.img_type, v.vid_type, s.sitename, ch.name as chaname, ch.uid as chaid FROM videos v, settings s, channels ch';$partOneSQL .= ($catIDS ? ', hostedgals_niche n, hostedgals_cats c ' : null);$partOneSQL .= ' WHERE 1';$partOneSQL .= ($chaIDS ? ' and v.channel IN ' . $chaIDS . ' ' : null);$partOneSQL .= ($catIDS ? ' and n.cat_id IN ' . $catIDS . ' AND n.cat_id = c.uid AND n.hostedgal_id = v.uid' : null);$partOneSQL .= ' AND v.date_added <= '' . $todayforsql . '' ';$partOneSQL .= ' AND v.channel = ch.uid ';$partOneSQL .= ' AND v.active = 1 ';$partOneSQL .= ' AND v.queue = 1 ';$partOneSQL .= ' ORDER BY v.date_added DESC ';$partOneSQL .= $limit;$partOneResult = mysql_query( $partOneSQL, $db->con );if ($row = mysql_fetch_object( $partOneResult )) { $vid_ids[] = $row->vid_id;}$from_sql_one = implode( ',', $vid_ids );mysql_data_seek( $partOneResult, 0 );$partTwoSQL = 'SELECT hostedgals_niche.cat_id, hostedgals_niche.hostedgal_id FROM hostedgals_niche JOIN videos ON (videos.uid = hostedgals_niche.hostedgal_id) where hostedgal_id IN(' . $from_sql_one . ')';$partThreeSQL = 'SELECT videos.uid, `hotlink`.`url` AS clip, `hotlinkimg`.`url` AS screen FROM `hotlink` , `hotlinkimg` , videos WHERE videos.hotlink_id = hotlink.uid AND videos.hotlinkimg_id = hotlinkimg.uid AND videos.uid IN(' . $from_sql_one . ') GROUP BY videos.uid';$partFourSQL = 'SELECT `videos`.`uid` , `hotlink_files`.`filename` , `hotlink_files`.`type` FROM `hotlink_files` , `videos` WHERE hotlink_files.video_uid = videos.uid AND videos.uid IN(' . $from_sql_one . ')';$getcatnames = mysql_query( 'select name, uid from hostedgals_cats where status = 1' );while ($row = mysql_fetch_assoc( $getcatnames )) { extract( $row ); $catarray[$uid] = $name;}$partTwoResult = mysql_query( $partTwoSQL, $db->con );while ($row = mysql_fetch_array( $partTwoResult )) { @extract( $row ); $tagArray[$hostedgal_id][] = $cat_id;}$partThreeResult = mysql_query( $partThreeSQL, $db->con );while ($row = mysql_fetch_array( $partThreeResult )) { @extract( $row ); $urlArray[$uid][] = $clip; $urlArray[$uid][] = $screen;}$partFourResult = mysql_query( $partFourSQL, $db->con );while ($row = mysql_fetch_array( $partFourResult )) { @extract( $row ); if ($type == '1') { $vidArray[$uid][] = $filename; } $imgArray[$uid][] = $filename;}$numRows = mysql_num_rows( $partOneResult );$output = '';$output .= '<videos>';$output .= ' <updated>' . date( 'Y-m-d', $timeforupdate ) . '</updated>';$output .= ' <total>' . $numRows . '</total>';while ($row = mysql_fetch_array( $partOneResult )) { $thisPath = $path; @extract( $row ); $output .= ' <video>'; $output .= ' <id>' . $vid_id . '</id>'; $output .= ' <tag>' . $tag . '</tag>'; $output .= ' <title>' . htmlentities( $description ) . '</title>'; $output .= ' <description>' . htmlentities( $description ) . '</description>'; $output .= ' <tags>'; $vtags = $tagArray[$vid_id]; $urls = $urlArray[$vid_id]; $vids = $vidArray[$vid_id]; $imgs = $imgArray[$vid_id]; if (is_array( $vtags )) { $vtags = array_unique( $tagArray[$vid_id] ); $temp = ''; foreach ($vtags as $v) { if ($catarray[$v]) { $temp .= $catarray[$v] . ','; continue; } } $temp = trim( $temp, ',' ); $output .= ' ' . $temp . ' '; } $output .= ' </tags>'; $output .= ' <paysite>' . $chaname . '</paysite>'; $output .= ' <clip_url>'; if (( $vid_type == 'local' && $hostedServer != '' )) { $thisPath = $hostedServer . 'vid/' . $chaid . '/' . $tag . '/'; } else { if (( $vid_type == 'local' && $hostedServer == '' )) { $thisPath = $thisPath . 'vid/' . $chaid . '/' . $tag . '/'; } else { if ($vid_type == 'hotlink') { $thisPath = trim( $urls[0] ); } } } $output .= $thisPath . ''; $output .= ' </clip_url>'; $thisPath = $path; $output .= ' <screen_url>'; if (( $img_type == 'local' && $hostedServer != '' )) { $thisPath = $hostedServer . 'vid/' . $chaid . '/' . $tag . '/'; } else { if (( $img_type == 'local' && $hostedServer == '' )) { $thisPath = $thisPath . 'vid/' . $chaid . '/' . $tag . '/'; } else { if ($img_type == 'hotlink') { $thisPath = trim( $urls[1] ); } } } $output .= $thisPath . ''; $output .= ' </screen_url>'; $output .= ' <clips>'; if (!is_array( $vids )) { $vids = array( ); foreach ($imgs as $img) { $img = explode( '.', $img ); $vids[] = '0' . $img[0] . '.flv'; } } @sort( $vids ); @sort( $imgs ); $i = 38; foreach ($vids as $v) { $output .= ' <clip>'; $output .= ' <duration>' . $duration . '</duration>'; $output .= ' <width>' . $width . '</width>'; $output .= ' <height>' . $height . '</height>'; $output .= ' <flv>' . $v . '</flv>'; $output .= ' <screens> <screen>' . trim( $imgs[$i] ) . '</screen> </screens>'; $output .= ' </clip>'; ++$i; } $output .= ' </clips>'; $output .= ' </video>';}$output .= '</videos>';echo $output;?>
  2. studiosx

    foreach() error

    NULL
  3. studiosx

    foreach() error

    I want to export videos, thumbs, duration, etc from my website into a xml format. I got this error: Invalid argument supplied for foreach() $output .= ' <clips>';if (!is_array( $vids )) { $vids = array( ); foreach ($imgs as $img) { $img = explode( '.', $img ); $vids[] = '0' . $img[0] . '.flv'; }}@sort( $vids );@sort( $imgs );$i = 38;foreach ($vids as $v) { $output .= ' <clip>'; $output .= ' <duration>' . $duration . '</duration>'; $output .= ' <width>' . $width . '</width>'; $output .= ' <height>' . $height . '</height>'; $output .= ' <flv>' . $v . '</flv>'; $output .= ' <screens> <screen>' . trim( $imgs[$i] ) . '</screen> </screens>'; $output .= ' </clip>'; ++$i;}$output .= ' </clips>'; Thank you!
×
×
  • Create New...