Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/admin/editsuff.inc
<h2>View/Edit Suffixes</h2>
<?php
	if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('page', $_GET) && ctype_digit($_GET['page']))
	{
		$page = $_GET['page'];
	}
	else
	{
		$page = 1;
	}
	$e->page = $page;
	$e->page *= $pagelimit;
	$e->page -= $pagelimit;
	$g_total = dbcom('SELECT COUNT(id) AS TOTAL FROM suffixes;');
	$e->total = mysql_result($g_total, 0);
	echo '<p>These are the suffixes that are randomly appended to the end of sponsored search results, to make the link appear more realistic.</p>' . "\n";
	echo '<form action="ddl.php?go=editsuff" method="post">' . "\n";
	echo 'Manually add a suffix:' . "\n";
	echo '<p><table>' . "\n";
	echo '<tr>' . "\n";
	echo '<td>' . "\n";
	echo '<label for="txtSuffix">Suffix:</label>' . "\n";
	echo '</td>' . "\n";
	echo '<td>' . "\n";
	echo '<input type="text" name="suffix" id="txtSuffix" size="30" maxlength="100" />' . "\n";
	echo '</td>' . "\n";
	echo '<td>' . "\n";
	echo '<input type="submit" name="sub" value="Add" class="formbutton">' . "\n";
	echo '</td>' . "\n";
	echo '</tr>' . "\n";
	echo '</table>' . "\n";
	echo '</form>' . "\n";
	if($_POST['sub'] == 'Remove from suffixes' && checkPostForm('deletePartner', $_POST) === TRUE)
	{
		echo '<b>' . count($_POST['list']) . '</b> suffix';
		if(count($_POST['list']) != 1)
		{
			echo 'es';
		}
		echo ' removed from suffixes.<br><br>';
		$idList = implode(',', $_POST['list']);
		dbcom("DELETE FROM suffixes WHERE id IN ($idList);");
	}
	else
	{
		if($_POST['sub'] == 'Add' && checkPostForm('addSuffix', $_POST) === TRUE)
		{
			echo 'Suffix (<span>' . $_POST['suffix'] . '</span>) has been added to the suffixes list.';
			dbcom("INSERT INTO suffixes VALUES (NULL, '{$_POST['suffix']}');");
		}
	}
	$get = dbcom("SELECT * FROM suffixes ORDER BY id LIMIT $e->page, $pagelimit;");
	if(mysql_num_rows($get) > 0)
	{
		echo '<form action="ddl.php?go=editsuff" method="post"><table border=0 cellpadding=0 cellspacing=0 width="100%"><tr>' . "\n";
		while($row = mysql_fetch_array($get))
		{
			$column++;
			echo '<td width="33%"><input type="checkbox" name="list[]" value="' . $row['id'] . '" id="list"><label>' . $row['suffix'] . '</label></td>' . "\n";
			if(is_int($column/3))
			{
				echo '</tr><tr>' . "\n";
			}
		}
		echo '</tr></table><br>';
		$e->paginate('ddl.php?go=editsuff&page=');
		echo '<table>' . "\n";
		echo '<tr>' . "\n";
		echo '<td>' . "\n";
		echo '<br><input type="button" value="Check All" class="form" onClick="this.value=check(this.form.list)">' . "\n";
		echo '</td>' . "\n";
		echo '</tr>' . "\n";
		echo '<tr>' . "\n";
		echo '<td>' . "\n";
		echo '<br><input type="Submit" name="sub" value="Remove from suffixes" class="formbuttonwide">' . "\n";
		echo '</td>' . "\n";
		echo '</tr>' . "\n";
		echo '</table>' . "\n";
		echo '</form>' . "\n";
	}
	else
	{
		echo '<p>No suffixes!</p>' . "\n";
	}
?>
Return current item: DDL CMS