Avatar billede kirkeby Nybegynder
27. maj 2006 - 13:44 Der er 1 løsning

Hvordan får jeg dette script tilføjet i gæstebogen ?

Hej !

Jeg har 2 ting som jeg gerne vil ha ændret i denne gæstebog..

1. Alt det som står om ICQ skal fjernes, og i stedet skal feltet hedde MSN..  så i stedet for den tjekker at feltet kun indeholder tal, skal den tjekke om der er et @ i feltet.. 

feltet skal ikke være obligatorisk at udfylde...

2. Jeg vil også gerne have tilføjet dette i gæstebogen, da jeg dagligt modtager 20-100 spam indlæg fra div servere om viagra tilbud..

rubrikken med tekst og input feltet må gerne stå over Besked feltet

Skriv "hej5": < input type="text" name="antispam" size="20" >



if(!$antispam) == "hej5"){ echo "Du skal skrive "hej5"; }
else {


}




her er index filen af gæstebogen :

<?php
    class Timer {
        var $startTime;
        var $endTime;
        function start() {
            $this->startTime = gettimeofday();
        }
        function stop() {
            $this->endTime = gettimeofday();
        }
        function elapsed() {
            return (($this->endTime["sec"] - $this->startTime["sec"]) * 1000000 + ($this->endTime["usec"] - $this->startTime["usec"])) / 1000000;
        }
    }
    $timer = new Timer();
    $timer->start();
    include("lib.php");
    include("settings-data.php");
    if (file_exists("content-data.php"))
        include("content-data.php");
    else
        createFile("content-data.php");
    include("useragent.php");
    $userAgent = $HTTP_USER_AGENT;
    $browser = getBrowser($arrBrowser,$userAgent);
    $system = getSystem($arrSystem,$userAgent);
    $formatedMailBody = "Browser: ".$browser['browser']." ".$browser['version']."\nSystem Os: ".$system."\nUser Agent: ".$userAgent;
//    if ($browser == "Other" || $system == "Other")
//        @mail($constant['admin-mail'], "detect useragent", $formatedMailBody, "Content-Type: text/plain; charset=windows-1251\nContent-Transfer-Encoding: 8bit\nX-Priority: 5");
    session_start();
    if (!isset($content))
        $content[0]['ip'] = "";
    $contentCnt = sizeof($content);
    $errMessage = "";
    if (!isset($userId))
        $userId = "";
    if (!isset($error))
        $error = "";
    if (!isset($style))
        $style = "";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



<html>
<head>
<title>Gæstebogen</title>
<?php
    if ($constant['charset'] != "")
    {
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$constant['charset']?>"/>
<?php
    }
?>
<script language="JavaScript" src="script.js" type="text/javascript"></script>
<?php
    if($constant['smile-in-message'])
    {
?>       
<script language="JavaScript" type="text/javascript">
<!--
    function setSmile(str)
    {
        obj = document.guestbook.message;
        obj.focus();
        obj.value =    obj.value + str;
    }
//-->
</script>
<?php
    }
?>
<link href="style.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
<!--
input.field {
    width : 370px
}

#error {
    color : <?=$constant['error-color']?>
}

input.button {
    width : 450px;
}

textarea {
    width : 450px;
}

.text {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['text-color']?>
}

.link {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['link-color']?>
}

.messagetext {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['message-text-color']?>
}

.messagelink {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['message-link-color']?>
}

.admintext {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['admin-message-text-color']?>
}

.adminlink {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['admin-message-link-color']?>
}

.headertext {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['header-text-color']?>
}

.headerlink {
    font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
    color : <?=$constant['header-link-color']?>
}

<?=$style?>
-->
</style>
</head>








<body bgcolor="<?=$constant['background-color']?>" text="<?=$constant['text-color']?>" link="<?=$constant['link-color']?>" vlink="<?=$constant['link-color']?>" alink="<?=$constant['link-color']?>" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<table width="400" border="0" cellpadding="0" cellspacing="0" align="center" height="100%">
<tr>
    <td valign="top" class="text">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="<?=$constant['border-color']?>">
                <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr>
                    <td bgcolor="<?=$constant['header-background-color']?>" class="headertext" id="book-title">Gæstebog</td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
        <br/>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="<?=$constant['border-color']?>">
                <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr>
                    <td bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center" width="50%"><a href="index.php#post"><b>Send Besked</b></a></td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
        <br/>
<?php
    $pageLine = pagesNumber($contentCnt, $constant['messages-to-page'], $page, "index.php", $constant['page-in-line'], "page: ", "total: ");
    if ($pageLine != "")
    {
?>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="<?=$constant['border-color']?>">
                <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr>
                    <td class="headertext" bgcolor="<?=$constant['header-background-color']?>"><?=$pageLine?></td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
        <br/>
<?php
    }
?>
<?php
    $currentContent = outputPageContent($content, $page, $constant['messages-to-page']);
    for ($i = 0; $i < sizeof($currentContent); $i++)
    {
        if (isset($currentContent[$i]['ip']) && $currentContent[$i]['ip'] != "")
        {
?>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="<?=$constant['border-color']?>">
                <table width="100%" border="0" cellpadding="0" cellspacing="1">
                <tr>
                    <td>
                        <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="<?=$constant['message-background-color']?>">
<?php
            // name and email as link >>
            if ($currentContent[$i]['name'] != "")
            {
?>                        <tr>
                            <td width="1%" align="center"><img src="img/name.gif" width="11" height="14" border="0" alt="Name"/></td>
                            <td class="messagetext"><?php
                            if ($currentContent[$i]['mail'] != "") {
                                print '<a href="mailto:'.$currentContent[$i]['mail'].'">'.censoredData($currentContent[$i]['name']).'</a>';
                            }
                            else {
                                print censoredData($currentContent[$i]['name']);
                            }
                            $check['status'] = false;
                            $check['id'] = -1;
                            $check = checkPublishName($currentContent[$i]['name'], "");
                            if(!$check['status'])
                                print ' [<a href="java script:info(\'user-info.php?id='.$check['id'].'\',450,250)">info</a>]';
                            ?></td>
                        </tr>
<?php
            }
            // name and email as link <<
            // url >>
            if ($currentContent[$i]['url'] != "")
            {
?>                        <tr>
                            <td align="center"><img src="img/url.gif" width="18" height="18" border="0" alt="Url"/></td>
                            <td class="messagetext"><a href="<?=$currentContent[$i]['url']?>"><?=censoredData($currentContent[$i]['url'])?></a></td>
                        </tr>
<?php
        }
            // url <<
            // icq >>
            if ($currentContent[$i]['icq'] != "")
            {
?>                        <tr>
                            <td><img src="http://online.mirabilis.com/scripts/online.dll?icq=<?=$currentContent[$i]['icq']?>&img=5" width="18" height="18" alt="User status"/></td>
                            <td><a href="http://web.icq.com/whitepages/message_me/1,,,00.icq?uin=<?=$currentContent[$i]['icq']?>&action=message" class="messagelink"><?=$currentContent[$i]['icq']?></a></td>
                        </tr>
<?php
            }
            // icq <<
            // date and time >>
            if ($currentContent[$i]['time'] != "")
            {
?>                        <tr>
                            <td align="center"><img src="img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
                            <td class="messagetext">[<?=getFullDate($currentContent[$i]['time'], $constant['locale']).", ".getTime($currentContent[$i]['time'])?>]</td>
                        </tr>
                        <tr>
                            <td><img src="img/sp.gif" width="1" height="1" border="0"/></td>
                            <td><hr size="1" color="<?=$constant['border-color']?>"/></td>
                        </tr>
<?php
            }
            // date and time <<
            // message >>
            if ($currentContent[$i]['message'] != "")
            {
?>                        <tr>
                            <td><img src="img/sp.gif" width="18" height="20" border="0"/></td>
                            <td class="messagetext" valign="top"><?=convertSmile(censoredData($currentContent[$i]['message']));?></td>
                        </tr>
<?php
            }
            // message <<
            if ($currentContent[$i]['admin-name'] != "")
            {
?>                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="<?=$constant['admin-message-background-color']?>">
<?php
            }
            // admin name >>
            if ($currentContent[$i]['admin-name'] != "")
            {
?>                        <tr>
                            <td width="1%" align="center"><img src="img/admin-name.gif" width="11" height="14" border="0" alt="Admin name"/></td>
                            <td class="admintext" valign="bottom"><?php
                            if (isset($currentContent[$i]['admin-mail']) && $currentContent[$i]['admin-mail'] != "")
                                print '<a href="mailto:'.$currentContent[$i]['admin-mail'].'"><b>'.$currentContent[$i]['admin-name'].'</b></a>';
                            else
                                print "<b>".$currentContent[$i]['admin-name']."</b>";
                            $check['status'] = false;
                            $check['id'] = -1;
                            $check = checkPublishName($currentContent[$i]['admin-name'], "");
                            if(!$check['status'])
                                print ' [<a href="java script:info(\'user-info.php?id='.$check['id'].'\',450,250)">info</a>]';
                            ?></td>
                        </tr>
<?php
            }
            // admin name <<
            // admin date and time >>
            if ($currentContent[$i]['admin-time'] != "")
            {
?>                        <tr>
                            <td align="center"><img src="img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
                            <td class="admintext">[<?=getFullDate($currentContent[$i]['admin-time'], $constant['locale']).", ".getTime($currentContent[$i]['admin-time'])?>]</td>
                        </tr>
                        <tr>
                            <td><img src="img/sp.gif" width="1" height="1" border="0"/></td>
                            <td><hr size="1" color="<?=$constant['border-color']?>"/></td>
                        </tr>
<?php
            }
            //admin date and time <<
            // admin message >>
            if ($currentContent[$i]['admin-message'] != "")
            {
?>                        <tr>
                            <td><img src="img/sp.gif" width="18" height="20" border="0"/></td>
                            <td class="admintext" valign="top"><?=convertSmile($currentContent[$i]['admin-message'])?></td>
                        </tr>
<?php
            }
            // admin message <<
?>
                        </table>
                    </td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
        <br/>
<?php
        }
    }
    if ($pageLine != "")
    {
?>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="<?=$constant['border-color']?>">
                <table width="100%" border="0" cellpadding="2" cellspacing="1">
                <tr>
                    <td class="headertext" bgcolor="<?=$constant['header-background-color']?>"><?=$pageLine?></td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
        <br/>
<?php
    }
?>
        <div align="right">
        <a name="post">&nbsp;</a>
        <table border="0" cellpadding="2" cellspacing="0">
        <form action="write.php" method="post" name="guestbook">
        <input type="hidden" name="page" value="<?=$page?>"/>
<?php
        if ($error != "")
        {
?>
        <tr>
            <td colspan="5" class="text">
                <b>Fandt følgende fejl:</b><br/>
                <span id="error"><?=$error?></span>
                </div>
                <br/>
            </td>
        </tr>
<?php
            session_unregister("error");
            session_unregister("style");
        }
?>
        <tr>
            <td align="center"><img src="img/name.gif" width="11" height="14" border="0" alt="Name"/></td>
            <td><img src="img/sp.gif" width="5" height="1"/></td>
            <td class="text"><span class="name">Navn: </span></td>
            <td><img src="img/sp.gif" width="5" height="1"/></td>
            <td><input type="text" size="26" name="name" value="<?php if (isset($name)) { print stripslashes($name); session_unregister("name"); } else { if(isset($cookie['name'])) print stripslashes($cookie['name']); } ?>" maxlength="50" class="field"/></td>
        </tr>
        <tr>
            <td align="center"><img src="img/url.gif" width="18" height="18" border="0" alt="Url"/></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td class="text"><span class="url">Url: </span></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td><input type="text" size="26" name="url" maxlength="50" value="<?php if (isset($url)) { print stripslashes($url); session_unregister("url"); } else { if(isset($cookie['url'])) print stripslashes($cookie['url']); else print "http://"; } ?>" class="field"/></td>
        </tr>
        <tr>
            <td align="center"><img src="img/mail.gif" width="18" height="15" border="0" alt="e-mail"/></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td class="text"><span class="email">E-mail: </span></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td><input type="text" size="26" name="email" value="<?php if (isset($email)) { print stripslashes($email); session_unregister("email"); } else { if(isset($cookie['mail'])) print stripslashes($cookie['mail']); } ?>" maxlength="50" class="field"/></td>
        </tr>
        <tr>
            <td align="center"><img src="img/icq.gif" width="17" height="18" border="0" alt="Icq"/></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td class="text"><span class="icq">Icq: </span></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td><input type="text" size="26" name="icq" value="<?php if (isset($icq)) { print stripslashes($icq); session_unregister("icq"); } else { if(isset($cookie['icq'])) print stripslashes($cookie['icq']); } ?>" maxlength="25" class="field"/></td>
        </tr>
        <tr>
            <td align="center"><img src="img/message.gif" width="15" height="18" border="0" alt="Message"/></td>
            <td><img src="img/sp.gif" width="1" height="1"/></td>
            <td colspan="3" class="text"><span class="message">Besked:</span></td>
        </tr>
        <tr>
            <td colspan="5" align="right"><textarea name="message" rows="15" cols="35" wrap="virtual"><?php if (isset($message)) { $p = ""; $constant['bold-in-message'] ? $p .= "<b>" : $p .= ""; $constant['italic-in-message'] ? $p .= "<i>" : $p .= ""; print strip_tags(stripslashes(br2nl($message)),$p); session_unregister("message"); } ?></textarea></td>
        </tr>
        <tr>
            <td colspan="5" align="right"><input type="submit" value="send" class="button"/></td>
        </tr>






<?php
        if($constant['smile-in-message'])
        {
?>       
        <tr>
            <td colspan="5" align="right">
                <a href="java script:setSmile(' :) ')"><img src="img/smile.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' ;) ')"><img src="img/wink.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' 8) ')"><img src="img/cool.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :J ')"><img src="img/curve-smile.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :P ')"><img src="img/tongue.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :D ')"><img src="img/biggrin.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :( ')"><img src="img/frown.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :o ')"><img src="img/astonish.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' %) ')"><img src="img/crazy.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :[] ')"><img src="img/fright.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :smoke: ')"><img src="img/smoke.gif" width="21" height="20" border="0"/></a>               
                <a href="java script:setSmile(' :evil: ')"><img src="img/evil.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :apple: ')"><img src="img/apple.gif" width="15" height="15" border="0"/></a>
                <a href="java script:setSmile(' :moo: ')"><img src="img/moo.gif" width="16" height="16" border="0"/></a>
            </td>
        </tr>
<?php
        }
        $timer->stop();
?>
        </form>
        <br/>
    </td>
</tr>






</tr>
</table>





</body>
<!-- generation time <?=$timer->elapsed()." sec";?> -->


</table>





</html>
Avatar billede kirkeby Nybegynder
22. oktober 2009 - 23:44 #1
j
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