Ejemplo n.º 1
0
function printFirstAid($firstaid)
{
    echo '<div style="padding:10px;margin:10px;border:2px solid black;"><h3>' . $firstaid["ailment"] . '</h3>';
    $ailment = $firstaid['ailment'];
    if ($ailment != null) {
        //printData ( 'ailment', $ailment );
    }
    $ailment_information = $firstaid['ailment_information'];
    if ($ailment_information != null) {
        printData('ailment_information', $ailment_information);
    }
    $ailment_causes = $firstaid['ailment_causes'];
    if ($ailment_causes != null) {
        printData('ailment_causes', $ailment_causes);
    }
    $ailement_prevention = $firstaid['ailement_prevention'];
    if ($ailement_prevention != null) {
        printData('ailement_prevention', $ailement_prevention);
    }
    $ailment_signs = $firstaid['ailment_signs'];
    if ($ailment_signs != null) {
        printData('ailment_signs', $ailment_signs);
    }
    $ailment_symptoms = $firstaid['ailment_symptoms'];
    if ($ailment_symptoms != null) {
        printData('ailment_symptoms', $ailment_symptoms);
    }
    $ailment_cautions = $firstaid['ailment_cautions'];
    if ($ailment_cautions != null) {
        printData('ailment_cautions', $ailment_cautions);
    }
    $ailment_medication = $firstaid['ailment_medication'];
    if ($ailment_medication != null) {
        printData('ailment_medication', $ailment_medication);
    }
    $ailment_treatmeant = $firstaid['ailment_treatmeant'];
    if ($ailment_treatmeant != null) {
        printData('ailment_treatmeant', $ailment_treatmeant);
    }
    $ailment_treatmeant_precautions = $firstaid['ailment_treatmeant_precautions'];
    if ($ailment_treatmeant_precautions != null) {
        printData('ailment_treatmeant_precautions', $ailment_treatmeant_precautions);
    }
    $ailment_treatment_position = $firstaid['ailment_treatment_position'];
    if ($ailment_treatment_position != null) {
        printData('ailment_treatment_position', $ailment_treatment_position);
    }
    $ailment_short_notes = $firstaid['ailment_short_notes'];
    if ($ailment_short_notes != null) {
        printData('ailment_short_notes', $ailment_short_notes);
    }
    echo '</div>';
}
Ejemplo n.º 2
0
function printTable()
{
    $matric = $mcode = $grade = "";
    if (isset($_POST["submit"])) {
        $matric = $_POST["matric"];
        $mcode = $_POST["mcode"];
        $grade = $_POST["grade"];
        $conn = connect();
        mysqli_query($conn, "INSERT INTO users(matric, mcode, grade) VALUES ('{$matric}', '{$mcode}', '{$grade}')");
        mysqli_close($conn);
        printData($matric);
    }
    if (isset($_POST["show"])) {
        $matric = $_POST["matric"];
        printData($matric);
    }
}
Ejemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     /** Load các thư viện helper cần dùng */
     $this->load->helper('underscore');
     $this->load->helper('url');
     $this->load->helper('dev');
     $this->load->helper('page');
     $this->load->helper('ip');
     /** Kiểm tra biến ENVIRONMENT */
     ENVIRONMENT != 'development' || $this->output->enable_profiler(TRUE);
     /** Lấy các biến trên đường dẫn */
     if ($segs = $this->uri->segment_array()) {
         if ($segs == '') {
             echo 'Tham so khong ton tai => Tang chu';
         } else {
             printData($segs);
         }
     }
     echo 'Dia chi ip: ' . getRealIPAddress();
 }
Ejemplo n.º 4
0
<section>
    <?php 
$reversed = true;
printData($article, $category, $reversed);
?>
</section>
Ejemplo n.º 5
0
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>-->
            </div><!-- /.navbar-collapse -->
            <p id="welcome"
               class="navbar-brand navbar-right hide <?php 
if ($_SESSION['logged']) {
    ?>
show <?php 
}
?>
"><span>Welcome </span><?php 
echo getValue($_SESSION, 'username');
?>
            </p>
            <a class="btn btn-default navbar-btn navbar-right <?php 
if (getValue($_SESSION, 'logged')) {
    echo 'hide';
}
?>
" href="sing.php">Sign in</a>
        </div><!-- /.container-fluid -->
    </nav>
    <div id="content">
        <aside class="nav-sidebar">
            <ul class="nav-sidebar list-group">
                <h1>Categories</h1>
                <?php 
printData($category);
?>
            </ul>
        </aside>
Ejemplo n.º 6
0
<?php

function printData($obj)
{
    echo "<pre>";
    print_r($obj);
    echo "</pre>";
}
$url = 'http://192.168.1.159:9875/v2/search';
$data = json_encode(array("storeId" => 2, "keyword" => "babe"));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, count($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$content = curl_exec($ch);
curl_close($ch);
$objects = json_decode($content, true);
foreach ($objects as $object) {
    foreach ($object as $key => $value) {
        printData($key);
    }
}
Ejemplo n.º 7
0
<?php

/**
 * Created by PhpStorm.
 * User: just
 * Date: 08.02.16
 * Time: 15:47
 */
if ($key = getValue($_GET, 'key')) {
    $data = $article;
} else {
    $data = [];
}
$printCategory = [];
print '<section>
        <ul class="nav-sidebar list-group">';
foreach ($data as $id => $item) {
    if ($key === $item['category']) {
        $printCategory[$id] = $item;
    } else {
        $printCategory[$id] = [];
    }
}
$reversed = true;
printData($printCategory, $category, $reversed);
print '</ul>
</section>';
    return $ret;
}
function _convertAgeToAgeGroup($age)
{
    $age = intval($age);
    if ($age <= 7) {
        return "<7";
    } else {
        if ($age <= 12) {
            return "8-12";
        } else {
            if ($age <= 17) {
                return "13-17";
            } else {
                if ($age <= 35) {
                    return "18-35";
                } else {
                    if ($age <= 52) {
                        return "36-52";
                    } else {
                        return "53+";
                    }
                }
            }
        }
    }
}
// Output
printHeader();
printData();
printFooter();
Ejemplo n.º 9
0
    if (preg_match('/[a-zA-Z]+Controller$/', $classname)) {
        include __DIR__ . '/controllers/' . $classname . '.php';
        return true;
    } elseif (preg_match('/[a-zA-Z]+Model$/', $classname)) {
        include __DIR__ . '/models/' . $classname . '.php';
        return true;
    } elseif (preg_match('/[a-zA-Z]+View$/', $classname)) {
        include __DIR__ . '/views/' . $classname . '.php';
        return true;
    }
}
$requestURI = explode('/', $_SERVER['REQUEST_URI']);
$scriptName = explode('/', $_SERVER['SCRIPT_NAME']);
if (stripos(strtolower($requestURI['2']), "index") === false) {
    // route the request to the right place
    $controller_name = ucfirst($requestURI['2']) . 'Controller';
    if (class_exists($controller_name)) {
        $request = new Request();
        $verb = $request->getRequestType();
        $controller = new $controller_name();
        $action_name = strtolower($verb) . 'Action';
        $result = $controller->{$action_name}($request);
        printData($result);
    } else {
        printData($controller_name . " Controller doesn't exists!");
        exit;
    }
} else {
    printData("Invalid API Call!");
    exit;
}
Ejemplo n.º 10
0
function createUser($user, $pass, $link, $clear = true)
{
    if ($clear) {
        deleteUsers($link);
    }
    $sql = "INSERT INTO web500_users (user, pass) VALUES ('{$user}', '{$pass}')";
    $res = mysql_query($sql, $link);
    return mysql_affected_rows() > 0;
}
if (array_key_exists('user', $_POST) && array_key_exists('pass', $_POST)) {
    $link = mysql_connect("<sansurBOYLEkotuBISIiste>", "<sansurBOYLEkotuBISIiste>", "<sansurBOYLEkotuBISIiste>");
    mysql_select_db("<sansurBOYLEkotuBISIiste>", $link);
    mysql_query($table, $link);
    $user = htmlspecialchars(mysql_real_escape_string($_POST['user']));
    $pass = htmlspecialchars(mysql_real_escape_string($_POST['pass']));
    if (userExists($user, $link)) {
        if (auth($user, $pass, $link)) {
            printData($user, $link);
        } else {
            echo "Invalid password :/<br/>\n";
        }
    } else {
        if (createUser($user, $pass, $link)) {
            echo "User {$user} created<br/>\n";
        } else {
            echo "Smthng bad happened :/<br/>\n";
        }
    }
} else {
    echo $loginform;
}
Ejemplo n.º 11
0
function printData($data, $word)
{
    static $i = 0;
    $html = "";
    foreach ($data as $key => $value) {
        $i++;
        if (is_array($value)) {
            $html .= "<div class='sub-values' style='padding-left:30px;'><div><b>" . htmlspecialchars($key) . "</b></div><div style='padding-left:30px;' >" . printData($value, $word) . "</div></div>";
        } else {
            $found = false;
            $islong = strlen($value) > 30;
            if (strpos($value, $word) !== false) {
                $found = true;
                $value = str_replace($word, "<span style='color:red;' >" . $word . "</span>", htmlspecialchars($value));
            } else {
                $value = htmlspecialchars($value);
            }
            $html .= "<div class='sub-values' ><i style='color:" . ($found ? "blue" : "grey") . ";'><small onclick='\$(\"#data-{$i}\").toggle();' >" . htmlspecialchars($key) . "</small></i> <span>" . substr($value, 0, 30) . ($islong ? "..." : "") . "</span></div>";
            if ($islong) {
                $html .= "<div id='data-{$i}' class='data' style='display:none;'><textarea style='width:100%;height:300px;'>" . $value . "</textarea></div>";
            }
        }
    }
    return "<div class='values' >" . $html . "</div>";
}
Ejemplo n.º 12
0
    $queryVendorId = "select * from vendor_detail where vd_name in (";
    for ($i = 0; $i < count($config['Vendor']); $i++) {
        if ($i < count($config['Vendor']) - 1) {
            $queryVendorId .= "'" . $config['Vendor'][$i] . "', ";
        } else {
            $queryVendorId .= "'" . $config['Vendor'][$i] . "'";
        }
    }
    $queryVendorId .= ") and vd_starts_on <= '" . date("Y-m-d") . "' and vd_end_on >= '" . date("Y-m-d") . "'";
    $resultVendor = $dbCentral->execute($dbCon, $queryVendorId);
    if ($dbCentral->getRecordsCount($resultVendor) > 0) {
        while ($row = $resultVendor->fetch_assoc()) {
            $vendor_ids[] = $row['vd_id'];
        }
    } else {
        printData("No content available for defined Vendors");
        exit;
    }
} else {
    trigger_error("No Vendor present. Please define atleast one Vendor in <b>" . LIB . "bootstrap.php config parameter</b>", E_USER_ERROR);
    exit;
}
$vendor_id = implode(',', $vendor_ids);
$PageName = strtolower(ucfirst(pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME)));
$hostName = 'http://' . $_SERVER['HTTP_HOST'];
// http://mysite.com
$ServerUri = parse_url($_SERVER['REQUEST_URI']);
// [path] => / & [query] => abc=1
$urlPath = !empty($ServerUri['path']) ? $ServerUri['path'] : '';
// /
$RootPath = $_SERVER['DOCUMENT_ROOT'];
Ejemplo n.º 13
0
    $xmlresponse = curl($url);
    $temp = json_decode($xmlresponse, true);
}
?>

<html>
<head> 
    <title>Contacts | Google Contacts API in PHP</title> 
    <script>
		function di(img){img.onerror=null;img.src='images/default_image.jpg';}
		function del(id,email,cid,etag){
			$('#contact-'+id).addClass('hide');
			$.post(
				'delete.php',
				{'email':email,'cid':cid,'etag':etag},
				function(data,status){if(data==200)console.log('success'); else console.log('error');}
			);
		}
	</script>
</head>
<body>
	<h4 style="text-align:right;"><a href="<?php 
echo $redirect_uri . '?logout=true';
?>
">Logout</a> </h4>
	<?php 
printData($temp, $accesstoken);
?>
  	<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
</body>
</html>
Ejemplo n.º 14
0
$result="";
$depotsExploded=explode("\r\n", $depots);
$count=0;

foreach ($depotsExploded as $key => $value) {
	if(!(strlen($value)==0)){
		//$depotsCombined[$count]=$value;
		$result=$result.$value."\r\n";
		//print($value);
	}else{
		$result=$result."\r\n"."******************"."\r\n";
	}
}

print($result);
file_put_contents('depots.txt',$result);*/
$method = $_GET['method'];
$randomNum = 0;
switch ($method) {
    case 'single':
        $randomNum = rand(0, 699);
        printData($randomNum);
        break;
    case 'multi':
        $randomNum = rand(700, 702);
        printData($randomNum);
        break;
    default:
        echo -1;
        break;
}