steviez Posted March 2, 2007 Share Posted March 2, 2007 Hi, Im using a error class on my site and it is coming up with looooooads of errors, the main file is functions.php. I did not design the site and im am new to PHP so please will someone look over the file and point me in the direction of errors please. Thanks <?php /********************************************************************** FUNCTION NAME: LANGUAGECONVTER() DESCIPTION: THIS FUNCTION IS USED FOR CONVTERING ENGLISH LANGUAGE SENTENCE TO DUTCH LANGUAGE. INPUT: SENTENCE IN ENGILSH LANGUAGE OUTPUT: SENTENCE IN DUTCH LANGUAGE AUTHOR: KIRAN PYATI **********************************************************************/ function languageConvter($content) { $content = strip_tags($content); $content = str_replace("&","and",$content); $content_length = strlen($content); $params = "es"; if($content_length > 50) { $convertedString = ''; $wrap_content = wordwrap($content,50, "<br>"); $strArray = explode("<br>",$wrap_content); $count_chunks = count($strArray); for($i=0;$i<$count_chunks;$i++) { $content_read = ""; $mainContent = urlencode(htmlspecialchars($strArray[$i], ENT_NOQUOTES, 'UTF-8')); $url ="http://babelfish.altavista.com/babelfish/tr?lp=en_nl&intl=1&tt=urltext&doit=done&urltext=".$mainContent; $fp = fopen($url, "r"); while(!feof($fp)) { $content_read.= fread($fp,8192); } fclose($fp); unset($url); $line = str_replace('"',"",$content_read); $ex_con = explode("<!-- Target text (content) -->",$line); $new_ex_content = explode("<!-- end: Target text (content) -->",$ex_con[1]); $strip_content = strip_tags($new_ex_content[0]); $displayContent = explode("In het Nederlands:",$strip_content); $convertedString.= $displayContent[1]; } return $convertedString; } else { $mainContent = urlencode(htmlspecialchars($content, ENT_NOQUOTES, 'UTF-8')); $url ="http://babelfish.altavista.com/babelfish/tr?lp=en_nl&intl=1&tt=urltext&doit=done&urltext=".$mainContent; $fp = fopen($url, "r"); while(!feof($fp)) { $content_read.= fread($fp,8192); } fclose($fp); unset($url); $line = str_replace('"',"",$content_read); $ex_con = explode("<!-- Target text (content) -->",$line); $new_ex_content = explode("<!-- end: Target text (content) -->",$ex_con[1]); $strip_content = strip_tags($new_ex_content[0]); $displayContent = explode("In het Nederlands:",$strip_content); return $displayContent[1]; } } /********************************************************************** FUNCTION NAME : calculate_age DESCIPTION : THIS FUNCTION IS USED FOR CALCULATING AGE OF THE PERSON. INPUT : YEAR,MONTH,DAY FOR E.G.1990,01,90 OUTPUT : AGE IN YEAR,MONTH NAD DAY FORMAT. AUTHOR : KIRAN PYATI **********************************************************************/ function calculate_age($birth_num_year, $birth_num_month, $birth_num_day) { global $lang; $birth_num_month_days = date(t, mktime(0, 0, 0, $birth_num_month, $birth_num_day, $birth_num_year)); $current_num_year = date(Y); $current_num_month = date(n); $current_num_day = date(j); $current_num_month_days = date(t); if($current_num_month>$birth_num_month) { $yy = $current_num_year - $birth_num_year; $mm = $current_num_month - $birth_num_month - 1; $dd = $birth_num_month_days - $birth_num_day + $current_num_day; if($dd>$current_num_month_days) { $mm += 1; $dd -= $current_num_month_days; } } if($current_num_month < $birth_num_month) { $yy = $current_num_year - $birth_num_year - 1; $mm = $birth_num_month + $current_num_month - 1; $dd = $birth_num_month_days - $birth_num_day + $current_num_day; if($dd>$current_num_month_days) { $mm += 1; $dd -= $current_num_day; } } if($current_num_month==$birth_num_month) { if($current_num_day == $birth_num_day) { $yy = $current_num_year - $birth_num_year; $mm = 0; $dd = 0; } if($current_num_day < $birth_num_day) { $yy = $current_num_year - $birth_num_year - 1; $mm = $birth_num_month + $current_num_month - 1; $dd = $birth_num_month_days - $birth_num_day + $current_num_day; if($dd>$current_num_month_days) { $mm += 1; $dd -= $current_num_day; } } if($current_num_day>$birth_num_day) { $yy = $current_num_year - $birth_num_year; $mm = $current_num_month - 1; $dd = $birth_num_month_days - $birth_num_day + $current_num_day; if($dd>$current_num_month_days) { $mm += 1; $mm -= $current_num_month; $dd -= $current_num_month_days; } } } if($dd > 0) { $age = $dd." ".$lang['days']; } if($mm > 0) { $age = $mm . " ".$lang['months']; } if($yy > 0) { $age = $yy . " ".$lang['years']; } return $age; } /********************************************************************** FUNCTION NAME : select_user_from_audio DESCIPTION : THIS FUNCTION IS USED FOR FEATCHING ROW FROM USER TABLE. INPUT : USER ID OUTPUT : ARRAY OF SIGNLE ROW. **********************************************************************/ function select_user_from_audio($user_id) { $query_user = "select * from user where id = '$user_id' and status = 'ACTIVE'"; $result_user = mysql_query($query_user); $user_row = mysql_fetch_array($result_user); return $user_row; } /********************************************************************** FUNCTION NAME : select_channel_name DESCIPTION : THIS FUNCTION IS USED FOR FEATCHING ROW FROM CHANNEL TABLE. INPUT : CHANNEL ID OUTPUT : ARRAY OF SIGNLE ROW. AUTHOR : KIRAN PYATI **********************************************************************/ function select_channel_name($channel_id) {//kiran $query_channel = "select * from channels where id = '$channel_id' and status = 'ACTIVE'"; $result_channel = mysql_query($query_channel); $row_channel = mysql_fetch_array($result_channel); return $row_channel; } /********************************************************************** FUNCTION NAME : select_group_name DESCIPTION : THIS FUNCTION IS USED FOR FEATCHING ROW FROM GROUP TABLE. INPUT : GROUP ID OUTPUT : ARRAY OF SIGNLE ROW. AUTHOR : KIRAN PYATI **********************************************************************/ function select_group_name($group_id) {//kiran $query_group = "select * from groups where id = '$group_id' and status = 'ACTIVE'"; $result_group = mysql_query($query_group); $row_group = mysql_fetch_array($result_group); return $row_group; } /********************************************************************** FUNCTION NAME : PrevNextGenerate DESCIPTION : THIS FUNCTION IS USED FOR PAGGING. INPUT : PAGE NO , REQUEST URI , SCREIPT NAME , TOTAL PAGES. OUTPUT : CONTENT. AUTHOR : KIRAN PYATI **********************************************************************/ function PrevNextGenerate($PageNo,$RequestURI,$Script,$totalpages) { global $SITEURL; $newurl = $Script."?".preg_replace("!&PageNo=[0-9]!is","",$RequestURI); $content = " <table width=\"85%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"> <tr> <td width=\"50%\" height=\"48\">"; if($PageNo>1) { $PrevPageNo = $PageNo -1; $content .= "<div align=\"left\" ><a href=".$newurl."&PageNo=".$PrevPageNo."><img src=\"".$SITEURL."images/bt_previous.gif\" border=\"0\" alt=\"Previous Page\" align=\"absmiddle\"></a></div>"; } $content .= " </td> <td width=\"50%\" height=\"48\"> <div align=\"right\">"; if($PageNo<$totalpages) { $NextPageNo = $PageNo + 1; $LastPageNo = $totalpages; $content .= "<a href=\"".$newurl."&PageNo=".$NextPageNo."\"><img src=\"".$SITEURL."images/bt_next.gif\" border=\"0\" alt=\"Next Page\" align=\"absmiddle\"></a>"; } $content .= " </div> </td> </tr> </table>"; return $content; } /********************************************************************** FUNCTION NAME : most_member_in_group DESCIPTION : THIS FUNCTION IS USED FOR FETCHING VALES IN SORTED BY GROUP MEMBER. INPUT : OUTPUT : Array of id with sorted order.that is id hahing most membets AUTHOR : KIRAN PYATI **********************************************************************/ function most_member_in_group() { $query_group_members = "select group_members,id from groups where status = 'ACTIVE'"; $result_group_members = mysql_query($query_group_members); $num_group_member = mysql_num_rows($result_group_members); for($gm=0;$gm<$num_group_member;$gm++) { $row_group_members = mysql_fetch_array($result_group_members); $ex_gr_mem = explode(",",$row_group_members[group_members]); $cnt_gr_mem = count($ex_gr_mem); $groupMemberArray[$gm] = $cnt_gr_mem; $groupMemberIdArray[$gm] = $row_group_members[id]; } $sort_group_member = array_multisort($groupMemberArray,SORT_DESC,$groupMemberIdArray); return $groupMemberIdArray; } /********************************************************************** FUNCTION NAME : most_audio_in_group DESCIPTION : THIS FUNCTION IS USED FOR FETCHING VALES IN SORTED BY GROUP AUDIO. INPUT : OUTPUT : Array of id with sorted order.that is id having most AUDIO **********************************************************************/ function most_audio_in_group() { $query_group_audio = "select group_audio,id from groups where status = 'ACTIVE'"; $result_group_audio = mysql_query($query_group_audio); $num_group_audio = mysql_num_rows($result_group_audio); for($gm=0;$gm<$num_group_audio;$gm++) { $row_group_audio = mysql_fetch_array($result_group_audio); $ex_gr_audio = explode(",",$row_group_audio[group_audio]); $cnt_gr_audio = count($ex_gr_audio); $groupAudioArray[$gm] = $cnt_gr_audio; $groupAudioIdArray[$gm] = $row_group_audio[id]; } $sort_group_audio = array_multisort($groupAudioArray,SORT_DESC,$groupAudioIdArray); return $groupAudioIdArray; } /********************************************************************** FUNCTION NAME : most_topic_in_group DESCIPTION : THIS FUNCTION IS USED FOR FETCHING VALES IN SORTED BY GROUP TOPIC. INPUT : OUTPUT : Array of id with sorted order.that is id having most TOPICS AUTHOR : KIRAN PYATI **********************************************************************/ function most_topic_in_group() { $query_group_topics = "select group_topics,id from groups where status = 'ACTIVE'"; $result_group_topics = mysql_query($query_group_topics); $num_group_topics = mysql_num_rows($result_group_topics); for($gm=0;$gm<$num_group_topics;$gm++) { $row_group_topics = mysql_fetch_array($result_group_topics); $ex_gr_topics = explode(",",$row_group_topics[group_topics]); $cnt_gr_topics = count($ex_gr_topics); $groupTopicsArray[$gm] = $cnt_gr_topics; $groupTopicsIdArray[$gm] = $row_group_topics[id]; } $sort_group_topics = array_multisort($groupTopicsArray,SORT_DESC,$groupTopicsIdArray); return $groupTopicsIdArray; } /********************************************************************** FUNCTION NAME : channel_details() DESCIPTION : THIS FUNCTION IS USED FOR DISPLAYING CHANNEL NAMES WITH THERE NAMES. INPUT : CHANNELS WITH COMMA SAPERATED OUTPUT : CHANNELS NAME WITH THERE LINK TO THE PAGE CHANNELS INDEX PAGE. AUTHOR : KIRAN PYATI **********************************************************************/ function channel_details($channel) { global $SITEURL; $arr_channel=explode (",",$channel); for($dt=0;$dt<=count($arr_channel);$dt++) { $channel_name = select_channel_name($arr_channel[$dt]); $ch_nm = $channel_name[1]; $new_channel_array[$dt]="<a href=".$SITEURL."channel/channel_details?ch=c&type=viewed&id=".$arr_channel[$dt].">".$ch_nm."</a>"; } $tage=implode(",",$new_channel_array); return $tage; } function get_group_membership($id) { $query = "select * from groups where status = 'ACTIVE' and id = '$id'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $createdBy = select_user_from_audio($row[group_owner]); if($createdBy[id] == $_COOKIE[usErId]) { $member_status = "You are owner of this group."; $set_membership_flag = "owner"; } elseif($member_status == "") { $ex_gr_mem = explode(",",$row[group_members]); $cnt_gr_mem = count($ex_gr_mem); for($m=0;$m<$cnt_gr_mem;$m++) { if($ex_gr_mem[$m] == $_COOKIE[usErId]) { $member_status = "You are member of this group."; $set_membership_flag = "member"; } } } if($member_status == "") { $member_status = "Not a member."; $set_membership_flag = "unknown"; } return $set_membership_flag; } /********************************************************************** FUNCTION NAME : select_messages DESCIPTION : THIS FUNCTION IS USED FOR FEATCHING ROW FROM MESSAGE TABLE. INPUT : USER ID OUTPUT : ARRAY OF SIGNLE ROW. AUTHOR : KIRAN PYATI **********************************************************************/ function select_messages($user_id) {//kiran $query_messages = "select * from meassage where mail_to = '$user_id' and status = 'ACTIVE' and is_new = 'YES'"; $result_messages = mysql_query($query_messages); $row_messages = mysql_fetch_array($result_messages); return $row_messages; } /********************************************************************** FUNCTION NAME : user_details DESCIPTION : THIS FUNCTION IS USED FOR DISPLAYING NUM OF AUDIO, NUM OF FAVORITES ANS NO OF FRIENDS USER HAVE. INPUT : USER ID OUTPUT : OUT CONTAIN NUM OF AUDIO, NUM OF FAVORITES ANS NO OF FRIENDS USER HAVE. **********************************************************************/ function user_details($user_id) { global $SITEURL; global $lang; ?> <DIV style="FONT-SIZE: 12px; PADDING-BOTTOM: 5px"> <? $user = select_user_from_audio($user_id); $query_audio = "select id from audio where status = 'ACTIVE' and user_id = '$user[id]'"; $result_audio = mysql_query($query_audio); $num_audio = mysql_num_rows($result_audio); $query_friends = "select id from friends where status = 'CONFIRM' and deleted = 'NO' and user_id = '$user[id]'"; $result_friends = mysql_query($query_friends); $num_friends = mysql_num_rows($result_friends); $ex_fav = explode(",",$user[favourites]); $cnt_fav = count($ex_fav); if($ex_fav[0] == '') $cnt_fav = 0; ?> <a href="<?php echo $SITEURL ?>myaudio?ch=u&user_id=<?php echo $user[id] ?>&fla=audio"> <? echo $lang['Audio']; ?> </a> (<?php echo $num_audio ?>) | <a href="<?php echo $SITEURL ?>myfavorites?user_id=<?php echo $user[id] ?>"> <? echo $lang['Favorites']; ?> </a> (<?php echo $cnt_fav ?>) | <a href="<?php echo $SITEURL ?>myfriends?user_id=<?php echo $user[id] ?>"> <? echo $lang['Friends']; ?> </a> (<?php echo $num_friends ?>) </DIV> <? } /********************************************************************** FUNCTION NAME : user_details DESCIPTION : TO DISPLAY HEADER FOR MESSAGE PAGES. INPUT : OUTPUT : HEADER FOR MESSAGES AUTHOR : KIRAN PYATI **********************************************************************/ function message_header() { global $SITEURL; global $lang; ?> <tr> <td width="90%" align="center" valign="top"><a href="mymessages?ch=i" class="whitelink"> <? echo $lang['Inbox_Messages']; ?> </a> | <a href="myoutbox?ch=i" class="whitelink"> <? echo $lang['Outbox_Messages']; ?> </a></td> </tr> <?php } /********************************************************************** FUNCTION NAME : audio_details DESCIPTION : TO DISPLAY AUDIO DETIALS. INPUT : OUTPUT : VIDEO DETAILS **********************************************************************/ function audio_details($whereCondition,$order_by,$sort_by,$limit_condition) { global $SITEURL; global $DEFAULT_AUDIO_IMAGE; global $lang; if($order_by ==''){ $order_by = "id"; } if($sort_by == ''){ $sort_by = "ASC"; } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php $query_top = "select * from audio where $whereCondition order by $order_by $sort_by $limit_condition"; $result_top = mysql_query($query_top); while($row_top = mysql_fetch_array($result_top)) { if($row_top['audio_image'] == '') { $display_audio_image = $DEFAULT_AUDIO_IMAGE; } else { $display_audio_image = $row_top['audio_image']; } ?> <tr> <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top"> </td> </tr> <tr> <td width="168" align="center" valign="top"> <table width="132" border="0" cellpadding="0" cellspacing="2" bgcolor="#2787EB"> <tr> <td bgcolor="#EAEEEF" valign="top"><a href="<?php echo $SITEURL ?>audios/listen?ch=v&id=<?php echo $row_top['id'] ?>"> <img src="<?php echo $SITEURL ?>audio_images/<?php echo $display_audio_image ?>" width="132" height="95" border="0"></a></td> </tr> </table> </td> <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="blue12"><a href="<?php echo $SITEURL ?>audios/listen?ch=v&id=<?php echo $row_top['id'] ?>"> <? echo $row_top['title']; ?> </a></td> </tr> <tr> <td align="left" valign="top"><? echo $row_top['embed_html']; ?></td> </tr> <?php $tags = explode(",",$row_top['tags']); $cntKK = count($tags); ?> <tr> <td align="left" valign="top"> <? echo $lang['Tags']; ?> : <?php echo tags_details($row_top['tags']); ?> </td> </tr> <tr> <td align="left" valign="top"> <? echo $lang['Channels']; ?> : <?php echo channel_details($row_top['channels']); ?> </td> </tr> <?php $added_date = $row_top['audio_date']; ?> <tr> <td align="left" valign="top"> <? echo $lang['Added_On']; ?>: <?php echo $added_date; ?> <? echo $lang['by']; ?> <a href="<?php echo $SITEURL ?>profile?user_id=<?php echo $row_top['user_id'] ?>&ch=u&fla=profile"> <?php $user = select_user_from_audio($row_top['user_id']); echo $user[username]; ?> </a> </td> </tr> <tr> <td align="left" valign="top">(<?php echo $row_top['rate'] ?> <? echo $lang['ratings']; ?> )</td> </tr> <tr> <td align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="62%" align="left"> <?php echo showRatingStars($row_top[rate],$row_top['no_of_user_rated']); ?> </td> </tr> <td width="38%" align="right"> <span class="browntext"> <? echo $lang['Runtime']; ?> : <?php echo $row_top['runtime'] ?> |</span> <?php echo $row_top['no_of_times_viewed']; echo " ".$lang['views']; ?> <span class="browntext">|</span> <?php $query_comment = "select id from comments where comment_id = '$row_top[id] and comment_type = 'AUDIO' and status = 'ACTIVE'"; $result_comment = mysql_query($query_comment); $num_comment = mysql_num_rows($result_comment); ?> <a href="<?php echo $SITEURL ?>audios/listen?ch=v&id=<?php echo $row_top['id'] ?>#comments" class="brownlink"><?php echo $num_comment ?> <? echo $lang['comments']; ?> </a></td> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <? } ?> </table> <? } /********************************************************************** FUNCTION NAME : EncodeURL DESCIPTION : Encoding an URL. INPUT : url. OUTPUT : encoded url. AUTHOR : KIRAN PYATI **********************************************************************/ function EncodeURL($url) { $url = ereg_replace("&","-",$url); return $url; } /********************************************************************** FUNCTION NAME : pagging DESCIPTION : PAGGING. INPUT : TOTAL NO OF RECORDS,DISPPLAY NO OF RESCORD ON ONE PAGE,CURRENT PAGE NO. OUTPUT : GOGOLE TYPE PAGE NUMBERS. AUTHOR : KIRAN PYATI **********************************************************************/ function pagging($pageNo,$totalRecords,$noOfRecordsToDisplay,$pageName) { $returnPage = ''; $totalpages = (int) ($totalRecords / $noOfRecordsToDisplay); if(($totalRecords % $noOfRecordsToDisplay)!=0) $totalpages++; for($i=1;$i<=$totalpages;$i++) { if($i != $pageNo) { $returnPage.= " <a href=".$pageName."&PageNo=".$i.">".$i."</a> "; } else { $returnPage.= " <strong>".$i."</strong> "; } } return $returnPage; } /********************************************************************** FUNCTION NAME : showRatingStars DESCIPTION : show stars depeninf on ratings of user. INPUT : total rate. OUTPUT : stars. AUTHOR : KIRAN PYATI **********************************************************************/ function showRatingStars($rate,$no_of_users) { global $SITEURL; $cnt = 0; $cnt = $rate / $no_of_users; $cnt = round($cnt); for($i=0;$i<$cnt;$i++) { ?> <img src="<?php echo $SITEURL ?>images/star.gif"> <? } } /******************************************************** Function from atul start here ************************************************/ function select_audio_detailes($vid) { $query_audio = "select * from audio where id='$vid' and status = 'ACTIVE'"; $result_audio = mysql_query($query_audio); $row_audio = mysql_fetch_array($result_audio); return $row_audio; } function select_channel_from_audio($channel_id) { $query_channel_desc = "select * from channels where id = '$channel_id' and status = 'ACTIVE'"; $result_channel_desc = mysql_query($query_channel_desc); $channel_row = mysql_fetch_array($result_channel_desc); return $channel_row; } function tags_details($tag) { global $SITEURL; $arr_tags=explode (",",$tag); for($dt=0;$dt<=count($arr_tags);$dt++) { $tagVar = $arr_tags[$dt]; $new_tag_array[$dt]="<a href=".$SITEURL."search?char=".$arr_tags[$dt].">".$tagVar."</a>"; } $tage=implode(", ",$new_tag_array); return $tage; } function count_number($table_name,$pass_id,$stat) { if($stat!="") { $query_num_audio="select count(*) as numaudio from $table_name where user_id='$pass_id' and status = '$stat'"; } else { $query_num_audio="select count(*) as numaudio from $table_name where user_id='$pass_id'"; } $result_num_audio=mysql_query($query_num_audio); $re=mysql_fetch_array($result_num_audio); $rr=$re[numaudio]; return $rr; } function channel_tags_details($tag) { $arr_tags = split(",",trim($tag)); for($dt12=0;$dt12<count($arr_tags);$dt12++) { $tagVar = $arr_tags[$dt12]; $new_tag_array[$dt12]="<a href='channelsearch?char=".$arr_tags[$dt12]."'>".$tagVar."</a>"; } $str=''; for($dt1=0;$dt1<=3;$dt1++) { $new_channel_t[$dt1]=$new_tag_array[$dt1]; if(trim($new_channel_t[$dt1])!="") { if($str == '') $str = $new_channel_t[$dt1]; else $str = $str. ",".$new_channel_t[$dt1]; } } return $str; } function channels_details($channelguest) { $num=0; $quer_audio="SELECT channels FROM `audio` where status = 'ACTIVE'"; $res_audio=mysql_query($quer_audio); while($row=mysql_fetch_array($res_audio)) { $arr_channel=explode (",",$row[channels]); for($ch_vi=0;$ch_vi<count($arr_channel);$ch_vi++) { if($channelguest==$arr_channel[$ch_vi]) { $num=$num+1; } } } return $num; } function channels_todays_details($channelguest) { $num=0; $mydate = date("d-m-Y"); $quer_audio="SELECT channels,audio_date FROM `audio` where status = 'ACTIVE'"; $res_audio=mysql_query($quer_audio); while($row=mysql_fetch_array($res_audio)) { $arr_channel=explode (",",$row[channels]); for($ch_vi=0;$ch_vi<count($arr_channel);$ch_vi++) { if($channelguest==$arr_channel[$ch_vi]) { if($mydate == $row[audio_date]) { $num=$num+1; } } } } return $num; } /************* Function from atul ends here ****************************/ ?> Link to comment https://forums.phpfreaks.com/topic/40935-help-with-errors/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.