$_GET sometimes not working; incorrect url encode method ?
Posted: Fri Dec 21, 2007 12:45 pm
1.
Sometimes clicking on the link below sends the information to pageb but sometimes it does not. The link holds static information which is passed to pageb. I don't find a reason of why clicking on this link works most of the time but at odd times clicking on the link directs you to pageb correctly but the information that is supposed to be passed is shown empty. I click on it again and it works... This happens on both ie7 and firefox 2. Can anybody tell me why ? (I can't use POST, only GET through a link. I am also using XHTML and UTF-8)
2.
Can anybody tell me which is the correct way to url encode?
Which one should I use: urlencode or rawurlencode. What is the standard? W3C says to use ";" but it seems that most browsers don't use that. W3C says to use "&" to encode "&" instead. But what about the spaces ("+" or "%20") ? Hyphens do not need to be encoded...
What is the max amount of chars I can put on an url ?
pagea: send information to pageb using link/GET:
pageb: receives information passed through by above link. The following is a hash check, if correct it will allow page to load.
Sometimes clicking on the link below sends the information to pageb but sometimes it does not. The link holds static information which is passed to pageb. I don't find a reason of why clicking on this link works most of the time but at odd times clicking on the link directs you to pageb correctly but the information that is supposed to be passed is shown empty. I click on it again and it works... This happens on both ie7 and firefox 2. Can anybody tell me why ? (I can't use POST, only GET through a link. I am also using XHTML and UTF-8)
2.
Can anybody tell me which is the correct way to url encode?
Which one should I use: urlencode or rawurlencode. What is the standard? W3C says to use ";" but it seems that most browsers don't use that. W3C says to use "&" to encode "&" instead. But what about the spaces ("+" or "%20") ? Hyphens do not need to be encoded...
What is the max amount of chars I can put on an url ?
pagea: send information to pageb using link/GET:
Code: Select all
<a href="../folder/pageb.php?function=pass&accesscode=<?php print dechex(crc32(md5("John Doe - Kansas" . "50" . "suburb" . "toyota")));?>&name=<?php print urlencode("John Doe - Kansas");?>&age=50&location=suburb&car=toyota">Submit</a>pageb: receives information passed through by above link. The following is a hash check, if correct it will allow page to load.
Code: Select all
if( $_GET["function"]=="pass"){
if(($_GET["accesscode"])==(dechex(crc32(md5((($_GET["name"]) . ($_GET["age"]) . ($_GET["location"]) . ($_GET["car"]))))))){
}else{
exit;
}
}