PDA

View Full Version : two identical Urlrequests - one works and one doesnt


kevtom
07-01-2011, 10:32 AM
ok,

I am really confusd here and a bit of a beginner so sorry if I am missing something.

I have a block of code that connects with php to check if a user is logged in. (I adapted it from a tutorial site so you might recognise it).


What I dont understand is I have 2 files on the server called

checkuserlog.php

and

checkuserlog2.php

They are both in the same location on the server as the swf file.

and are reached with the line

var varSend1:URLRequest = new URLRequest ("checkuserlog.php");


The two checkuserlog files were different and one wasnt working - but now i have made them IDENTICAL but when i change;

var varSend1:URLRequest = new URLRequest ("checkuserlog.php");

to

var varSend1:URLRequest = new URLRequest ("checkuserlog2.php");

one works fine as intended (checkuser2.php)
the other doesnt return a variable to me - i get nothing back.

I tried it on a wamp server too and still got the same problems.

I thought I was pretty good at coding but this is seriously driving me crazy and I am now considering gardening instead :(

kevtom
07-01-2011, 04:30 PM
ok just to update;

i took the file that doesnt work (checkuser.php) and deleted all the spaces and returns and then added them back in and saved it and it worked.

The file is very simple at the moment, i stripped it doen to find my error - just;

<?php

session_start();

if ($_POST[log_check] == "check")
{
$message="not_logged_in";
echo"phpreturn=$message";
}

?>

so, could anyone explain to me why deleting the spaces and linebreaks made a difference and what i can do to stop this problem happening again?

kevtom
07-01-2011, 06:25 PM
i take it back its not working again :(
i add a bit of code - it stops working, i take the code back out to what it was before and it still doesnt work, even though it was working fine the previous time.

Its as if it will work for a while then just stop. So I switch to a file which i know works from a previous attempt and then that isnt working.

I'm really at a loss

audiopro
07-02-2011, 03:29 PM
Your PHP script is either not returning a value or is returning the wrong value.

What happens if you return a message when the conditional isn't met?

$message='Nothing returned';
if ($_POST[log_check] == "check")
{
$message="not_logged_in";
}

echo"phpreturn=$message";