Gå til innhold

Enda meir trøbbel med gjestebok :(


Anbefalte innlegg

No funker iallefall include scriptet med gjesteboka - einaste problem er at det komme fram at det ikkje er noken innlegg i den - for å sjå innlegga må eg gå direkte til gjestebok-fila uten å ha med index "rundt".

Er jo selfølgelig litt tåpelig å måtte opne gjesteboka i _blank når alt det andre blir includa midt på sida - så eg spør så fint: Er det noken her som kan tenke seg å sjå over gjesteboka (koden), og skjekke opp mot index.php og få alle linker og sånn til å funke?? (sei fra, så kan eg maile filene til den aktuelle personen)

 

Ville vert _supert_, og om den som gjør det vil skal /me linke til han/ho! :D

Endret av arve87
Lenke til kommentar
Videoannonse
Annonse

okei, here it goes!

 

<? 
//Title of your guestbook
 $title = "Gjestebok @ Ompatut.tk";
//Change "admin" with your own password. It's required when you delete an entry
 $admin_password = "ompa";
//Enter your email here
 $admin_email = "[email protected]";
//Your website URL
 $home = "http://www.ompatut.tk";
//Send you an email when someone add your guestbook, YES or NO
 $notify = "NO";
//Your Operating System
//For Windows/NT user : WIN
//For Linux/Unix user : UNIX
 $os = "UNIX";
//Maximum entry per page when you view your guestbook
 $max_entry_per_page = "10";
//Name of file used to store your entry, change it if necessary
 $data_file = "innlegg.dat";
//Maximum entry stored in data file
 $max_record_in_data_file = "1500";
//Color & font setting
 $background = "#FFFFFF";
 $table_top = "#B7C1CA";
 $table_content_1a = "#E2E6EA";
 $table_content_1b = "#8C9AA7";
 $table_content_2a = "#637383";
 $table_content_2b = "#637383";
 $table_bottom = "#B7C1CA";
 $table_border = "#000000";
 $title_color = "#2E3D4C";
 $link = "blue";
 $visited_link = "blue";
 $active_link = "red";
 $font_face = "verdana";
 $message_font_face = "verdana";
 $message_font_size = "2";
//-- Don't change bellow this line

if (!empty($_GET)) extract($_GET);
else if (!empty($HTTP_GET_VARS)) extract($HTTP_GET_VARS);

if (!empty($_POST)) extract($_POST);
else if (!empty($HTTP_POST_VARS)) extract($HTTP_POST_VARS);

if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER["PHP_SELF"];
if (!isset($do)) $do = "";
if (!isset($page)) $page=1;

if (!file_exists($data_file)) {
   if ($f = fopen($data_file,"w")) fclose($f); 
   else { echo "<B>Error !!</B>Can't create data file.<BR>"; exit; }
} else {
 if ($max_record_in_data_file <> "0") {
    $f = file($data_file);
    rsort($f);
    $j = count($f);
    if ($j > $max_record_in_data_file) {
       $rf = fopen($data_file,"w");
           if (strtoupper($os)=="UNIX") {         
           if (flock($rf,2)) {
                 for ($i=0; $i<$max_record_in_data_file; $i++) {
                     fwrite($rf,$f[$i]);      
        }
                 flock($rf,3);
           }
           } else {
              for ($i=0; $i<$max_record_in_data_file; $i++) {
                 fwrite($rf,$f[$i]);      
           }
        }
    fclose($rf);
    }
 }
}

switch ($do) {
case "":
  $record = file($data_file);
  rsort($record);
  $jmlrec = count($record);
?>
  <HTML>
  <HEAD><TITLE><?echo "$title"?></TITLE></HEAD>
  <BODY bgcolor="<?echo "$background"?>" link="<?echo "$link"?>" vlink="<?echo "$visited_link"?>" alink="<?echo "active_link"?>" topmargin="0" marginheight="0">
  <CENTER>
  <FONT SIZE="6" FACE="<?echo $font_face?>" COLOR="<?echo "$title_color"?>"><B><?echo "$title"?></B></FONT><BR>
  <FONT SIZE="2" FACE="<?echo $font_face?>" color="<?echo "$title_color"?>">(:: <B><A HREF="<?echo "$home"?>"><font color="<?echo "$title_color"?>">Home</font></A></B> ::)</FONT><P>
  <TABLE width="600" cellpadding=0 cellspacing=1 border=0>
  <TR bgcolor='<?echo "$table_border"?>'>
  <TD>
     <TABLE width="100%" cellpadding=4 cellspacing=1 border=0>
     <TR>
    <TD bgcolor='<?echo "$table_top"?>' colspan=2 width='585'>
          <FONT SIZE="2" FACE="<?echo $font_face?>" COLOR="#ffffff"><B>Click <A HREF="<?echo "$PHP_SELF?do=add_form&page=$page"?>">here</A> to sign the guestbook</FONT></B>
       </TD>
    <TD bgcolor='<?echo "$table_top"?>' align='center' width='15'>
       <A HREF="mailto:<?echo "$admin_email"?>"><IMG SRC="webmaster.gif" BORDER=0 ALT="Contact webmaster" align="center"></A>
    </TD>
  </TR>
<?
     $jml_page = intval($jmlrec/$max_entry_per_page);
     $sisa = $jmlrec%$max_entry_per_page;
     if ($sisa > 0) $jml_page++;
     $no = $page*$max_entry_per_page-$max_entry_per_page;
     if ($jmlrec == 0) echo "<TR><TD colspan=3 bgcolor='#FFE1E1' align='center'><FONT SIZE='3' FACE='$font_face'>There is no entry yet.</FONT></TD></TR>";

 $w = 0; //--Color
       for ($i=0; $i<$max_entry_per_page; $i++) {
     $no++;
     $recno = $no-1;
     if (isset($record[$recno])) {
        $row = explode("|~~|",$record[$recno]);
     if ($w==0) { 
      $warna = $table_content_1a;
      $warna2 = $table_content_1b;
      $w=1;
     } else { 
      $warna = $table_content_2a;
      $warna2 = $table_content_2b;
      $w=0;
     }
     echo "<TR>
             <TD bgcolor='$warna2' align='center' valign='top' width='15'>
         <FONT SIZE=2 FACE='$font_face'>$no</FONT>
       </TD>
       <TD bgcolor='$warna' width='570'>
       <TABLE BORDER=0 width=100%>
       <TR>
        <TD>
         <FONT FACE='$font_face' SIZE='1'>$row[1]</FONT><BR>
      <FONT FACE='$font_face' SIZE='2'><B>$row[2]</B> from $row[4]</FONT>
     </TD>
   	";
              echo "<TD align=right valign=top>
     <A HREF='mailto:$row[3]'><IMG SRC='email.gif' BORDER=0 ALT=\"$row[2]'s email\"></A>";
              if (trim($row[6])<>"" and trim($row[6])<>"http://") {
                          if (ereg("^http://", trim($row[6]))) echo " <A HREF='$row[6]' TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT=\"$row[2]'s homepage\"></A>";
                          else echo " <A HREF='http://$row[6]' TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT=\"$row[2]'s homepage\"></A>";
              }
     echo "</TD></TR></TABLE>";
     echo "<BR><TABLE BORDER=0 WIDTH=100%>
           <TR><TD WIDTH=5> </TD><TD>
           <FONT SIZE='2' FACE='$message_font_face' SIZE='$message_font_size'>$row[5]</FONT>
     </TD></TR>
                    </TABLE>
          ";
     echo "</TD>";
     echo "<TD valign='top' bgcolor='$warna2' align='center' width='15'>
           <A HREF='$PHP_SELF?do=del&id=$row[0]&page=$page'>
     <IMG SRC='del.gif' ALT='Delete entry # $no' border=0 align='center'></A>
     </TD>
     </TR>";
 	} //--end if  
       } //--end for
     echo "<TR><TD colspan=3 bgcolor='$table_bottom' align='center' width='600'><FONT SIZE='1' FACE='$font_face'>";      
     if ($jml_page > 1) {    
   if ($page <> 1) echo "[<A HREF='$PHP_SELF?page=1'>Top</A>] "; else echo "[Top] "; 
   echo "Page # ";
      if ($jml_page > 10) {
   if ($page < 5) {
     $start = 1;
 	$stop = 10;
  } elseif ($jml_page - $page < 5) {
     $start = $jml_page - 9;
 	$stop = $jml_page;
  } else {
     $start = $page-4;
 	$stop = $page+5;
  }
  if ($start <> 1) echo "... ";
        for ($p=$start; $p<=$stop; $p++) {
         if ($p == $page) echo "<FONT color='$active_link'><B>$p</B></FONT>  ";
   else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>  ";
        }
  if ($stop <> $jml_page) echo "... ";      
  echo "of $jml_page ";
      } else {
        for ($p=1; $p<=$jml_page; $p++) {
         if ($p == $page) echo "<FONT color='$active_link'><B>$p</B></FONT>  ";
   else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>  ";
        }
   }    
      if ($page <> $jml_page) echo "[<A HREF='$PHP_SELF?page=$jml_page'>Bottom</A>]"; else echo "[bottom]"; 
     } else echo "Page #1 of 1";        
  echo "</FONT></TD></TR>";
?>
       </TABLE>        
 </TD>
 </TR>
 </TABLE>
 <P> 
</CENTER>
  </BODY>
  </HTML>
<?
break;
case "add_form":
?>
<!-- For advanced user : customize your form here, but don't change both the name and value -->
<html>
<head>
<title><?echo "$title"?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="<?echo "$background"?>">
<div align="center"> 
 <font size="5" face="<?echo $font_face?>" color="<?echo "$title_color"?>"><b><?echo "$title"?></b></font><BR>
 <FONT SIZE="1" FACE="<?echo $font_face?>"><B><A HREF="<?echo "$home"?>"><FONT COLOR="<?echo "$title_color"?>">Home</FONT></A> :: <A HREF="<?echo "$PHP_SELF"?>"><FONT COLOR="<?echo "$title_color"?>">View entry</FONT></A></B></FONT>
 <form method="post" action="<?echo "$PHP_SELF"?>">
 <input type="hidden" name="do" value="add">
   <table width="460" border="0" cellspacing="0" cellpadding="0" bgcolor="<?echo "$table_border"?>">
     <tr>
     <td>
       <div align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="5">
             <tr bgcolor="<?echo "$table_content_1a"?>"> 
               <td width="28%"> 
                 <div align="right"><font face="<?echo $font_face?>" size="2">*Name 
                   : </font></div>
               </td>
               <td width="72%"> 
                 <input type="text" name="vname" size="30" maxlength="70">
               </td>
             </tr>
             <tr bgcolor="<?echo "$table_content_1a"?>"> 
               <td width="28%"> 
                 <div align="right"><font face="<?echo $font_face?>" size="2">*Email 
                   : </font></div>
               </td>
               <td width="72%"> 
                 <input type="text" name="vemail" size="30" maxlength="100">
               </td>
             </tr>
             <tr bgcolor="<?echo "$table_content_1a"?>"> 
               <td width="28%"> 
                 <div align="right"><font face="<?echo $font_face?>" size="2">Website
                   : </font></div>
               </td>
               <td width="72%"> 
                 <input type="text" name="vurl" size="30" maxlength="150" VALUE="http://">
               </td>
             </tr>
             <tr bgcolor="<?echo "$table_content_1a"?>"> 
               <td width="28%"> 
                 <div align="right"><font face="<?echo $font_face?>" size="2">*Country 
                   : </font></div>
               </td>
               <td width="72%"> 
<select name="vcountry">
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antarctica">Antarctica</option>
<option value="Antigua And Barbuda">Antigua And Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Aruba">Aruba</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Barbados">Barbados</option>
<option value="Belarus">Belarus</option>
<option value="Belgium">Belgium</option>
<option value="Belize">Belize</option>
<option value="Benin">Benin</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
<option value="Bolivia">Bolivia</option>
<option value="Bosnia And Herzegowina">Bosnia And Herzegowina</option>
<option value="Botswana">Botswana</option>
<option value="Bouvet Island">Bouvet Island</option>
<option value="Brazil">Brazil</option>
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<option value="Brunei Darussalam">Brunei Darussalam</option>
<option value="Bulgaria">Bulgaria</option>
<option value="Burkina Faso">Burkina Faso</option>
<option value="Burundi">Burundi</option>
<option value="Cambodia">Cambodia</option>
<option value="Cameroon">Cameroon</option>
<option value="Canada">Canada</option>
<option value="Cape Verde">Cape Verde</option>
<option value="Cayman Islands">Cayman Islands</option>
<option value="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="China">China</option>
<option value="Christmas Island">Christmas Island</option>
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Congo">Congo</option>
<option value="Cook Islands">Cook Islands</option>
<option value="Costa Rica">Costa Rica</option>
<option value="Cote D Ivoire">Cote D Ivoire</option>
<option value="Croatia">Croatia</option>
<option value="Cuba">Cuba</option>
<option value="Cyprus">Cyprus</option>
<option value="Czech Republic">Czech Republic</option>
<option value="Denmark">Denmark</option>
<option value="Djibouti">Djibouti</option>
<option value="Dominica">Dominica</option>
<option value="Dominican Republic">Dominican Republic</option>
<option value="East Timor">East Timor</option>
<option value="Ecuador">Ecuador</option>
<option value="Egypt">Egypt</option>
<option value="El Salvador">El Salvador</option>
<option value="Equatorial Guinea">Equatorial Guinea</option>
<option value="Eritrea">Eritrea</option>
<option value="Estonia">Estonia</option>
<option value="Ethiopia">Ethiopia</option>
<option value="Falkland Islands">Falkland Islands</option>
<option value="Faroe Islands">Faroe Islands</option>
<option value="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</option>
<option value="France, Metropolitan ">France, Metropolitan </option>
<option value="French Guiana">French Guiana</option>
<option value="French Polynesia">French Polynesia</option>
<option value="French Southern Territories">French Southern Territories</option>
<option value="Gabon">Gabon</option>
<option value="Gambia">Gambia</option>
<option value="Georgia">Georgia</option>
<option value="Germany">Germany</option>
<option value="Ghana">Ghana</option>
<option value="Gibraltar">Gibraltar</option>
<option value="Greece">Greece</option>
<option value="Greenland">Greenland</option>
<option value="Grenada">Grenada</option>
<option value="Guadeloupe">Guadeloupe</option>
<option value="Guam">Guam</option>
<option value="Guatemala">Guatemala</option>
<option value="Guinea">Guinea</option>
<option value="Guinea-Bissau">Guinea-Bissau</option>
<option value="Guyana">Guyana</option>
<option value="Haiti">Haiti</option>
<option value="Heard And Mc Donald Islands">Heard And Mc Donald Islands</option>
<option value="Honduras">Honduras</option>
<option value="Hong Kong">Hong Kong</option>
<option value="Hungary">Hungary</option>
<option value="Iceland">Iceland</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Iran">Iran</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="North Korea">North Korea</option>
<option value="South Korea">South Korea</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Lao Peoples Republic">Lao Peoples Republic</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macau">Macau</option>
<option value="Macedonia">Macedonia</option>
<option value="Madagascar">Madagascar</option>
<option value="Malawi">Malawi</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mali">Mali</option>
<option value="Malta">Malta</option>
<option value="Marshall Islands">Marshall Islands</option>
<option value="Martinique">Martinique</option>
<option value="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mayotte">Mayotte</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia">Micronesia</option>
<option value="Moldova">Moldova</option>
<option value="Monaco">Monaco</option>
<option value="Mongolia">Mongolia</option>
<option value="Montserrat">Montserrat</option>
<option value="Morocco">Morocco</option>
<option value="Mozambique">Mozambique</option>
<option value="Myanmar">Myanmar</option>
<option value="Namibia">Namibia</option>
<option value="Nauru">Nauru</option>
<option value="Nepal">Nepal</option>
<option value="Netherlands">Netherlands</option>
<option value="Netherlands Antilles">Netherlands Antilles</option>
<option value="New Caledonia">New Caledonia</option>
<option value="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Niue">Niue</option>
<option value="Norfolk Island">Norfolk Island</option>
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Palau">Palau</option>
<option value="Palestinian Territory">Palestinian Territory</option>
<option value="Panama">Panama</option>
<option value="Papua New Guinea">Papua New Guinea</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Philippines">Philippines</option>
<option value="Pitcairn">Pitcairn</option>
<option value="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Puerto Rico">Puerto Rico</option>
<option value="Qatar">Qatar</option>
<option value="Reunion">Reunion</option>
<option value="Romania">Romania</option>
<option value="Russian Federation">Russian Federation</option>
<option value="Rwanda">Rwanda</option>
<option value="Saint Kitts And Nevis">Saint Kitts And Nevis</option>
<option value="Saint Lucia">Saint Lucia</option>
<option value="Saint Vincent And The Grenadines">Saint Vincent And The Grenadines</option>
<option value="Samoa">Samoa</option>
<option value="San Marino">San Marino</option>
<option value="Sao Tome And Principe">Sao Tome And Principe</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Senegal">Senegal</option>
<option value="Seychelles">Seychelles</option>
<option value="Sierra Leone">Sierra Leone</option>
<option value="Singapore">Singapore</option>
<option value="Slovakia">Slovakia</option>
<option value="Slovenia">Slovenia</option>
<option value="Solomon Islands">Solomon Islands</option>
<option value="Somalia">Somalia</option>
<option value="South Africa">South Africa</option>
<option value="South Georgia">South Georgia</option>
<option value="The South Sandwich Islands">The South Sandwich Islands</option>
<option value="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="St Helena">St Helena</option>
<option value="St Pierre and Miquelon">St Pierre and Miquelon</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Svalbard And Jan Mayen Islands">Svalbard And Jan Mayen Islands</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
<option value="Taiwan">Taiwan</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania">Tanzania</option>
<option value="Thailand">Thailand</option>
<option value="Togo">Togo</option>
<option value="Tokelau">Tokelau</option>
<option value="Tonga">Tonga</option>
<option value="Trinidad And Tobago">Trinidad And Tobago</option>
<option value="Tunisia">Tunisia</option>
<option value="Turkey">Turkey</option>
<option value="Turkmenistan">Turkmenistan</option>
<option value="Turks And Caicos Islands">Turks And Caicos Islands</option>
<option value="Tuvalu">Tuvalu</option>
<option value="Uganda">Uganda</option>
<option value="Ukraine">Ukraine</option>
<option value="United Arab Emirates">United Arab Emirates</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="US Minor Outlying Islands">US Minor Outlying Islands</option>
<option value="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Vatican City State">Vatican City State</option>
<option value="Venezuela">Venezuela</option>
<option value="Viet Nam">Viet Nam</option>
<option value="Virgin Islands (British)">Virgin Islands (British)</option>
<option value="Virgin Islands (U.S.)">Virgin Islands (U.S.)</option>
<option value="Wallis And Futuna Islands">Wallis And Futuna Islands</option>
<option value="Western Sahara">Western Sahara</option>
<option value="Yemen">Yemen</option>
<option value="Yugoslavia">Yugoslavia</option>
<option value="Zaire">Zaire</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
<option value="Unknown">--Other--</option>
</select>
               </td>
             </tr>
             <tr bgcolor="<?echo "$table_content_1a"?>"> 
               <td valign="top" width="28%"> 
                 <div align="right"><font face="<?echo $font_face?>" size="2">*Comment 
                   : </font></div>
               </td>
               <td width="72%"> 
                 <textarea name="vcomment" cols="40" rows="7" wrap="VIRTUAL"></textarea><BR><font size=1 FACE="<?echo $font_face?>">* Required field</font>
               </td>
             </tr>
             <tr bgcolor="<?echo "$table_content_1b"?>"> 
               <td colspan="2"> 
                 <div align="center"><font face="<?echo $font_face?>" size="3"> 
                   <font size="2">
                   <input type="submit" value="Submit">
                   <input type="reset" value="Reset">
   	<input type="button" value="Back" onclick="window.location='<?echo "$PHP_SELF?page=$page"?>'">
                   </font></font></div>
               </td>
             </tr>
           </table>
       </div>
     </td>
   </tr>
 </table>
 </form>
</div>
</body>
</html>
<!-- End of entry form -->
<?
break;
case "add":
  if (trim($vname)=="" or trim($vcomment=="") or trim($vemail)=="") {
     echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>You may left some fields. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
  exit;
  }
  if (!ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $vemail)) {
     echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>Invalid email address. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
  exit;
  }
  if (trim($vurl) <> "") {
   if (trim($vurl) <> "http://") {
      if (!preg_match ("/http:\/\/(.*)\.(.*)/i", $vurl)) {
            echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>Invalid URL format. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
         exit;
      }
      }
  }
  $test_comment = explode(" ",$vcomment);
  $jmltest = count($test_comment);
  for ($t=0; $t<$jmltest; $t++) {
     if (strlen(trim($test_comment[$t])) > 40) {
       echo "<HTML><BODY bgcolor='#ffffff'><H2>Error!</H2><FONT SIZE=2 FACE='$font_face'>Please don't abuse my guestbook. Click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
    exit;      
  }
  }

  $idx = date("YmdHis");
  $tgl = date("F d, Y - h:i A");

  $vname = str_replace("<","",$vname);
  $vname = str_replace(">","",$vname);
  $vname = str_replace("~","-",$vname);
  $vname = str_replace("\"",""",$vname);

  $vemail = str_replace("<","",$vemail);
  $vemail = str_replace(">","",$vemail);
  $vemail = str_replace("~","",$vemail);
  $vemail = str_replace("\"","",$vemail);

  $vcomment = str_replace("<","<",$vcomment);
  $vcomment = str_replace(">",">",$vcomment);
  $vcomment = str_replace("~","-",$vcomment);
  $vcomment = str_replace("\"",""",$vcomment);   
  $vcomment = str_replace("\r\n","<BR>",$vcomment);
  
  $vurl = preg_replace("(<|>| |\(|\)|\||\"|\')","",$vurl);

  if (eregi("<|>|\"\~",$vcountry)) $vcountry = "Unknown";
  $newdata = "$idx|~~|$tgl|~~|$vname|~~|$vemail|~~|$vcountry|~~|$vcomment|~~|$vurl\n";
  $newdata = stripslashes($newdata);
  $bagus = true;

  $cekdata = file($data_file);
  $jmlcekdata = count($cekdata);
  if ($jmlcekdata > 0) {
     rsort($cekdata);
     if ($jmlcekdata > 2) {
        $newrow = explode("|~~|",$newdata);
     $jmlentry = 0;
        for ($c=0; $c<3; $c++) {
            $cekrow = explode("|~~|",$cekdata[$c]);
            if ($cekrow[3] == $newrow[3] or ($cekrow[2] == $newrow[2] and $cekrow[4] == $newrow[4])) $jmlentry++;
     }
        if ($jmlentry < 3) $bagus = true; else $bagus = false;
     }
  }

  if ($bagus) {
  $tambah = fopen($data_file,"a");
  if (strtoupper($os)=="UNIX") {
     if (flock($tambah,2)) {
     fwrite($tambah,$newdata);
     flock($tambah,3);
     }
  } else fwrite($tambah,$newdata);
  fclose($tambah);
  //--SEND MAIL
  if (strtoupper($notify)=="YES") {
     $msgtitle = "Someone signed your guestbook";
     $vcomment = str_replace(""","\"",$vcomment);   
     $vcomment = stripslashes($vcomment);
  $vcomment = str_replace("<BR>","\n",$vcomment);
     $msgcontent = "Local time : $tgl\n\nThe addition from $vname :\n----------------------------\n\n$vcomment\n\n-----End Message-----";
     mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n");
  }
  //-----------
  }

  echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF'><BODY bgcolor='#FFFFFF'><CENTER><H2>Thank you, your entry has been added.</H2>Please wait...</CENTER></BODY></HTML>";

break;
case "del":
  $record = file($data_file);
  $jmlrec = count($record);
  for ($i=0; $i<$jmlrec; $i++) {
      $row = explode("|~~|",$record[$i]);
   if ($id == $row[0]) {
      echo "
   <HTML><TITLE>Delete record</TITLE>
   <BODY bgcolor='$background'>
   <CENTER>
   <FONT FACE='$font_face' SIZE='4' COLOR='$title_color'>Delete Confirmation</FONT>
   <BR><BR>
   <TABLE border=0 cellpadding=5 cellspacing=1 width=450>
 	<TR>
 	<TD bgcolor='$table_top'>
           <FONT SIZE=2 FACE='$font_face'>
 	<FONT SIZE='1'><B>$row[1]</FONT><BR>$row[2]</B> from $row[4]<BR><A HREF='mailto:$row[3]'>$row[3]</A><P>$row[5]
 	</FONT> 
 	</TD>
 	</TR>
   </TABLE>
   ";
      break;
   }
  }   
  echo "<FORM ACTION='$PHP_SELF' METHOD='post'><FONT FACE='$font_face' COLOR='$title_color' SIZE=2><B>Admin password : </B></FONT><INPUT TYPE='password' NAME='pwd'><INPUT TYPE='hidden' NAME='do' VALUE='del2'><P><INPUT TYPE='submit' VALUE='Delete this record'> <INPUT TYPE='button' VALUE='Cancel' onclick=\"window.location='$PHP_SELF?page=$page'\"><INPUT TYPE='hidden' NAME='id' VALUE='$id'><INPUT TYPE='hidden' NAME='page' VALUE='$page'></FORM></CENTER></BODY></HTML>";
break;
case "del2":
  if ($pwd <> $admin_password) {
        echo "<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'></HEAD><BODY bgcolor='#ffffff'><CENTER><H2>Invalid admin password !</H2>Please wait...</CENTER></BODY><HTML>";
        exit;
  }
  $record = file($data_file);
  $jmlrec = count($record);
  for ($i=0; $i<$jmlrec; $i++) {
      $row = explode("|~~|",$record[$i]);
      if ($id==$row[0]) {
      $record[$i] = "";
   break;
   }
  }
  $update_data = fopen($data_file,"w");
  if (strtoupper($os) == "UNIX") {
     if (flock($update_data,2)) {
     for ($j=0; $j<$jmlrec; $j++) {
            if ($record[$j] <> "") fputs($update_data,$record[$j]);
  }
  flock($update_data,3);
  }
  } else {
     for ($j=0; $j<$jmlrec; $j++) {
            if ($record[$j] <> "") fputs($update_data,$record[$j]);
  }
  }
  fclose($update_data);

  echo "<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'></HEAD><BODY bgcolor='#ffffff'><CENTER><H2>Record has been deleted !</H2>Please wait...</CENTER></BODY><HTML>";

break;
} //--end switch
?> 

 

Så er include scriptet mitt sånn:

<?php
$sjekk_side = isset($side);
if ($sjekk_side == 1)
{
if (@fopen("sider/$side.htm", "r"))
{
include ("sider/$side.htm");
}
elseif (@fopen("sider/$side.php", "r"))
{
include ("sider/$side.php");
}
if (!(@fopen("sider/$side.htm", "r")) && !(@fopen("sider/$side.php", "r")))
{
include("sider/404/404.htm");
}
}
if ($sjekk_side <> 1)
{
include("sider/index2.htm");
}
?>

 

Så vil /me helst kunne linke til gjesteboka i form av index.php?side=gjestebok/ardguest (boka heiter ardguest) :p

 

Dette går berre ikkje skikkelig.. :(

Lenke til kommentar

index.php: (gjestebokfila)

<? 
//Title of your guestbook
$title = "Gjestebok @ Ompatut.tk";
//Change "admin" with your own password. It's required when you delete an entry
$admin_password = "ompa";
//Enter your email here
$admin_email = "[email protected]";
//Your website URL
$home = "http://www.ompatut.tk";
//Send you an email when someone add your guestbook, YES or NO
$notify = "NO";
//Your Operating System
//For Windows/NT user : WIN
//For Linux/Unix user : UNIX
$os = "UNIX";
//Maximum entry per page when you view your guestbook
$max_entry_per_page = "10";
//Name of file used to store your entry, change it if necessary
$data_file = "innlegg.dat";
//Maximum entry stored in data file
$max_record_in_data_file = "1500";
//Color & font setting
$background = "#FFFFFF";
$table_top = "#B7C1CA";
$table_content_1a = "#E2E6EA";
$table_content_1b = "#8C9AA7";
$table_content_2a = "#637383";
$table_content_2b = "#637383";
$table_bottom = "#B7C1CA";
$table_border = "#000000";
$title_color = "#2E3D4C";
$link = "blue";
$visited_link = "blue";
$active_link = "red";
$font_face = "verdana";
$message_font_face = "verdana";
$message_font_size = "2";

// Filnavn til gjestebok
$adresse="index.php";

//-- Don't change bellow this line

if (!empty($_GET)) extract($_GET);
else if (!empty($HTTP_GET_VARS)) extract($HTTP_GET_VARS);

if (!empty($_POST)) extract($_POST);
else if (!empty($HTTP_POST_VARS)) extract($HTTP_POST_VARS);

//if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER["PHP_SELF"];
if (!isset($PHP_SELF)) $PHP_SELF = $adresse;
if (!isset($do)) $do = "";
if (!isset($page)) $page=1;

if (!file_exists($data_file)) {
  if ($f = fopen($data_file,"w")) fclose($f); 
  else { echo "<B>Error !!</B>Can't create data file.<BR>"; exit; }
} else {
if ($max_record_in_data_file <> "0") {
   $f = file($data_file);
   rsort($f);
   $j = count($f);
   if ($j > $max_record_in_data_file) {
      $rf = fopen($data_file,"w");
          if (strtoupper($os)=="UNIX") {         
          if (flock($rf,2)) {
                for ($i=0; $i<$max_record_in_data_file; $i++) {
                    fwrite($rf,$f[$i]);      
       }
                flock($rf,3);
          }
          } else {
             for ($i=0; $i<$max_record_in_data_file; $i++) {
                fwrite($rf,$f[$i]);      
          }
       }
   fclose($rf);
   }
}
}

switch ($do) {
case "":
 $record = file($data_file);
 rsort($record);
 $jmlrec = count($record);
?>
 <HTML>
 <HEAD><TITLE><?echo "$title"?></TITLE></HEAD>
 <BODY bgcolor="<?echo "$background"?>" link="<?echo "$link"?>" vlink="<?echo "$visited_link"?>" alink="<?echo "active_link"?>" topmargin="0" marginheight="0">
 <CENTER>
 <FONT SIZE="6" FACE="<?echo $font_face?>" COLOR="<?echo "$title_color"?>"><B><?echo "$title"?></B></FONT><BR>
 <FONT SIZE="2" FACE="<?echo $font_face?>" color="<?echo "$title_color"?>">(:: <B><A HREF="<?echo "$home"?>"><font color="<?echo "$title_color"?>">Home</font></A></B> ::)</FONT><P>
 <TABLE width="600" cellpadding=0 cellspacing=1 border=0>
 <TR bgcolor='<?echo "$table_border"?>'>
 <TD>
    <TABLE width="100%" cellpadding=4 cellspacing=1 border=0>
    <TR>
   <TD bgcolor='<?echo "$table_top"?>' colspan=2 width='585'>
         <FONT SIZE="2" FACE="<?echo $font_face?>" COLOR="#ffffff"><B>Click <A HREF="<?echo "$PHP_SELF?do=add_form&page=$page"?>">here</A> to sign the guestbook</FONT></B>
      </TD>
   <TD bgcolor='<?echo "$table_top"?>' align='center' width='15'>
      <A HREF="mailto:<?echo "$admin_email"?>"><IMG SRC="webmaster.gif" BORDER=0 ALT="Contact webmaster" align="center"></A>
   </TD>
 </TR>
<?
    $jml_page = intval($jmlrec/$max_entry_per_page);
    $sisa = $jmlrec%$max_entry_per_page;
    if ($sisa > 0) $jml_page++;
    $no = $page*$max_entry_per_page-$max_entry_per_page;
    if ($jmlrec == 0) echo "<TR><TD colspan=3 bgcolor='#FFE1E1' align='center'><FONT SIZE='3' FACE='$font_face'>There is no entry yet.</FONT></TD></TR>";

$w = 0; //--Color
      for ($i=0; $i<$max_entry_per_page; $i++) {
    $no++;
    $recno = $no-1;
    if (isset($record[$recno])) {
       $row = explode("|~~|",$record[$recno]);
    if ($w==0) { 
     $warna = $table_content_1a;
     $warna2 = $table_content_1b;
     $w=1;
    } else { 
     $warna = $table_content_2a;
     $warna2 = $table_content_2b;
     $w=0;
    }
    echo "<TR>
            <TD bgcolor='$warna2' align='center' valign='top' width='15'>
        <FONT SIZE=2 FACE='$font_face'>$no</FONT>
      </TD>
      <TD bgcolor='$warna' width='570'>
      <TABLE BORDER=0 width=100%>
      <TR>
       <TD>
        <FONT FACE='$font_face' SIZE='1'>$row[1]</FONT><BR>
     <FONT FACE='$font_face' SIZE='2'><B>$row[2]</B> from $row[4]</FONT>
    </TD>
   ";
             echo "<TD align=right valign=top>
    <A HREF='mailto:$row[3]'><IMG SRC='email.gif' BORDER=0 ALT=\"$row[2]'s email\"></A>";
             if (trim($row[6])<>"" and trim($row[6])<>"http://") {
                         if (ereg("^http://", trim($row[6]))) echo " <A HREF='$row[6]' TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT=\"$row[2]'s homepage\"></A>";
                         else echo " <A HREF='http://$row[6]' TARGET='_blank'><IMG SRC='homepage.gif' BORDER=0 ALT=\"$row[2]'s homepage\"></A>";
             }
    echo "</TD></TR></TABLE>";
    echo "<BR><TABLE BORDER=0 WIDTH=100%>
          <TR><TD WIDTH=5> </TD><TD>
          <FONT SIZE='2' FACE='$message_font_face' SIZE='$message_font_size'>$row[5]</FONT>
    </TD></TR>
                   </TABLE>
         ";
    echo "</TD>";
    echo "<TD valign='top' bgcolor='$warna2' align='center' width='15'>
          <A HREF='$PHP_SELF?do=del&id=$row[0]&page=$page'>
    <IMG SRC='del.gif' ALT='Delete entry # $no' border=0 align='center'></A>
    </TD>
    </TR>";
 } //--end if  
      } //--end for
    echo "<TR><TD colspan=3 bgcolor='$table_bottom' align='center' width='600'><FONT SIZE='1' FACE='$font_face'>";      
    if ($jml_page > 1) {    
  if ($page <> 1) echo "[<A HREF='$PHP_SELF?page=1'>Top</A>] "; else echo "[Top] "; 
  echo "Page # ";
     if ($jml_page > 10) {
  if ($page < 5) {
    $start = 1;
 $stop = 10;
 } elseif ($jml_page - $page < 5) {
    $start = $jml_page - 9;
 $stop = $jml_page;
 } else {
    $start = $page-4;
 $stop = $page+5;
 }
 if ($start <> 1) echo "... ";
       for ($p=$start; $p<=$stop; $p++) {
        if ($p == $page) echo "<FONT color='$active_link'><B>$p</B></FONT>  ";
  else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>  ";
       }
 if ($stop <> $jml_page) echo "... ";      
 echo "of $jml_page ";
     } else {
       for ($p=1; $p<=$jml_page; $p++) {
        if ($p == $page) echo "<FONT color='$active_link'><B>$p</B></FONT>  ";
  else echo "<A HREF='$PHP_SELF?page=$p'>$p</A>  ";
       }
  }    
     if ($page <> $jml_page) echo "[<A HREF='$PHP_SELF?page=$jml_page'>Bottom</A>]"; else echo "[bottom]"; 
    } else echo "Page #1 of 1";        
 echo "</FONT></TD></TR>";
?>
      </TABLE>        
</TD>
</TR>
</TABLE>
<P> 
</CENTER>
 </BODY>
 </HTML>
<?
break;
case "add_form":
?>
<!-- For advanced user : customize your form here, but don't change both the name and value -->
<html>
<head>
<title><?echo "$title"?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="<?echo "$background"?>">
<div align="center"> 
<font size="5" face="<?echo $font_face?>" color="<?echo "$title_color"?>"><b><?echo "$title"?></b></font><BR>
<FONT SIZE="1" FACE="<?echo $font_face?>"><B><A HREF="<?echo "$home"?>"><FONT COLOR="<?echo "$title_color"?>">Home</FONT></A> :: <A HREF="<?echo "include.php?side=index"?>"><FONT COLOR="<?echo "$title_color"?>">View entry</FONT></A></B></FONT>
<form method="post" action="<?echo $adresse;?>">
<input type="hidden" name="do" value="add">
  <table width="460" border="0" cellspacing="0" cellpadding="0" bgcolor="<?echo "$table_border"?>">
    <tr>
    <td>
      <div align="center">
          <table width="100%" border="0" cellspacing="1" cellpadding="5">
            <tr bgcolor="<?echo "$table_content_1a"?>"> 
              <td width="28%"> 
                <div align="right"><font face="<?echo $font_face?>" size="2">*Name 
                  : </font></div>
              </td>
              <td width="72%"> 
                <input type="text" name="vname" size="30" maxlength="70">
              </td>
            </tr>
            <tr bgcolor="<?echo "$table_content_1a"?>"> 
              <td width="28%"> 
                <div align="right"><font face="<?echo $font_face?>" size="2">*Email 
                  : </font></div>
              </td>
              <td width="72%"> 
                <input type="text" name="vemail" size="30" maxlength="100">
              </td>
            </tr>
            <tr bgcolor="<?echo "$table_content_1a"?>"> 
              <td width="28%"> 
                <div align="right"><font face="<?echo $font_face?>" size="2">Website
                  : </font></div>
              </td>
              <td width="72%"> 
                <input type="text" name="vurl" size="30" maxlength="150" VALUE="http://">
              </td>
            </tr>
            <tr bgcolor="<?echo "$table_content_1a"?>"> 
              <td width="28%"> 
                <div align="right"><font face="<?echo $font_face?>" size="2">*Country 
                  : </font></div>
              </td>
              <td width="72%"> 
<select name="vcountry">
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antarctica">Antarctica</option>
<option value="Antigua And Barbuda">Antigua And Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Aruba">Aruba</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Barbados">Barbados</option>
<option value="Belarus">Belarus</option>
<option value="Belgium">Belgium</option>
<option value="Belize">Belize</option>
<option value="Benin">Benin</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
<option value="Bolivia">Bolivia</option>
<option value="Bosnia And Herzegowina">Bosnia And Herzegowina</option>
<option value="Botswana">Botswana</option>
<option value="Bouvet Island">Bouvet Island</option>
<option value="Brazil">Brazil</option>
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<option value="Brunei Darussalam">Brunei Darussalam</option>
<option value="Bulgaria">Bulgaria</option>
<option value="Burkina Faso">Burkina Faso</option>
<option value="Burundi">Burundi</option>
<option value="Cambodia">Cambodia</option>
<option value="Cameroon">Cameroon</option>
<option value="Canada">Canada</option>
<option value="Cape Verde">Cape Verde</option>
<option value="Cayman Islands">Cayman Islands</option>
<option value="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="China">China</option>
<option value="Christmas Island">Christmas Island</option>
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Congo">Congo</option>
<option value="Cook Islands">Cook Islands</option>
<option value="Costa Rica">Costa Rica</option>
<option value="Cote D Ivoire">Cote D Ivoire</option>
<option value="Croatia">Croatia</option>
<option value="Cuba">Cuba</option>
<option value="Cyprus">Cyprus</option>
<option value="Czech Republic">Czech Republic</option>
<option value="Denmark">Denmark</option>
<option value="Djibouti">Djibouti</option>
<option value="Dominica">Dominica</option>
<option value="Dominican Republic">Dominican Republic</option>
<option value="East Timor">East Timor</option>
<option value="Ecuador">Ecuador</option>
<option value="Egypt">Egypt</option>
<option value="El Salvador">El Salvador</option>
<option value="Equatorial Guinea">Equatorial Guinea</option>
<option value="Eritrea">Eritrea</option>
<option value="Estonia">Estonia</option>
<option value="Ethiopia">Ethiopia</option>
<option value="Falkland Islands">Falkland Islands</option>
<option value="Faroe Islands">Faroe Islands</option>
<option value="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</option>
<option value="France, Metropolitan ">France, Metropolitan </option>
<option value="French Guiana">French Guiana</option>
<option value="French Polynesia">French Polynesia</option>
<option value="French Southern Territories">French Southern Territories</option>
<option value="Gabon">Gabon</option>
<option value="Gambia">Gambia</option>
<option value="Georgia">Georgia</option>
<option value="Germany">Germany</option>
<option value="Ghana">Ghana</option>
<option value="Gibraltar">Gibraltar</option>
<option value="Greece">Greece</option>
<option value="Greenland">Greenland</option>
<option value="Grenada">Grenada</option>
<option value="Guadeloupe">Guadeloupe</option>
<option value="Guam">Guam</option>
<option value="Guatemala">Guatemala</option>
<option value="Guinea">Guinea</option>
<option value="Guinea-Bissau">Guinea-Bissau</option>
<option value="Guyana">Guyana</option>
<option value="Haiti">Haiti</option>
<option value="Heard And Mc Donald Islands">Heard And Mc Donald Islands</option>
<option value="Honduras">Honduras</option>
<option value="Hong Kong">Hong Kong</option>
<option value="Hungary">Hungary</option>
<option value="Iceland">Iceland</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Iran">Iran</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="North Korea">North Korea</option>
<option value="South Korea">South Korea</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Lao Peoples Republic">Lao Peoples Republic</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macau">Macau</option>
<option value="Macedonia">Macedonia</option>
<option value="Madagascar">Madagascar</option>
<option value="Malawi">Malawi</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mali">Mali</option>
<option value="Malta">Malta</option>
<option value="Marshall Islands">Marshall Islands</option>
<option value="Martinique">Martinique</option>
<option value="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mayotte">Mayotte</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia">Micronesia</option>
<option value="Moldova">Moldova</option>
<option value="Monaco">Monaco</option>
<option value="Mongolia">Mongolia</option>
<option value="Montserrat">Montserrat</option>
<option value="Morocco">Morocco</option>
<option value="Mozambique">Mozambique</option>
<option value="Myanmar">Myanmar</option>
<option value="Namibia">Namibia</option>
<option value="Nauru">Nauru</option>
<option value="Nepal">Nepal</option>
<option value="Netherlands">Netherlands</option>
<option value="Netherlands Antilles">Netherlands Antilles</option>
<option value="New Caledonia">New Caledonia</option>
<option value="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Niue">Niue</option>
<option value="Norfolk Island">Norfolk Island</option>
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Palau">Palau</option>
<option value="Palestinian Territory">Palestinian Territory</option>
<option value="Panama">Panama</option>
<option value="Papua New Guinea">Papua New Guinea</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Philippines">Philippines</option>
<option value="Pitcairn">Pitcairn</option>
<option value="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Puerto Rico">Puerto Rico</option>
<option value="Qatar">Qatar</option>
<option value="Reunion">Reunion</option>
<option value="Romania">Romania</option>
<option value="Russian Federation">Russian Federation</option>
<option value="Rwanda">Rwanda</option>
<option value="Saint Kitts And Nevis">Saint Kitts And Nevis</option>
<option value="Saint Lucia">Saint Lucia</option>
<option value="Saint Vincent And The Grenadines">Saint Vincent And The Grenadines</option>
<option value="Samoa">Samoa</option>
<option value="San Marino">San Marino</option>
<option value="Sao Tome And Principe">Sao Tome And Principe</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Senegal">Senegal</option>
<option value="Seychelles">Seychelles</option>
<option value="Sierra Leone">Sierra Leone</option>
<option value="Singapore">Singapore</option>
<option value="Slovakia">Slovakia</option>
<option value="Slovenia">Slovenia</option>
<option value="Solomon Islands">Solomon Islands</option>
<option value="Somalia">Somalia</option>
<option value="South Africa">South Africa</option>
<option value="South Georgia">South Georgia</option>
<option value="The South Sandwich Islands">The South Sandwich Islands</option>
<option value="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="St Helena">St Helena</option>
<option value="St Pierre and Miquelon">St Pierre and Miquelon</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Svalbard And Jan Mayen Islands">Svalbard And Jan Mayen Islands</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
<option value="Taiwan">Taiwan</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania">Tanzania</option>
<option value="Thailand">Thailand</option>
<option value="Togo">Togo</option>
<option value="Tokelau">Tokelau</option>
<option value="Tonga">Tonga</option>
<option value="Trinidad And Tobago">Trinidad And Tobago</option>
<option value="Tunisia">Tunisia</option>
<option value="Turkey">Turkey</option>
<option value="Turkmenistan">Turkmenistan</option>
<option value="Turks And Caicos Islands">Turks And Caicos Islands</option>
<option value="Tuvalu">Tuvalu</option>
<option value="Uganda">Uganda</option>
<option value="Ukraine">Ukraine</option>
<option value="United Arab Emirates">United Arab Emirates</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="US Minor Outlying Islands">US Minor Outlying Islands</option>
<option value="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Vatican City State">Vatican City State</option>
<option value="Venezuela">Venezuela</option>
<option value="Viet Nam">Viet Nam</option>
<option value="Virgin Islands (British)">Virgin Islands (British)</option>
<option value="Virgin Islands (U.S.)">Virgin Islands (U.S.)</option>
<option value="Wallis And Futuna Islands">Wallis And Futuna Islands</option>
<option value="Western Sahara">Western Sahara</option>
<option value="Yemen">Yemen</option>
<option value="Yugoslavia">Yugoslavia</option>
<option value="Zaire">Zaire</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
<option value="Unknown">--Other--</option>
</select>
              </td>
            </tr>
            <tr bgcolor="<?echo "$table_content_1a"?>"> 
              <td valign="top" width="28%"> 
                <div align="right"><font face="<?echo $font_face?>" size="2">*Comment 
                  : </font></div>
              </td>
              <td width="72%"> 
                <textarea name="vcomment" cols="40" rows="7" wrap="VIRTUAL"></textarea><BR><font size=1 FACE="<?echo $font_face?>">* Required field</font>
              </td>
            </tr>
            <tr bgcolor="<?echo "$table_content_1b"?>"> 
              <td colspan="2"> 
                <div align="center"><font face="<?echo $font_face?>" size="3"> 
                  <font size="2">
                  <input type="submit" value="Submit">
                  <input type="reset" value="Reset">
   <input type="button" value="Back" onclick="window.location='<?echo "$PHP_SELF?page=$page"?>'">
                  </font></font></div>
              </td>
            </tr>
          </table>
      </div>
    </td>
  </tr>
</table>
</form>
</div>
</body>
</html>
<!-- End of entry form -->
<?
break;
case "add":
 if (trim($vname)=="" or trim($vcomment=="") or trim($vemail)=="") {
    echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>You may left some fields. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
 exit;
 }
 if (!ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $vemail)) {
    echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>Invalid email address. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
 exit;
 }
 if (trim($vurl) <> "") {
  if (trim($vurl) <> "http://") {
     if (!preg_match ("/http:\/\/(.*)\.(.*)/i", $vurl)) {
           echo "<HTML><BODY bgcolor='#ffffff'><H2>Error !</H2><FONT SIZE=2 FACE='$font_face'>Invalid URL format. Please click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
        exit;
     }
     }
 }
 $test_comment = explode(" ",$vcomment);
 $jmltest = count($test_comment);
 for ($t=0; $t<$jmltest; $t++) {
    if (strlen(trim($test_comment[$t])) > 40) {
      echo "<HTML><BODY bgcolor='#ffffff'><H2>Error!</H2><FONT SIZE=2 FACE='$font_face'>Please don't abuse my guestbook. Click <B><A HREF='javascript:history.back()'>here</A></B> and try again.</FONT></BODY></HTML>";
   exit;      
 }
 }

 $idx = date("YmdHis");
 $tgl = date("F d, Y - h:i A");

 $vname = str_replace("<","",$vname);
 $vname = str_replace(">","",$vname);
 $vname = str_replace("~","-",$vname);
 $vname = str_replace("\"",""",$vname);

 $vemail = str_replace("<","",$vemail);
 $vemail = str_replace(">","",$vemail);
 $vemail = str_replace("~","",$vemail);
 $vemail = str_replace("\"","",$vemail);

 $vcomment = str_replace("<","<",$vcomment);
 $vcomment = str_replace(">",">",$vcomment);
 $vcomment = str_replace("~","-",$vcomment);
 $vcomment = str_replace("\"",""",$vcomment);   
 $vcomment = str_replace("\r\n","<BR>",$vcomment);
 
 $vurl = preg_replace("(<|>| |\(|\)|\||\"|\')","",$vurl);

 if (eregi("<|>|\"\~",$vcountry)) $vcountry = "Unknown";
 $newdata = "$idx|~~|$tgl|~~|$vname|~~|$vemail|~~|$vcountry|~~|$vcomment|~~|$vurl\n";
 $newdata = stripslashes($newdata);
 $bagus = true;

 $cekdata = file($data_file);
 $jmlcekdata = count($cekdata);
 if ($jmlcekdata > 0) {
    rsort($cekdata);
    if ($jmlcekdata > 2) {
       $newrow = explode("|~~|",$newdata);
    $jmlentry = 0;
       for ($c=0; $c<3; $c++) {
           $cekrow = explode("|~~|",$cekdata[$c]);
           if ($cekrow[3] == $newrow[3] or ($cekrow[2] == $newrow[2] and $cekrow[4] == $newrow[4])) $jmlentry++;
    }
       if ($jmlentry < 3) $bagus = true; else $bagus = false;
    }
 }

 if ($bagus) {
 $tambah = fopen($data_file,"a");
 if (strtoupper($os)=="UNIX") {
    if (flock($tambah,2)) {
    fwrite($tambah,$newdata);
    flock($tambah,3);
    }
 } else fwrite($tambah,$newdata);
 fclose($tambah);
 //--SEND MAIL
 if (strtoupper($notify)=="YES") {
    $msgtitle = "Someone signed your guestbook";
    $vcomment = str_replace(""","\"",$vcomment);   
    $vcomment = stripslashes($vcomment);
 $vcomment = str_replace("<BR>","\n",$vcomment);
    $msgcontent = "Local time : $tgl\n\nThe addition from $vname :\n----------------------------\n\n$vcomment\n\n-----End Message-----";
    mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n");
 }
 //-----------
 }

 echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=include.php?side=index'><BODY bgcolor='#FFFFFF'><CENTER><H2>Thank you, your entry has been added.</H2>Please wait...</CENTER></BODY></HTML>";

break;
case "del":
 $record = file($data_file);
 $jmlrec = count($record);
 for ($i=0; $i<$jmlrec; $i++) {
     $row = explode("|~~|",$record[$i]);
  if ($id == $row[0]) {
     echo "
  <HTML><TITLE>Delete record</TITLE>
  <BODY bgcolor='$background'>
  <CENTER>
  <FONT FACE='$font_face' SIZE='4' COLOR='$title_color'>Delete Confirmation</FONT>
  <BR><BR>
  <TABLE border=0 cellpadding=5 cellspacing=1 width=450>
 <TR>
 <TD bgcolor='$table_top'>
          <FONT SIZE=2 FACE='$font_face'>
 <FONT SIZE='1'><B>$row[1]</FONT><BR>$row[2]</B> from $row[4]<BR><A HREF='mailto:$row[3]'>$row[3]</A><P>$row[5]
 </FONT> 
 </TD>
 </TR>
  </TABLE>
  ";
     break;
  }
 }   
 echo "<FORM ACTION='$PHP_SELF' METHOD='post'><FONT FACE='$font_face' COLOR='$title_color' SIZE=2><B>Admin password : </B></FONT><INPUT TYPE='password' NAME='pwd'><INPUT TYPE='hidden' NAME='do' VALUE='del2'><P><INPUT TYPE='submit' VALUE='Delete this record'> <INPUT TYPE='button' VALUE='Cancel' onclick=\"window.location='$PHP_SELF?page=$page'\"><INPUT TYPE='hidden' NAME='id' VALUE='$id'><INPUT TYPE='hidden' NAME='page' VALUE='$page'></FORM></CENTER></BODY></HTML>";
break;
case "del2":
 if ($pwd <> $admin_password) {
       echo "<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'></HEAD><BODY bgcolor='#ffffff'><CENTER><H2>Invalid admin password !</H2>Please wait...</CENTER></BODY><HTML>";
       exit;
 }
 $record = file($data_file);
 $jmlrec = count($record);
 for ($i=0; $i<$jmlrec; $i++) {
     $row = explode("|~~|",$record[$i]);
     if ($id==$row[0]) {
     $record[$i] = "";
  break;
  }
 }
 $update_data = fopen($data_file,"w");
 if (strtoupper($os) == "UNIX") {
    if (flock($update_data,2)) {
    for ($j=0; $j<$jmlrec; $j++) {
           if ($record[$j] <> "") fputs($update_data,$record[$j]);
 }
 flock($update_data,3);
 }
 } else {
    for ($j=0; $j<$jmlrec; $j++) {
           if ($record[$j] <> "") fputs($update_data,$record[$j]);
 }
 }
 fclose($update_data);

 echo "<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT='1; URL=$PHP_SELF?page=$page'></HEAD><BODY bgcolor='#ffffff'><CENTER><H2>Record has been deleted !</H2>Please wait...</CENTER></BODY><HTML>";

break;
} //--end switch
?> 

 

include.php:

<?php
$side=$_REQUEST['side'];
$sjekk_side = isset($side);

if ($sjekk_side == 1) {
if ($side=="index") {
 include ("$side.php");
 exit();
}

if (is_file("sider/$side.htm")) {
 include ("sider/$side.htm");
 exit();
}

elseif (is_file("sider/$side.php")) {
include ("sider/$side.php");
exit();
}

if (!is_file("sider/$side.htm") || (!is_file("sider/$side.php"))) {
include("sider/404/404.htm");
exit();
}
if ($sjekk_side <> 1) {
include("index.php");
exit();
}
}
?>

 

Du må ha gjesteboka i samme katalog som include.php...

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...