Page 1 of 1

plz help me find my problem

Posted: Fri Dec 04, 2009 5:37 am
by chris_s_22
1}When i go to my searchindex.php which displays a search form.
2)The data from form is sent to the search.php for checking and displays results without a problem.
3)If i then navigate to a page other than any of the result links everything is fine
4)If i click on one of the result links, it let me navigate to the page and displays fine
BUT doesnt let me navigate away from that page, it fails on the is_authed function
(the is_authed function checks session data.)

the search result page links sends users to view.php if i echo out session data its fine
unless it came from the search results the session username is changed

So im guessing that my problem is in search.php that somewhere i change the session username
so the data been passed to the view.php is wrong

This is the search.php

Code: Select all

 
<?php include 'Connect.php';?>
<html><head><link href="style.css" rel="stylesheet" type="text/css"></head>
<body>
<div class=navigationbarbox><?php include "navigationbar.php";?></div>
<?php
if(!isset($_GET[submit])) 
{
     // Show the form
     include 'searchindex.php';
     exit;
} 
else 
{
    if (empty($_GET['searchone']) )// Check if field empty
    {
        // Reshow the form with an error
        $searchempty_error = 'field empty';
        include 'searchindex.php';
        exit;
    }
//CHECKS USERNAME
    if(!preg_match("/^[a-z\d]{1,100}$/i", $_GET[searchone]))
    {
        // Reshow the form with an error
        $searchentery_error = "Invalid search only letters and numbers!<br />";
        include 'searchindex.php';
        exit;  
    }
    $result = mysql_query ("SELECT * FROM members WHERE username LIKE '%$searchone%' "); 
    $num=mysql_num_rows($result);
 
    if($num>0) 
    {
        /* start the search result box */
        echo '<div class="searchresults">';
        echo "<table><tr>";
        while($row=mysql_fetch_array($result)) 
        {
            $userid = $row["id"];
            $photo = $row["photo"];
            echo "<td><img src='http://myurl.co.uk/NEWTEACH/userimages/$photo' width='100' height='150'><br>";
            echo '<a href="profileindex.php?userid='.$userid.'">' . $row['username'] . '</a><br>';
            echo '<strong>Location:</strong>' . $row['location'] . '<br>';
            echo '<strong>Date of Birth:</strong>' . $row['dob'] . '</td>';
        } 
        echo "</tr></table>";
        echo '</div>'; //end searchresults div
    } 
        else 
        {
        echo '<p>Sorry, your search returned no results!</p>';
        }  // end if $num
 
} // end isset if 
?> 
<div class=searchresult><?php 
    echo '<strong>You searched for:</strong> ' . $searchone . '<br>';
    echo 'There are ' . $num . ' results.';
?></div>
</body>
</html>
 
MY SESSION IS THE FIRST THING IN CONNECT.PHP which also conect to database and calls for any functions needed.