All pastes #770299 Raw Edit

Stuff

public php v1 · immutable
·published 2007-11-12 01:57 UTC
rendered paste body
<?php session_start();	/*	class inputSelections	{		public $name=null;				public function setName($n)		{			$name = $n;		}				public function getName()		{			return $name;		}	}	*/	class Selections	{		public $str;				public $type;				function __construct()		{			$this->str=array();						$this->type=1;		}				public function setType($t)		{			$this->type =$t;		}				public function getType()		{			return $this->type;		}		public function setStr($s)		{			//echo $s[0]."oxox";						$this->str = $s;						if(count($this->str)>1)				$this->type = 1;			else				$this->type = 2;		}				/*public function createOptions()		{			$options = $op;		}*/				public function getNumOfOptions()		{			return count($this->str);		}				public function getIndexOption($i)		{			$var = $this->str[$i];			//echo "$var lol$i";			return $var;		}	}		function modify_array($ar)	{		$i = 1;		$newAry=array();		echo $ar;		$temp = explode("<#",$ar);		//$list = array();		while (count($temp) > $i)		{			$temp1 = explode("#>",$temp[$i]);						$temp2 = explode("/",$temp1[0]);						$newSelc = new Selections();			$newSelc->setStr($temp2);  						//echo $temp2[0];			array_push($newAry,$newSelc);						//$newAry[$i]=&$newSelc;						//$ss = $newSelc->getIndexOption(0);						$i++;		}		return $newAry;		}	echo "<head><title>Select Word</title></head";	$story_file = $_SESSION['name'];			if(!isset($_SESSION['name']))	{		echo "<hr/>Please select a story first<br/> <a href=\"index.php\"><b>click here</b></a> to go back to <u>Story Selection</u>";	}	else	{		$file_name = "stories//".$story_file;		$fh = fopen($file_name,'r');		$fr = fread($fh,filesize($file_name));								$newAry = modify_array($fr); 		echo "<center>";		echo "<h1><font color=\"blue\">Select your words</font></h1>";		echo "<hr/><br/>";		echo "<h3>Please fill out the form and hit submit</h3>";			echo "<form action=\"change.php\" method=\"POST\">";		echo "<table border=\"0\" width=\"40%\">";				for($i=0;$i< count($newAry); $i++)		{			$x = $i+1;			echo "<tr>";			echo "<td>($x)</td>";			echo "<td align=\"right\">";						$obj = $newAry[$i];			//echo $obj->getType();						if($obj->getType() == 1)			{				$inp = $obj->getIndexOption(0);				echo "<p align=\"right\">$inp</td>";				echo "<td><input type=\"text\" name=\"T$i\" size=\"20\"></td>";				echo "</tr>";			}			else			{					$j = $obj->getNumOfOptions();								$op = $obj->getIndexOption(0);								echo "<p align=\"right\">";				for($k=1;$k<$j;$k++)				{					echo "/".$inp->getIndexOption($k);				}				echo "</td>";				echo "<td>";				for($k=0;$k<$j;$k++)				{						$x = $k+1;					$op = $inp->getIndexOption($k);					//displaying the radio buttons						echo "<input type=\"radio\" value=\"V$x\" name=\"R1\">$op";				}				echo "</td>";				echo "</tr>";			}			}				echo "<tr>";				echo "<td colspan=\"3\" align=center>";		echo "<br/>";		echo "<input type=\"submit\" value=\"Submit\" name=\"button\"/>";		echo "<input type=\"submit\" value=\"Go Back\"name=\"button\"/>";		echo "</td>";				echo "</tr>";		echo "</table>";			echo "</center>";	}	?>