Mini PHP Framework Include/init.php

Source: Internet
Author: User


<?php

Defined (' ACC ') | | Exit (' Access Denied ');


Initialization scripts, specifically responsible for environment detection and configuration



0: First detect where you are


/*

Under Win, the path

D:\www\info no problem.

D:/www/info no problem.


On the Linux path

/var/www/info, forward slash



So: Unify into forward slash, in Linux format


*/


Detecting the root directory and defining constants

Define (' ROOT ', str_replace (' include/init.php ', ' ', str_replace (' \ \ ', '/', __file__)));




Contains the public underlying file

Require (ROOT. ' include/absdb.class.php ');

Require (ROOT. ' include/mysql.class.php ');

Require (ROOT. ' include/conf.class.php ');

Require (ROOT. ' include/log.class.php ');

Require (ROOT. '/model/model.php ');



function __autoload ($classname) {

Require (ROOT. ' model/'. $classname. '. php ');

}



Detect magic quotes with or without opening, if not turned on, the Get,post,cookie manually escaped. (addslashes)

if (!GET_MAGIC_QUOTES_GPC ()) {

function Addslash ($arr) {

foreach ($arr as $k = = $v) {

if (Is_array ($v)) {

$arr [$k] = Addslash ($v);

} else if (is_string ($v)) {

$arr [$k] = addslashes ($v);

}

}


return $arr;

}


$_get = Addslash ($_get);

$_post = Addslash ($_post);

$_cookie = Addslash ($_cookie);

}





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.