Skip to content
Permalink
Browse files

apiにajax以外からのアクセス禁止実装

  • Loading branch information
m
m committed Oct 21, 2019
1 parent ce33d99 commit cd8fc66d8d05698fecabedcdc8734b438bd800fe
Showing with 11 additions and 0 deletions.
  1. +6 −0 server/count_question.php
  2. +5 −0 server/count_up.php
@@ -1,5 +1,11 @@
<?php
require('config.php');
$request = isset($_SERVER['HTTP_X_REQUESTED_WITH'])
? strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) : '';
if($request !== 'xmlhttprequest') exit;
header('Content-type: application/json; charset=utf-8');
if(!isset($_GET['id']) || $_GET['id'] == ''){
echo 'id exit';
@@ -1,5 +1,10 @@
<?php
require('config.php');
$request = isset($_SERVER['HTTP_X_REQUESTED_WITH'])
? strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) : '';
if($request !== 'xmlhttprequest') exit;
header('Content-type: application/json; charset=utf-8');
$link = mysql_connect($sql_url, $user, $pw);
if (!$link) {

0 comments on commit cd8fc66

Please sign in to comment.
You can’t perform that action at this time.