My code doesnt work :(

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rhys.Mataira
    New Member
    • Jun 2006
    • 3

    #1

    My code doesnt work :(

    My code will not show up anything at all on the screen can someone guide me why this would be?


    <?php
    $pagetitle="Log in";
    If (!$_POST['pass']) or (!$_POST['user']) {
    echo"
    <head></head>
    <style type=\”text/css\”>
    <!--
    .style1 {
    font-family: Tahoma, \”High Tower Text\”, fantasy;
    font-size: large;
    }
    -->
    </style>
    <title>$pagetit le</title>
    <body>
    <form name=\”form1\” method=\”post\” action=\”home.c ms.php\”>
    Username
    <input type=\”text\” name=\”user\”>
    <br>
    <br>
    Password
    <input type=\”password \” name=\”pass\”>
    <br>
    <br>
    Submit
    <input type=\”submit\” name=\”Submit\” value=\”Submit\ ”>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>";
    elseif ($_POST['pass'] == "PASSWORD")&&($ _POST['user'] == "USER") {
    print "success";
    // For testing purposes
    }
    else {
    echo"
    <head></head>
    <style type=\”text/css\”>
    <!--
    .style1 {
    font-family: Tahoma, \”High Tower Text\”, fantasy;
    font-size: large;
    }
    -->
    </style>
    <title>$pagetit le</title>
    <body>
    <form name=\”form1\” method=\”post\” action=\”home.c ms.php\”>
    Username
    <input type=\”text\” name=\”user\”>
    <br>
    <br>
    Password
    <input type=\”password \” name=\”pass\”>
    <br>
    <br>
    Submit
    <input type=\”submit\” name=\”Submit\” value=\”Submit\ ”>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>";
    }
    ?>
  • Rhys.Mataira
    New Member
    • Jun 2006
    • 3

    #2
    I figured it out as i posted :| very sorry

    if statements were not correct

    Comment

    • Rhys.Mataira
      New Member
      • Jun 2006
      • 3

      #3
      code will not work again!

      My code will not work again, i only started codeing php about 2 days ago, so sorry for my posts.

      The code was working but i must of changed something and now it wont work. Help would be greatly apperciated

      <?php
      $login = "false";
      if ($_POST['pass']=="pass" && $_POST['user']=="user") {
      print "success";
      global $login;
      $login = "true";
      // For testing purposes
      // include("a.cms. html");
      if (!file_exists(" news.cms.txt")) {
      print "Error with news database.";
      exit;
      }
      //file does exist
      $array = file("news.cms. txt");
      // $cdate = date('l dS \of F Y h:i A')
      $i = 0;
      foreach($array as $row) {
      global i;
      $line = explode("|", $row);
      print "<label class=\"smallfo nt\">Posted by $line[0]</label>";
      print "<input name=\"name$i\" type=\"text\" value=\"$line[0]\">";
      print "<br />";
      print "<textarea name=\"news$i\" cols=\"80\" rows=\"4\" id=\"news\">$li ne[1]</textarea>";
      print "<br />";
      print "</p>";
      $i++;
      }
      echo "
      </td>
      </tr>
      </table>

      </form>
      </tr>
      </table>
      </body>
      </html>";
      } else {
      ?>
      <head>
      <title>CMS - Login</title>
      <style type=“text/css”>
      <!--
      .style1 {
      font-family: Tahoma, “High Tower Text”, fantasy;
      font-size: large;
      }
      -->
      </style>
      </head>
      <body>
      <form name="form1" method="post" action="home.cm s.php">
      Username
      <input type="text" name="user">
      <br>
      <br>
      Password
      <input type="text" name="pass">
      <br>
      <br>
      Submit
      <input type="submit" name="Submit" value="Submit">
      </form>
      <p>&nbsp;</p>
      </body>
      </html>
      <?
      }
      ?>

      Comment

      Working...