Location: PHPKode > projects > ComicFlow > editseries.php
<?php session_start();

if($_SESSION['loggedin'] == 'yes' and $_SESSION['ip'] == $_SERVER["REMOTE_ADDR"])
   {
      // Get the default templates, Includes and Database connections
      include("header.php");

      $tpl->assignInclude("content", "themes/$themes/tpl/editseries.tpl");

      // Prepare the template
      $tpl->prepare();

      // Get the menu items and links
      include("./lang/$language/general.lang.php");
	  include("./lang/$language/edit.lang.php");
	  include("./lang/$language/error.lang.php");
      include("menu.php");

      // Assign needed values
      $tpl->assignGlobal("theme", $themes);      
      $tpl->assignGlobal("pmcurl", $siteurl);
      $tpl->assignGlobal("sitetitle", $sitetitle);
      $tpl->assignGlobal("imgfolder", "themes/$themes/img");
      $tpl->assign("version", $version);

		if($_GET['error'] == '01') {
			$tpl->assign("error_message", "<div class=\"errormsg\">$lang_error_emtyfield</div>");
		} elseif($_GET['error'] == '02') {
			$tpl->assign("error_message", "<div class=\"errormsg\">$lang_error_artistexist</div>");
		} elseif($_GET['error'] == '03') {
			$tpl->assign("error_message", "<div class=\"errormsg\">$lang_error_noedit</div>");
		} else {
			$tpl->assign("error_message", "");
		}
		
      // Get the artist data from database
      $select = "SELECT * FROM pmc_artist WHERE uid = '". $_GET['uid'] ."'";
      $data = mysql_db_query($sql['data'], $select) or die("Select Failed!");
      $row = mysql_fetch_array($data);

      // Query result
      $uid = $row['uid'];
      $name = $row['name'];
      $types = $row['type'];
      $link = $row['link'];
      $year = $row['year'];
      $publisher = $row['publisher'];
      $format = $row['format'];
      $comtype = $row['comtype'];
      $genre = $row['genre'];
      $volume = $row['volume'];
      $mini = $row['mini'];
      
      if($comtype == '5') { $tpl->assign("onload", "onload=\"document.getElementById('showhide').style.display = '';\""); } else { $tpl->assign("onload", "onload=\"document.getElementById('showhide').style.display = 'none';\""); }

      // Get all the form values from url
      $tpl->assign("get_uid", $uid);
      $tpl->assign("get_a", $_GET['a']);
      $tpl->assign("get_name", $name);
      $tpl->assign("get_volume", $volume);
      $tpl->assign("get_year", $year);
      $tpl->assign("get_mini", $mini);
      $tpl->assign("get_link", $link);
      $tpl->assign("get_type", $types);
      $tpl->assign("get_form", "function.php?cmd=editseries&uid=$uid&a=". $_GET['a'] ."");

    //--------------------------------------------------------------------------
	// GET PUBLISHERS FROM ARTIST TABLE
	//--------------------------------------------------------------------------
    $get = "SELECT * FROM pmc_artist WHERE type = 'Publisher' ORDER BY name";
    $com = mysql_db_query($sql['data'], $get) or die("Select Failed!");

    while ($row = mysql_fetch_array($com))
      	{
        	// GET FIELDS FROM QUERY
            $uid = $row['uid'];
            $name = $row['name'];
            $type = $row['type'];

            if($publisher == $uid) { $sel = ' selected'; } else { $sel = ''; }

            // SET TEMPLATE VALUES
            $tpl->newBlock("addc_publisher");
            $tpl->assign("pmc_publisher", $name);
            $tpl->assign("pmc_publisher_uid", $uid);
            $tpl->assign("selected", $sel);
    	}
    
    //--------------------------------------------------------------------------
  	// GET GENRES FROM ARTIST TABLE
  	//--------------------------------------------------------------------------
    $get = "SELECT * FROM pmc_artist WHERE type = 'Genre' ORDER BY name";
    $com = mysql_db_query($sql['data'], $get) or die("Select Failed!");

    while ($row = mysql_fetch_array($com))
     	{
     		// GET FIELDS FROM QUERY
            $uid = $row['uid'];
            $name = $row['name'];
            $type = $row['type'];

            if($genre == $uid) { $sel = ' selected'; } else { $sel = ''; }

            // SET TEMPLATE VALUES
            $tpl->newBlock("addc_genre");
            $tpl->assign("pmc_genre", $name);
            $tpl->assign("pmc_genre_uid", $uid);
            $tpl->assign("selected", $sel);
     	}
     
    //--------------------------------------------------------------------------
  	// GET FORMATS FROM ARTIST TABLE
  	//--------------------------------------------------------------------------
    $get = "SELECT * FROM pmc_artist WHERE type = 'Format' ORDER BY name";
    $com = mysql_db_query($sql['data'], $get) or die("Select Failed!");

    while ($row = mysql_fetch_array($com))
     	{
            // GET FIELDS FROM QUERY
            $uid = $row['uid'];
            $name = $row['name'];
            $type = $row['type'];

            if($format == $uid) { $sel = ' selected'; } else { $sel = ''; }

            // SET TEMPLATE VALUES
            $tpl->newBlock("addc_format");
            $tpl->assign("pmc_format", $name);
            $tpl->assign("pmc_format_uid", $uid);
            $tpl->assign("selected", $sel);
     	}
     
    //--------------------------------------------------------------------------
 	// GET TYPES FROM ARTIST TABLE
 	//--------------------------------------------------------------------------
    $get = "SELECT * FROM pmc_artist WHERE type = 'Type' ORDER BY name";
    $com = mysql_db_query($sql['data'], $get) or die("Select Failed!");

    while ($row = mysql_fetch_array($com))
     	{
            // GET FIELDS FROM QUERY
            $uid = $row['uid'];
            $name = $row['name'];
            $type = $row['type'];

            if($comtype == $uid) { $sel = ' selected'; } else { $sel = ''; }

            // SET TEMPLATE VALUES
            $tpl->newBlock("addc_type");
            $tpl->assign("pmc_type", $name);
            $tpl->assign("pmc_type_uid", $uid);
            $tpl->assign("selected", $sel);
   		}
   		
      // Print the result
      $tpl->printToScreen();

   } else {

   // Login failed
   header("Location: error.php?error=01");
   exit;

}

?>
Return current item: ComicFlow