Widget PHP non modificabile dall'utente

DNAvirusG

Nuovo Utente
26 Mag 2011
7
0
0
Salve a tutti!
Ho questo sito di riferimento: http://ow.ly/54fHE

Ecco i dati demo per loggarsi: demo/demo

Se si va nella sezione Get Widget troverete un form con delle impostazioni da poter settare e automaticamente vi fornirà il codice nel box in basso da poter inserire nel proprio sito/blog..

Ora il problema è questo. L'utente finale non dovrebbe avere la libertà di eliminare l'ultima parte del codice che riguarda i backlinks del sito in questione. Più precisamente questa porzione di codice:

Codice:
<div style="text-align:center;margin:5px;"><a href="http://tweetfeed.com">Want a widget like this?</a></div>

Inserisco anche il codice della pagina showwidget.php:

PHP:
<?php
	require_once('inc/functions.php');
	$keyword = 	$_GET['k'];
	$length = 	$_GET['l'];
	$width =	$_GET['w'];
	$username = $_GET['u'];

  if (isset($_SERVER['HTTP_REFERER'])) {
    $unique_id = md5($username . '-' . $keyword . '-' . $_SERVER['HTTP_REFERER']);
    
    dbconnect();
    $t = mysql_query('INSERT IGNORE INTO widget_logs (unique_widget, widget_url) VALUES (\''.$unique_id.'\', \''.addslashes($_SERVER['HTTP_REFERER']).'\')');
    
    if (mysql_insert_id()) {
      file_put_contents('widget-log.txt', $unique_id . " # " . $username . ' # ' . $keyword .  ' # ' . $_SERVER['HTTP_REFERER'] . "\r\n", FILE_APPEND);
    }
    
    dbclose();
  }

	if ($length>25) { $length=25; }
	if ($width>800) { $width=800; }
	$keyword = cleankeywords($keyword);
	require_once('inc/simplepie.inc');
	$feed = new SimplePie('http://search.twitter.com/search.atom?q='.$keyword);
	$feed->handle_content_type();

	$output.=	"<style>";
	$output.=	"<!--";
	$output.=	"	#tweetbox					{ width:".$width."px !important; font-family:Arial, Helvetica, sans-serif; font-size:90%; overflow:hidden;line-height:130%;}";
	$output.=	"	#tweetbox ol				{ list-style-type:none; padding:0; margin:0; }";
	$output.=	"	#tweetbox ol li				{ padding:10px 0 10px 0; margin:0 0 0 0; border-bottom:1px dotted #999;}";
	$output.=	"	#tweetbox ol li a			{  }";
	$output.=	"-->";
	$output.=	"</style>";

	$output.=	"	<div id='tweetbox' style='width:300px;'>";
	$output.=	"        <ol>";
	
	foreach ($feed->get_items() as $item):
        	$i++;
			if ($i<=$length) {
				$output2.=	"            <li>";
				$output2.=	"            <div style=''><img src='".$item->get_link(0, 'image')."' style='float:left;display:block;margin-right:10px;width:48px;height:48px;' />".$item->get_description()."<br /><span class='date'>".$item->get_date('j F Y | g:i a')."</span><br /><a href='".$item->get_permalink()."' style='font-weight:bold;'>".$item->get_author(0)->get_name()."</a><br style='clear:both;' /></div></li>";
			}
        endforeach;
         if ($i==0) {
	$output2.=	"                <li><h2>No tweets!</h2><br />Nobody is talking about this yet!<br />You could be the first to <em><a href='http://twitter.com/'><strong>Tweet about ".$keyword."</strong></a>!</em></li>";
            }
	$output2.=	"        </ol><div style=\"text-align:center;font-size:90%;\">Powered by <a href=\"http://TweetFeed.com/$username\"><strong>TweetFeed.com</strong></a></div>";
	$output2.=	"	</div>";

	$output2 = str_replace("\"", "'", $output2);
	$output2 = mysql_escape_string($output2);
?>
document.write("<?=$output?>");
document.write("<?=$output2?>");

Qualcuno ha una soluzione da proporre?
Grazie in anticipo!
 
Tipo così:

PHP:
    $output2.=    "        </ol><div style=\"text-align:center;font-size:90%;\">Powered by <a href=\"http://TweetFeed.com/$username\"><strong>TweetFeed.com</strong></a></div>"; 
    $output2.=    "    </div>";
    $output2.=    "    <div style=\"text-align:center;margin:5px;\"><a href=\"http://tweetfeed.com\">Want a widget like this?</a></div>";
 

Discussioni simili