<?php
session_start();
include("include/config.php");
include("include/functions/import.php");
$thebaseurl = $config['baseurl'];

$sql = "SELECT * from channels";
$chanres = $conn->Execute($sql);

if($chanres)
{
	while(!$chanres->EOF)
	{
		$CID = $chanres->fields['CID'];
		$name = $chanres->fields['name'];
					
		$seokey = seo_clean_titles_sendmail($name);
					
					$seokeycount = channel_seokey_count($seokey);
					if ($seokeycount > 1)
					{
						$newseokey = $seokey."-".$channelid;
						$query = "UPDATE channels SET seokey='".mysql_real_escape_string($newseokey)."' WHERE CID='".mysql_real_escape_string($CID)."'";
						$conn->execute($query);
						echo "Converted Channel With ID: $CID<br>";
					}
					else
					{
						$newseokey = $seokey."-".$channelid;
						$query = "UPDATE channels SET seokey='".mysql_real_escape_string($seokey)."' WHERE CID='".mysql_real_escape_string($CID)."'";
						$conn->execute($query);
						echo "Converted Channel With ID: $CID<br>";
					}
		
		@$chanres->MoveNext();
	}
}


?>