How to parse SOAP response with PHP?

Parse error php login, please help?

  • i have this script: <?php session_start (); include ("sql.php"); switch (@$_POST['Do']) { case "login": $cxn = mysqli_connect($host, $user, $passwd, $dbname) or die ("couldnt connect to server"); $sql = "SELECT loginName FROM member WHERE loginName='$_POST[fusername]'"; $result = mysqli_query ($cxn,$sql) or die ("could not execute query"); $num = mysqli_num_rows ($result); if ($num > 0) //Login name was found { $sql = "SELECT loginName From member WHERE loginName = '$_POST[fusername]' AND password = md5('$_POST[fpassword]')"; $result2 = mysqli_query ($cxn,$sql) or die ("could not execute query2"); $num2 = mysqli_num_rows ($result2); if ($num2 > 0) // Password is correct { $_SESSION['auth']="yes"; $logname = $_POST['fusername']; $_SESSION['logname'] = $logname; $today = date("F j, Y, g:i a"); $sql = "INSERT INTO login (loginName, loginTime) VALUES ('$logName', '$today')"; $result = mysqli_query($cxn,$sql) or die ("cant insert query into database"); header ("Location: member_page.php"); } else // password is not correct { $message ="The login name, '$_POST[fusername]' exists, but you have not entered the correct password! please try again"; include("login_form.php"); } } elseif ($num == 0) { $message ="Login name does not exist"; include("login_form.php"); } } break; case "new": foreach ($_POST as $field => $value) { if ($field != "fax") { if ($value == "") { $blanks[] = $field; } } } if (isset ($blanks)) { $message_new = "the following fields are blank. please enter the required information: "; foreach ($blanks as $value) { $message_new .= "$value, "; } extract ($_POST); include("login_form.php"); exit(); } /* check if username alreay exists */ $sql = "SELECT loginName FROM Member WHERE loginName = '$loginName'"; $result = mysqli_query ($cxn, $sql) or die ("couldnt execute select query"); $num = mysqli_num_rows ($result); if ($num > 0) { $message_new = "$loginName alreay used. Select another username"; include ("login_form.inc"); exit (); } ?> I GET PARSE ERROR ON LINE47 AFTER THE BREAK, WHAT HAVE I DONE WRONG?

  • Answer:

    Here we don't see your original formatting but based on your difficulties, you should probably better align your code to see where brackets should be opened or closed. You have a closing bracket that shouldn't be there right before your "break". As a side note, you should be real careful because I can see a very easy way to infiltrate your SQL queries to bypass your security logic. Never rely on user input without serious validation.

adeel451 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

your sructure of your switch is a little wonky case "login": do this switch($_POST['something']) { case("login"): echo "Hi"; break; } i am one of those believers that you should never suppress the errors with @ error check it before use please, you are opening yourself up to attack.

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.