Portal Home > Knowledgebase > Articles Database > how do i add html to php scripts


how do i add html to php scripts




Posted by rumrunner439, 07-24-2008, 12:19 PM
Im trying to figure out how to add some html code for two things one is a video album for my members and i have to add it to the funtions.php and the other is code for pets where members can buy ea other as pets but its in html and my site is mostly php i also want to change the messages to a better message system but i dont know how to recode my funtions to make the new code work So ill post code for some ideas if someone thinks it can be done thanks

Posted by Steve_Arm, 07-24-2008, 12:40 PM
You should post some code. You can mix html and php code.

Posted by Jatinder, 07-24-2008, 12:49 PM
You have there options for generating dynamic HTML from PHP: Embed PHP directly in HTML code. Echo HTML from within PHP code Use template system A simple pseudo template file: A template parser will then read this template file and replace template tags with some value. In the above pseudo template, {DATE} is a template tag.

Posted by greg2007, 07-25-2008, 02:00 AM
As you state "add html to php" I would guess your 'file' is mainly php. In that case you can simply 'end' php within the file, write some html, start php again. If your file is mostly HTML, and only a few bits of PHP here and there, you might use Jatinder first example. Remembering of course that if you have any php in a file, it has to be saved as a .php extention or it wont run.

Posted by Codebird, 07-25-2008, 04:09 AM
I previously used to echo html through php, but then found it easier and more controllable to embed php in html, so as an advice go with embedding php into html as Jatinder's first example

Posted by webcertain, 07-25-2008, 06:00 AM
you can also do things like; now $stuff will contain the html code, which you can use whereever.

Posted by rumrunner439, 07-27-2008, 06:24 PM
oh wow im going to have to post some code i see, i currently use efriends by alstrasoft and after 6 months of working thur the bugs im almost thinking i should use phpfox 1.6.20 gee anyone got a copy but i have tried to post my funtions.php but it had to many characters to post it here, and first i have to figure out how to fix my video_albums.php into the funtions www.x1159.com also i need to fix my messages and photo albums and i have the better code but its html so i just have to figure out how to add it thanks

Posted by rumrunner439, 07-27-2008, 06:26 PM
My video_albums.php ill have to post the funtions in two posts
's Video Album
videoalbum; $approve=$videoa->approve; $approve=if_empty($approve); $vtitle=$videoa->vtitle; show_header(); echo "
".name_header($p_id,$m_id)."
"; if($approve[$videoa_id]==1) { echo "
Report this video!
$vtitle[$videoa_id]
"; $one = "1"; $previous = $videoa_id - $one; $next = $videoa_id + $one; ob_start(); number_photos($p_id); $lastpic = ob_get_contents(); ob_end_clean(); if ($videoa_id == 0) { echo "Next

"; } elseif ($videoa_id == $lastpic) { echo "Previous"; } else { echo "Previous Next

"; } $new_page_id = $photos[$pho_id]; include("comments/comments_show.php"); include("comments/comments_form.php"); echo "
"; } else echo "

No Videos Available


"; show_footer(); }//elseif /* elseif($act=='tribe'){ //showing tribe photo album, depending on page $trb_id=form_get("trb_id"); $page=form_get("page"); if($page==''){ $page=1; } $sql_query="select name from tribes where trb_id='$trb_id'"; $name=sql_execute($sql_query,'get'); show_header(); ?>
name; ?> Photo Album
photo); //print_r($photos); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); //print_r($photos); //echo $pho_id; show_header(); echo "
".$name->name."
"; echo "
$captures[$pho_id]
"; show_footer(); }//elseif */ elseif($act=='del'){ global $base_path,$HTTP_REFERER; $m_id=cookie_get("mem_id"); $m_pass=cookie_get("mem_pass"); login_test($m_id,$m_pass); $pho_id=form_get("pho_id"); $sql_query="select videoalbum,vtitle from videoalbum where mem_id='$m_id'"; $videoa=sql_execute($sql_query,'get'); $video=$videoa->videoalbum; $approve=$videoa->approve; $approve=if_empty($approve); $vtitle=$videoa->vtitle; if(file_exists("$base_path/$videoa[$videoa_id]")) unlink("$base_path/$videoa[$videoa_id]"); /* $sql_query="select videoalbum from members where mem_id='$m_id'"; $mem=sql_execute($sql_query,'get'); if($photos[$i]==$mem->photo){ $sql_query="update members set photo='',photo_b_thumb='',photo_thumb='' where mem_id='$m_id'"; sql_execute($sql_query,''); }//if */ unset($videoa[$videoa_id]); unset($vtitle[$videoa_id]); unset($accept[$videoa_id]); $line=''; $line2=''; $line3=''; $line4=''; foreach($videoa as $p){ $line.=$p."|"; } $sql_query="update videoalbum set videoalbum='$line', where mem_id='$m_id'"; sql_execute($sql_query,''); show_screen($HTTP_REFERER); }//elseif ?>
"; }//if else { echo "No photos available"; } }//function function photo_album3($mem_id,$page,$mod){ $p_id=0; $m_id=0; $page=$page-1; $sql_query="select photo_b_thumb,capture,approve from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $approve=split("\|",$pho->approve); $approve=if_empty($approve); $start=$page*5; $end=$start+5; if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ echo ""; }//if else { echo "No photos available"; } }//function function photo_album2($mem_id,$page,$mod){ $p_id=0; $m_id=0; $page=$page-1; $sql_query="select photo_b_thumb,capture from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $start=$page*5; $end=count($photos); if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ echo ""; }//if else { echo "No photos available"; } }//function //showing user photo album function photo_album($mem_id,$page,$mod){ $page=$page-1; $sql_query="select photo_b_thumb,capture from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $start=$page*6; $end=$start+100000; if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ for($i=$start;$i<$end;$i++){ if($main->photo_b_thumb==$photos[$i]) $main_set="Main Photo"; echo ""; $main_set=""; }//for }//if else { echo "No photos available"; } }//function //showing user photo album function photo_album_count($mem_id,$page,$mod){ $page=$page-1; $cou=0; $sql_query="select photo_b_thumb,capture from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $start=$page*6; $end=$start+1000000; if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ for($i=$start;$i<$end;$i++){ $cou++; }//for }//if return $cou; }//function //Deleteing user photo album function del_album($mem_id,$page,$mod,$cid){ global $base_path,$main_url; $sql_query="select photo,photo_b_thumb,photo_thumb,capture,approve from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photo_b_thumb=split("\|",$pho->photo_b_thumb); $photo=split("\|",$pho->photo); $photo_thumb=split("\|",$pho->photo_thumb); $pho_cou=count($photo); $photo_b_thumb=if_empty($photo_b_thumb); $photo=if_empty($photo); $photo_thumb=if_empty($photo_thumb); $capture=split("\|",$pho->capture); $capture=if_empty($capture); $approve=split("\|",$pho->approve); $approve=if_empty($approve); if($pho_cou!=0){ for($i=0;$i<$pho_cou;$i++){ if($i!=$cid) { $photo_up.="|".$photo[$i]; $photo_b_thumb_up.="|".$photo_b_thumb[$i]; $photo_thumb_up.="|".$photo_thumb[$i]; $capture_up.="|".$capture[$i]; $approve_up.="|".$approve[$i]; } else { if(file_exists($base_path."/".$photo[$i])){ @unlink($base_path."/".$photo[$i]); @unlink($base_path."/".$photo_b_thumb[$i]); @unlink($base_path."/".$photo_thumb[$i]); } } if($main->photo==$photo[$i]) { $sql_query="update members set photo='no',photo_thumb='no',photo_b_thumb='no' where mem_id='$mem_id'"; sql_execute($sql_query,''); } }//for $sql_query="update photo set photo='$photo_up',photo_b_thumb='$photo_b_thumb_up',photo_thumb='$photo_thumb_up',capture='$capture_up',approve='$approve_up' where mem_id='$mem_id'"; // echo $sql_query; sql_execute($sql_query,''); }//if }//function function del_album1($mem_id,$page,$mod,$cid){ global $base_path,$main_url; $sql_query="select photo,photo_b_thumb,photo_thumb,capture from tribe_photo where trb_id='$mem_id'"; // echo $sql_query; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from tribes where trb_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photo_b_thumb=split("\|",$pho->photo_b_thumb); $photo=split("\|",$pho->photo); $photo_thumb=split("\|",$pho->photo_thumb); $pho_cou=count($photo); // $photo_b_thumb=if_empty($photo_b_thumb); // $photo=if_empty($photo); // $photo_thumb=if_empty($photo_thumb); $capture=split("\|",$pho->capture); // $capture=if_empty($capture); if($pho_cou!=0){ sql_execute($sql_query,''); for($i=0;$i<$pho_cou;$i++){ if($i!=$cid) { $photo_up.="|".$photo[$i]; $photo_b_thumb_up.="|".$photo_b_thumb[$i]; $photo_thumb_up.="|".$photo_thumb[$i]; $capture_up.="|".$capture[$i]; } else { if(file_exists("$base_path/$photos[$i]")){ @unlink("$base_path/$photos[$i]"); } } if($i!=$cid) { if($main->photo_b_thumb==$photos[$i]) { $sql_query="update tribes set photo='',photo_thumb='',photo_b_thumb='' where trb_id='$m_id'"; sql_execute($sql_query,''); } } }//for $sql_query="update tribe_photo set photo='".$photo_up."',photo_b_thumb='".$photo_b_thumb_up."', photo_thumb='".$photo_thumb_up."',capture='".$capture_up."' where trb_id='$mem_id'"; // echo $sql_query; sql_execute($sql_query,''); }//if }//function //showing tribe photo album function tribe_photo_album1($trb_id,$page){ $page=$page-1; $sql_query="select photo_b_thumb,capture from tribe_photo where trb_id='$trb_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from tribes where trb_id='$trb_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $photos=array_unset($photos,"no"); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $start=$page*5; $end=count($photos); if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ echo ""; }//if else { echo "No photos available"; } }//function function tribe_photo_album2($trb_id,$page){ $page=$page-1; $sql_query="select photo_b_thumb,capture from tribe_photo where trb_id='$trb_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from tribes where trb_id='$trb_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); //print_r($photos); $photos=array_unset($photos,"no"); $captures=split("\|",$pho->capture); $captures=if_empty($captures); //print_r($captures); $start=$page*5; $end=count($photos); if($end>count($photos)){ $end=count($photos); }//if $ii=0; if($photos!=''){ echo ""; }//if else { echo "No photos available"; } }//function function tribe_photo_album($trb_id,$page){ $page=$page-1; $sql_query="select photo_b_thumb,capture from tribe_photo where trb_id='$trb_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from tribes where trb_id='$trb_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $photos=array_unset($photos,"no"); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $start=$page*5; $end=$start+5; if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ for($i=$start;$i<$end;$i++){ echo ""; }//for }//if else { echo "No photos available."; } }//function //drop-down list of user friends function drop_friends($mem_id){ $fr=count_network($mem_id,"1","ar"); echo ""; }//foreach }//if }//function function drop_friends1($mem_id,$ti){ $fr=count_network($mem_id,"1","ar"); echo ""; }//while }//function function show_friends_deg($m_id,$limit,$inline,$page,$deg){ $friends=count_network($m_id,"$deg","ar"); $friends=if_empty1($friends); if($friends!=''){ $start=($page-1)*$limit; $end=$start+$limit; if($end>count($friends)){ $end=count($friends); } for($i=$start;$i<$end;$i++){ $frd=$friends[$i]; if(($i==0)||($i%$inline==0)) { echo ""; }//if echo ""; }//foreach }//if else { echo "

No friends.

"; }//else }//function function delete_banner($id) { $sql_query="update banners set b_exp='Y' where b_id='$id'"; sql_execute($sql_query,''); }//function function maketime ($hour,$minute,$second,$month,$date,$year){ if ($hour === false) $hour = Date ("G"); if ($minute === false) $minute = Date ("i"); if ($second === false) $second = Date ("s"); if ($month === false) $month = Date ("n"); if ($date === false) $date = Date ("j"); if ($year === false) $year = Date ("Y"); if ($year >= 1970) return mktime ($hour, $minute, $second, $month, $date, $year); // date before 1-1-1970 (Win32 Fix) $m_days = Array (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if ($year % 4 == 0 && ($year % 100 > 0 || $year % 400 == 0)) { $m_days[1] = 29; // non leap-years can be: 1700, 1800, 1900, 2100, etc. } // go backward (-), based on $year $d_year = 1970 - $year; $days = 0 - $d_year * 365; $days -= floor ($d_year / 4); // compensate for leap-years $days += floor (($d_year - 70) / 100); // compensate for non-leap-years $days -= floor (($d_year - 370) / 400); // compensate again for giant leap-years // go forward (+), based on $month and $date for ($i = 1; $i < $month; $i++) { $days += $m_days [$i - 1]; } $days += $date - 1; // go forward (+) based on $hour, $minute and $second $stamp = $days * 86400; $stamp += $hour * 3600; $stamp += $minute * 60; $stamp += $second; return $stamp; } function connections1($mem_id,$frd_id){ //anonymous if($frd_id=='0'){ $result=$result.''; } //1 user and 2 are the same elseif($mem_id==$frd_id){ $result=$result."You"; }//if else { $friend=array(); $friend=count_network($mem_id,"1","ar"); //1 degree if (is_array($friend)&&in_array($frd_id,$friend)){ $result=$result.show_online($frd_id)."You"; }//if //2 degree else { $friend=count_network($mem_id,"2","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg2=count_network($frd_id,"1","ar"); $my=count_network($mem_id,"1","ar"); if(count($my)"; show_online($result[0]);$result=$result."You"; }//if //3 degree else{ $friend=count_network($mem_id,"3","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg1=count_network($frd_id,"1","ar"); $my2=count_network($mem_id,"2","ar"); if(count($my2)"; show_online($result[0]);$result=$result.""; show_online($last);$result=$result."You"; }//if //4 degree else{ $friend=count_network($mem_id,"4","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg1=count_network($frd_id,"1","ar"); $my3=count_network($mem_id,"3","ar"); if(count($my3)"; show_online($result[0]);$result=$result.""; show_online($result1[0]);$result=$result.""; show_online($last);$result=$result."You"; }//if //no connection else{ $result=$result."No connections between You and ";show_online($frd_id); }//else }//else }//else }//else }//else return $result; }//function function show_profile_pc($mem_id,$type){ $sql_query="select * from profiles where mem_id='$mem_id'"; $pro=sql_execute($sql_query,'get'); $sql_query="select * from members where mem_id='$mem_id'"; $mem=sql_execute($sql_query,'get'); $sql_query="select trb_id from tribes where mem_id='$mem_id'"; $num=sql_execute($sql_query,'num'); $tribes=array(); if($num==0) $tribes=""; else { $res=sql_execute($sql_query,'res'); while($trb=mysql_fetch_object($res)){ array_push($tribes,$trb->trb_id); } } //basic profile if($type=="basic"){ $here_for=$pro->here_for; if($here_for!='') $here_for="".$here_for.""; if($mem->showgender=="0") $gender=""; elseif($mem->gender=="m") $gender="Male"; elseif($mem->gender=="f") $gender="Female"; else $gender=""; if($mem->showloc=="0") $location=""; else { if($mem->country!='United States'){ $location=$mem->country; } else { $sql_query="select city,state from zipdata where zipcode='$mem->zip'"; $num=sql_execute($sql_query,'num'); if($num==0){ $location=$mem->country; } else { $loc=sql_execute($sql_query,'get'); $city=strtolower($loc->city); $city=ucfirst($city); $location=$city.", ".$loc->state; } } } $interests=$pro->interests; if($interests!=''){ $split=split(",",$interests); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $interests=rtrim($interest,','); } $hometown=$pro->hometown; if($hometown!=''){ $hometown="".$hometown.""; } $schools=$pro->schools; if($schools!=''){ $split=split(",",$schools); $school=''; foreach($split as $word){ $school.="".$word.","; } $schools=rtrim($school,','); } if($mem->showage=="0"){ $age=''; } else { $birth=$mem->birthday; $age=(int)((time()-$birth)/31536000); } $description=array("Here For"=>$here_for,"Gender"=>$gender,"Age"=>$age,"Location"=>$location,"Interests"=>$interests,"Hometown"=>$hometown,"Schools"=>$schools,"Education"=>$pr o->education,"High School(s)"=>$pro->high_schools,"Film School(s)"=>$pro->film_schools,"College/University"=>$pro->college_university,"Major"=>$pro->major,"Degree(s)"=>$pro->degrees,"Year of degree"=>$pro->yearofdegree,"Special Training"=>$pro->special_training,"Special Groups"=>$pro->special_groups,"About Me"=>emoticon(htmlcode($pro->about_me))); while(list($key,$val)=each($description)){ if($val!=''){ echo ""; }//if }//while answers("bas",$mem_id); if($tribes!=''){ echo ""; }//if }//while answers("per",$mem_id); }//personal //professional elseif($type=="professional"){ $position=$pro->position; if($position!=''){ $position="".$position.""; } $company=$pro->company; if($company!=''){ $company="".$company.""; } $occupation=$pro->occupation; if($occupation!=''){ $occupation="".$occupation.""; } if($pro->industry!=''){ $sql_query="select name from industries where ind_id='$pro->industry'"; $ind=sql_execute($sql_query,'get'); $industry=$ind->name; } else { $industry=''; } $specialities=$pro->specialities; if($specialities!=''){ $split=split(",",$specialities); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $specialities=rtrim($interest,','); } $overview=$pro->overview; $skills=$pro->skills; if($skills!=''){ $split=split(",",$skills); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $skills=rtrim($interest,','); } $p_positions=$pro->p_positions; if($p_positions!=''){ $split=split(",",$p_positions); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $p_positions=rtrim($interest,','); } $p_companies=$pro->p_companies; if($p_companies!=''){ $split=split(",",$p_companies); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $p_companies=rtrim($interest,','); } $assotiations=$pro->assotiations; if($associations!=''){ $split=split(",",$assotiations); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $associations=rtrim($interest,','); } $description=array ( "Position/Title"=>$position, "Company"=>$company, "Occupation"=>$occupation, "Industry"=>$industry, "Specialties"=>$specialities, "Overview"=>$overview, "Skills"=>$skills, "Past Positions"=>$p_positions, "Past Companies"=>$p_companies, "Associations"=>$association ); while(list($key,$val)=each($description)){ if($val!=''){ echo ""; }//if }//while echo ""; }//professional }//function function answers($typ,$mem_id) { $res = sql_execute("SELECT * FROM questions WHERE q_sec='$typ' ORDER BY q_id ASC","res"); $pro = sql_execute("SELECT * FROM profiles WHERE mem_id='$mem_id'","get"); while($que=mysql_fetch_object($res)){ $ftype=$que->q_field; $id="q_".$que->q_id; $val=$pro->$id; if($val!="") { echo ""; } } } function show_friends1($m_id,$limit,$inline,$page){ $sql_query="select limitsim from members where mem_id=$m_id"; $lm=sql_execute($sql_query,'get'); $lim=$lm->limitsim; switch ($lim) { case 0: $lim=4; break; case 1: $lim=3; break; case 2: $lim=2; break; case 3: $lim=1; break; } //echo $limit."!!!!!!!!!!!"; $friends=count_network($m_id,$lim,"ar"); if($friends!=''){ $start=($page-1)*$limit; $end=$start+$limit; if($end>count($friends)){ $end=count($friends); } for($i1=$start;$i1<$end;$i1++){ $frd=$friends[$i1]; if(($i1==0)||($i1%$inline==0)){}//if echo ""; $f=1; $i=0; do { $pos=strpos($n,"icon_arrow_blue.gif"); if ($pos){ $n = substr ($n,$pos+1); $i++; }else {$f=0;} }while($f==1); //echo $i; $sql_query="select limitsim from members where mem_id=$frd"; $lim=sql_execute($sql_query,'get'); $limit=$lim->limitsim; switch ($limit) { case 0: $limit=4; break; case 1: $limit=3; break; case 2: $limit=2; break; case 3: $limit=1; break; } if ($i==0){$i=4;} if ( $i <=$limit){ show_online1($frd);} }//foreach }//if else { echo "

No friends.

"; }//else }//function function show_online1($m_id){ $sql_query="select fname,lname,online,mem_id from members where mem_id='$m_id'"; //echo $sql_query; $mem=sql_execute($sql_query,'get'); if($mem->online=='on'){ echo ""; $sql_query="select * from members where mem_id='$m_id'"; $mem1=sql_execute($sql_query,'get'); $now=time(); $was=$mem1->birthday; $y=@date("Y",$now); $m=@date("m",$was); $d=@date("d",$was); $birth_in_this=mktime(0,0,0,$m,$d,$y); $dif=$birth_in_this-$now; $dif=round($dif/(60*60*24)); } else { echo ""; $sql_query="select * from members where mem_id='$m_id'"; $mem1=sql_execute($sql_query,'get'); $now=time(); $was=$mem1->birthday; $y=@date("Y",$now); $m=@date("m",$was); $d=@date("d",$was); $birth_in_this=mktime(0,0,0,$m,$d,$y); $dif=$birth_in_this-$now; $dif=round($dif/(60*60*24)); } } //showing user main photo function get_education_drop() { return ' '; } function htmlcode($string) { $string=eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","",$string); $string=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","\\1",$string); $string=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","\\1",$string); $string=eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","\\1",$string); $string=eregi_replace("\\[strike\\]([^\\[]*)\\[/strike\\]","\\1",$string); $string=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","\\1",$string); $string=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","\\1",$string); $string=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","\\1",$string); $string=eregi_replace("\\[url=http://([^\\[]+)\\]([^\\[]*)\\[/url\\]","\\2",$string); $string=eregi_replace("\[br\]", '
', $string); return $string; } function remove_script($str) { $str = eregi_replace("\\
Posted by rumrunner439, 07-27-2008, 06:39 PM
First half of my funtions code b_img); $tmp_count=count($tmp); $ext=strtolower($tmp[$tmp_count-1]); if($ext=="swf") { $img_s=" "; } else $img_s="".stripslashes($row->b_desc).""; $dis[]="".$img_s.""; $dis_id[]=$row->b_id; } $tak=rand(0,$num); $sql_query="select * from banners where b_id='$dis_id[$tak]'"; $num=sql_execute($sql_query,'num'); if($num!=0) { $bann=sql_execute($sql_query,'get'); $d_f=date("d",$bann->b_f_day); $m_f=date("m",$bann->b_f_day); $y_f=date("Y",$bann->b_f_day); $d_t=date("d",$bann->b_t_day); $m_t=date("m",$bann->b_t_day); $y_t=date("Y",$bann->b_t_day); // $f_day=mktime(0,0,0,$m_f,$d_f,$y_f); // $t_day=mktime(0,0,0,$m_t,$d_t,$y_t); $f_day=mktime(0,0,0,$m_f,$d_f,$y_f); $t_day=mktime(0,0,0,$m_t,$d_t,$y_t); $today=mktime(0,0,0,date("m"),date("d"),date("Y")); if(($bann->b_dur=="D") and ($today>$t_day)) { delete_banner($dis_id[$tak]); } elseif($bann->b_dur=="C" and ($bann->b_ncl<=$bann->b_clks)) { delete_banner($dis_id[$tak]); } elseif($bann->b_dur=="I" and ($bann->b_noi<=$bann->b_see)) { delete_banner($dis_id[$tak]); } echo $dis[$tak]; for($i=0; $i<=$ip_co; $i++) { mysql_query("update banners set b_see=b_see+1 where b_id='$dis_id[$tak]'"); } } } } function f_banners() { global $cookie_url,$main_url; $sql="select * from banners where b_blk='N' and b_typ='F' and b_exp='N'"; $res=mysql_query($sql); $dis=array(); $dis_id=array(); $num=mysql_num_rows($res); if(mysql_num_rows($res)) { while($row=mysql_fetch_object($res)) { $tmp=explode(".",$row->b_img); $tmp_count=count($tmp); $ext=strtolower($tmp[$tmp_count-1]); if($ext=="swf") { $img_s=" "; } else $img_s="".stripslashes($row->b_desc).""; $dis[]="".$img_s.""; $dis_id[]=$row->b_id; } $tak=rand(0,$num); $sql_query="select * from banners where b_id='$dis_id[$tak]'"; $num=sql_execute($sql_query,'num'); if($num!=0) { $bann=sql_execute($sql_query,'get'); $d_f=date("d",$bann->b_f_day); $m_f=date("m",$bann->b_f_day); $y_f=date("Y",$bann->b_f_day); $d_t=date("d",$bann->b_t_day); $m_t=date("m",$bann->b_t_day); $y_t=date("Y",$bann->b_t_day); // $f_day=mktime(0,0,0,$m_f,$d_f,$y_f); // $t_day=mktime(0,0,0,$m_t,$d_t,$y_t); // $today=mktime(0,0,0,date("m"),date("d"),date("Y")); $f_day=mktime(0,0,0,$m_f,$d_f,$y_f); $t_day=mktime(0,0,0,$m_t,$d_t,$y_t); $today=mktime(0,0,0,date("m"),date("d"),date("Y")); if(($bann->b_dur=="D") and ($today>$t_day)) { delete_banner($dis_id[$tak]); } elseif($bann->b_dur=="C" and ($bann->b_ncl<=$bann->b_clks)) { delete_banner($dis_id[$tak]); } elseif($bann->b_dur=="I" and ($bann->b_noi<=$bann->b_see)) { delete_banner($dis_id[$tak]); } echo $dis[$tak]; for($i=0; $i<=$ip_co; $i++) { mysql_query("update banners set b_see=b_see+1 where b_id='$dis_id[$tak]'"); } } } } function mailing($to,$name,$from,$subj,$body) { global $SERVER_NAME,$admin_mail; $subj=nl2br($subj); $body=nl2br($body); $recipient = $to; $headers = "From: $name <$from>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Return-Path: <$admin_mail>\n"; $headers .= "Content-Type: text/html;\n"; $headers .= "X-Mailer: PHP/" . phpversion(); ini_set("sendmail_from", $from); mail("$recipient","$subj","$body","$headers","-r $from"); } function form_get($value){ global $HTTP_POST_VARS,$HTTP_GET_VARS,$_SERVER; $REQUEST_METHOD=$_SERVER["REQUEST_METHOD"]; if($REQUEST_METHOD=='POST') $get_value=$HTTP_POST_VARS["$value"]; elseif($REQUEST_METHOD=='GET') $get_value=$HTTP_GET_VARS["$value"]; return addslashes_deep($get_value); } function addslashes_deep($value) { $value = is_array($value) ? array_map('addslashes_deep', $value) : addslashes($value); return $value; } function cookie_get($name){ global $HTTP_COOKIE_VARS; return $HTTP_COOKIE_VARS[$name]; } //require file, depending on mode function check($mode){ global $cookie_url,$main_url; $modules=array("article","blog_url","blogs","calendar","chkuser","events","forums","help","im","iml","imv","join","listing","login","main","messages", "paypal","paystat","people_card","photo_album","privacy","profile","rank","recent_view","search","terms","tour","tribe","update_paypal","user","forgot ","tacs","widgets"); if(isset($mode)) if(in_array($mode,$modules)) $document=$mode.".php"; else $document="main.php"; else $document="main.php"; require("$document"); } //require admin file, depending on mode function ad_check($mode){ if(isset($mode)){ $document=$mode.".php"; } else{ $document="main.php"; } require("admin/$document"); } //require calendar file, depending on mode function cal_check($mode){ if(isset($mode)){ $document=$mode.".php"; } else{ $document="calendar.php"; } require("calendar/$document"); } //printing java code for listing categories function listing_cats_java($mod){ $sql_query="select * from categories"; $res=sql_execute($sql_query,'res'); while($cat=mysql_fetch_object($res)){ if($mod==1){ echo "; listCategory.setDefaultOption('$cat->cat_id','$cat->cat_id'); listCategory.addOptions('$cat->cat_id','Select Subcategory','$cat->cat_id'"; } elseif($mod==2){ $nex=$cat->cat_id+1; echo " listmessage_categoryId.setDefaultOption('$cat->cat_id','$nex'); listmessage_categoryId.addOptions('$cat->cat_id'"; } $sql_query="select * from sub_categories where cat_id='$cat->cat_id'"; $res2=sql_execute($sql_query,'res'); while($sub=mysql_fetch_object($res2)){ echo ",'$sub->name','$sub->sub_cat_id'"; }//while echo ");"; }//while }//function // Returnds the curent page number on a multipage display function getpage(){ if(!isset($_GET['page'])) $page=1; else $page=$_GET['page']; return $page; } function getpages(){ if(!isset($_GET['page'])) $page=1; else $page=$_GET['page']; return $page; } //Displays the page numbers function show_page_nos($sql,$url,$lines,$page){ $tmp =explode("LIMIT",$sql); if(count($tmp)<1) $tmp =explode("limit",$sql); $pgsql =$tmp[0]; include 'show_pagenos.php'; } //Formats The Date function format_date($date,$time=0){ $tmp =explode(" ",$date); $date2 =explode("-",$tmp[0]); $date =$date2[1]."-".$date2[2]."-".$date2[0]; if($time) return $date." ".$tmp[1]; else return $date; } //just printing listing cats list function listing_cats($sel){ $sql_query="select * from categories"; $res=sql_execute($sql_query,'res'); while($cat=mysql_fetch_object($res)){ if($cat->cat_id=="$sel"){ echo ""; } else{ echo ""; } }//while }//function //admin header function show_ad_header($adsess){ $mode=form_get("mode"); $act=form_get("act"); ?> Site Administration "; }//if echo ""; }//foreach }//if else { echo "

No friends.

"; }//else }//function //showing pages line (if the output is too big, for ex. search results are split into several pages) function pages_line($id,$type,$page,$limit){ //spliting friends list if($type=='friends'){ $friends=count_network($id,"1","num"); if($friends!='0'){ if($friends%$limit==0){ $pages=$friends/$limit; }//if else { $pages=(int)($friends/$limit)+1; }//else $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if($i==$page){ echo ""; } echo $first.$i.$mid."$i".$last." "; if($i==$page){ echo ""; } }//for echo "   "; if($pages!=$page){ echo $first.($page+1).$mid.">".$last." "; }//if echo $first.$pages.$mid.">>".$last." "; }//if }//if if($type=='friends2'){ $friends=count_network($id,"2","num"); if($friends!='0'){ if($friends%$limit==0){ $pages=$friends/$limit; }//if else { $pages=(int)($friends/$limit)+1; }//else $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if($i==$page){ echo ""; } echo $first.$i.$mid."$i".$last." "; if($i==$page){ echo ""; } }//for echo "   "; if($pages!=$page){ echo $first.($page+1).$mid.">".$last." "; }//if echo $first.$pages.$mid.">>".$last." "; }//if }//if if($type=='friends3'){ $friends=count_network($id,"3","num"); if($friends!='0'){ if($friends%$limit==0){ $pages=$friends/$limit; }//if else { $pages=(int)($friends/$limit)+1; }//else $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if($i==$page){ echo ""; } echo $first.$i.$mid."$i".$last." "; if($i==$page){ echo ""; } }//for echo "   "; if($pages!=$page){ echo $first.($page+1).$mid.">".$last." "; }//if echo $first.$pages.$mid.">>".$last." "; }//if }//if if($type=='friends4'){ $friends=count_network($id,"4","num"); if($friends!='0'){ if($friends%$limit==0){ $pages=$friends/$limit; }//if else { $pages=(int)($friends/$limit)+1; }//else $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if($i==$page){ echo ""; } echo $first.$i.$mid."$i".$last." "; if($i==$page){ echo ""; } }//for echo "   "; if($pages!=$page){ echo $first.($page+1).$mid.">".$last." "; }//if echo $first.$pages.$mid.">>".$last." "; }//if }//if if($type=='friendsall'){ $friends=count_network($id,"all","num"); if($friends!='0'){ if($friends%$limit==0){ $pages=$friends/$limit; }//if else { $pages=(int)($friends/$limit)+1; }//else $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if($i==$page){ echo ""; } echo $first.$i.$mid."$i".$last." "; if($i==$page){ echo ""; } }//for echo "   "; if($pages!=$page){ echo $first.($page+1).$mid.">".$last." "; }//if echo $first.$pages.$mid.">>".$last." "; }//if }//if //spliting members list elseif($type=='members'){ $membs=tribe_members($id); $members=count($membs); if($members!='0'){ if($members%$limit==0) $pages=$members/$limit; else $pages=(int)($members/$limit)+1; $first=""; $last=""; echo $first."1".$mid."<<".$last." "; if($page!='1'){ echo $first.($page-1).$mid."<".$last; }//if echo "   "; for($i=1;$i<=$pages;$i++){ if
<?=$site_name?> skin==0) $s->file=$p_id.".css"; if($s->skin!=1) echo "file."\" type=\"text/css\" rel=\"stylesheet\">"; } if($mode=="user"){ ?> error; $detailes_line=$err->detailes; show_header(); require('error.php'); show_footer(); exit(); } //complete pages function complete_screen($comid){ $sql_query="select * from complete where cmp_id='$comid'"; $cmp=sql_execute($sql_query,'get'); $header_line=$cmp->complete; $detailes_line=$cmp->detailes; show_header(); require('complete.php'); show_footer(); exit(); } //checkin user login info function login_test($mem_id,$mem_pass){ global $conf; $sql_query="select password,ban,mem_acc,amount,deducted from members where mem_id='$mem_id' and mem_id>0"; $num=sql_execute($sql_query,'num'); $mem=sql_execute($sql_query,'get'); //if password incorrect $adsess=form_get("adsess"); if($adsess!="") admin_test($adsess); else { $mode=form_get("mode"); $act=form_get("act"); $pack = sql_execute("SELECT package_amt,onetime,period,vphoto FROM member_package WHERE package_id='".$mem->mem_acc."'","get"); if(($num==0)||($mem_pass!=$mem->password)){ error_screen(0); } //if user banned elseif($mem->ban=='y'){ error_screen(12); } if(!$pack->onetime && $pack->package_amt>0){ if((time()-$mem->deducted)>($pack->period*86400)) if($mem->amount>$pack->package_amt) deduct($mem_id); elseif(($mode!="user" && $act!="profile")&&($mode!="login" && $act!="home")) error_screen(37); } $mem=sql_execute($sql_query,'get'); if(($mode!="user" && $act!="profile")&&($mode!="login" && $act!="home")&&($pack->package_amt>0)) if($mem->amount<$conf['min_balance']) error_screen(39); if($mode=="photo_album" && $pack->vphoto=='0') error_screen(40); //updating db (setting user in online mode) $now=time(); $was=$now-60*20; $sql_query="update members set current='$now' where mem_id='$mem_id'"; sql_execute($sql_query,''); $sql_query="update members set online='off' where current < $was"; sql_execute($sql_query,''); } } //checkin admin session key function admin_test($session){ $time=time(); $interval=$time-3600*24; $sql_query="delete from admin where started < $interval"; @sql_execute($sql_query,''); $sql_query="select * from admin where sess_id='$session'"; $num=@sql_execute($sql_query,'num'); if($num==0) error_screen(24); } //sending messages, depending on message id function messages($to,$mid,$data){ global $system_mail,$site_name; if($mid==7){ $subject=$data[0]; $body=$data[1]; $name=$data[2]; $from_mail=$data[3]; }//if else{ $sql_query="select * from messages where mes_id='$mid'"; $mes=sql_execute($sql_query,'get'); $subject=$mes->subject; $body=$mes->body; //replacing templates $body=ereg_replace("\|email\|","$data[0]",$body); $body=ereg_replace("\|password\|","$data[1]",$body); $body=ereg_replace("\|link\|","$data",$body); $body=ereg_replace("\|subject\|","$data[0]",$body); $body=ereg_replace("\|message\|","$data[1]",$body); $body=ereg_replace("\|user\|","$data[0]",$body); $subject=ereg_replace("\|email\|","$data[0]",$subject); $subject=ereg_replace("\|password\|","$data[1]",$subject); $subject=ereg_replace("\|link\|","$data",$subject); $subject=ereg_replace("\|subject\|","$data[0]",$subject); $subject=ereg_replace("\|message\|","$data[1]",$subject); $subject=ereg_replace("\|user\|","$data[0]",$subject); $name=$site_name; $from_mail=$system_mail; }//else $subject=stripslashes($subject); $body=stripslashes($body); $sql_query="select notifications from members where email='$to'"; $num=sql_execute($sql_query,'num'); if($num>0){ $mem=sql_execute($sql_query,'get'); if($mem->notifications=='1'){ $stat=1; } else { $stat=0; } } else { $stat=1; } if(($stat==1)||($mid<4)){ mailing($to,$name,$from_mail,$subject,$body); } } //deleting empty values of array function if_empty($data){ $flag=0; if($data==''){ return ''; }//if else{ $result=array(); $i=0; foreach($data as $val){ if((isset($val))&($i!=0)&($val!="")){ //if(!$val){ $flag=1; array_push($result,$val); }//if $i++; }//foreach if($flag==0){ return ''; }//elseif else { return $result; }//else }//else }//function function if_empty1($data){ $flag=0; if($data==''){ return ''; }//if else{ $result=array(); $i=0; foreach($data as $val){ if($val){ //if(!$val){ $flag=1; array_push($result,$val); }//if $i++; }//foreach if($flag==0){ return ''; }//elseif else { return $result; }//else }//else }//function //showing country drop-down list function country_drop(){ ?> $i\n"; } else { echo "
"; echo ""; echo ""; echo "
"; if(($lst->privacy=='y')||($lst->anonim=='y')){ echo ""; }//if else { show_photo($lst->mem_id); }//else echo "
"; if($lst->anonim!='y'){ show_online($lst->mem_id); } else{ echo "anonymous"; } echo "
".stripslashes($lst->title)."
$date - $cat->name - $sub->name
".stripslashes($lst->descr_part)." more
"; if($lst->anonim!='y'){ connections($m_id,$lst->mem_id); } echo "
"; if($i==5){ break; } $i++; }//if }//while }//if }//else }//if }//if //profile section listings from user and friends elseif($mode=='inprofile'){ $friends=array(); $friends=count_network($m_id,"1","ar"); $sql_query="select * from listings where (mem_id='$m_id'"; if($friends!=''){ foreach($friends as $fr){ $sql_query.=" or mem_id='$fr'"; }//foreach }//if $sql_query.=") and stat='a' order by added"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "

No listings available

 "; }//if else { $res=sql_execute($sql_query,'res'); while($lst=mysql_fetch_object($res)){ $date=date("m/d",$lst->added); echo "$date ".stripslashes($lst->title).""; $c_name=get_cat_name($lst->cat_id); echo " ($c_name) - "; show_online($lst->mem_id); echo "
"; }//while }//else }//elseif //showing user's listings elseif($mode=='my'){ $sql_query="select * from listings where mem_id='$m_id' and stat='a'"; $sql_query.=" order by added"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "No listings available"; }//if else { $res=sql_execute($sql_query,'res'); while($lst=mysql_fetch_object($res)){ $date=date("m/d",$lst->added); echo "$date ".stripslashes($lst->title).""; $c_name=get_cat_name($lst->cat_id); echo " ( $c_name) - ";show_online($lst->mem_id); echo "
"; }//while }//else }//elseif //showing one category listings elseif($mode=='cat'){ $cid=form_get('cat_id'); $start=($page-1)*20; $sql_query="select * from listings where cat_id='$cid' and stat='a'"; $sql_query.=" order by added limit $start,20"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "No listings available"; }//if else { $res=sql_execute($sql_query,'res'); while($lst=mysql_fetch_object($res)){ if($lst->show_deg!='trb'){ if(($lst->show_deg!='any')&&($lst->mem_id!=$m_id)){ $lister_friends=lister_degree($lst->mem_id,$lst->show_deg); } else{ $lister_friends[]=$m_id; } if((in_array($m_id,$lister_friends))||($lst->anonim=='y')){ $date=date("m/d",$lst->added); echo "$date ".stripslashes($lst->title)." "; if($lst->anonim!='y'){ show_online($lst->mem_id);echo " - "; } else{ echo "anonymous"; } echo find_relations($m_id,$lst->mem_id); echo "
"; }//if }//if }//while }//else }//elseif //showing one sub-category listings elseif($mode=='sub_cat'){ $sid=form_get('sub_cat_id'); $start=($page-1)*20; $sql_query="select * from listings where sub_cat_id='$sid' and stat='a'"; $sql_query.=" order by added limit $start,20"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "No listings available"; }//if else { $res=sql_execute($sql_query,'res'); while($lst=mysql_fetch_object($res)){ if($lst->show_deg!='trb'){ if(($lst->show_deg!='any')&&($lst->mem_id!=$m_id)){ $lister_friends=lister_degree($lst->mem_id,$lst->show_deg); } else{ $lister_friends[]=$m_id; } if((in_array($m_id,$lister_friends))||($lst->anonim=='y')){ $date=date("m/d",$lst->added); echo "$date ".stripslashes($lst->title)." "; if($lst->anonim!='y'){ show_online($lst->mem_id); } else{ echo "anonymous"; } echo " - ";echo find_relations($m_id,$lst->mem_id); echo "
"; }//if }//if }//while }//else }//elseif //showing tribe listings elseif($mode=='tribe'){ $sql_query="select * from listings where trb_id='$m_id' and stat='a'"; $sql_query.=" order by added"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "No listings available"; }//if else { $res=sql_execute($sql_query,'res'); while($lst=mysql_fetch_object($res)){ $date=date("m/d",$lst->added); echo "$date ".stripslashes($lst->title).""; $c_name=trim(get_cat_name($lst->cat_id)); echo " ($c_name) - "; show_online($lst->mem_id); echo "
"; }//while }//else }//elseif }//function //searching degree between 2 users function find_relations($mem_id,$frd_id){ if($frd_id=='0'){ return ''; } if($mem_id==$frd_id){ return 'You'; }//if else { $fr1=count_network($mem_id,"1","ar"); if(is_array($fr1)&&in_array($frd_id,$fr1)){ return "1°"; }//if else { $fr2=count_network($mem_id,"2","ar"); if(is_array($fr2)&&in_array($frd_id,$fr2)){ return "2°"; }//if else { $fr3=count_network($mem_id,"3","ar"); if(is_array($fr3)&&in_array($frd_id,$fr3)){ return "3°"; }//if else { $fr4=count_network($mem_id,"4","ar"); if(is_array($fr4)&&in_array($frd_id,$fr4)){ return "4°"; }//if else{ return "(unrelated)"; }//else }//else }//else }//else }//else }//function //building a connection chain between 2 user's function connections($mem_id,$frd_id){ //anonymous if($frd_id=='0'){ echo ''; } //1 user and 2 are the same elseif($mem_id==$frd_id){ echo "You"; }//if else { $friend=array(); $friend=count_network($mem_id,"1","ar"); //1 degree if (is_array($friend)&&in_array($frd_id,$friend)){ echo show_online($frd_id)."You"; }//if //2 degree else { $friend=count_network($mem_id,"2","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg2=count_network($frd_id,"1","ar"); $my=count_network($mem_id,"1","ar"); if(count($my)"; show_online($result[0]);echo "You"; }//if //3 degree else{ $friend=count_network($mem_id,"3","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg1=count_network($frd_id,"1","ar"); $my2=count_network($mem_id,"2","ar"); if(count($my2)"; show_online($result[0]);echo ""; show_online($last);echo "You"; }//if //4 degree else{ $friend=count_network($mem_id,"4","ar"); if(is_array($friend)&&in_array($frd_id,$friend)){ $deg1=count_network($frd_id,"1","ar"); $my3=count_network($mem_id,"3","ar"); if(count($my3)"; show_online($result[0]);echo ""; show_online($result1[0]);echo ""; show_online($last);echo "You"; }//if //no connection else{ echo "No connections between You and ";show_online($frd_id); }//else }//else }//else }//else }//else }//function //searching zip codes within specified radius function inradius($zip,$radius) { $sql_query="SELECT * FROM zipdata WHERE zipcode='$zip'"; $num=sql_execute($sql_query,'num'); if($num==0){ return "not found"; }//if else { $zp=sql_execute($sql_query,'get'); $lat=$zp->lat; $lon=$zp->lon; $sql_query="SELECT zipcode FROM zipdata WHERE (POW((69.1*(lon-\"$lon\")*cos($lat/57.3)),\"2\")+POW((69.1*(lat-\"$lat\")),\"2\"))<($radius*$radius) "; $num2=sql_execute($sql_query,'num'); if($num2>0){ $res=sql_execute($sql_query,'res'); $i=0; while($found=mysql_fetch_object($res)) { $zipArray[$i]=$found->zipcode; $i++; }//while }//if else { return "no result"; }//else }//else return $zipArray; } // end func //showing one user friends function show_friends($m_id,$limit,$inline,$page){ $friends=count_network($m_id,"1","ar"); if($friends!=''){ $start=($page-1)*$limit; $end=$start+$limit; if($end>count($friends)){ $end=count($friends); } for($i=$start;$i<$end;$i++){ $frd=$friends[$i]; if(($i==0)||($i%$inline==0)) { echo "
"; echo "
"; show_photo($frd); echo "
"; show_online($frd); echo "

"; }//if echo ""; }//foreach }//if else { echo "

No members.

"; }//else }//function //showing topics of tribe discussion board function show_board($trb_id){ $sql_query="select * from board where trb_id='$trb_id'"; $res=sql_execute($sql_query,'res'); echo ""; while($brd=mysql_fetch_object($res)){ $sql_query="select rep_id,added from replies where top_id='$brd->top_id' order by added desc"; $num=sql_execute($sql_query,'num'); $res2=sql_execute($sql_query,'res'); $one=mysql_fetch_object($res2); if($one->added==''){ $one->added=$brd->added; } $last_post=date("m/d/Y",$one->added); echo ""; }//while }//function //showing tribe events list function show_events($trb_id){ $sql_query="select * from events where trb_id='$trb_id'"; $res=sql_execute($sql_query,'res'); while($evn=mysql_fetch_object($res)){ $date=date("m/d/Y",$evn->start_date); echo "".stripslashes($evn->title)." $date"; $start_time=date("h:i A",$evn->start_time); if($evn->start_time!='0'){ echo " @ $start_time "; } echo "
"; }//while }//function function show_files($trb_id) { $get=sql_execute("SELECT files FROM tribes WHERE trb_id='$trb_id'","get"); $files=split("\|",$get->files); if($files!='') { foreach($files as $f) { echo "".$f."
"; } } } //function //user friends drop-down list function drop_mem_tribes($mem_id,$sel){ $sql_query="select tribes from members where mem_id='$mem_id'"; $mem=sql_execute($sql_query,'get'); $tribes=split("\|",$mem->tribes); $tribes=if_empty($tribes); if($tribes!=''){ foreach($tribes as $trb){ $sql_query="select name from tribes where trb_id='$trb'"; $name=sql_execute($sql_query,'get'); if($trb==$sel){ echo ""; }//if }//while if($groups!=''){ echo ""; }//if }//while answers("per",$mem_id); }//personal //professional elseif($type=="professional"){ $position=$pro->position; if($position!=''){ $position="".$position.""; } $company=$pro->company; if($company!=''){ $company="".$company.""; } $occupation=$pro->occupation; if($occupation!=''){ $occupation="".$occupation.""; } if($pro->industry!=''){ $sql_query="select name from industries where ind_id='$pro->industry'"; $ind=sql_execute($sql_query,'get'); $industry=$ind->name; } else $industry=''; $specialities=$pro->specialities; if($specialities!=''){ $split=split(",",$specialities); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $specialities=rtrim($interest,','); } $overview=$pro->overview; $skills=$pro->skills; if($skills!=''){ $split=split(",",$skills); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $skills=rtrim($interest,','); } $p_positions=$pro->p_positions; if($p_positions!=''){ $split=split(",",$p_positions); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $p_positions=rtrim($interest,','); } $p_companies=$pro->p_companies; if($p_companies!=''){ $split=split(",",$p_companies); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $p_companies=rtrim($interest,','); } $assotiations=$pro->assotiations; if($associations!=''){ $split=split(",",$assotiations); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $assotiations=rtrim($interest,','); } $description=array ( "Position/Title"=>$position, "Company"=>$company, "Occupation"=>$occupation, "Industry"=>$industry, "Specialties"=>$specialities, "Overview"=>$overview, "Skills"=>$skills, "Past Positions"=>$p_positions, "Past Companies"=>$p_companies, "Associations"=>$assotiations); while(list($key,$val)=each($description)){ if($val!=''){ echo ""; }//if }//while answers("pro",$mem_id); }//professional }//function //shows testimonials on user function show_testimonials($p_id,$m_id){ $sql_query="select * from testimonials where mem_id='$p_id' and stat='a'"; $num=sql_execute($sql_query,'num'); if($num==0){ echo "

";echo name_header($p_id,$m_id);echo " has no testimonials.

"; } else { $res=sql_execute($sql_query,'res'); while($tst=mysql_fetch_object($res)){ echo "
Posted by rumrunner439, 07-27-2008, 06:41 PM
second half of my funtions now i have to figure out how to get the video_albums.php to work right now all im getting is a login screen with my video_albums.php }//function //showing number of new discussion board posts since last user's visit function tribe_new_posts($mem_id,$trb_id){ $visit=cookie_get("$trb_id"); if($visit==''){ $visit=0; } $sql_query="select top_id from board where trb_id='$trb_id' and added>$visit"; $num=sql_execute($sql_query,'num'); if($num==0){ return "no new posts"; }//if else { return "$num new posts read"; }//else }//function //returns tribe's members array function tribe_members($trb_id){ $sql_query="select members from tribes where trb_id='$trb_id'"; $trb=sql_execute($sql_query,'get'); //$trb->members=$trb->members."|"; $members=split("\|",$trb->members); //echo $members[0]; $members=if_empty1($members); return $members; }//function //shows tribe members function show_members($trb_id,$limit,$inline,$page){ $members=tribe_members($trb_id); if($members!=''){ $start=($page-1)*$limit; $end=$start+$limit; if($end>count($members)){ $end=count($members); } for($i=$start;$i<$end;$i++){ $frd=$members[$i]; if(($i==0)||($i%$inline==0)) { echo "
"; echo "
"; show_photo($frd); echo "
"; show_online($frd); echo "
TopicAuthorRepliesLast Post
".stripslashes($brd->topic)." "; echo name_header($brd->mem_id,''); echo "$num$last_post
$key$val
Network Groups"; $i=0; foreach($groups as $group){ $sql_query="select name from groups where trb_id='$group'"; $trb=sql_execute($sql_query,'get'); echo "$trb->name"; $i++; if($i!=count($groups)){ echo ", "; } } } }//basic //personal elseif($type=="personal"){ $languages=$pro->$pro->languages; if($languages!=''){ $split=split(",",$ineterests); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $languages=rtrim($ineterest,','); } $website=$pro->website; if($website!=''){ $website="".$website.""; } $books=$pro->books; if($books!=''){ $split=split(",",$books); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $books=rtrim($ineterest,','); } $music=$pro->music; if($music!=''){ $split=split(",",$music); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $music=rtrim($interest,','); } $movies=$pro->movies; if($movies!=''){ $split=split(",",$movies); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $movies=rtrim($interest,','); } $travel=$pro->travel; if($travel!=''){ $split=split(",",$travel); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $travel=rtrim($interest,','); } $clubs=$pro->clubs; if($clubs!=''){ $split=split(",",$clubs); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $clubs=rtrim($interest,','); } $about=$pro->about; $meet_people=$pro->meet_people; if($meet_people!=''){ $split=split(",",$meet_people); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $meet_people=rtrim($interest,','); } $description=array( "Languages"=>$languages, "Personal Website"=>$website, "Favorite books"=>$books, "Favorite music"=>$music, "Favorite movies/tv"=>$movies, "I've traveled to"=>$travel, "Clubs"=>$clubs, "About me"=>$about, "I want to meet people for"=>$meet_people ); while(list($key,$val)=each($description)){ if($val!=''){ echo "
$key$val
$key$val
"; $date=date("F d, Y",$tst->added); echo "
";show_photo($tst->from_id);echo "
"; show_online($tst->from_id);echo "
$date
".stripslashes($tst->testimonial)."
"; }//while }//else } //when showing form with radio or checkbox elements, functions chacks if it must be checked function checked($val,$ch){ if($val==$ch){ echo " checked "; } } function photo_album1($mem_id,$page,$mod){ $p_id=0; $m_id=0; $page=$page-1; $sql_query="select photo_b_thumb,capture,approve from photo where mem_id='$mem_id'"; $pho=sql_execute($sql_query,'get'); $sql_query="select photo_b_thumb from members where mem_id='$mem_id'"; $main=sql_execute($sql_query,'get'); $photos=split("\|",$pho->photo_b_thumb); $photos=if_empty($photos); $captures=split("\|",$pho->capture); $captures=if_empty($captures); $approve=split("\|",$pho->approve); $approve=if_empty($approve); $start=$page*5; $end=count($photos); if($end>count($photos)){ $end=count($photos); }//if if($photos!=''){ echo "
"; $p=0; for($i=$start;$i<$end;$i++){ if ($p==0){ echo ""; } $p++; echo ""; if ($p==5){ echo ""; $p=0; } }//for echo "
"; echo ($approve[$i]==1) ? "" : "Not Approved



"; echo "

$captures[$i]
"; if($mod=='edi'){ echo "Delete
Set as Main"; } echo "
"; $p=0; for($i=$start;$i<$end;$i++){ if ($p==0){ echo ""; } $p++; echo ""; if ($p==5){ echo ""; $p=0; } }//for echo "
"; echo ($approve[$i]==1) ? "" : "Not Approved"; echo "
$captures[$i]"; if($mod=='edi'){ echo "
Delete"; } echo "
"; $p=0; for($i=$start;$i<$end;$i++){ if ($p==0){ echo ""; } $p++; echo ""; if ($p==5){ echo ""; $p=0; } }//for echo "

$captures[$i]"; if($mod=='edi'){ echo "
Delete"; } echo "
"; if($mod=='edi'){ echo ""; } echo "
$main_set
$captures[$i]
Delete
"; $p=0; for($i=$start;$i<$end;$i++){ if ($p==0){ echo ""; } $p++; echo ""; echo ""; if ($p==5){ echo ""; $p=0; } }//for echo "

$captures[$i]
Delete
"; $p=0; for($i=$start;$i<$end;$i++){ $ii++; if($photos[$i]){ if ($p==0){ echo ""; } $p++; //$ii=$i-1; echo ""; echo ""; if ($p==5){ echo ""; $p=0; } } } //for echo "

$captures[$i]
Delete
$captures[$i]
"; echo "
"; show_photo($frd); echo "
"; show_online($frd); echo "
$key".stripslashes($val)."
Groups"; $i=0; foreach($tribes as $tribe){ $sql_query="select name from tribes where trb_id='$tribe'"; $trb=sql_execute($sql_query,'get'); echo "".stripslashes($trb->name).""; $i++; if($i!=count($tribes)){ echo ", "; } } } }//basic //personal elseif($type=="personal"){ $languages=$pro->$pro->languages; if($languages!=''){ $split=split(",",$ineterests); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $languages=rtrim($ineterest,','); } $website=$pro->website; if($website!=''){ if(strpos($website,"ttp:")){ $website="".$website."";}else{ $website="".$website.""; } } $books=$pro->books; if($books!=''){ $split=split(",",$books); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $books=rtrim($ineterest,','); } $music=$pro->music; if($music!=''){ $split=split(",",$music); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $music=rtrim($interest,','); } $movies=$pro->movies; if($movies!=''){ $split=split(",",$movies); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $movies=rtrim($interest,','); } $travel=$pro->travel; if($travel!=''){ $split=split(",",$travel); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $travel=rtrim($interest,','); } $clubs=$pro->clubs; if($clubs!=''){ $split=split(",",$clubs); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $clubs=rtrim($interest,','); } $about=$pro->about; $meet_people=$pro->meet_people; if($meet_people!=''){ $split=split(",",$meet_people); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $meet_people=rtrim($interest,','); } $hobby=$pro->hobby; if($hobby!=''){ $split=split(",",$hobby); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $hobby=rtrim($interest,','); } $status=$pro->status; if($status!=''){ $split=split(",",$status); $interest=''; foreach($split as $word){ $interest.="".$word.","; } $status=rtrim($interest,','); } $description=array("Languages"=>$languages, $GLOBALS['word'][125]=>$website, "Favorite books"=>$books, "Favorite music"=>$music, "Favorite movies/tv"=>$movies, "I've traveled to"=>$travel, "Clubs"=>$clubs, "Hobby"=>$hobby, "Status"=>$status, "About me"=>$about, "I want to meet people for"=>$meet_people); while(list($key,$val)=each($description)){ if($val!=''){ echo "
$key".stripslashes($val)."
$key".stripslashes($val)."
".get_media($mem_id)."
".$que->q_que.""; if($ftype=="tb" || $ftype=="ta") echo $val; else { if($ftype=="rb" || $ftype=="dd") { $ans = sql_execute("SELECT * FROM answers WHERE a_id='$val' ORDER BY a_id","get"); echo $ans->a_ans; } elseif($ftype=="cb") { $ans = sql_execute("SELECT * FROM answers WHERE a_qid = '".$que->q_id."' ORDER BY a_id ASC","res"); $val = explode("|",$val); while($row=mysql_fetch_object($ans)){ if(in_array($row->a_id,$val)) echo $row->a_ans."
"; } } } echo "