Jump to content

Recommended Posts

I am pulling files from a directory and echoing them. I scripted a petition, and for some reason, it changes the order that a person signs. The red part is where it echo's the names of the signers. Is there a way to have it display the signers in order they sign? (if you get the chance, check it out... [url=http://nicotinejunkie.cv.vc/petition]http://nicotinejunkie.cv.vc/petition[/url])

<html>
<head>
<?php include("css.css"); ?>
</head>
<body>
<div align='center'>

<?php

if ($_POST['submit']) {
    $time = date('M. d, Y - g:ia');
    $timetwo = date('YmdHis');
    $tos = $_POST['tos'];
    $uniqueip = 0;
    $uniquemail = 0;
    $ip = $_SERVER['REMOTE_ADDR'];
    $providedname = $_POST['name'];
    $hidden = $_POST['count'];
    $reference = $hidden + 1;
    $email = $_POST['email'];
    $dirmail = 'petition/ipemail/email/';

    if ($_POST['email'] == NULL) {
        $uniquemail = 1;
      }
    if ($_POST['name'] == NULL) {
        $uniquemail = 1;
      }

    if ($handle = opendir($dirmail)) {
        while (false !== ($file = readdir($handle))) {
              if($file !== "." && $file !== ".." && $file !== "Thumbs.db") {
                  $fconfolder = $dirmail . $file;
                  $conmail = file_get_contents($fconfolder);
                  if ($conmail == $email) {
                      $uniquemail = 1;
                    }
                }
              }
        }
    $dirip = 'petition/ipemail/ip/';
    if ($handle = opendir($dirip)) {
        while (false !== ($filetwo = readdir($handle))) {
              if ($filetwo !== "." && $filetwo !== ".." && $filetwo !== "Thumbs.db") {
                  $sconfolder = $dirip . $filetwo;
                  $conip = file_get_contents($sconfolder);
                  if ($conip == $ip) {
                      $uniqueip = 1;
                      }
                }
              }
      }

    if ($uniqueip == 0 && $uniquemail == 0 && $tos == "on") {

        $pifile = "petition/ipemail/ip/signer-" . $timetwo . ".php";
        $first = fopen($pifile, 'w')or die("Cannot create signature. Error code 111. Please email lover_boy699@hotmail.com to rectify the situation.<br>");
        fwrite($first, $ip);
        fclose($first);

        $pefile = "petition/ipemail/email/signer-" . $timetwo . ".php";
        $second = fopen($pefile, 'w')or die("Cannot create signature. Error code 222. Please email lover_boy699@hotmail.com to rectify the situation.<br>");
        fwrite($second, $email);
        fclose($second);

        $openthird = "petition/signer-" . $timetwo . ".php";
        $includestuff = file_get_contents('petition/includestuff.php');
        $write = "<?php " . $includestuff . " = '" . $providedname . "'; ?>";
        $stripwrite = stripslashes($write);
        $third = fopen($openthird, 'w')or die("Cannot create signature. Error code 333. Please email lover_boy699@hotmail.com to rectify the situation.<br>");
        fwrite($third, $stripwrite);
        fclose($third);

        $log = "petition/ipemail/log/log.php";
        $clog = file_get_contents($log);
        $fourth = fopen($log, 'w')or die("Cannot add to log file.");
        $logwrite = $clog . "<br>" . $providedname . "(" . $ip . ") has signed with this email: " . $email . ". [" . $time . "]";
        fwrite($fourth, $logwrite);
        fclose($fourth);

        echo "<meta http-equiv='refresh' content='0;http://nicotinejunkie.cv.vc/petition/index.php'>";

      } else {
        echo "<br><br><br><table border='0'><tr><td align='center'><font style='color: red;'>ERROR! Your signature has not been added!</font></td></tr><tr><td align='left'>Possible reasons of why your signature has not been added:<br>  1) The email submitted has already been used by another signer.<br>  2) A signer has already signed the petition under your IP Address.<br>  3) You have not agreed to the ";
        echo "<a href='tos.php' style='border-width: 0px;' onclick=";
        echo '"window.open(this.href, ';
        echo "'popupwindow', 'width=356,height=427'); return false;";
        echo '"';
        echo ">Terms of Service</a>.<br>You have not filled out a section of the form.";
      }
  } else {

echo "<table cellspacing='0' cellpadding='0' width='440' border='0' style='border-style: solid; border-width: 1px; border-color: #000000;'>
  <tr>
      <td align='center'>
        <img src='DC.jpg' width='440'>
        </img>
      </td>
  </tr>
  <tr>
      <td align='center'>
<table border='0' cellspacing='0' cellpadding='0' width='440'>
  <tr>
      <td>
        <table border='0' width='440' cellspacing='0' cellpadding='0'>
            <tr>
              <td align='center' style='background-color: #000000; color: #ffffff; border-style: solid; border-width: 1px; border-color: #ffffff;'><b>ID</b>
              </td>
              <td align='center' style='background-color: #000000; color: #ffffff; border-style: solid; border-width: 1px; border-color: #ffffff;'><b>Name</b>
              </td>
              <td align='center' style='background-color: #000000; color: #ffffff; border-style: solid; border-width: 1px; border-color: #ffffff;'><b>IP Verification</b>
              </td>
              <td align='center' style='background-color: #000000; color: #ffffff; border-style: solid; border-width: 1px; border-color: #ffffff;'><b>Email Verification</b>
              </td>
            </tr>";

[color=red]$dir = "petition/";
$count = 1;
$signersonetwo = 0;

if ($handle = opendir($dir)) {

  while (false !== ($file = readdir($handle))) {

      if ($file !== "." && $file !== ".." && $file !== "ipemail" && $file !== "includestuff.php" && $file !== "DC.jpg" & $file !== "css.css") {

          $sid = substr($file, -5, 1);
          $path = $dir . $file;
          include($path);

          if ($signersonetwo == 0) {
              echo "<tr><td class='signersone'>".$count."</td><td class='signersone' align='center'>".$name."</td><td class='signersone' align='center'>Unique IP</td><td class='signersone' align='center'>Unique Email</td></tr>";
              $count++;
              $signersonetwo++;
            } elseif ($signersonetwo == 1) {
              echo "<tr><td class='signerstwo'>".$count."</td><td class='signerstwo' align='center'>".$name."</td><td class='signerstwo' align='center'>Unique IP</td><td class='signerstwo' align='center'>Unique Email</td></tr>";
              $count++;
              $signersonetwo = $signersonetwo-1;
            }[/color]

        }
      }
  }

echo "<table>
      </td>
  </tr>
</table>";


echo "<div class='form' id='form'>
  <form action='petition.php' method='POST'>
  <input type='hidden' value='" . $count . "' name ='count' />
      <table border='0' cellspacing='0' cellpadding='0' style='border-style: solid; border-width: 1px; border-color: #000000;'>
        <tr>
            <td align='center' style='background-color: #000000; color: #ffffff;'>
              To support, add your signature:
            </td>
        </tr>
        <tr>
            <td>
              <table border='0'>
                  <tr>
                    <td align='right'>
                        Name:
                    </td>
                    <td>
                        <input type='text' value='Anonymous' name='name' />
                    </td>
                  </tr>
                  <tr>
                    <td align='right'>
                        Email:
                    </td>
                    <td>
                        <input type='text' name='email' />
                    </td>
                  </tr>
              </table>
            </td>
        </tr>
        <tr>
            <td>
              <table border='0' width='100%' style ='border-style: solid; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px; border-right-width: 0px; border-color: #000000;' cellpadding='0' cellspacing='0'>
                  <tr>
                    <td>
                        <input type='checkbox' name='tos' />
                    </td>
                    <td>
                        I agree to the ";
echo "<a href='tos.php' style='border-width: 0px;' onclick=";
echo '"window.open(this.href, ';
echo "'popupwindow', 'width=356,height=427'); return false;";
echo '">Terms of Service</a>.';
echo "                    </td>
                  </tr>
              </table>
            </td>
        </tr>
        <tr>
            <td>
              <table border='0' cellspacing='0' cellpadding='0' width='100%'>
                  <tr>
                    <td align='center'>
                        <input type='submit' name='submit' value='submit' />
                    </td>
                  </tr>
              </table>
            </td>
        </tr>
        <tr>
            <td align='center' style='background-color: #000000; color: #ffffff;'>
              Support what:
            </td>
        </tr>
        <tr>
            <td align='center' style='background-color: #ffffff; color: #000000;'>
              This petition is to try and persuade Vagrant Records recording artist 'Dashboard Confessional' into recording an unaccoustic  version of 'The Best Deceptions'.
            </td>
        </tr>
      </table>
  </form>
<div style='float: left; text-align: justify;'>
Who knows, maybe if we get enough signatures, they will want to make the version for their fans!?
</div>
</div>";

}

?>

</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/15166-order/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.