#!/usr/local/bin/php Search for $ST"; $LE["TITLE"] .= " - Search for $ST"; $output .= Module_Search(); }elseif(strlen($gmode)==1){ $JD = "Alphabetical Order ".strtoupper($gmode)."\n"; $LE["TITLE"] .= " - View Alphabetical Order ".strtoupper($gmode); $output .= Module_Alphabet(); }elseif($gmode=="add"){ $JD = "Submit Link Exchange"; $LE["TITLE"] .= " - Submit Your Link"; $output .= Module_Add(); }else{ $JD = "Last 60 Links Exchange"; $LE["TITLE"] .= " - View Last 60 Links Exchange"; $output .= Module_Index(); } $JD = "Top : \n$JD\n"; echo HTML_header(); echo $output; echo get_link_footer(false); echo HTML_footer(); ####################################################################################### # FUNCTION - FUNCTION ####################################################################################### function Module_Search(){ global $LE; global $ST; global $SCRIPT_NAME; global $arg, $L_screen, $L_pages; //$sqlE = "SELECT DISTINCT le.id AS 'LEID', le.* FROM link_exchange le, link_owner lo WHERE le.id = lo.link_id AND le.archive='N' AND lo.owner= {$LE["CLIENT"]} "; //$sqlE .= "AND (le.title LIKE '%".a_s($ST)."%' OR le.link LIKE '%".a_s($ST)."%' OR le.msg LIKE '%".a_s($ST)."%') ORDER BY le.title ASC "; $sqlE = "SELECT * FROM client WHERE le_title LIKE '%".a_s($ST)."%' OR domain LIKE '%".a_s($ST)."%' OR le_desc LIKE '%".a_s($ST)."%' ORDER BY le_title ASC "; if ($L_screen == ""){$L_screen = $arg[2]; $L_pages = $arg[3];} if ($L_screen == "") { $L_screen = 0; $result = open_mysql ("u3709_link", $sqlE); $rows = mysql_num_rows($result); $L_pages = ceil($rows / $LE["ROWS_PER_PAGE"]); $result = open_mysql("close"); } $out .= BOX_open(); $out .= "\n"; if ($L_pages>0){ $start = $L_screen * $LE["ROWS_PER_PAGE"]; $sqlE .= " LIMIT $start, {$LE["ROWS_PER_PAGE"]} "; $URL = "{$SCRIPT_NAME}/search"; $hasil = open_mysql ("u3709_link", $sqlE); open_mysql ("close"); while ($line = mysql_fetch_array($hasil, MYSQL_ASSOC)){ $out .= "\n"; } $out .= "\n"; }else{ $out .= "\n"; } $out .= "
\n"; $out .= "".s_s($line["le_title"])."
\n"; if (s_s($line["le_desc"])!=""){ $out .= smooth_cutter(s_s($line["le_desc"]),250)."
"; } $out .= "URL: http://".s_s($line["domain"]).""; $out .= "
".LE_Navigator_Slash($URL,$L_screen,$L_pages,$ST)."

"; $out .= "Sorry, your search did not match to any data.
"; $out .= "Please try another search.
"; $out .= "
\n"; $out .= BOX_close(); return $out; } function Module_Index(){ global $LE; //$sqlE = "SELECT DISTINCT le.id AS 'LEID', le.* FROM link_exchange le, link_owner lo WHERE le.id = lo.link_id AND le.archive='N' AND lo.owner= {$LE["CLIENT"]} ORDER BY created DESC LIMIT 0,30"; $sqlE = "SELECT le_title,le_desc,domain FROM client ORDER BY id DESC LIMIT 0,30"; $hasil = open_mysql ("u3709_link", $sqlE); $tot = (mysql_num_rows($hasil)/2); open_mysql ("close"); $out .= BOX_open(); $out .= "\n"; while ($line = mysql_fetch_array($hasil, MYSQL_ASSOC)){ $out .= "\n"; } $out .= "
\n"; $out .= "".s_s($line["le_title"])."
\n"; if (s_s($line["le_desc"])!=""){ $out .= smooth_cutter(s_s($line["le_desc"]),250)."
"; } $out .= "URL: http://".s_s($line["domain"]).""; $out .= "
\n"; $out .= BOX_close(); return $out; } function Module_Alphabet(){ global $LE; global $SCRIPT_NAME; global $arg, $L_screen, $L_pages; $out .= BOX_open(); $out .= "\n"; //$sqlE = "SELECT DISTINCT le.id AS 'LEID', le.* FROM link_exchange le, link_owner lo WHERE le.id = lo.link_id AND le.archive='N' AND lo.owner= {$LE["CLIENT"]} AND le.title LIKE '{$arg[1]}%' ORDER BY le.id ASC "; $sqlE = "SELECT * FROM client WHERE le_title LIKE '{$arg[1]}%' ORDER BY id ASC "; if ($L_screen == ""){$L_screen = $arg[2]; $L_pages = $arg[3];} if ($L_screen == "") { $L_screen = 0; $result = open_mysql ("u3709_link", $sqlE); $rows = mysql_num_rows($result); $L_pages = ceil($rows / $LE["ROWS_PER_PAGE"]); $result = open_mysql("close"); } $out .= "
\n"; if ($L_pages>0){ $start = $L_screen * $LE["ROWS_PER_PAGE"]; $sqlE .= " LIMIT $start, {$LE["ROWS_PER_PAGE"]} "; $URL = "{$SCRIPT_NAME}/{$arg[1]}"; $hasil = open_mysql ("u3709_link", $sqlE); open_mysql ("close"); while ($line = mysql_fetch_array($hasil, MYSQL_ASSOC)){ $out .= "\n"; } $out .= "\n"; } $out .= "
\n"; $out .= "".s_s($line["le_title"])."
\n"; if (s_s($line["le_desc"])!=""){ $out .= smooth_cutter(s_s($line["le_desc"]),250)."
"; } $out .= "URL: http://".s_s($line["domain"]).""; $out .= "
".LE_Navigator_Slash($URL,$L_screen,$L_pages,$ST)."
\n"; $out .= BOX_close(); return $out; } function Module_Add(){ global $LE; global $SCRIPT_NAME; global $HTTP_POST_VARS; if($LE["LINK_TITLE"]==""){$LE["LINK_TITLE"] = $LE["ORG_NAME"];} if($LE["LINK_DESC"]==""){$LE["LINK_DESC"] = $LE["DESCRIPTION"];} $form = <<

How to link your web site to www.kusumasarivilla.com?

Please fill in the following form and your link will be instantly on our page.
We will not exchange links with "adult" sites or sites which promote illegal or unethical acts, or not related to travel industry.
We will put your link at {$LE["LINK"]}/linkexchange/@.htm (where @ is the first character of your page title).
Please note that once we have verified our link (see below) is not displayed on your site within 1 week, we will remove your link in our page.

Link Exchange Form
Complete domain name without " http:// "
(ex: www.xxx.com) *
Your Email*
Your Page Title*
Page Description
(300 chars max)
In which exact page do you put our link
(ex. http://www.xxx.com/links.htm)*
Required field(*)

How to link www.kusumasarivilla.com to your web site?

It's easy, please use the following information:

Title : {$LE["TITLE_WEB"]}
URL : {$LE["LINK"]}
Description :
{$LE["LINK_DESC"]}



EOT; $out = ""; if ($HTTP_POST_VARS["SubmitIT"]!="Submit"){ $out .= BOX_open(); $out .= $form; $out .= BOX_close(); }else{ $out .= BOX_open(); $out .= process_submit_form($HTTP_POST_VARS); $out .= BOX_close(); } return $out; } function get_client_detail($ID){ global $LE; if ($ID+0==0){die("No Client-ID");} $sql = "SELECT * FROM client WHERE id=$ID"; $hasil = open_mysql ("u3709_link", $sql); open_mysql ("close"); $ln = mysql_fetch_array($hasil, MYSQL_ASSOC); $LE["ORG_ID"] = $ln["org_id"]; $LE["DOMAIN"] = s_s($ln["domain"]); $LE["DOMAIN_TITLE"] = s_s($ln["title"]); if (substr($LE["DOMAIN"],-1)=="/"){$LE["DOMAIN"] = substr($LE["DOMAIN"],0,-1);} $LE["LINK_TITLE"] = s_s($ln["le_title"]); $LE["LINK_DESC"] = s_s($ln["le_desc"]); } function get_search_form(){ global $LE; global $ST; global $JD; global $SCRIPT_NAME; $out = "
\n
{$JD}\n Total {$LE["TOT_LINK"]} links | Submit Link Exchange
\n \n
\n Search for title, url or link description
\n"; $out .= line(); return $out; } function get_org_header(){ global $LE; $index = "[Index Page]\n"; $out = ""; return $out.line(); } function get_alphabet_list(){ global $LE; global $SCRIPT_NAME; $sqlE = "SELECT LEFT(LTRIM(le_title),1) AS 'huruf', count(*) AS 'qty' FROM client GROUP BY 1 ORDER BY 1 ASC "; $hasil = open_mysql ("u3709_link", $sqlE); open_mysql ("close"); $out = "Alphabetical List:
"; while ($line = mysql_fetch_array($hasil, MYSQL_ASSOC)){ $url = "{$SCRIPT_NAME}/".strtolower($line["huruf"]).".htm"; if ($line["qty"]+0>1){ $alt = "There are ".$line["qty"]." links here"; }else{ $alt = "There is ".$line["qty"]." link here"; } $out .= "".strtoupper($line["huruf"])." - "; $TOT_LINK += $line["qty"]; } $LE["TOT_LINK"] = $TOT_LINK; $out = substr($out,0,-2); return line().$out; } function get_link_footer($add_alpha=true){ $out .= BOX_open(); $out .= "\n"; $out .= "\n"; $out .= "
\n"; $out .= "Bali Hotel and Villa Reservations
\n"; $out .= "BaliBagus.com Reservation directory for any type of hotels, villas and accommodation in Bali. Search your hotel, get the special rates and book, Simple and Fast!
"; $out .= "URL: http://www.balibagus.com

"; $out .= "Kusuma Sari Villa and Spa Bali
\n"; $out .= " Nestled on a hillside rice paddy and bounded by the river Bembeng, the Villa Kusuma Sari was recently completed to international standards outside a quiet historic Hindu town.
"; $out .= "URL: http://www.kusumasarivilla.com"; $out .= "

\n"; $out .= BOX_close($add_alpha); return $out; } function HTML_header(){ global $LE; global $JD; $form = get_search_form(); $org_header = get_org_header(); $out = << {$LE["TITLE"]}
{$org_header}{$form} EOT; return $out; } function HTML_footer(){ global $LE; $out = <<

© Copyright KusumaSariVilla.com 2005, All rights reserved.

EOT; return $out; } function BOX_open(){ $out = <<
 
EOT; return $out; } function BOX_close($add_alpha=true){ if($add_alpha){$alpha = get_alphabet_list();} $out = <<
 
EOT; return $out; } function line(){ $out = "

"; return $out; } function a_s($str){ return addslashes(strip_tags(trim($str))); } function s_s($str){ return stripslashes(strip_tags(trim($str))); } function LE_Navigator_Slash($URL,$Page,$Total_Pages,$teks){ $str = "
"; $str .= "
"; $str .= ""; if ($teks!=""){$q = "?t=$teks";}else{$q = "";} //********************************************************************************* // Previous Button //********************************************************************************* if ($Page > 0) { $tmp = $URL . "/" . ($Page - 1) . "/$Total_Pages.htm{$q}"; $str .= "<<"; }else{$str .= "<<";} //********************************************************************************* // Numbering Button //********************************************************************************* if ($Total_Pages > 10) {$jml = 10;} else {$jml = $Total_Pages;} for ($i = 0; $i < $jml; $i++) { if ($i == $Page) { $str .= " ".($i+1).""; }else{ $tmp = $URL . "/$i/$Total_Pages.htm{$q}"; $str .= " ".($i+1).""; } } //********************************************************************************* // Next Button //********************************************************************************* if ($Page < ($Total_Pages-1)) { $tmp = $URL . "/" . ($Page + 1) . "/$Total_Pages.htm{$q}"; $str .= " >>"; }else{$str .= " >>";} //********************************************************************************* // Page list box //********************************************************************************* $str .= "  \n \n \n"; $str .= "
\n"; return $str; } function smooth_cutter($S,$N){ $S1 = substr($S,0,$N); $S2 = substr($S,$N,$N+20); $arr = explode(" ",$S2); if (is_array($arr)){ return $S1.$arr[0].".."; }else{ return $S1.".."; } } function open_mysql ($db, $query="SELECT 1") { global $link; global $var; $user_mysql = $var["user_mysql"]; $pwd_mysql = $var["pwd_mysql"]; if ($db == "close"){ mysql_close($link); }else{ //echo $query."
"; $db = $var["db"]; $e = ""; $link = mysql_connect("localhost", $user_mysql, $pwd_mysql) or die($e . "Error: Could not connect to mysql server!
"); mysql_select_db($db,$link) or die($e . "Error: Could not select database: " . $db . "
"); $result = mysql_query($query ,$link) or die($e . "Error: Query failed
".mysql_error() ); return $result; } } function error($s){ global $LE; $LE["TITLE"] = "Error: " .$LE["TITLE"]; echo HTML_header(); echo BOX_open(); echo "

$s

\n"; echo go_back(); echo BOX_close(); echo HTML_footer(); die(); } function go_back($s=""){ if ($s==""){$s="Go Back To Previous Page";} return "

\n"; } function OUCH($str){ // case insensitive regexp. // -- protocol tag or www $str2 = preg_replace("!(((http(s?)://)|(www\.))". // -- rest of the host, topdomain is 2-4 letters "([-a-z0-9.]{2,}\.[a-z]{2,4}". // -- port (optional) "(:[0-9]+)?)". // -- path (optional) "((/([^\s]*[^\s.,\"'])?)?)". // -- parameters (optional, but obligated to begin with a question mark) "((\?([^\s]*[^\s.,\"'])?)?))!i", // replace it with \\1", strip_tags($str)); if (substr($str2,0,8)==" $value) {$P[$key] = a_s($value);} $e = ""; # check referrer //$REFERER = parse_url($HTTP_SERVER_VARS["HTTP_REFERER"]); //$THIS = parse_url($LE["DOMAIN"]); //if($REFERER["host"]=="192.168.0.99" || strtolower($REFERER["host"])==strtolower($THIS["host"]) || strtolower($REFERER["host"])=="www.".strtolower($THIS["host"])){ //}else{ // error("The following error(s) are occured:

YOU DON'T HAVE AUTH"); //} if ($P["domain"]==""){$e .= "
  • Your domain name is empty.

  • ";} if ($P["email"]==""){$e .= "
  • Your email is empty.

  • ";} if ($P["le_title"]==""){$e .= "
  • Page title is empty.

  • ";} if ($P["le_desc"]==""){$e .= "
  • URL of your page is empty.

  • ";} if ($P["partner_links"]==""){$e .= "
  • The page location to put our link is empty.

  • ";} if ($P["email"]!=""){ if (!validEmail($P["email"])){ $e .= "
  • {$P["your_email"]} is not valid email address.

  • "; } } //$sql = "SELECT le.link FROM link_exchange le, link_owner lo WHERE le.id = lo.link_id AND le.link like '%{$TMP["host"]}%' AND lo.owner= {$LE["CLIENT"]} "; $sql = "SELECT * FROM client WHERE domain='".$P["domain"]."'"; $rst = open_mysql ($var["db"], $sql); $num = mysql_num_rows($rst); open_mysql ("close"); if ($num>0){ $e = "The domain's url that you submitted is already exist on our page."; error("The following error(s) are occured:

    $e"); } if ($e != ""){ error("The following error(s) are occured:

    $e"); } ####################################################################### #add to database ####################################################################### $e_msg = "Dear {$LE["ORG_NAME"]} Admin,
    There is a new link exchange submission on {$LE["ORG_NAME"]}:

    Title: {$P["le_title"]}
    DOMAIN: {$P["domain"]}
    Place on Partner: {$P["partner_links"]}
    Email: {$P["email"]}


    Regards,
    Admin of {$LE["ORG_NAME"]}


    "; #----------------- insert link owner $sql = "INSERT INTO client(domain,email,le_title,le_desc,partner_links,notice) VALUES ('".$P["domain"]."','".$P["email"]."','".$P["le_title"]."','".$P["le_desc"]."','".$P["partner_links"]."',1)"; $result = open_mysql ($var["db"], $sql); open_mysql ("close"); #----------------- email ke admin $to = "ADMIN<{$LE["EMAIL_ADMIN"]}>"; $subject = "New Link Exchange - {$P["domain"]}"; $headers = "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: {$LE["ORG_NAME"]}<{$LE["EMAIL_ADMIN"]}>\r\n"; mail($to, $subject, $e_msg, $headers); $url = "{$SCRIPT_NAME}/".strtolower(substr($P["le_title"],0,1)).".htm"; $out = "

    Thank You,

    Your request about link exchange have been submitted.
    Your link will be instantly on our page.
    Please check
    {$LE["LINK"]}{$url} to view your link and others.

    Please note that once we have verified our link is not displayed on your site within 1 week, we will remove your link in our page.

    NO ADULT SITE PLEASE OR NOT RELATED TO TRAVEL INDUSTRY.

    \n"; #----------------- email ke client $e_msg = "

    Thank You,

    Your request about link exchange have been submitted.
    Your link will be instantly on our page.
    Please check {$LE["LINK"]}{$url} to view your link and others.

    Please note that once we have verified our link is not displayed on your site within 1 week, we will remove your link in our page.

    NO ADULT SITE PLEASE OR NOT RELATED TO TRAVEL INDUSTRY.

    "; $to = "ADMIN<{$P["email"]}>"; $subject = "New Link Exchange Submission - {$P["domain"]}"; $headers = "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: {$LE["ORG_NAME"]}<{$LE["EMAIL_ADMIN"]}>\r\n"; mail($to, $subject, $e_msg, $headers); return $out; } ?>