The error is being caused by hand editing that yo are adding into the connection file.
$q = strtolower( $_GET["q"] );
this means that there is no q URL variable being passed into the checkout success page
try using isset:
$q = strtolower(isset($_GET["q"])?$_GET["q"]:"");
if you need further assistance wit the hand editing you are trying to do, I would suggest signing up for a premiere support appointment