Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- include 'validateschema.php';
- //echo $_SESSION['validate'];
- if(!validate())
- {
- echo "There was an error in the XML Validation";
- }
- else
- {
- //GET USER
- foreach($xml->user as $users) {
- echo "{$users->firstname} - {$users->lastname} - {$users->username} - {$users->password} - {$users->email} - {$users->sellamount} - {$users->buyamount} - {$users->level}\t\n";
- $first= $users->firstname;
- $last=$users->lastname;
- $user=$users->username;
- $pass=$users->password;
- $mail=$users->email;
- $sell=$users->sellamount;
- $buy=$users->buyamount;
- $level=$users->level;
- //echo "<br>".$first." ".$last." ".$user." ".$pass." ".$mail." ".$buy." ".$sell." ".$level."<br>";
- //ADD INTO TBLMEMBERS
- $query="INSERT INTO tblMembers VALUES('', '$first', '$last', '$user', '$pass', '$mail', $sell, $buy, $level)";
- $result=mysql_query($query) or die("Member was not inserted into tblmembers");
- //ADD Idmember to XML IDMember
- $query="SELECT LAST_INSERT_ID() from tblMembers";
- $result= mysql_query($query);
- $row=mysql_fetch_array($result);
- $insertedID=$row['LAST_INSERT_ID()'];
- $xml->user->idmember = "$insertedID";
- file_put_contents('cellphone.xml', $xml->asXML());
- if(!validate())
- {
- echo "There was an error in the data inputed";
- }
- }
- //GET PHONE
- foreach($xml->phone as $phones) {
- echo "{$phones->model} - {$phones->brand} - {$phones->Sellprice} - {$phones->color} - {$phones->SellDate} - {$phones->Features} - {$phones->condition} - {$phones->Cellstatus}\t\n";
- $model= $phones->model;
- $brand=$phones->brand;
- $sellp=$phones->Sellprice;
- $color=$phones->color;
- $selld=$phones->SellDate;
- $features=$phones->Features;
- $condition=$phones->condition;
- $cellstatus=$phones->Cellstatus;
- $buyp=$phones->buyprice;
- $buyd=$phones->buydate;
- $idmem=$phones->idmember;
- $image=$phones->image;
- $views=$phones->views;
- //ADD PHONE TO DB
- $query="INSERT INTO tblSellphones VALUES('','$image', '$model', '$brand', '$sellp', '$color', '$selld', '$features', '$condition', '$idmem', '$cellstatus', '$views', '$buyp', '$buyd')";
- $result=mysql_query($query) or die("Phone was not inserted into tblsellphones");
- $query="SELECT LAST_INSERT_ID() from tblSellphones";
- $result= mysql_query($query);
- $row=mysql_fetch_array($result);
- $insertedID=$row['LAST_INSERT_ID()'];
- $phones->idcellphone = "$insertedID";
- file_put_contents('cellphone.xml', $xml->asXML());
- if(!validate())
- {
- echo "There was an error in the data inputed";
- }
- }
- echo "<a href='dispphone.php'>You can now purchase a phone of your choice</a>";
- }
- //MAKE USER PURCHASE PHONE
- ?>
Add Comment
Please, Sign In to add comment