CSubskrypcja - duży problem
: czw mar 01, 2007 11:30 pm
Witam.
Zainstalowałem na swojej stronie skrypt CSubskrypcja
Skrypt jest osadzony na stronie, kod skryptu wygląda tak
Cały problem polega na tym, że kod HTML poza tym skryptem przestaje być wyświetlany, wszystko poza nim dosłownie znika. Po wrzuceniu na serwer źródło urywa się za głównym formularzem.
Co z tym zrobić ? Gdzie jest błąd ? Skrypt został ściągnięty z Webinside to chyba nie powinien zawierać błędów, a jednak coś jest nie tak.
Z góry dziękuję za wszelką pomoc.
Zainstalowałem na swojej stronie skrypt CSubskrypcja
Skrypt jest osadzony na stronie, kod skryptu wygląda tak
Kod: Zaznacz cały
<?
if(isset($HTTP_POST_VARS))
{
while(list($key,$value)=each($HTTP_POST_VARS))
{
$$key=$value;
}
}
?>
<?
if($STEP==""){
$STEP=1;
}
if($STEP>0)
{
if($STEP==1)
{
if(!isset($email))
{
function formularz()
{
?>
<form ACTION= <?php $adres = $_SERVER['REQUEST_URI']; echo $adres; ?> method=post><INPUT TYPE=HIDDEN NAME=STEP VALUE=2>
<div align="center" id="newsletter">
<center>
<table border="0" width="180" height="90" cellspacing="1">
<tr>
<td width="180" height="30" colspan="2" valign="middle" align="center"><input TYPE=\"text\" name=email>
</td>
</tr>
<tr>
<td width="180" height="30" colspan="2" valign="middle" align="center">Zapisz: <input TYPE="radio" name=confirm value=zapis checked><br /> Wypisz: <input TYPE="radio" name=confirm value=wypis></td>
</tr>
<tr>
<td width="160" height="30" valign="middle" align="center"><input TYPE=submit value='Zatwierdź' style="border: 1px double #ab1414; background-color: #fbfaf8;"></td>
</tr>
</table>
</center>
</div>
</form>
<?
}
return formularz();
}
}
if($STEP==2&&isset($confirm)&&$confirm=='zapis'||$confirm=='wypis'&& !$email)
{
if(!eregi("^([a-z0-9_-]+([.a-z0-9_-]+)*)@([a-z0-9_-]{1,}(.[a-z0-9_-]{1,})*.[a-z]{2,3})$",$email))
{
echo "<div align=\"center\">
<center>
<table border=\"0\" width=\"310\" height=\"20\">
<tr>
<td width=\"310\" height=\"20\" align=center>blad w adresie ! </td>
</tr>
</table>
</center>
</div></center>";
exit;
}
}
if($STEP==2&&isset($confirm)&&$confirm=='zapis')
{
?>
<FORM ACTION=flymail.php METHOD=POST>
<INPUT TYPE=HIDDEN NAME=STEP VALUE=3>
<INPUT TYPE=HIDDEN NAME=email VALUE=<?echo($email);?>>
<? ///
$tablica=file("emaile.txt");
$ile=0;
for($i=0;$i<count($tablica);$i++)
{
$ex=explode("|**|", $tablica[$i]);
if($email==chop($ex[1]))
{
$ile++;
if($ile==1)
{
echo "<div align=\"center\">
<center>
<table border=\"0\" width=\"310\" height=\"20\">
<tr>
<td width=\"310\" height=\"20\" align=center>Podany adres email (<B>$ex[1]</B>) już istnieje </td>
</tr>
</table>
</center>
</div></center>";
exit;
}
}
}
if($ile==0 && $email)
{
$email=htmlspecialchars($email);
$email=strip_tags($email);
$counter=file("emaile.txt");
$row=array_reverse($counter);
$liczba=$row[0]+1;
$plik=fopen("emaile.txt","a");
flock($plik, 2);
fwrite($plik,"$liczba|**|$email|**|\n");
flock($plik,3);
fclose($plik);
$message ="<html>";
$message .="<head>";
$message .="<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=iso-8859-2\">";
$message .="<title>dodanie subskrypcji</title>";
$message .="</head>";
$message .="<body bgcolor=\"rgb(245,245,245)\">";
$message .="<font style=\"font-family:vrdana;color:darkblue;font-size:13px;font-weight:normal\"><hr>Dostajesz automatycznego emaila z potwierdzeniem subskrypcji - <br><h1>Witamy :)</h1></FONT><br>";
$message .="<a HREF=\"http://www.twojadres.com.pl\">http://www.twojadres.com.pl</A>";// tutaj wpisz swój adres
$message .="<br>";
$message .="<font style=\"font-family:vrdana;color:darkblue;font-size:13px;font-weight:normal\">Data przeslania: $data</font>";
$message .="</body>";
$message .="</html>";
$headers ="MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=iso-8859-1\r\n";
//mail("$ex[0]","Inormacja o dodaniu subskrypcji","$message","$headers"); // jeśli serwer nie ma obslugi tej funkcjii usun ta linie lub zostaw tak jak jest a jak ma to usun // przed funkcja
echo "<div align=\"center\">
<center>
<table border=\"0\" width=\"310\" height=\"20\">
<tr>
<td width=\"310\" height=\"20\" align=center>Dziekujemy za dopisane do bazy adresu <b>$email</b></td>
</tr>
</table>
</center>
</div>";
}
else
{
echo "<div align=\"center\">
<center>
<table border=\"0\" width=\"310\" height=\"20\">
<tr>
<td width=\"310\" height=\"20\" align=center>podaj adres!</td>
</tr>
</table>
</center>
</div>";
}
}
///
if($STEP==2&&isset($confirm)&&$confirm=='wypis')
{
?><FORM ACTION=flymail.php METHOD=POST>
<INPUT TYPE=HIDDEN NAME=STEP VALUE=4>
<input TYPE=HIDDEN NAME=CONFIRM VALUE=<?echo($wypis);?>>
<INPUT TYPE=HIDDEN NAME=email VALUE=<?echo($email);?>>
<?
$nr='0';
$plik=file("emaile.txt");
for($i=0;$i<count($plik);$i++){
$ex=explode("|**|",$plik[$i]);
if(chop($email)==chop($ex[1]))
{
$dane=file("emaile.txt");
unset($dane[$i]);
$file=fopen('emaile.txt','w');
fwrite($file,str_replace("\n\r","",join('',$dane)));
fclose($file);
setlocale('LC_TIME','polish');
$data=strftime(" %A, %d %B %Y");
$message ="<html>";
$message .="<head>";
$message .="<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=iso-8859-2\">";
$message .="<title>usuniecie subskrypcji</title>";
$message .="</head>";
$message .="<body bgcolor=\"rgb(245,245,245)\">";
$message .="<font style=\"font-family:vrdana;color:darkblue;font-size:13px;font-weight:normal\"><hr>Dostajesz automatycznego emaila z potwierdzeniem usunięcia subskrypcji - <br><h1>szkoda :(</h1></FONT><br>";
$message .="<a HREF=\"http://www.twojadres.com.pl\">http://www.twojadres.com.pl</A>";// tutaj wpisz swój adres
$message .="<br>";
$message .="<font style=\"font-family:vrdana;color:darkblue;font-size:13px;font-weight:normal\">Data przeslania: $data</font>";
$message .="</body>";
$message .="</html>";
$headers ="MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=iso-8859-1\r\n";
//mail("$ex[0]","Inormacja o usunieciu subskrypcji","$message","$headers"); // jeśli serwer nie ma obslugi tej funkcjii usun ta linie lub zostaw tak jak jest a jak ma to usun // przed funkcja
echo "<div align=\"center\">
<center>
<table border=\"0\" width=\"310\" height=\"20\">
<tr>
<td width=\"310\" height=\"20\" align=center>usunieto adres z bazy danych</td>
</tr>
</table>
</center>
</div>\n";
$nr++;
}
}
$target=chop(trim($nr));
$trafienia=$target;
if($trafienia<=0)
{
echo "<center><font style=\"font-family:verdana;color:darkblue;font-size:13px\">Adres</font> '<font style=\"font-family:verdana;color:red;font-size:13px\">$email</font><font style=\"font-family:verdana;color:darkblue;font-size:13px\">' nie występuje w bazie danych</font></CENTER>";
}
}
}
?>
Cały problem polega na tym, że kod HTML poza tym skryptem przestaje być wyświetlany, wszystko poza nim dosłownie znika. Po wrzuceniu na serwer źródło urywa się za głównym formularzem.
Co z tym zrobić ? Gdzie jest błąd ? Skrypt został ściągnięty z Webinside to chyba nie powinien zawierać błędów, a jednak coś jest nie tak.
Z góry dziękuję za wszelką pomoc.