Avatar billede xvid Seniormester
10. marts 2004 - 03:09 Der er 1 kommentar og
1 løsning

tagwall problemer

Hej

efter at jeg havde finpudsen denne tagwall kan jeg ikke få den til at virke, jeg får ikke nogen fejl meddelelse, den kommer bare ikke frem

håber at der er nogen der kan hjælpe

på forhånd tak


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type='text/css'>
body {
  font-family: Trebuchet MS;
  color: #000000;
  font-size: 10pt;
}
INPUT {
  border: 1px solid;
  color: #000000;
}
TEXTAREA {
  border: 1px solid;
  color: #000000;
}
A {
  text-decoration: none;
  color: #000000;
}
A:hover {
  text-decoration: underline;
  color: blue;
}
.text {
    padding: 2px;
    margin: 2px;
    width: 400px;
    word-wrap:break-word;
}
</style>
  <title>Tagwall</title>
</head>
<body>
<form method='post' action='<?PHP echo $_SERVER['PHP_SELF']; ?>'>
<table cellspacing='7' width="272">
  <tr>
    <td width="127"><b><font size="2" face="Arial">Dit navn</font></b></td>
    <td width="129"><b><font size="2" face="Arial">Din e-mail</font></b></td>
  </tr>
  <tr>
    <td width="127"><input type='text' name='name' size='21' style="font-family: Arial; font-size: 10 pt; font-weight: bold"></td>
    <td width="129"><input type='text' name='email' size='21' style="font-family: Arial; font-size: 10 pt; font-weight: bold; background-color: #FFFFFF; border-style: solid; border-width: 1"></td>
  </tr>
  <tr>
    <td width="260" colspan="2"><b><font size="2" face="Arial">Din besked</font></b></td>
  </tr>
  <tr>
    <td width="260" colspan="2"><textarea cols='51' rows='7' name='text' style="font-family: Arial; font-size: 10 pt; font-weight: bold"></textarea></td>
  </tr>
  <tr>
    <td width="260" colspan="2"><input type='submit' name='send' value=' Post ' style="font-family: Arial; font-size: 10 pt; font-weight: bold; background-color: #FFFFFF; border-style: solid; border-width: 1"></form></td>
  </tr>
  <tr>
    <td width="260" colspan="2"><b>:) <img border="0" src="glad.gif" width="15" height="15">
      :( <img border="0" src="sur.gif" width="15" height="15">
      :'( <img border="0" src="ked.gif" width="15" height="15">
      :D <img border="0" src="skratt.gif" width="15" height="15">
      :P <img border="0" src="cool.gif" width="15" height="15">
      ;) <img border="0" src="ironi.gif" width="15" height="15"></b></td>
  </tr>
</table>
<br><br>

<?php
//MySQL server configuration
$host = "";    //Enter the address to your MySQL server
$user = "";    //Enter the user to your MySQL server
$pass = "";    //Enter the password to your user
$db = "";      //Enter the database on your MySQL server where you created the table from the structure.sql

//Do not modify anything under this line!
//Connect to the MySQL server
mysql_connect("$host", "$user", "$pass");

//Select a database
mysql_select_db($db);

if (isset($_POST['send'])) {
    //Get the input typed in the form
    $name = $_POST['name'];
    $email = $_POST['email'];
   
    //If nothing was typed in the name field, then the Name will be replaced with 'anonymous'
    $name = ($name == "") ? "Annonym" : $name;
    //If nothing was typed in the E-mail field, then the E-mail will be replaced with null@null
    $email = ($email == "") ? "ingen@mail" : $email;
   
    //If the text field isn't empty, then this code will be executed:
    //If an URL was typed in the text field, then it will be replaced with <a href='http://somedomain.com'>http://somedomain.com</a>
    //If an < or > has been typed, it will be replaced with &lt; or &gt;
    //Insert the data into the MySQL database
    if(!empty($_POST['text'])){
   
        $text = $_POST['text'];
        $text = ereg_replace("<", "&lt;", $text);
        $text = ereg_replace(">", "&gt;", $text);
        $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $text);
   
        $emotearr = array(":)",
        ":(",
        ":\'(",
        ":D",
        ":P",
        ";)"
        );
        $emotetag = array("<img src=\"glad.gif\">",
        "<img src=\"sur.gif\">",
        "<img src=\"ked.gif\">",
        "<img src=\"skratt.gif\">",
        "<img src=\"cool.gif\">",
        "<img src=\"ironi.gif\">"
        );
        $text = str_replace($emotearr, $emotetag, $text);
        mysql_query("insert into tagwall (name, email, text) values ('$name', '$email', '$text')") or die(mysql_error());
    }
}
//Get all the data from the MySQL database, sort by the row 'id' and limit the rows that's being printed to 20
//Make an array from the $result variable
//Convert the 'new line's to <br>
$result = mysql_query("SELECT email, name, `text`, DATE_FORMAT(time, '%d/%m %Y %H:%i:%s') AS time FROM tagwall ORDER BY id DESC LIMIT 40") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
    echo "<p><b><a href='mailto:".$row['email']."'>".$row['name']."</a></b> - ".$row['time']."</p>";
    echo "<p class='text'>".nl2br($row['text'])."</p><br />";
}
//Close the connection to the MySQL server
mysql_close();
?>
</body>
</html>


------------------------------------------------------------------------------------------
efter

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type='text/css'>
body {
  font-family: verdana;
  color: #000000;
  background-color: #b5b5b5;
  font-size: 8pt;
}
a:link { color: #ffffff; text-decoration: underline; }
a:visited { color: #333333; text-decoration: underline; }
a:active { color: #000000; }
a:hover { color:#ff0000;  } 
INPUT {
  border: 1px solid;
  color: #000000;
}
TEXTAREA {
  border: 1px solid;
  color: #000000;
}
A {
  text-decoration: none;
  color: #000000;
}
A:hover {
  text-decoration: underline;
  color: none;
}
.text {
    padding: 2px;
    margin: 2px;
    width: 400px;
    word-wrap:break-word;
}
</style>
  <title>Tagwall</title>
</head>
<body topmargin="0" leftmargin="70">
<form method='post' action='%3c?PHP echo $_SERVER[' ? PHP_SELF'];>'>
<table cellspacing='7' width="407">
  <tr>
    <td width="123"><font size="2" face="verdana">Dit navn</font></td>
    <td width="328"><input type='text' name='name' size='37' style="font-family: Verdana; font-size: 10 pt; background-color: #B5B5B5; BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: #000000 1px solid"></td>
  </tr>
  <tr>
    <td width="123"><font size="2" face="verdana">Din e-mail</font></td>
    <td width="328"><input type='text' name='email' size='37' style="font-family: Verdana; font-size: 10 pt; background-color: #B5B5B5; BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: #000000 1px solid"></td>
  </tr>
  <tr>
    <td width="135" valign="top"><font size="2" face="verdana">Din besked</font></td>
    <td width="352"><textarea cols='37' rows='7' name='text' style="font-family: Verdana; font-size: 10 pt; background-color: #B5B5B5; border: 1 solid #000000"></textarea></td>
  </tr>
  <tr>
    <td width="76"><font size="2" face="verdana">&nbsp;</font></td>
    <td width="303"><input type='submit' name='send' value=' Post ' style="font-family: Verdana; font-size: 10 pt; background-color: #B5B5B5; border-style: solid; border-width: 1"></form></td>
  </tr>
  <tr>
    <td width="76">
      <p align="center"><font size="2" face="verdana">Vælg smiley</font></p>
    </td>
    <td width="303">:)<b> <img border="0" src="glad.gif" width="15" height="15">
      </b>:(<b> <img border="0" src="sur.gif" width="15" height="15">
      </b>:'(<b> <img border="0" src="ked.gif" width="15" height="15">
      </b>:D<b> <img border="0" src="skratt.gif" width="15" height="15">
      </b>:P<b> <img border="0" src="cool.gif" width="15" height="15">
      </b>;)<b> <img border="0" src="ironi.gif" width="15" height="15"></b></td>
  </tr>
</table>
<br><br>

<?php
//MySQL server configuration
$host = "";    //Enter the address to your MySQL server
$user = "";    //Enter the user to your MySQL server
$pass = "";    //Enter the password to your user
$db = "";      //Enter the database on your MySQL server where you created the table from the structure.sql

//Do not modify anything under this line!
//Connect to the MySQL server
mysql_connect("$host", "$user", "$pass");

//Select a database
mysql_select_db($db);

if (isset($_POST['send'])) {
    //Get the input typed in the form
    $name = $_POST['name'];
    $email = $_POST['email'];
   
    //If nothing was typed in the name field, then the Name will be replaced with 'anonymous'
    $name = ($name == "") ? "annonym" : $name;
    //If nothing was typed in the E-mail field, then the E-mail will be replaced with null@null
    $email = ($email == "") ? "ingen@mail" : $email;
   
    //If the text field isn't empty, then this code will be executed:
    //If an URL was typed in the text field, then it will be replaced with <a href='http://somedomain.com'>http://somedomain.com</a>
    //If an < or > has been typed, it will be replaced with &lt; or &gt;
    //Insert the data into the MySQL database
    if(!empty($_POST['text'])){
   
        $text = $_POST['text'];
        $text = ereg_replace("<", "&lt;", $text);
        $text = ereg_replace(">", "&gt;", $text);
        $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=%22/0/%22>\\0</a>", $text);
   
        $emotearr = array(":)",
        ":(",
        ":\'(",
        ":D",
        ":P",
        ";)"
        );
        $emotetag = array("<img src=%22glad.gif/%22>",
        "<img src=%22sur.gif/%22>",
        "<img src=%22ked.gif/%22>",
        "<img src=%22skratt.gif/%22>",
        "<img src=%22cool.gif/%22>",
        "<img src=%22ironi.gif/%22>"
        );
        $text = str_replace($emotearr, $emotetag, $text);
        mysql_query("insert into tagwall (name, email, text) values ('$name', '$email', '$text')") or die(mysql_error());
    }
}
//Get all the data from the MySQL database, sort by the row 'id' and limit the rows that's being printed to 20
//Make an array from the $result variable
//Convert the 'new line's to <br>
$result = mysql_query("SELECT email, name, `text`, DATE_FORMAT(time, '%d/%m %Y %H:%i:%s') AS time FROM tagwall ORDER BY id DESC LIMIT 40") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
    echo "<p><a href='mailto:%22.$row[' email']."'>".$row['name']."</a> - ".$row['time']."</p>";
    echo "<p class='text'>".nl2br($row['text'])."</p><br />";
}
//Close the connection to the MySQL server
mysql_close();
?>
</body>
</html>
Avatar billede thedeathart Nybegynder
16. marts 2004 - 11:33 #1
hvad med at indtaste dine mySQL oplysninger...
Avatar billede xvid Seniormester
17. marts 2004 - 14:16 #2
jeg har glemt helt om denne, man har fundet ud af det, bruger den gamle
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester