Location: PHPKode > projects > HuMo-gen > admin/include/links.php
<?php
// *** Safety line ***
if (!defined('ADMIN_PAGE')){ exit; }

echo '<h1 align=center>'.$language["links_name"].'</h1>';

echo $language["links_intro"].'<br>';

	// *** Change Link ***
	if (isset($_POST['link_wijzigen'])){
		$datasql = mysql_query("SELECT * FROM humo_settings WHERE setting_variabele='link'",$db);
		while ($dataDb=mysql_fetch_object($datasql)){
			$waarde=addslashes($_POST[$dataDb->setting_id.'own_code'])."|".addslashes($_POST[$dataDb->setting_id.'link_text']);
			$sql="UPDATE humo_settings SET setting_value='".$waarde."' WHERE setting_id=".$_POST[$dataDb->setting_id.'id'];
			$result=mysql_query($sql) or die(mysql_error());
		}
	}

	// *** Remove link  ***
	$datasql = mysql_query("SELECT * FROM humo_settings WHERE setting_variabele='link'",$db);
	while ($dataDb=mysql_fetch_object($datasql)){
		if (isset($_POST[$dataDb->setting_id.'link_verwijderen'])){
			$sql="DELETE FROM humo_settings WHERE setting_id='".$dataDb->setting_id."'";
			$result=mysql_query($sql) or die(mysql_error());
		}
	}

	// *** Add link ***
	if (isset($_POST['link_toevoegen'])){
		$waarde=addslashes($_POST['own_code'])."|".addslashes($_POST['link_text']);
		$sql="INSERT INTO humo_settings SET setting_variabele='link', setting_value='".$waarde."'";
		$result=mysql_query($sql) or die(mysql_error());
	}

	// *** Show all links ***
	print "<form method='post' action='".$_SERVER['PHP_SELF']."?linken=1'>";
	echo '<input type="hidden" name="page" value="'.$page.'">';
	echo '<table class="humo standaard" border="1">';
	print '<tr><th colspan=5 class="tabel_kop">'.$language["links_EXTRALINKS"].'</th></tr>';
	print '<tr><th>Nr.</th><th>'.$language["links_owncode"].'</th><th>'.$language["links_description"].'</th><th>'.$language["links_change_add"].'</th><th bgcolor=red>'.$language["admin_remove"].'</th></tr>';
	$datasql = mysql_query("SELECT * FROM humo_settings WHERE setting_variabele='link'",$db);
	if ($datasql){
		$teller=1;
		while ($dataDb=mysql_fetch_object($datasql)){
			$lijst=explode("|",$dataDb->setting_value);
			echo '<tr>';
			echo '<td>';
			echo '<input type="hidden" name="'.$dataDb->setting_id.'id" value="'.$dataDb->setting_id.'">';
			echo 'Link '.$teller."</td>";
			echo '<td><input type="text" name="'.$dataDb->setting_id.'own_code" value="'.$lijst[0].'" size="20"></td>';
			echo '<td><input type="text" name="'.$dataDb->setting_id.'link_text" value="'.$lijst[1].'" size="20"></td>';
			echo '<td><input type="Submit" name="link_wijzigen" value="'.$language["admin_change"].'"></td>';
			echo '<td bgcolor="red"><input type="Submit" name="'.$dataDb->setting_id.'link_verwijderen" value="'.$language["admin_remove"].'"></td>';
			echo "</tr>";
			$teller++;
		}

		// *** Add new link ***
		echo "<tr>";
			echo "<td><br></td>";
			echo '<td>';
			echo '<input type="text" name="own_code" value="Code" size="20"></td>';
			echo '<td><input type="text" name="link_text" value="Eigenaar database" size="20"></td>';
			echo '<td><input type="Submit" name="link_toevoegen" value="'.$language["admin_add"].'"></td>';
			echo '<td bgcolor="red"><br></td>';
		echo "</tr>";
	}
	else{
		echo '<tr><td colspan="4">Vul eerst 1 database</td></tr>';
	}
	print "</table>";
	print "</form>";
?>
Return current item: HuMo-gen