Avatar billede tupsy Nybegynder
16. december 2000 - 19:55 Der er 1 kommentar og
1 løsning

Login fejl??

Jeg har fundet følgende PHP script(en af flere)
Men, når jeg vil logge ind sker der ingenting..
Nogen der kan finde fejlen eller har en ide om hvorfor??

<html>
<head>
<title>Poll Administration</title>
<meta name=\"author\" content=\"bp135\">
</head>
<body bgcolor=\"#dddddd\" leftmargin=\"0\" topmargin=\"0\" link=\"#006699\" vlink=\"#006699\">
<?php
////////////////////////////////////////////////////////////////////
//  Advanced Poll 1.25 (PHP)
//  Copyright (c)2000 bp135
//  URL: http://bp135.cjb.net
//
// This program is free software. It may be used and modified free
// of charge for personal, academic or non-profit use. By using
// this script you agree to indemnify bp135 from any liability.
// Please do not remove this copyright notice.
////////////////////////////////////////////////////////////////////

$admin_pass = \"2005\";          // Administration password
$config_file = \"pollconfig.php\"; // path to config file
$poll_dat = \"polldata.txt\";      // path to poll data file

// Done
////////////////
if($admin) {
  $flag = ($admin==$admin_pass) ? 1 : 0;
}
else {
  $flag=2;
}
if ($flag==0 || $flag==2) {
?>
<form method=\"post\" action=\"<?php echo $PHP_SELF; ?>\">
  <br><br><br>
  <table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">
    <tr bgcolor=\"#D3A9A9\">
      <td><b><font face=\"Verdana, Arial\" size=\"3\">Poll Administration</font></b></td>
    </tr>
    <tr>
      <td><input type=\"password\" name=\"admin\" size=\"20\"><input type=\"submit\" name=\"Submit\" value=\"Submit\"></td>
    </tr>
    <tr>
      <td><font face=\"Verdana, Arial\" size=\"2\"><?php if ($flag == 0) { echo \"<font color=\\\"#FF0000\\\">Wrong password. Please try again.</font>\";}
                                                    else { echo \"Please enter a valid password!\";}?></font></td>
    </tr>
  </table>
</form>
<?php    } else { ?>
<?php
if ($save == \"yes\") {
  $part1 = array(
        \"$answer1\",\"$answer2\",\"$answer3\",\"$answer4\",\"$answer5\",\"$answer6\",\"$answer7\",\"$answer8\",\"$answer9\",\"$answer10\"
  );
  $part2 = array(
        \"$value1\",\"$value2\",\"$value3\",\"$value4\",\"$value5\",\"$value6\",\"$value7\",\"$value8\",\"$value9\",\"$value10\"
  );
  $part3 = array(
        \"$color1\",\"$color2\",\"$color3\",\"$color4\",\"$color5\",\"$color6\",\"$color7\",\"$color8\",\"$color9\",\"$color10\"
  );
  $config=\"<?php\\n\";
  $config.=\"\\$base_gif=\'$base_gif\';\\n\";
  $config.=\"\\$bgcolor_tab=\'$bgcolor_tab\';\\n\";
  $config.=\"\\$table_width=\'$table_width\';\\n\";
  $config.=\"\\$bgcolor_fr=\'$bgcolor_fr\';\\n\";
  $config.=\"\\$status=\'$status\';\\n\";
  $config.=\"\\$img_height=\'$img_height\';\\n\";
  $config.=\"\\$img_length=\'$img_length\';\\n\";
  $config.=\"\\$show_type=\'$show_type\';\\n\";
  $config.=\"\\$check_vote=\'$check_vote\';\\n\";
  $config.=\"\\$lock_timeout=\'$lock_timeout\';\\n\";
  $config.=\"?>\";
  $fp = fopen(\"$config_file\",\"w\");
  fputs($fp, $config);
  fclose($fp);
  $question=trim($question);
  if (!$question) { $question = \"Enter a question!\"; }
  $poll_fp = fopen(\"$poll_dat\",\"w\");
  fwrite($poll_fp,\"$question\\n\");
    for ($i=0; $i<10; $i++) {
      $part1[$i]=trim($part1[$i]);
      if ($part1[$i]) {
          $part2[$i]=trim($part2[$i]);
          if (!ereg(\"^[0-9]+$\",$part2[$i])) {
            $part2[$i] = \"0\";
          }
          if (!ereg(\"^[a-z]+$\",$part3[$i])) {
            $part3[$i] = \"aqua\";
          }
          fwrite($poll_fp,\"$part1[$i]|$part2[$i]|$part3[$i]\\n\");
      }
    }
  fclose($poll_fp);
  $updated=1;
}
require \"$config_file\";
$line = file($poll_dat);
for ($i=1; $i<sizeof($line); $i++) {
  list($name,$vote,$color) = split(\"\\|\",$line[$i]);
  $answer[$i] = $name;
  $val[$i] = $vote;
  $gif[$i] = chop($color);
}
?>
<br>
<table border=\"0\" cellspacing=\"0\" align=\"center\" width=\"600\">
  <tr bgcolor=\"#FFFFFF\">
    <td rowspan=\"6\" width=\"15\"><img src=\"<?php echo $base_gif;?>/blank.gif\" width=\"15\" height=\"1\"></td>
    <td colspan=\"5\">&nbsp;</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td rowspan=\"4\" bgcolor=\"#E6E6FF\" width=\"32\"><img src=\"<?php echo $base_gif;?>/blank.gif\" width=\"32\" height=\"1\"></td>
    <td rowspan=\"3\" width=\"10\">&nbsp;</td>
    <td height=\"63\" width=\"300\"><b><font size=\"4\" face=\"Verdana, Arial\">Poll Administration</font></b></td>
    <td height=\"63\" width=\"211\">
      <div align=\"right\"><a href=\"poll.php\"><font face=\"Verdana, Arial\" size=\"2\">Back to Poll Page</font></a></div>
    </td>
    <td rowspan=\"3\" width=\"18\"><img src=\"<?php echo $base_gif;?>/blank.gif\" width=\"12\" height=\"1\"></td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td colspan=\"2\"><font face=\"Verdana, Arial\" size=\"2\"><?php if ($updated==1) { echo \"<font color=\\\"#008200\\\">The settings have been updated!</font>\";}
                                                    else { echo \"Edit or create a new poll\";}?></font>
      <hr size=\"1\">
    </td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td colspan=\"2\">
      <form method=\"post\" action=\"<?php echo $PHP_SELF; ?>\" name=\"vote\">
        <p><b><font face=\"Verdana, Arial\" size=\"2\"><br>Configuration Settings:</font></b></p>
        <table width=\"100%\" border=\"0\">
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Your question:</b></font></td>
            <td colspan=\"2\">
              <input type=\"hidden\" name=\"save\" value=\"yes\">
              <input type=\"text\" name=\"question\" size=\"36\" value=\"<?php echo chop($line[0]);?>\" maxlength=\"60\">
              <select name=\"status\">
                <option value=\"1\" <?php if ($status == 1) {echo \"selected\";}?>>enabled</option>
                <option value=\"0\" <?php if ($status == 0) {echo \"selected\";}?>>disabled</option>
              </select>
            </td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>URL to the *.gif directory:</b></font></td>
            <td colspan=\"2\"><input type=\"text\" name=\"base_gif\" value=\"<?php echo $base_gif;?>\" size=\"36\"></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Background (frame):</b></font></td>
            <td colspan=\"2\"><input type=\"text\" name=\"bgcolor_fr\" value=\"<?php echo $bgcolor_fr;?>\" size=\"10\"></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Background (table):</b></font></td>
            <td colspan=\"2\"><input type=\"text\" name=\"bgcolor_tab\" value=\"<?php echo $bgcolor_tab;?>\" size=\"10\"></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Table width:</b></font></td>
            <td colspan=\"2\"><input type=\"text\" name=\"table_width\" value=\"<?php echo $table_width;?>\" size=\"10\"></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Max. bar image length:</b></font></td>
            <td colspan=\"2\"><input type=\"text\" name=\"img_length\" value=\"<?php echo $img_length;?>\" size=\"2\"></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Bar image height:</b></font></td>
            <td><input type=\"text\" name=\"img_height\" value=\"<?php echo $img_height;?>\" size=\"2\"></td>
            <td><b><font face=\"Verdana, Arial\" size=\"1\">Show:</font>
              <input type=\"radio\" name=\"show_type\" value=\"1\" <?php if ($show_type == 1) {echo \"checked\";}?>><font face=\"Verdana, Arial\" size=\"1\">percent</font>
              <input type=\"radio\" name=\"show_type\" value=\"2\" <?php if ($show_type == 2) {echo \"checked\";}?>><font face=\"Verdana, Arial\" size=\"1\">votes</font></b></td>
          </tr>
          <tr>
            <td width=\"30%\"><font face=\"Verdana, Arial\" size=\"1\"><b>Use:</b></font></td>
            <td><select name=\"check_vote\">
                <option value=\"0\" <?php if ($check_vote == 0) {echo \"selected\";}?>>nothing</option>
                <option value=\"1\" <?php if ($check_vote == 1) {echo \"selected\";}?>>cookies</option>
                <option value=\"2\" <?php if ($check_vote == 2) {echo \"selected\";}?>>cookies + IP table</option>
              </select></td>
            <td><font face=\"Verdana, Arial\" size=\"1\"><b>Timeout:</b></font>
              <input type=\"text\" name=\"lock_timeout\" size=\"2\" value=\"<?php echo $lock_timeout;?>\">
              <font face=\"Verdana, Arial\" size=\"1\"><b>hour</b></font></td>
          </tr>
          <tr>
            <td colspan=\"3\">
              <div align=\"left\"><font face=\"Verdana, Arial\" size=\"2\"><br>
                The answer boxes are the answers the users can choose.<br>
                Write at <u>least 2 answers(*)</u> and leave the others blank<br>
                if you do not wish to use all.</font><br>
                <br>
                <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">
<?php
$color_array = array(
        \"aqua\",\"blue\",\"brown\",\"gold\",\"green\",\"orange\",\"pink\",\"purple\",\"red\",\"yellow\"
);
for ($i=1; $i < 11; $i++) { 
echo \"                  <tr>\\n\";
echo \"                    <td width=\\\"25%\\\"><font face=\\\"Verdana, Arial\\\" size=2>Answer\\n\";
echo \"                      $i:</font> </td>\\n\";
echo \"                    <td width=\\\"32%\\\">\\n\";
echo \"                      <input type=text name=\\\"answer$i\\\" value=\\\"$answer[$i]\\\" size=30 maxlength=30>\\n\";
echo \"                    </td>\\n\";
echo \"                    <td width=\\\"8%\\\">\\n\";
echo \"                      <input type=text name=\\\"value$i\\\" value=\\\"$val[$i]\\\" size=5>\\n\";
echo \"                    </td>\\n\";
echo \"                    <td width=\\\"35%\\\">\\n\";
echo \"                      <select name=\\\"color$i\\\">\\n\";
echo \"                        <option>---</option>\\n\";
for ($j=0; $j < 10; $j++) {
  if ($gif[$i] == $color_array[$j]) {
    echo \"                        <option value=\\\"$color_array[$j]\\\" selected>$color_array[$j]</option>\\n\";
  }
  else {
    echo \"                        <option value=\\\"$color_array[$j]\\\">$color_array[$j]</option>\\n\";
  }
}
if ($i < 3) {
  echo \"                      </select> (*)\\n                    </td>\\n                  </tr>\\n\";
}
else {
  echo \"                      </select>\\n                    </td>\\n                  </tr>\\n\";
}
}
?>
                </table>
                <br>
                <font face=\"Verdana, Arial\" size=\"2\">Password:</font>
                <input type=\"password\" name=\"admin\">
                <input type=\"submit\" value=\"Save poll\" name=\"submit\">
                <input type=\"reset\" value=\"Reset\" name=\"reset\">
              </div>
            </td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td colspan=\"4\"><div align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=1>This script can be found at <a href=\"http://bp135.cjb.net\" target=\"_blank\">http://bp135.cjb.net</font></a></div></td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td colspan=\"5\">&nbsp;</td>
  </tr>
</table>
<br>
<?php    } ?>
</body>
</html>




Tupsy!!
Avatar billede tupsy Nybegynder
16. december 2000 - 20:01 #1
Det bruges til en webpoll, så hvis der en der har et pollscript liggende der virker er dette da også MEGET velkommen i stedet...
Det skal helst gemme sine resultater i en ren txt-fil = INGEN database..

Tupsy!!
Avatar billede tupsy Nybegynder
16. december 2000 - 20:22 #2
Sorry.. Har selv fundet et jeg lige skal afprøve..

Tupsy!!
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