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
Share on other sites

Um... what's not working? I can't tell what's wrong if you just posted your code without stating the problem. Saying it doesn't work doesn't mean anything.

 

One thing I see is that the anchor tag is not closed in your echo.

Link to comment
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
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
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
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.