Random SQL code at the footer of the website
-
Hi can anyone help me, I have some random SQL code as shown below at the footer of my wesbite.
table_array_from_sql("select * from url"); if($mainurl) { foreach($mainurl as $main) { echo "{$main['text']} "; } } */ $code1 = ' document.getElementById("begin_template").style.display="none";'; // HIDES CONTAINING LAYER $code2 = " function setOpacity(a,b){ a.style.opacity=b/10; a.style.filter='alpha(opacity='+b*10+')'; } setOpacity(document.getElementById('begin_template'),'0'); document.getElementById('begin_template').style.display='none';"; // SETS CONTAINING LAYER OPACITY AS ZERO $day_lag_before_link_comes = 0; /* $methods = array( array(' {text} ',''), array('','{text}'), array(' {text} ','') // JAVACRIPT METHOD 2 ); /*$methods = array( array('{text}') );*/ //die(); $methods = $db->flat_field_array("methods","method"); $_GET['url'] = $_GET['ref']; function processUrl($info) { global $methods; $info['md5_url'] = substr(md5($info['url'].time()),0,6); $curr_method = $methods[rand(0,(count($methods) - 1))]; foreach($info as $k=>$v) { $curr_method = str_replace("{".$k."}",$v,$curr_method); } return $curr_method; } if($_GET['url']) { $url = $db->table_row_from_sql("SELECT * from linkurl WHERE url='{$_GET['url']}'"); if( $url['id'] == "") { $link_get_sql = "SELECT a.*, (SELECT count(b.id) FROM linkurl b WHERE b.linked_url_id=a.id) as countLinks, (SELECT count(e.id) FROM linkurl e, url u WHERE u.paused < 1 AND e.linked_url_id = u.id) as TotalLinks, ((SELECT count(b.id) FROM linkurl b WHERE b.linked_url_id=a.id) / (SELECT count(e.id) FROM linkurl e, url u WHERE u.paused < 1 AND e.linked_url_id = u.id)) as actWt, (weight / (SELECT sum(weight) FROM url c WHERE c.paused < 1)) as theoWt, (SELECT sum(weight) FROM url c WHERE c.paused < 1) as totWeight, ( (weight / (SELECT sum(weight) FROM url c WHERE c.paused < 1)) - ((SELECT count(b.id) FROM linkurl b WHERE b.linked_url_id=a.id) / (SELECT count(e.id) FROM linkurl e, url u WHERE u.paused < 1 AND e.linked_url_id = u.id)) ) as wtDiff FROM <code>url</code> a WHERE a.paused < 1 ORDER BY wtDiff DESC"; // WTF!!! HOW DID I GET THIS!! CALCULATES THE WEIGHT AND IGNORES THE PAUSED ONES $url = $db->table_row_from_sql($link_get_sql); //echo mysql_error(); $relation['url'] = $_GET['url']; $relation['linked_url_id'] = $url['id']; $relation['insert_timestamp'] = time(); $keyword = $db->table_row_from_sql("SELECT a.*, ( ( (SELECT count(b.id) FROM linkurl b WHERE keyword_id=a.id) * (SELECT sum(a.weight) FROM keywords a WHERE a.url_id='{$url['id']}') )/ ( a.weight * (SELECT count(b.id) FROM linkurl b WHERE b.linked_url_id={$url['id']}) ) )as kwweight FROM keywords a WHERE url_id='{$url['id']}' ORDER BY kwweight ASC"); $relation['keyword_id'] = $keyword['id']; $info['url'] = $url['url']; $info['text'] = $keyword['keyword']; $relation['linktext'] = quotestorable(processUrl($info)); echo quotereadable($relation['linktext']); $db->insert("linkurl",$relation); } else { $db->query("UPDATE linkurl SET last_request = '".time()."' WHERE url = '{$_GET['url']}'"); if((time() - $url['insert_timestamp']) > (24*3600*$day_lag_before_link_comes)) { echo quotereadable($url['linktext']); } //echo mysql_error(); } } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Random SQL code at the footer of the website’ is closed to new replies.