
27.05.2008, 20:57
|
|
Постоянный
Регистрация: 22.03.2008
Сообщений: 325
С нами:
9545988
Репутация:
63
|
|
Короче препод зверь и просит без использования массива как реалезовать?Он говорит надо типа напрямю с буфером... ВОт.
PHP код:
<style type="text/css">
<!--
.N { background-color:white; }
.C { background-color:#FFFFBB; }
.A { background-color:#BBFFBB; }
.D { background-color:#FFBBBB; }
-->
</style>
<?
if(!empty($_POST[submit])&&!empty($_POST[file1])&&!empty($_POST[file2]))
{
$file1=$_POST[file1];
$file2=$_POST[file2];
$file1=fopen($file1,'rb');
$file2=fopen($file2,'rb');
for($a=0;$file3=fgets($file1);$a++)
{
$text1[$a]=$file3;
}
for($a=0;$file4=fgets($file2);$a++)
{
$text2[$a]=$file4;
}
}
?>
<table width=100% height=20% border=0 ><tr><td>
<form method='POST' align=right>
file1:<input type=text name='file1'>
file2:<input type=text name='file2'>
<input type=submit name=submit>
</form>
</td></tr></table>
<table bgcolor="white" border="1" cellpadding="1" cellspacing="1" width="100%">
<tr bgcolor="#eeeeee">
<td width=50%>
old version<br>
<?echo $_POST[file1];?>
</td>
<td>
new version<br>
<?echo $_POST[file2];?>
</td>
</tr>
</table>
<br>
<!-- by Mylenka-->
<?
for($a=0;count($text1)>$a;$a++)
{
if(strcasecmp($text1[$a],$text2[$a])==0)
{
print '<table bgcolor="#000000" border="0" cellpadding="1" cellspacing="1" width="100%">';
print '<tr bgcolor="#eeeeee">';
print '<td style="color: rgb(136, 136, 136); font-family: Courier New,Helvetica,sans-serif; font-size: 8pt;" bgcolor="white">';
echo '<font color=red>'. $a .'</font> ';
echo $text1[$a];
print '</td><td style="color: rgb(136, 136, 136); font-family: Courier New,Helvetica,sans-serif; font-size: 8pt;" bgcolor="white">';
echo '<font color=red>'. $a .'</font> ';
echo $text2[$a];
print'</td></tr></table>';
}
else
{
print '<table bgcolor="#000000" border="0" cellpadding="1" cellspacing="1" width="100%" >';
print '<tr style="color: rgb(0, 0, 0);" bgcolor="#eeeeee">';
print '<td class="C" width=50% style="color: rgb(136, 136, 136); font-family: Courier New,Helvetica,sans-serif; font-size: 8pt;" bgcolor="white">';
echo '<font color=red>'. $a .'</font> ';
echo $text1[$a];
print '</td><td class="C" style="color: rgb(136, 136, 136); font-family: Courier New,Helvetica,sans-serif; font-size: 8pt;" bgcolor="white">';
echo '<font color=red>'. $a .'</font> ';
echo $text2[$a];
print'</td></tr></table>';
}
}
?>
|
|
|