Jump to content

Is something wrong?


Whalenut

Recommended Posts

Hi I´m what you would call a newbie with PHP coding, but i have made a login script using sessions. Now my problem is that when I use firefox or Netscape i have to log in twice to actually log in. My question is: Is there something wrong with my script?

 

<?php

 

if(empty($_POST['AnvId']) or empty($_POST['LosenOrd']) )

  {

echo "fyll i båda fälten"; //saying: fill both fields!

}

 

else

{

include('pics/detdu.php');

 

 

 

$AnvId = str_replace("'","''",$_POST['AnvId']);

$LosenOrd = str_replace("'","''",$_POST['LosenOrd']);

 

 

$cxn = mysql_connect($host, $user, $dbLogin);

 

mysql_select_db($dBase);

 

$sql = 'select link from users where user="'.trim($AnvId).'" and password="'.trim($LosenOrd).'";';

 

$result = mysql_query($sql);

 

if (!$result) {

  echo 'Could not run query: ' . mysql_error();

  exit;

}

 

$row = mysql_fetch_row($result);

if ($row[0] == "")

{

  header("Location:http://www.whalenut.se/design/index.php");

}

else

{

session_start();

$_SESSION['AnvId'] == $_POST['AnvId'];

header("Location:$row[0]");

 

}

}

 

 

?>

 

I´m am thankfull for any type of constructive answers and/or comments

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.