I am very new to PHP development and I am currently learning java and php at the same time with integration and I therefor mix them together with the syntax and so. This current code is meant to use an passed in arguments using $_GET and then process them. The current solution is just for temporal development focusing on the client java side. The problem is that not even my temporary solution is working and my IDE does not tell me any errors. I think I messed up with the scope but I am not sure.
[source lang="php"]//Set mode$error = NULL;$output = NULL;try{ $mode = $_GET["mode"];}catch(exception $exc){ $error = "No mode";} //set error to null, results in message to error if set to true//Check to make sure it is an valid userif ($mode == "userVerify"){ if (username == "open"){ $output = "valid"; }else{ try{ $username = $_GET["username"]; $password = $_GET["password"]; }catch(exception $exc){ $error = "No username or password given"; } $output = "valid"; }}//Connection checking, allways returns true if executedelseif ($mode == "connectionCheck"){ $output = "true";}//Check prestige levelelseif ($mode == "userPrestigeLevel"){ $username = $_GET["username"]; if (username == "open"){ $output = "0"; }else{ //Executed if it is not an open user $output = "0"; }}else{$error = "Unvalid mode" . $mode;}if ($output == NULL){ $error = "No output";}if ($error != NULL){ $output = "ERROR: " . $error;}echo $output;[/source]
I pass in arguments using the sytem localhost/file.php?mode=userVerify?username=test?password=test and all I receive back is "ERROR: No output". I know this code is anything but pretty, but for know all i want is some basic functionality.
Edited by philipborg, 07 September 2012 - 10:38 AM.







