Location: PHPKode > projects > EasyFest > new/createEventHead.php
<?php
include_once("include/db_connection.php");
	header("Expires: Thu, 17 May 2001 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0              
	session_start();
		if($_SESSION["loggedIn"] == FALSE){
		header("Location:user_login.php");
		exit;
		
	 }include_once("config.php");
$UserName=$_SESSION['UserName'];

	include('header1.php');
	$query1=mysql_fetch_array(mysql_query("select UserName FROM users WHERE Type='1' AND  UserName='$UserName'" ));
if($UserName==$query1['UserName'] ){
	// echo $UserName;
	 include('left_user.php');}
	 else{
	
	 include('left_coord.php');
	}
	?>
   
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Premium Series by Free CSS Templates</title>
<meta name="keywords" content="" />
<meta name="Premium Series" content="" />
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />

<script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>

<title>Untitled Document</title>
</head>
<?php 
 
  	$UserName=$_SESSION['UserName'];
	$EventName=$_POST['EventName'];
  	if(isset($_POST['EventHead']))
	{
		$EventHead = $_POST['EventHead'];
		$Password = $_POST['Password'];
	/*	$sqlq="SELECT * FROM events WHERE EventAssociate=$UserName";
		$sqlw="SELECT * FROM events WHERE EventAssociate=$UserName AND EventHead=NULL" ;
		$result1 = mysql_query($sqlq);
	     	$numberOfRows1 = MYSQL_NUM_ROWS($result1);
				$result2 = mysql_query($sqlw);
	     	$numberOfRows2 = MYSQL_NUM_ROWS($result2);*/
		//if($numberOfRows2>0){
		$query = "INSERT INTO users(`UserName`, `Password`,`Type`) VALUES ('$EventHead', '$Password','2')";

$result = mysql_query($query) or die("Invalid query: " . mysql_error() . "<br><br>". $query);
		
				$query1= "UPDATE events SET  EventHead='$EventHead' WHERE EventName='$EventName' ";
$result = mysql_query($query1) or die("Invalid query: " . mysql_error() . "<br><br>". $query1);
$query2 = "INSERT INTO rights(`UserName`, `EventName`) VALUES ('$EventHead', '$EventName')";

$result = mysql_query($query2) or die("Invalid query: " . mysql_error() . "<br><br>". $query2);
		
	//	}?>

	     <script type="text/javascript">
<!--
window.location = "assignRightsToEventHead.php<?php echo "?EventHead="."$EventHead" ;?>"
//-->
</script>	
	<?php
	}
?>


<body>
<div id="wrapper">
	<!-- start page -->
	<div id="page">
    	  <!-- start content -->
        <div id="prtCnt" align="center">
		<div id="content" align="center">
		  <div class="post">
	    <h2 class="title">&nbsp;</h2>
	    <div class="entry">
<table width="573" border="0">
      <tr>
        <td width="80" height="260" class="matter"><?php $query= "SELECT * FROM users ";	$result=@mysql_query($query) or die(" checkPass fatal error: ".mysql_error());
		
	// Check exactly one row is found:
	//for($i=1;$i<=mysql_num_rows($result);$i++)
	//{
	//$row=mysql_fetch_array($result);
	//echo $row[1]."<br>";
	//}?>&nbsp;</td>
        
        <td width="483" >
        <form id="form2"   name="createEventHead" method="post" action="<?php print $_SERVER["PHP_SELF"]; ?>">
   <span class="style1">EventHead Name</span>
        
          <p>
           <label for="EventHead"> <input name="EventHead" type="text"  size="45" maxlength="45" /></label>
          </p>
          <p>&nbsp;</p>
		  <span class="style1">Password</span>
          <p><label for="Password"> <input name="Password" type="Password"  size="45" maxlength="45" /></label>
          </p>
          <p>&nbsp;</p>
          <p>
            <select name="EventName">
              <?php  $sqlQuery = "SELECT * FROM rights WHERE UserName='$UserName' AND EventAdministration='1'";
		  $result = MYSQL_QUERY($sqlQuery);
$numberOfRows = MYSQL_NUM_ROWS($result);
	$i = 0;
	while ($i<$numberOfRows)
	{
$EventName = MYSQL_RESULT($result,$i,"EventName");?>
              <option value="<?php echo $EventName; ?>"><?php echo $EventName; ?></option>
              <?php $i++;}?>
            </select>
            <label for="submit"></label>
          </p>
        <div align="right"></div><p align="right"><input type="submit" name="submit" id="submit" value="Submit" />          
            </p>
        </form>
     
  
    </table>

                    </p>
				</div>
		  </div>
		</div>
        </div>
        <!-- end content -->
		<!-- start sidebars -->
		<!-- end sidebars -->
	  <div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("createEventHead");
  frmvalidator.addValidation("EventHead","req","Please enter EventHead");
 frmvalidator.addValidation("EventHead","maxlen=45","Max length for EventHead name  is 45");
 frmvalidator.addValidation("EventHead","alpha_s");
 
 frmvalidator.addValidation("Password","req","Please enter Password");
 frmvalidator.addValidation("Password","maxlen=45","Max length for Password is 45");
 
  
 frmvalidator.addValidation("EventName","req","You dont have rights ");
 frmvalidator.addValidation("EventName", "maxlen=45","Max length for Password is 45");
</script>
<?php
	include('footer.php');
?>
Return current item: EasyFest