View Single Post
Old Dec 10th, 2004, 9:29 PM   #8
Overmind
Professional Programmer
 
Overmind's Avatar
 
Join Date: Jun 2004
Location: South Africa, Johannesburg
Posts: 301
Rep Power: 5 Overmind is on a distinguished road
Well, I have finished it, though there are still things I want to add and change, but the same basic code will be the same. here it is I have trashed the idea of an admin place for now.


index.php
<HTML class="body"><LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>
<A HREF="addcode.php">Add Code</A>
<table border="0">
<tr>
<td valign="top">
<?PHP

$lang = $_POST['lang'];
echo '<form method="POST">';
echo '<select name="lang" class="inputbutton">';
$d = opendir('langs/');
while (false !== ($f = readdir($d))) {
if ($f == '..' || $f == '.') { $f = '';}
else {
	echo '<option value="langs/'.$f.'/">'.$f;
   }
   
   }
echo '</select>';
echo '<input type="submit" value=" Go--> " name="submit" class="inputbutton">';
echo '</form>';

if ($lang != '')
	{
$d = opendir($lang);
while (false !== ($f = readdir($d))) {
if ($f == '..' || $f == '.') { $f = '';}
else {
	$lines = file($lang.$f);
	$title = $lines[2];
	$num = 20;
 if(strlen($title) > $num)
   {
     $temp = substr( $title, 0, $num-2);
     $temp .= "...";
     $title = $temp;
   }
	
	
	echo '<A HREF="'.$lang.$f.'" target="tehframe">'.$title.'</A><BR>';
   }
   
   }
	
	}
?>
	
<HTML></td>
<td>
<BR><BR>
<iframe width="650" height="300" name="tehframe" align="center"></iframe>
</td>
</tr>
</table>
<BR><BR>
<font color="white" size="1">
<CENTER>--------------------------------<BR>
c0de rep0sit0ry v1.0<BR>
<A HREF="http://www.jethro.za.net/">www.jethro.za.net</a></font>
</HTML>

addcode.php
<HTML class="body"><LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>
<A HREF="index.php" class="hover">Browse Code</A><BR><BR>
<?PHP
$lang = $_POST['lang'];
$title = $_POST['title'];
$code = $_POST['code'];
$agree = $_POST['agree'];

echo '<form method="POST">';
echo '<textarea cols=80 rows=10 name="code" class="inputbutton"></textarea><BR><BR>';
echo 'Language? <select name="lang" class="inputbutton">';
$d = opendir('langs/');
while (false !== ($f = readdir($d))) {
if ($f == '..' || $f == '.') { $f = '';}
else {
	echo '<option value="langs/'.$f.'">'.$f;
   }
   }
echo '</select><BR>';
echo 'Title? <input type="text" value="Title" name="title" class="inputbutton"><BR>';
echo 'Do you agree to our <A href="conditions.php" target="blahwin">"terms & conditions</a>? <select name="agree" class="inputbutton">';
echo '<option value="NO">NO';
echo '<option value="YES">YES';
echo '</select><BR>';
echo '<input type="submit" value=" Post--> " name="submit" class="inputbutton"><BR>';

echo '</form>';

if ($agree == 'YES')
	{ 
	$name = strftime('%c');
	$code = ">TITLE<\n---------\n".$title."\n\n>CODE<\n---------\n".$code;
	$title = $lang."/".$name.'_'.$title.'.txt';
	$file = fopen($title,'w+');
	$code = stripslashes($code);
	fwrite($file,$code);
	fflush($file);
	fclose($file);
	}
?>
<HTML>
<BR><BR>
<font color="white" size="1">
<CENTER>--------------------------------<BR>
c0de rep0sit0ry v1.0<BR>
<A HREF="http://www.jethro.za.net/">www.jethro.za.net</a></font>
</HTML>
style.css
<style>
 .inputbox { 
 border-top:#333333 solid thin; 
 border-bottom:#333333 solid thin; 
 border-right:#333333 solid thin; 
 border-left:#333333 solid thin; 
 font-family: verdana, helvetica, sans-serif; 
 color: #57c6f9;
 background-color: #57c6f9
 }
 
 .inputbutton { 
 font-size: 100%; 
 font-family: verdana, helvetica, sans-serif; 
 color: #FFFFFF;
 background-color: #57c6f9
 }
 .body {
 background-color: #57c6f9
 }

 </style>
A least it works....for now....until someone breaks it.
:dancing:
__________________
[SIGPIC][/SIGPIC]
Overmind is offline   Reply With Quote