Jump to content

[SOLVED] question


justAnoob

Recommended Posts

This script works on all my pages on the site I'm working on....except for 1 page... I don't understand why... Yes,, I have session_start(); at the top of the page. I know this is not in detail,, but maybe someone has had the same prob..

<?php
        if(isset($_SESSION['auth']))
        {
      		unset($_SESSION['message']);
	    sleep(3);
		echo ($_SESSION['goodlog'] . '<a href="logout.php">Log out');
	}
        else
        {
      		echo '<form name="form1" method="post" action="login.php">
			  <input name="username" type="text" id="username" />
			  <input name="password" type="password" id="password" />
			  <input type="submit" name="submit" id="submit" value="Login">
			  </form>';
  	      }
	    ?>

 

Link to comment
https://forums.phpfreaks.com/topic/158649-solved-question/
Share on other sites

That is the problem,, there really isn't one,, the code is identical....The strange thing is that the log in form appears on the page that is having the problem, so I sign in again and it returns me to the homepage. Then if I click on the link again to go back to the problem page, everything is ok... So the scripts only work when I sign in from the problem page.

Link to comment
https://forums.phpfreaks.com/topic/158649-solved-question/#findComment-836715
Share on other sites

Here is the problem page form.

<form id="form1" name="form1" method="post" action="login.php">
            <div align="center">
              <div align="center">
                <?php
        if(!isset($_SESSION['auth']))
	{
		echo ($_SESSION['message']);
	}
	?>
                <?php
        if(isset($_SESSION['goodreg']))
	{
		unset($_SESSION['message']);
		echo ($_SESSION['goodreg']);
	}
	?>
                <br>
                <?php
        if(isset($_SESSION['auth']))
        {
      		unset($_SESSION['message']);
	    sleep(3);
		echo ($_SESSION['goodlog'] . '<a href="logout.php">Log out');
	}
        else
        {
      		echo '<form name="form1" method="post" action="login.php">
			  <input name="username" type="text" id="username" />
			  <input name="password" type="password" id="password" />
			  <input type="submit" name="submit" id="submit" value="Login">
			  </form>';
  	      }
	    ?>
                <br />
              </div>
            </div>
          </form>

 

And here is the form from the homepage and all the other pages that work fine.

<form id="form1" name="form1" method="post" action="login.php">
    <div align="center">
      
      <div align="center">
        <?php
        if(!isset($_SESSION['auth']))
	{
		echo ($_SESSION['message']);
	}
	?>
        <?php
        if(isset($_SESSION['goodreg']))
	{
		unset($_SESSION['message']);
		echo ($_SESSION['goodreg']);
	}
	?>
          <br>
          <?php
        if(isset($_SESSION['auth']))
        {
      		unset($_SESSION['message']);
	    sleep(3);
		echo ($_SESSION['goodlog'] . '<a href="logout.php">Log out');
	}
        else
        {
      		echo '<form name="form1" method="post" action="login.php">
			  <input name="username" type="text" id="username" />
			  <input name="password" type="password" id="password" />
			  <input type="submit" name="submit" id="submit" value="Login">
			  </form>';
  	      }
	    ?>
          <br />
        </div>
    </div>
  </form>

 

 

Link to comment
https://forums.phpfreaks.com/topic/158649-solved-question/#findComment-836717
Share on other sites

This is really strange, or maybe it is something I do not know about...

 

Here is the link on my homepage that takes my to the page that I'm having problems with.

<?php
echo substr($row['description'],0,50).'<a href="http://------.com/viewitem.php?id_main='.$row['id'].'"> ...View</a>';
?>

With the code above,,, even when I'm signed in and click on the link,, it takes me to the page but as I mentioned earlier in this thread,,, it still shows the log in form...  Now check out the code below....

 

<?php
echo '<a href="viewitem.php"><img src="images/my_btn.png" width="91" height="20" border="0">';
?>

Now if I just put in a picture with a link to replace the original code above,, it takes me to the page just fine with no problems.. What is causing the problems with the first line of code???

 

 

Link to comment
https://forums.phpfreaks.com/topic/158649-solved-question/#findComment-836749
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.