0 Replies - 7303 Views - Last Post: 13 September 2012 - 02:25 PM

#1 Taero  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-May 12

Silverlight & PHP Data Objects

Posted 13 September 2012 - 02:25 PM

Hi,

I am trying to find out how I can consume a PHP Webservice as seen below. I THINK that I need to somehow open the url and send post variables, then parse the xml response and pull out the info I need. But I can not figure out how... Should I be looking at HttpWebRequest class?

Any help is greatly appreciated.

http://www.dreaminco...ure-user-login/
<?php
session_start();
try {
$dbh = new PDO("mysql:host=mysql.fake.net;dbname=crlogin",'username', 'password');
} catch (PDOException $e)
{
	echo $e->getMessage();
}
if ($_POST['user'] != null and $_POST['user'] != "" and $_POST['password'] != null and $_POST['password'] != "")
{
$username = $_POST['user'];
$password = $_POST['password'];
$sth = $dbh->query("SELECT COUNT(*) FROM users WHERE username='$username' and password='$password'");
$result = $sth->fetchAll(PDO::FETCH_OBJ);
$sth1 = $dbh->query("SELECT * FROM tblItem");
$result1 = $sth1->fetchAll(PDO::FETCH_OBJ);
switch ($result[0]->{'COUNT(*)'})
{
case 0;
echo 'Invalid username or password';
break;

case 1;
$_SESSION['x'] = 'success';

print_r($result1);
echo "it worked!";
break;
	
}


//echo $result[0]->{'COUNT(*)'};
//print_r($result);
}

?>





Is This A Good Question/Topic? 0
  • +

Page 1 of 1