Href doesn't suddenly

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
binarydream
Forum Newbie
Posts: 1
Joined: Tue Mar 02, 2004 6:49 pm

Href doesn't suddenly

Post by binarydream »

How can this happen, back from vacation. Update both Xampp and Wamp
Then I can only use href when I'm logged on the webpage
Otherwise it says the page doesn't exist 404

<a href="calc001.php">Count funktionen</a>

Starting page where I have the referrer, href. above
index.php
<?php
session_start(); // Alltid överst på sidan

include "bla/conn.php"; // Databasanslutningen


// Inloggning
if (isset($_POST['submit'])){

$sql = "SELECT col_id, col_user, col_level FROM tbl_user
WHERE col_user='{$_POST['txtuser']}'
AND col_pwd='{$_POST['txtpasswd']}'";
$result = mysql_query($sql);
$rad = mysql_fetch_object($result);


// Hittades inte användarnamn och lösenord
// skicka till formulär med felmeddelande
if (mysql_num_rows($result) == 0){
header("Location: index.php?badlogin=");
exit;
}

// Sätt sessionen med unikt index
$_SESSION['sess_id'] = mysql_result($result, 0);
$_SESSION['sess_user'] = $_POST['txtuser'];
$_SESSION['sess_level'] = $rad->col_level;

header("Location: index.php");
exit;
}

// Utloggning
if (isset($_GET['logout'])){
session_unset();
session_destroy();
header("Location: index.php");
exit;
}

?>


and the page I'm trying to get to
calc001.php
<?php
session_start(); // Alltid överst på sidan

include "bla/conn.php"; // Databasanslutningen

// Kolla om inloggad = sessionen satt
if (!isset($_SESSION['sess_user'])) {
header("Location: index.php");
exit;
}

?>
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Re: Href doesn't suddenly

Post by icesolid »

Try using the root leading:

../blah/page.php
Post Reply