0 Replies Latest reply on Nov 14, 2011 3:08 PM by Treasurepet

    PHP Issue

    Treasurepet

      Hello all, I have a site with login system, when I run it on my local sever it worked perfectly ok, but when uploaded it was not taking me to member page as on my local server.

       

      I got the following error when trying to login:

       

      Warning:  Cannot modify header information - headers already sent by (output started at /home/leomconn/public_html/index.php:9) in /home/leomconn/public_html/index.php on line 190

       

       

      Please can anybody help me with this.

       

      The codes are below.

       

      myconfig.php

       

      <?php

      $con=mysql_connect("localhost","leomconn_leom","happiness100");

      if(!$con)

      {

      die("Database connection failed: ".mysql_error());

      }

       

      //selecting the database and inserting into the database

      mysql_select_db("leomconn_leomdatabase",$con);

      ?>

       

       

      registered.php

      <?php

      if (isset($_POST['Submit']))

      {

      include("myconfig.php");

      $username = $_POST["username"];

      $password = $_POST["password"];

       

       

      $check = mysql_query("SELECT * FROM registered WHERE username = '$username'");

      if(mysql_num_rows($check)==0)

      {

      $ins = mysql_query("INSERT INTO registered(username, password) VALUES('$username', '$password')");

      echo "<br/>";

      echo "<font color=#000000 size=+2> Entered Succefully</font>"; echo "<br/>";

      echo "<br/>";

      }

      else

      {

      echo "<font color=#000000 size=+2> Username already exist</font><br/>";

      }

      }

      ?>

       

      index.php

      <?php

       

      if(isset($_POST['Submit']))

      {

      include("myconfig.php");

      $username=$_POST["username"];

      $password=$_POST["password"];

      $check=mysql_query("select * from registered where username='$username' AND password='$password'");

      if(mysql_num_rows($check)==0)

      echo "<font color=#0000FF>Make Payment to be activated </font><br/>";

       

      //creatinga a sersion and header that redirects it to the page called secret.php

      else

      {

      $_SESSION[xyz]=$username;

      // the secret.php page is the page the user goes after he logs in succefully

      header("Location:member.php");

       

      }

      }

       

      ?>

       

      I will really appreciate if anybody can help me out.

       

      thanks all

       

      Treasurepet