Jump to content

Not Loading Function Into Div


Xtremer360

Recommended Posts

I'm not sure whether to put this under the php forum or ajax forum but because I tink it's more of an issue wit the php code itself I decided to put it here. I came across this file from a friend that said this file will work for me. Okay now basically I have the list of characters and when someone clicks on Add New it will load the addcharacter function. That's what I want it to do. However with all of this it will not load the function. Am I missing something somewhere?

 

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid)
{
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject)
{
	// if IE
	try
	{
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
	} 
	catch (e)
	{
		try
		{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch (e)
		{
		}
	}
}
else
{
	return false
}

page_request.onreadystatechange=function()
{
	loadpage(page_request, containerid)
}

page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid)
{
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs()
{
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++)
{
	var file=arguments[i]
	var fileref=""
	if (loadedobjects.indexOf(file)==-1)
	{ 
		//Check to see if this object has not already been added to page before proceeding
		if (file.indexOf(".js")!=-1)
		{
			//If object is a js file
			fileref=document.createElement('script')
			fileref.setAttribute("type","text/javascript");
			fileref.setAttribute("src", file);
		}
		else if (file.indexOf(".css")!=-1)
		{
			//If object is a css file
			fileref=document.createElement("link")
			fileref.setAttribute("rel", "stylesheet");
			fileref.setAttribute("type", "text/css");
			fileref.setAttribute("href", file);
		}
	}
	if (fileref!="")
	{
		document.getElementsByTagName("head").item(0).appendChild(fileref)
		loadedobjects+=file+" " //Remember this object as being already added to page
	}
}
}

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="" />

<title>Untitled 1</title>
</head>

<body>

<?php {
    print '<h1 class=backstage>Character Management</h1><br />';
    print "<h2 class=backstage>Characters :: <a href=\"#\" onclick=\"ajaxpage('addcharacter', 'content'); return false;\">Add New</a></h2><br />";
      $query = "SELECT 
            bio.charactername,
            bio.style_id,
            style.id,
            style.name
        FROM
            efed_bio as bio
        INNER JOIN
            efed_list_styles as style
        ON
            style.id = bio.style_id";            
     $result = mysql_query ( $query ); // Run The Query
     $rows = mysql_num_rows($result);
     if ($rows > 0)
     {
    
    print '<table width="100%" class="table1">';
    print '<tr class="rowheading">';
    print '<td> </td>';
    print '<td> </td>';
    print '<td>Character Name</td>';
    print '<td align=center width=100>Poser Name</td>';
    print '<td align=center width=60>Style</td>';
    print '<td align=center width=60>Alignment</td>';
    print '<td align=center width=60>Status</td>';
    print '</tr>';
        // Fetch and print all records.
        $i = 0;
        $current_row = 0;
        while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
            $sClass = 'row2';
            if ($i ++ & 1) {
                $sClass = 'row1';
            }
            printf ( "<tr class=\"%s\">", $sClass );
            print "<td valign=\"top\" align=center width=35><a href=\"#\" onclick=\"ajaxpage('editcharacter', 'content'); return false;\">Edit</a></td>";
            print "<td valign=\"top\" align=center width=25><a href=\"#\" onclick=\"ajaxpage('bio', 'content'); return false;\">Bio</a></td>";
            printf ( "<td valign=\"top\">%s</td>", $row ['charactername'] );
            printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['posername'] );
            printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['style_id'] );
            printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['alignment_id'] );
            printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['status_id'] );
            print '</tr>';
        }
         print '</table>';
     }
     else
     {
     print '<span>There are no characters.</span><br />';
     }
     print '<br />';
returnmain();
}

function addcharacter() {
print '<h1 class="backstage">Character Management</h1><br />';
print '<h2 class="backstage">Add New Character</h2><br />';
print '<form name="addcharacter" method="post" action="backstage.php" id="addcharacter">';
print '<table width="100%" class="table2">';
print '<tr>';
print '<td class="rowheading">Character Name:</td><td class="row3">';
print '<input type="text" name="charactername" class="fieldtext490" value=""></td>';
print '</tr>';
print '<tr>';
print '<td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="username" class="fieldtext160"></td>';
print '</tr>';
print '<tr>';
print '<td width="120" class="rowheading">Poser name:</td><td class="row3"><input type="text" name="posername" class="fieldtext160" value=""></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Style:</td>';
print '<td class="row3"><select name="style" class="selection"><option value="0">- Select -</option>';
print '<option value="Singles">Singles</option><option value="Tag Team">Tag Team</option><option value="Stable">Stable</option><option value="Manager">Manager</option><option value="Referee">Referee</option><option value="Staff">Staff</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Gender:</td>';
print '<td class="row3"><select name="gender" class="selection"><option value="0">- Select -</option>';
print '<option value="Male">Male</option><option value="Female">Female</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Status:</td>';
print '<td class="row3"><select name="status" class="selection"><option value="0">- Select -</option>';
print '<option value="Active">Active</option><option value="Inactive">Inactive</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class=rowheading>Division:</td>';
print '<td class=row3><select name=division class="selection"><option value=0>- Select -</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class=rowheading>Alignment:</td>';
print '<td class="row3"><select name="alignment" class="selection"><option value="0">- Select -</option>';
print '<option value="Face">Face</option><option value="Heel">Heel</option><option value="Neutral">Neutral</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Sort:</td>';
print '<td class="row3"><select name="sort" class="selection"><option value=0>- Select -<option value="A">A<option value="B">B<option value="C">C<option value="D">D<option value="E">E<option value="F">F<option value="G">G<option value="H">H<option value="I">I<option value="J">J<option value="K">K<option value="L">L<option value="M">M<option value="N">N<option value="O">O<option value="P">P<option value="Q">Q<option value="R">R<option value="S">S<option value="T">T<option value="U">U<option value="V">V<option value="W">W<option value="X">X<option value="Y">Y<option value="Z">Z<option value="0-9">0-9</select></td>';
print '</tr>';
print '</table><br />';
print '<input type="submit" value="Save Character" class="button" name="addcharacter"><br /><br />';
print '<input type="button" value="Return to Character List" class="button200"><br /><br />';
print '<h2 class="backstage"><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
}
?>

</body>
</html>

Link to comment
Share on other sites

Here's the mainscript:

 

<?php
ob_start("ob_gzhandler");  // cache system

require "backstageconfig.php";
require "backstagefunctions.php";

if ((!empty($_POST)) && (isset($_POST['action']))) 
{
	$action=$_POST{'action'};
} 
else
{
	$action="mainmenu";
}

if ((isset($_POST['uname'])) && (isset($_POST['pword'])))
{
	$uname=$_POST{'uname'};
	$pword=md5($_POST{'pword'});
	validate($fedid, $uname, $pword, 0, 0, $cookiedomain, $cookiepath, $admincssfile);
	$action="mainmenu";
}
elseif ((!(isset($_COOKIE['uname']))) && (!(isset($_COOKIE['pword']))))
{
	require_once "backstage_libs/login.php";
	login($admincssfile,$fed,$url);
}
else
{
	$uname=$_COOKIE["uname"];
	$pword=$_COOKIE["pword"];
	validate($fedid, $uname, $pword, 0, 0, $cookiedomain, $cookiepath, $admincssfile);

	if (isset($_POST['newdefaultcharacterid']))
	{
		$newdefaultcharacterid = (integer)$_POST["newdefaultcharacterid"];
		$query = "UPDATE
				efed_handler
			SET
				default_char_id = '$newdefaultcharacterid'
			WHERE
				login = '$uname' and
				fed_id = '$fedid'"; 
		mysql_db_query($dbname, $query) or Die (mysql_error());
	}
}

$query = "SELECT
		h.id as userid,
		h.surname as surname,
		h.firstname as firstname,
		h.isadmin as isadmin,
		newscat.id as defaultcategoryid,
		bio.id as defaultcharacterid,
		bio.style_id as styleid,
		bio.username as defaultcharacterusername,
		bio.charactername as defaultcharactername,
		styles.name as style
	FROM
		efed_handler as h
	LEFT JOIN
		efed_bio as bio
	ON
		(
			h.default_char_id = bio.id and
			bio.fed_id = '$fedid'
		)
	LEFT JOIN
		efed_list_styles as styles
	ON
		(
			bio.style_id = styles.id and
			bio.fed_id = '$fedid'
		)
	LEFT JOIN
		efed_list_newscategory as newscat
	ON
		(
			h.default_news_id = newscat.id and
			newscat.fed_id = '$fedid'
		)
	WHERE
		h.login = '$uname' and
		h.password = '$pword' and
		h.fed_id = '$fedid'"; 
$result = mysql_query ($query); 
while ($row = mysql_fetch_assoc($result)) 
{
	$fieldarray=array('userid','surname','firstname','isadmin','defaultcharacterid','defaultcharacterusername','defaultcharactername','defaultcategoryid','styleid','username','style','charactername');
	foreach ($fieldarray as $fieldlabel)
	{
		if (isset($row[$fieldlabel])) 
		{ 
			$$fieldlabel=$row[$fieldlabel];
			$$fieldlabel=cleanquerydata($$fieldlabel);
		}
	}
}

if ($action != "logout")
{
	headercode($fedid,$admincssfile,$userid,$isadmin,$defaultcharacterid,$defaultcharacterusername,$defaultcharactername,$surname,$firstname,$action,$dirpath,$folder,$headshot,$bioheadheight,$bioheadwidth,$surname,$firstname,$forums);
}
else
{
	headercode($fedid,$admincssfile,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
}
// print "<center>\n";

switch ($action)	
{
	case "mainmenu":
		mainscreen();
		print "</div>\n";
		footercode();
		break;

	case "login":
		require_once "backstage_libs/login.php";
		login($admincssfile,$fed,$url);
		break;

	case "handler":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/handler.php";
			handler($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$ip); 
		}
		break;

	case "character":
		require_once "backstage_libs/character.php";
		character($fedid,$uname,$pword,$userid,$dirpath,$isadmin,$admincssfile,$dbname,$sortorderarray,$iframe,$defaultcharacterid,$styleid,$defaultcharacterusername,$heatmetersenabled,$heatmeters);
		break;

	case "newscategory":
		if ($isadmin == "1") 
		{
			require_once "backstage_libs/newscategory.php";
			newscategory($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$targetarray); 
		}
		break;

	case "news":
		require_once "backstage_libs/news.php";
		news($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$defaultcategoryid,$ip,$defaultcharacterid,$defaultcharactername);
		break;

	case "content":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/content.php";
			content($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "template":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/template.php";
			template($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "biolayout":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/biolayout.php";
			biolayout($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "quotes":
		require_once "backstage_libs/quotes.php";
		quotes($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$defaultcharacterid,$defaultcharactername);
		break;

	case "alliesrivals":
		require_once "backstage_libs/alliesrivals.php";
		alliesrivals($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$numalliesrivals,$defaultcharacterid,$defaultcharactername,$defaultcharacterusername);
		break;

	case "roleplay":
		require_once "backstage_libs/roleplay.php";
		roleplay($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$defaultcharacterid,$defaultcharactername);
		break;

	case "champions":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/champions.php";
			champions($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "title":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/title.php";
			title($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "titlehistory":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/titlehistory.php";
			titlehistory($uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "division":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/division.php";
			division($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "eventname":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/eventname.php";
			eventname($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname); 
		}
		break;

	case "eventbooker":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/eventbooker.php";
			eventbooker($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot); 
		}
		break;

	case "submitmatch":
		require_once "backstage_libs/submitmatch.php";
		submitmatch($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot);
		break;

	case "submitseg":
		require_once "backstage_libs/submitseg.php";
		submitseg($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot);
		break;

	case "resultscompilation":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/resultscompilation.php";
			resultscompilation($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot); 
		}
		break;

	case "resultsediting":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/resultsediting.php";
			resultsediting($uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot,$url); 
		}
		break;

	case "menustructures":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/menustructures.php";
			menustructures($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$headshot,$url); 
		}
		break;

	case "arenas":
		if ($isadmin == "1") 
		{ 
			require_once "backstage_libs/arenas.php";
			arenas($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$url); 
		}
		break;

	case "manageapplications":
		if ($isadmin == "1") 
		{
			require_once "backstage_libs/manageapplications.php";
			manageapplications($fedid,$uname,$pword,$userid,$isadmin,$admincssfile,$dbname,$dirpath,$url);
		}
		break;

	case "logout":
		SetCookie ("uname", "");
		SetCookie ("pword", "");
		require_once "backstage_libs/login.php";
		login($admincssfile,$fed,$url);
		break;

	default:
		print "Default Screen<br />";
		footercode();
		break;
}
exit;
?>

 

And here's the headercode functio and notice where it says ajax.js:

 

function headercode($fedid,$admincssfile,$userid,$isadmin,$defaultcharacterid,$defaultcharacterusername,$defaultcharactername,$surname,$firstname,$action,$dirpath,$folder,$headshot,$bioheadheight,$bioheadwidth,$surname,$firstname,$forums)
{
if (isset($_POST['option'])) { $option=$_POST['option']; }

// print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";

print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n";
print "\"http://www.w3.org/TR/html4/loose.dtd\">\n";
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
print "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n";
print "<meta http-equiv=\"Content-Language\" content=\"en-us\">\n";
print "<meta name=\"language\" content=\"en-us\">\n";
print "<title>Backstage V2 Administration Console</title>\n";

print "<link rel=\"stylesheet\" href=\"".$admincssfile."\" type=\"text/css\" media=\"screen\">\n";
$admincssfile = str_replace(".css", "_print.css", "$admincssfile");
print "<link rel=\"stylesheet\" href=\"".$admincssfile."\" type=\"text/css\" media=\"print\">\n";

print "<script src=\"/jscripts/scriptaculous/prototype.js\" type=\"text/javascript\"></script>\n";
print "<script src=\"/jscripts/scriptaculous/scriptaculous.js\" type=\"text/javascript\"></script>\n";
print "<script type=\"text/javascript\" src=\"./jscripts/ajax.js\"></script>\n";

print "</head>\n";
print "<body>\n";
print "<div id=container>\n";
print "<div class=header>";
print "<form method=POST name=changedefaultcharacter>\n";
print "<input type=hidden name=action value=mainmenu>\n";
print "<input type=hidden name=newdefaultcharacterid value=0>\n";
print "</form>\n";

print "<script type=\"text/javascript\" language=\"javascript\">\n"; 
print "function executeformchangedefaultcharacter(newdefaultcharacterid) {\n";
print "document.changedefaultcharacter.newdefaultcharacterid.value = newdefaultcharacterid;\n";
print "document.changedefaultcharacter.submit();\n";
print "}\n";
print "</script>\n";

if ((isset($userid)) && ($userid > "0"))
{
	print "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"95%\">\n";
	print "<tr>\n";
	if ($defaultcharacterid > "0")
	{
		if (file_exists("$dirpath/backstage_rosterheadshot.php"))
		{
			print "<td width=".($bioheadwidth+10)." align=center><a target=_blank href=".$folder."/bio.php?username=".$defaultcharacterusername."><img src=\"/backstage_rosterheadshot.php?username=".$defaultcharacterusername."\" border=0  hspace=5 vspace=5 /></a></td>\n";			
		}
		elseif (file_exists("$dirpath$headshot/$defaultcharacterusername.jpg"))
		{
			print "<td width=".($bioheadwidth+10)." align=center><a target=_blank href=".$folder."/bio.php?username=".$defaultcharacterusername."><img src=".$headshot."/".$defaultcharacterusername.".jpg border=0 hspace=5 vspace=5 /></a></td>\n";
		}
		elseif (file_exists("$dirpath$headshot/$defaultcharacterusername.gif"))
		{
			print "<td width=".($bioheadwidth+10)." align=center><a target=_blank href=".$folder."/bio.php?username=".$defaultcharacterusername."><img src=".$headshot."/".$defaultcharacterusername.".gif border=0 hspace=5 vspace=5 /></a></td>\n";
		}
		else
		{
			print "<td width=".($bioheadwidth+10)." align=center><a target=_blank href=".$folder."/bio.php?username=".$defaultcharacterusername."><img src=".$headshot."/default.jpg border=0 hspace=5 vspace=5 /></a></td>\n";
		}
	}
	else
	{
			print "<td width=".($bioheadwidth+10)." align=center><img src=".$headshot."/default.jpg border=0 hspace=5 vspace=5 /></td>\n";
	}

	if ($isadmin == "1")
	{
		$query = "SELECT
				bio.id
			FROM
				efed_bio as bio
			WHERE
				bio.fed_id = '$fedid'"; 
		$result = mysql_query ($query); 
		$totalnumcharacters = mysql_num_rows($result);

		$query = "SELECT
				c.id
			FROM
				efed_handler_characters as c
			INNER JOIN
				efed_handler as h
			ON
				(
					h.id = c.handler_id
				)
			WHERE
				h.fed_id = '$fedid'"; 
	}
	else
	{	
		$query = "SELECT
				c.id
			FROM
				efed_handler_characters as c
			INNER JOIN
				efed_handler as h
			ON
				(
					h.id = c.handler_id
				)
			WHERE
				h.id = '$userid' and
				h.fed_id = '$fedid'"; 
	}
	$result = mysql_query ($query); 
	$numavailablecharacters = mysql_num_rows($result);
	if (($numavailablecharacters > "1") || (($isadmin == "1") && (isset($totalnumcharacters)) && ($totalnumcharacters > "0")))
	{
		print "<td>";
		print "<form method=POST name=changecharacter>\n";
		print "<select name=newdefaultcharacterid class=dropdown onChange=\"executeformchangedefaultcharacter(document.changecharacter.newdefaultcharacterid.value);\">";

		if ($defaultcharacterid > "0")
		{
			print "<option value=".$defaultcharacterid.">".$defaultcharactername;
		}
		else
		{
			print "<option value=0>- Select -";
		}

		if ($isadmin == "1")
		{
			$query = "SELECT
					bio.id as getcharacterid,
					bio.charactername as getcharacter
				FROM
					efed_bio as bio
				WHERE
					bio.id <> '$defaultcharacterid' and
					bio.status_id = '1' and
					bio.fed_id = '$fedid'
				ORDER BY
					bio.charactername"; 
		}
		else
		{
			$query = "SELECT
					bio.id as getcharacterid,
					bio.charactername as getcharacter
				FROM
					efed_bio as bio
				INNER JOIN
					efed_handler_characters as c
				ON
					(
						bio.id = c.bio_id						
					)
				INNER JOIN
					efed_handler as h
				ON
					(
						h.id = c.handler_id
					)
				WHERE
					h.id = '$userid' and
					c.bio_id <> '$defaultcharacterid' and
					bio.status_id = '1' and
					bio.fed_id = '$fedid' and
					h.fed_id = '$fedid'
				ORDER BY
					bio.charactername"; 
		}
		$result = mysql_query ($query); 
		$numrows = mysql_num_rows ($result);
		if ($numrows > 0)
		{
			if ($isadmin == "1")
			{
				print "<option value=0>** Active Characters **";
			}

			while ($row = mysql_fetch_assoc($result))
			{
				$fieldarray=array('getcharacterid','getcharacter');
				foreach ($fieldarray as $fieldlabel)
				{
					if (isset($row[$fieldlabel])) 
					{ 
						$$fieldlabel=$row[$fieldlabel];
						$$fieldlabel=cleanquerydata($$fieldlabel);
					}
				}
				print "<option value=".$getcharacterid.">".$getcharacter;
			}
		}

		if ($isadmin == "1")
		{
			$query = "SELECT
					bio.id as getcharacterid,
					bio.charactername as getcharacter
				FROM
					efed_bio as bio
				WHERE
					bio.id <> '$defaultcharacterid' and
					bio.status_id = '2' and
					bio.fed_id = '$fedid'
				ORDER BY
					bio.charactername"; 
		}
		else
		{
			$query = "SELECT
					bio.id as getcharacterid,
					bio.charactername as getcharacter
				FROM
					efed_bio as bio
				INNER JOIN
					efed_handler_characters as c
				ON
					(
						bio.id = c.bio_id						
					)
				INNER JOIN
					efed_handler as h
				ON
					(
						h.id = c.handler_id
					)
				WHERE
					h.id = '$userid' and
					c.bio_id <> '$defaultcharacterid' and
					bio.status_id = '2' and
					bio.fed_id = '$fedid'
				ORDER BY
					bio.charactername"; 
		}
		$result = mysql_query ($query); 
		$numrows = mysql_num_rows($result);
		if ($numrows > "0")
		{
			print "<option value=0>** Inactive Characters **";	
			while ($row = mysql_fetch_assoc($result))
			{
				$fieldarray=array('getcharacterid','getcharacter');
				foreach ($fieldarray as $fieldlabel)
				{
					if (isset($row[$fieldlabel])) 
					{ 
						$$fieldlabel=$row[$fieldlabel];
						$$fieldlabel=cleanquerydata($$fieldlabel);
					}
				}
				print "<option value=".$getcharacterid.">".$getcharacter;
			}
		}
		print "</select>\n";
		print "</form>\n";
		print "</td>\n";
	}
	else
	{
		print "<td>".$defaultcharactername."</td>\n";
	}

	print "<td width=40% valign=bottom align=right>\n";
	print "<a href=\"#\" onClick=\"executeform('mainmenu','0');\">Home</a> | ";
	print "<a href=\"#\" onClick=\"executeform('logout','0');\">Logout</a> | ";
	print "<a target=\"_blank\" href=\"http://www.gcwonline.net/forums\">Forums</a> | ";
	print "<a target=\"_blank\" href=\"http://www.gcwonline.net/writing\">Writing Guide</a>";
	print "</td>\n";
	print "</tr>\n";
	print "</table>\n";
	print "</div>\n";

	print "<div id=container2>\n";

	print "<div id=nav>";
	print "<form method=POST name=mainmenu>\n";
	print "<input type=hidden name=action value=0>\n";
	print "<input type=hidden name=option value=0>\n";
	print "</form>\n";

	print "<script type=\"text/javascript\" language=\"javascript\">\n"; 
	print "function executeform(action,option) {\n";
	print "document.mainmenu.action.value = action;\n";
	print "document.mainmenu.option.value = option;\n";
	print "document.mainmenu.submit();\n";
	print "}\n";
	print "</script>\n";

	if ((isset($userid)) && ($userid > "0") && ($defaultcharacterid > "0"))
	{
		print "<h1>Character</h1>\n";
		print "<ul>\n";
		print "<li";
		if (($action == "character") && ((isset($option)) && ($option == "2"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('character','2');\">Bio</a></li>\n";
		print "<li";
		if (($action == "alliesrivals") && ((isset($option)) && ($option == "0"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('alliesrivals','0');\">Allies</a></li>\n";
		print "<li";
		if (($action == "alliesrivals") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('alliesrivals','1');\">Rivals</a></li>\n";
		print "<li";
		if ($action == "quotes") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('quotes','0');\">Quotes</a></li>\n";
		print "</ul>\n";

		print "<h1>Submit</h1>\n";
		print "<ul>\n";
		print "<li";
		if ($action == "roleplay") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('roleplay','0');\">Roleplay</a></li>\n";
		print "<li";
		if ($action == "news") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('news','0');\">News</a></li>\n";
		print "<li";
		if ($action == "submitmatch") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('submitmatch','0');\">Match</a></li>\n";
		print "<li";
		if ($action == "submitseg") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('submitseg','0');\">Seg</a></li>\n";
		print "</ul>\n";
	}

	if ((isset($isadmin)) && ($isadmin == "1"))
	{
		print "<h1>Booking</h1>\n";
		print "<ul>\n";
		print "<li";
		if ($action == "champions") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('champions','0');\">Champions</a></li>\n";
		print "<li";
		if ($action == "eventbooker") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('eventbooker','0');\">Booker</a></li>\n";
		print "<li";
		if (($action == "resultscompilation") && ((isset($option)) && ($option == "0"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('resultscompilation','0');\">Compiler</a></li>\n";
		print "<li";
		if (($action == "resultscompilation") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('resultscompilation','1');\">Archives</a></li>\n";
		print "</ul>\n";

		print "<h1>Fed Admin</h1>\n";
		print "<ul>\n";
		print "<li";
		if ($action == "handler") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('handler','0');\">Handlers</a></li>\n";
		print "<li";
		if (($action == "character") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('character','1');\">Characters</a></li>\n";
		print "<li";
		if ($action == "manageapplications") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('manageapplications','0');\">Applications</a></li>\n";
		print "<li";
		if ($action == "eventname") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('eventname','0');\">Event Names</a></li>\n";
		print "<li";
		if ($action == "title") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('title','0');\">Title Names</a></li>\n";
		print "<li";
		if ($action == "division") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('division','0');\">Divisions</a></li>\n";
		print "<li";
		if ($action == "arenas") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('arenas','0');\">Arenas</a></li>\n";
		print "</ul>\n";

		print "<h1>Site Admin</h1>\n";
		print "<ul>\n";
		print "<li";
		if ($action == "template") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('template','0');\">Templates</a></li>\n";
		print "<li";
		if ($action == "content") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('content','0');\">Content</a></li>\n";
		print "<li";
		if ($action == "biolayout") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('biolayout','0');\">Bio Configuration</a></li>\n";
		print "<li";
		if ($action == "newscategory") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('newscategory','0');\">News Categories</a></li>\n";
		print "<li";
		if ($action == "menustructures") { print " class=active"; }
		print "><a href=\"#\" onClick=\"executeform('menustructures','0');\">Menus</a></li>\n";
		print "</ul>\n";
	}
	print "</div>\n";
}

print "<div id=content>\n";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.