3 hopefully 'quick' issues if someone could help? [Edit: full code now here for reference - http://pastebin.com/d1jTs1jV]
1) My query parser for php isn't working. I thought believe I've done it right, so I'd appreciate some help here. CS50 check one passed fine, but check 2 gives me errors
Requesting hello.php? returns 200, text/html, and correct output \ expected output, not an exit code of 0
:( Requesting hello.php?name=Alice returns 200, text/html, and correct output \ expected output, not an exit code of 0
Here's the code for my parse (can remove once answered)
if (strchr(line, '?') == NULL)
// look for a query; if there is none - set it equal to null terminator as spec'ed
{
*query = '\0';
return true;
}
char* query_ptr = strchr(line, '?');
// otherwise, you should have ? and a valid pointer to it with strchr
if (query_ptr == NULL)
{
// make sure you get a valid pointer;
error(501);
return false;
}
else if (*(query_ptr + 1) == ' ')
// check if there is nothing after the question mark - if so, again query is ""
{
*query = '\0';
}
else
// otherwise, start from 1 after the question mark and copy the lowercase query into the index and null terminate
{
query_ptr++;
int query_idx = 0;
while(*(query_ptr + query_idx) != ' ')
{
*(query + query_idx) = tolower(*(query_ptr + query_idx));
query_idx++;
}
*(query + query_idx + 1) = '\0';
return true;
}
2. cat2.html + cat3.html are no longer in the directories I think I saw someone say to email someone with the code to check, is that the case?
**3. I can't load 2 files ** Not sure what's going on here - I can load cat.html and cat.jpg successfully separately.
Thanks for any help!