Topic: "PHP Weirdness" (page 3 of 4)

< 1 2 3 4 >
Author Post
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
QuoteQuote from sniperkid:
[0] => 1
[ID] => 1
[1] => sniperkid
[Username] => sniperkid
[2] => [pwd]
[Password] => [pwd]
[3] => {email}
{Email} => {email}
[4] =>
[LastLogin] =>
[5] => 1
[AccessLevel] => 1
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
i'm suspecting that i've been up too long and there's something obvious i'm missing. remember that these things are case sensitive.
SELECT * FROM tblUsers WHERE Username='$username'

also, if you can do a straight-forward select * then it should work. failing that see whether you can select * from x where id=1?
private message
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Yep doing a straight forward * works, doing where ID=1 works, but anything from $_SESSION or $_COOKIE that i try to concatenate in the mysql_query doesn't. I was doing it late on Friday thinking same thing, tried it over weekend still can't get my head around it.
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
So that would mean that WHERE Username='sniper' works, right? if that is the case i stick to the browser binding cookie issue as it works on a free remote server. I'll have to sleep on it mate. I'll have a think and get back to you. if you manage to hack it though i would love to know what the issue was.
private message
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Yep
Works: SELECT * FROM tblUsers WHERE Username='sniperkid'
($username = $_SESSION['username'];)
Doesn't: SELECT * FROM tblUsers WHERE Username='$username'
($usertest = "sniperkid";)
Works: SELECT * FROM tblUsers WHERE Username='$usertest'

Thanks for your input, i will look into that and let you know!
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
this is going to make me pop my clocks. can you do me a favour and see whether you can pass it as a $_GET variable? it's driving me insane.:idiot:
private message
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
yep, $_GET and $_POST work fine (its why i didn't notice the issue until now :))
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
okay, now this may sound weird but it works with a lot of odd javascript. try $username="".$_SESSION['username']; and see whether that changes anything. or maybe $username=trim(" ".$_SESSION['username']);
Edited by aceldama on 02.07.2012 11:29:25
private message
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
ok $username = "".trim($_SESSION['username']); works!!!!! I will use this, thanks alot!!!
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
that is weird. seems like the variable was passing a reference rather than the actual value. adding the "".x to it forces it to create a new string. the trim function was supposed to do the same. anyway, glad to be of help. you know it'll probably be better if you did an $username=htmlspecialchars($_SESSION['var']); instead. it would not only make it harder to hack, but it should force a string rebuild too.
private message

Topic: "PHP Weirdness" (page 3 of 4)

< 1 2 3 4 >