SourceForge.net Logo
<?
session_start();
$mCreated="Created Mike Chirico mmc 03.02.03 mchirico@users.sourceforge.net";
$websec_page='http://vc2000-12.med.upenn.edu'.$PHP_SELF;
include("header.php");
?>
<html>
<head>
<title>MSG2003 Elections</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

<style type="text/css">
<!--

.tableblack {  background-color: #000000; font-size: 16pt; font-weight: bold; color: #FFFFFF}
.tablewhite { border: 1px solid black; padding: 5px; color: #000000; background-color: #FFFFFF}
.tdtop {  }
.tableborder	{   background-color: #FFFFDD; border: 1px solid black; }


-->
</style>

</head>
<!--Created MMC 4.01.02 Quick Election System   -->

<?
/*  Tables



CREATE TABLE msg2003candidate (
  pkey int(11) NOT NULL auto_increment,
  positionkey int(11),
  fname varchar(15) default NULL,
  lname varchar(25) default NULL,
  email varchar(50) default NULL,
  website text,
  description text,		
  year int(11) default NULL,
  timeEnter timestamp(14) NOT NULL,
  
  PRIMARY KEY  (pkey)
);


CREATE TABLE msg2003position (
  pkey int(11) NOT NULL auto_increment,
  positionkey int(11),
  title varchar(50),
  morder int(11),
  module int(11),	
  timeEnter timestamp(14) NOT NULL,
  
  PRIMARY KEY  (pkey)
);



CREATE TABLE msg2003votingResults (
  pkey int(11) NOT NULL auto_increment,
  candidatepkey int(11),
  positionkey int(11),
  PennNetID varchar(20),
  nineDigitPennID varchar(9),
  eightDigitPennID varchar(8),
  fnname varchar(15),
  lnname varchar(20),
  email varchar(50),
  stuid varchar(10),
  comments text,
  ip varchar(15),
  year int(11),
  timeEnter timestamp(14) NOT NULL,
  
  PRIMARY KEY  (pkey)
); 


for(reset($HTTP_POST_VARS);
                      $key=key($HTTP_POST_VARS);
                      next($HTTP_POST_VARS)) {
    $this = addslashes($HTTP_POST_VARS[$key]);
    $this = strtr($this, ">", " ");
    $this = strtr($this, "<", " ");
    $this = strtr($this, "|", " ");
    $$key = $this;
  }


*/
?>
<body bgcolor="#FFFFFF">

<?

//temp

/*

	$nineD='234523';
	$ip='130.91.96.181';

	$uid=$passS[1];
	$nineD=$k[3];
        $eightD=$k[5];
        $ip=$k[9];
*/
$link=mysql_connect("localhost","username","password");
mysql_select_db("vc2000",$link);





reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {


    if (substr($key,0,16)=='radiopositionkey'){
		$r=preg_split("/radiopositionkey/",$key) ;
		//print $r[1]; //positionkey
	

    	$query= "insert into msg2003votingResults (PennNetID,nineDigitPennID,candidatepkey,positionkey,ip) 
		values ('$uid','$nineD', $val,$r[1],'$ip')";
       // echo $query."<br>";
	$mysql_result=mysql_query($query,$link);

	}

}

?>


<?

?>

<?



$query="

 select m1.positionkey,m1.pkey,m1.fname,
  m1.lname, m1.email, m1.website,m1.classyear,m1.previousmsg,
  m2.title,m1.description

 from msg2003candidate m1, msg2003position m2
 left outer join  msg2003votingResults m3
 on m3.positionkey=m2.positionkey and m3.PennNetID='$uid'
 where m1.positionkey=m2.positionkey
 and (m2.year<=0 or m2.year=2)
 and m3.pkey is null
 order by m2.morder 
";

$mysql_result=mysql_query($query,$link);


?>




<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV>
<form METHOD=post name="form1" >
<table width="601" border="1" cellspacing="0" cellpadding="0" class="tableblack">
        <tr>
          <td class=tableblack>2003 MSG Executive Elections</td>
        </tr>
	<tr>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablewhite" >


	<?
	$messageComplete='<tr><td class=tableblack><br><b>Votes have been submitted</b><br></td></tr>';
	$norows=true;
	$heading='null';
	while($row=mysql_fetch_array($mysql_result)){
	$norows=false;
	$messageComplete='';
	if($heading != $row[0]){
	?>

		<tr>
                <td><b><? print $row['title']; ?></b></td>
        	</tr>
        	<tr>
	<?  $heading=$row[0];
		} // endif
	?>
          	 <td>

                  <table  width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="tableborder" >
                    <tr>
                      <td width="10%"><input type="radio" name="<? print 'radiopositionkey'.$row['positionkey']; ?>" value="<? print $row['pkey']; ?>"></td>
                      <td width="90%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
                          <tr>
                            <td width="22%">Name:</td>
                            <td width="78%"><? print $row['fname']." ". $row['lname']; ?></td>
                          </tr>


                          <tr>
                            <td width="22%">Statement:</td>
                            <td width="78%"><? print $row['website']; ?></td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>

                </td>
        </tr>

        <? } //while ?>
        </tr>
      </table>

	</td>
        </tr>

	<?      
// If no rows Print message and expire token   
	if($norows){
		print	$messageComplete; 
		$fp=popen("/home/src/pas/websec-client/websec_client vc2000lec2 expire_token $websec_token","r");

		}

	?>	



      </table>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</form>
      <p>&nbsp;</p>
    </DIV>
  </BLOCKQUOTE></BLOCKQUOTE>











<?
mysql_close($link);
?>
</body>
</html>



Tutorials

Linux System Admin Tips: There are over 200 Linux tips and tricks in this article. That is over 100 pages covering everything from NTP, setting up 2 IP address on one NIC, sharing directories among several users, putting running jobs in the background, find out who is doing what on your system by examining open sockets and the ps command, how to watch a file, how to prevent even root from deleting a file, tape commands, setting up cron jobs, using rsync, using screen conveniently with emacs, how to kill every process for a user, security tips and a lot more. These tip grow weekly. The above link will download the text version for easy grep searching. There is also an html version here.

Breaking Firewalls with OpenSSH and PuTTY: If the system administrator deliberately filters out all traffic except port 22 (ssh), to a single server, it is very likely that you can still gain access other computers behind the firewall. This article shows how remote Linux and Windows users can gain access to firewalled samba, mail, and http servers. In essence, it shows how openSSH and Putty can be used as a VPN solution for your home or workplace.

MySQL Tips and Tricks: Find out who is doing what in MySQL and how to kill the process, create binary log files, connect, create and select with Perl and Java, remove duplicates in a table with the index command, rollback and how to apply, merging several tables into one, updating foreign keys, monitor port 3306 with the tcpdump command, creating a C API, complex selects, and much more.

Create a Live Linux CD - BusyBox and OpenSSH Included: These steps will show you how to create a functioning Linux system, with the latest 2.6 kernel compiled from source, and how to integrate the BusyBox utilities including the installation of DHCP. Plus, how to compile in the OpenSSH package on this CD based system. On system boot-up a filesystem will be created and the contents from the CD will be uncompressed and completely loaded into RAM -- the CD could be removed at this point for boot-up on a second computer. The remaining functioning system will have full ssh capabilities. You can take over any PC assuming, of course, you have configured the kernel with the appropriate drivers and the PC can boot from a CD. This tutorial steps you through the whole processes.

SQLite Tutorial : This article explores the power and simplicity of sqlite3, first by starting with common commands and triggers, then the attach statement with the union operation is introduced in a way that allows multiple tables, in separate databases, to be combined as one virtual table, without the overhead of copying or moving data. Next, the simple sign function and the amazingly powerful trick of using this function in SQL select statements to solve complex queries with a single pass through the data is demonstrated, after making a brief mathematical case for how the sign function defines the absolute value and IF conditions.

The Lemon Parser Tutorial: This article explains how to build grammars and programs using the lemon parser, which is faster than yacc. And, unlike yacc, it is thread safe.

How to Compile the 2.6 kernel for Red Hat 9 and 8.0 and get Fedora Updates: This is a step by step tutorial on how to compile the 2.6 kernel from source.

Virtual Filesystem: Building A Linux Filesystem From An Ordinary File. You can take a disk file, format it as ext2, ext3, or reiser filesystem and then mount it, just like a physical drive. Yes, it then possible to read and write files to this newly mounted device. You can also copy the complete filesystem, since it is just a file, to another computer. If security is an issue, read on. This article will show you how to encrypt the filesystem, and mount it with ACL (Access Control Lists), which give you rights beyond the traditional read (r) write (w) and execute (x) for the 3 user groups file, owner and other.

Working With Time: What? There are 61 seconds in a minute? We can go back in time? We still tell time by the sun?



Chirico img Mike Chirico, a father of triplets (all girls) lives outside of Philadelphia, PA, USA. He has worked with Linux since 1996, has a Masters in Computer Science and Mathematics from Villanova University, and has worked in computer-related jobs from Wall Street to the University of Pennsylvania. His hero is Paul Erdos, a brilliant number theorist who was known for his open collaboration with others.


Mike's notes page is souptonuts. For open source consulting needs, please send an email to mchirico@gmail.com. All consulting work must include a donation to SourceForge.net.

SourceForge.net Logo


SourceForge.net Logo