Created
February 26, 2015 15:18
-
-
Save backy22/dacb544b42d3a941e910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dataFile = 'cc.dat'; | |
$userhouse1 = $_GET['userhouse1']; | |
$stay1 = $_GET['stay1']; | |
$stay2 = $_GET['stay2']; | |
$fp = fopen($dataFile, "r"); | |
while (($dataRow = fgetcsv($fp, 0, ",")) !== FALSE) { | |
$dataArray1[] = $dataRow; | |
} | |
fclose($fp); | |
$rightData = array(); | |
foreach ($dataArray1 as $eachData1){ | |
// dataArray1:[0]神楽坂 [1]Jon [2]4 [3]2015-02-01 [4]2015-02-15みたいな各配列 | |
// eachData1[0]:ex 神楽坂 | |
// eachData1[1]:ex Jon | |
// eachData1[2]:ex 4 | |
// eachData1[3]:2015-02-01 | |
// eachData1[4]:201-02-15 | |
if( | |
$eachData1[0] == $userhouse1 && | |
$eachData1[3] == $stay1 && | |
$eachData1[4] == $stay2 && | |
){$rightData = $eachData1; | |
} | |
} | |
if( | |
$rightData[1] == null or | |
$rightData[2] == null or | |
$rightData[3] == null or | |
$rightData[4] == null | |
){ | |
$rightData[1] = ""; | |
$rightData[2] = ""; | |
$rightData[3] = ""; | |
$rightData[4] = ""; | |
} | |
$response = array( | |
'guestname' => $rightData[1], | |
'people' => $rightData[2], | |
'stay1' => $rightData[3], | |
'stay2' => $rightData[4] | |
); | |
echo json_encode($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment