phpbar.de logo

Mailinglisten-Archive

[php] ereg_replace? PHP Buch :-(

[php] ereg_replace? PHP Buch :-(

TI-NEWS/PPK info_(at)_grossalp.ch
Mon, 19 Jul 1999 12:46:17 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0065_01BED1E4.B1A853E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Hallo liste,

Ich baue eben eine kleine lokale suchmaschine mit php3 und mysql auf:
http://www.ti-news.ch/search/index.php3
aber bei der link eintragung auf:
http://www.ti-news.ch/search/addurl.php3
kann der Unix oder besser gesagt mysql keine daten aufnehmen die
 das zeichen ( ' ; ) enthalten wie kann ich das beim eintrag ersetzen?

Auch im Buch finde ich keine Beispiele, ich habe nur in scripten von
www.phorum.org
ein beisbiel gefunden:

else{
   $body=eregi_replace("<\\?", "&lt;?", $body);
   $body=eregi_replace("\\?>", "?&gt;", $body);
   $body=eregi_replace("<script", "&lt;script", $body);
   $body=eregi_replace("</script>", "&lt;/script&gt;", $body);
  }

aber wie anwenden bei der datenbank eintragung?

oder muss ich die daten der mysql ändern?
bei eintragung:
DROP TABLE IF EXISTS z_tiapp;
CREATE TABLE z_tiapp (
   id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
   cat varchar(60) NOT NULL,
   url varchar(255) NOT NULL,
   tit varchar(255),
   descr blob NOT NULL,
   hit char(3) DEFAULT '0',
   datum date,
   vmail blob NOT NULL,
   PRIMARY KEY (id),
   UNIQUE url (url)
);


bei meinem Ok insert in:

DROP TABLE IF EXISTS z_tinew;
CREATE TABLE z_tinew (
   id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
   cat varchar(60) NOT NULL,
   url varchar(255),
   tit varchar(255),
   descr blob NOT NULL,
   hit char(3) DEFAULT '0',
   datum date,
   PRIMARY KEY (id)
);


Danke im voraus für jede antwort

Patrik Hohl
Screendesign





------=_NextPart_000_0065_01BED1E4.B1A853E0
Content-Type: application/octet-stream;
	name="addurlrisp.php3"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="addurlrisp.php3"

<?php
 require("db.php3");
 require("alto.php3");
 ?>
 <P>
<CENTER><TABLE WIDTH=3D"455" BORDER=3D"0" CELLPADDING=3D"5" =
ALIGN=3D"LEFT" BGCOLOR=3D"White">
 <TR>
  <TD><P>
<FONT FACE=3D"Verdana" SIZE=3D"2" COLOR=3D"Navy">
In futuro potrete vedere di persona=20
quante volte il Vostro sito</FONT> <B><FONT FACE=3D"Verdana" SIZE=3D"2" =
COLOR=3D"Red"><? echo $url; ?> </FONT></B>
<FONT FACE=3D"Verdana" SIZE=3D"2" COLOR=3D"Navy">viene contattato dai =
vari utenti di Ti Search.=20
Pertanto si ringrazia del vostro inserimento=20
nel Database di amministrazione. Appena accettato=20
ricever&agrave; conferma tramite e-mail:</FONT><BR>
 <FONT FACE=3D"Verdana" SIZE=3D"2" COLOR=3D"Red"><? echo $vmail; =
?></FONT> <P></FONT><BR>

<BR>


 	<?php
			=09
			// CHECK FOR FIELDS
			if ($go=3D=3D1) {
				if ($descr=3D=3D"" || $vmail=3D=3D"" || $tit=3D=3D"") {
					?>
					<script>
						window.alert('Riempire le caselle Pf.! ');
					</script>
					<?php
				} else {
					// EINTRAGUNG  IN DATENBANK
=09
					/* init dbquery1 */
					$datum=3Ddate("Y-m-d");	=09
					mysql_db_query("grossalp_ppk", "INSERT INTO z_tiapp =
(id,cat,url,tit,descr,hit,datum,vmail) VALUES =
('$newid','$cat','$url','$tit','$descr','$hit','$datum','$vmail')");=20
				}
			}
=09
   ?>
 <BR><A HREF=3D"index.php3" TARGET=3D"_top">INDEX Ti Search</A><BR><BR>
<?php
$an_id=3Dmysql_query("SELECT *  from z_tiapp  WHERE url=3D'$url'");

			 while($zeile=3Dmysql_fetch_array($an_id)):=20

		  $cat=3D($zeile["cat"]);
		 =20
		  $vmail=3D($zeile["vmail"]);

		   $url=3D($zeile["url"]);

		    $tit=3Dhtmlspecialchars($zeile["tit"]);

			 $descr=3Dhtmlspecialchars($zeile["descr"]);

			  $hit=3D($zeile["hit"]);

			   $id=3D($zeile["id"]);

			    $datum=3D($zeile["datum"]);

?>

<CENTER><TABLE WIDTH=3D"450" BORDER=3D"0" CELLSPACING=3D"0" =
CELLPADDING=3D"0" BGCOLOR=3D"slateblue">
<TR BGCOLOR=3D"slateblue">
    <TD ALIGN=3D"LEFT" VALIGN=3D"TOP" BGCOLOR=3D"slateblue"><IMG =
SRC=3D"pic/rand1.gif" WIDTH=3D24 HEIGHT=3D48 BORDER=3D0 ALT=3D""></TD>
	<TD WIDTH=3D"402" BGCOLOR=3D"slateblue"><IMG SRC=3D"pic/vuoto.gif" =
WIDTH=3D402 HEIGHT=3D1 BORDER=3D0 ALT=3D""><BR>
	<FONT FACE=3D"Times New Roman" SIZE=3D"2" COLOR=3D"White">
	ID: <?php echo $id ?> Categoria:&nbsp;<?php echo $cat ?>&nbsp;- <?php =
echo $tit ?>&nbsp;Hits:&nbsp;<?php echo $hit ?>
</FONT></TD>
	<TD ALIGN=3D"RIGHT" VALIGN=3D"TOP" BGCOLOR=3D"slateblue"><IMG =
SRC=3D"pic/rand.gif" WIDTH=3D24 HEIGHT=3D48 BORDER=3D0 ALT=3D""></TD>
</TR>
<TR BGCOLOR=3D"#E8E8FF">
    <TD WIDTH=3D"24" BGCOLOR=3D"White">&nbsp;</TD>
	<TD WIDTH=3D"402"><BLOCKQUOTE><FONT FACE=3D"Times New Roman" SIZE=3D"2" =
COLOR=3D"Navy">
	<BR>
	<?php echo $descr ?><BR>
	<?php echo $datum ?>&nbsp;<A HREF=3D"http://<?php echo $url ?>" =
TARGET=3D"_top"><?php echo $tit ?></A>&nbsp;
	<A HREF=3D"http://<?php echo $url ?>" TARGET=3D"_blank">New window</A>
=09
</FONT></BLOCKQUOTE></TD>
	<TD WIDTH=3D"24" BGCOLOR=3D"White">&nbsp;<TD WIDTH=3D"24" =
BGCOLOR=3D"White"></TD>
</TR>
</TABLE></CENTER>

<BR>
<?php
endwhile;
?>=09
<BR><CENTER><FONT FACE=3D"Verdana" SIZE=3D"1" COLOR=3D"Red"><A =
HREF=3D"http://www.ti-news.ch/" =
TARGET=3D"_top">www.ti-news.ch</A>&nbsp;<A =
HREF=3D"addurl.php3">addurl</A></CENTER>
</TD>
</TR>
</TABLE></CENTER>
</BODY>
</HTML>
<?php
if ($submiter =3D=3D "public") :
{
	$message.=3D"$vmail ha inserito un nuovo indirizzo web.\n";
	$message.=3D"Passare per approvazione su di:\n";
	=
$message.=3D"http://www.ti-news.ch/search/adminxy/addurl.php3?New_ID=3D$i=
d \n\n";
	=
$message.=3D"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n\n";
	$message.=3D"Screendesign http://www.ppk.grossalp.ch/\n";
	$message.=3D"in data : $datum .\n";
=09
	mail ("info_(at)_ti-news.ch","ADDURL" , "$message",
          "From: search_(at)_ti-news.ch\n
           Reply-To: User Ti Search <$vmail>\n
           X-Header: Nescape" );

	echo "<META HTTP-EQUIV=3D\"REFRESH\" CONTENT=3D\"22; =
URL=3Dindex.php3\">";
}=20

endif;
?>

------=_NextPart_000_0065_01BED1E4.B1A853E0--



php::bar PHP Wiki   -   Listenarchive