Jump to content

alimosavi

Members
  • Posts

    3
  • Joined

  • Last visited

alimosavi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. /core/includes/patch.inc.php content : <?php //input patch from other modules or other things and output relative effect $base_url = url(); $parts = parse_url($base_url); $main_url = substr($base_url, 0, strlen($base_url) - strlen($parts['path'])); $request_path = request_uri(TRUE); $base_path_len = strlen(rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/')); $path = substr(urldecode($request_path), $base_path_len + 1); $base_url_dir = substr($base_url, 0, strlen($base_url) - strlen($path)); /* show corrent url */ function url(){ if(isset($_SERVER['HTTPS'])){ $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; }else{ $protocol = 'http'; } return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } function request_uri($omit_query_string = FALSE) { if (isset($_SERVER['REQUEST_URI'])) { $uri = $_SERVER['REQUEST_URI']; } else { if (isset($_SERVER['argv'][0])) { $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0]; } elseif (isset($_SERVER['QUERY_STRING'])) { $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; } else { $uri = $_SERVER['SCRIPT_NAME']; } } // Prevent multiple slashes to avoid cross site requests via the Form API. $uri = '/' . ltrim($uri, '/'); return $omit_query_string ? strtok($uri, '?') : $uri; } ?>
  2. /core/includes/bootstrap.inc.php content : <?php // Load site Config define('CONFIG', ROOT . '/server/default/config.php'); require_once CONFIG; $inc = array("dbconnect", "modules", "patch" ,"theme"); foreach ($inc as $value) { require_once($value . '.inc.php'); } define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']); ?> /core/includes/dbconnect.inc.php content : // Database Variables $dbhost = $mysql_host; $dbuser = $mysql_username; $dbpass = $mysql_password; $dbname = $mysql_dbname; $MYSQL_ERRNO = ""; $MYSQL_ERROR = ""; // Connect To Database function db_connect() { global $dbhost, $dbuser, $dbpass, $dbname; global $MYSQL_ERRNO, $MYSQL_ERROR; $link_id = mysql_connect($dbhost, $dbuser, $dbpass); if(!$link_id) { $MYSQL_ERRNO = 0; $MYSQL_ERROR = "Connection failed to $dbhost."; return 0; } else if(!mysql_select_db($dbname)) { $MYSQL_ERRNO = mysql_errno(); $MYSQL_ERROR = mysql_error(); return 0; } else return $link_id; } // Handle Errors function sql_error() { global $MYSQL_ERRNO, $MYSQL_ERROR; if(empty($MYSQL_ERROR)) { $MYSQL_ERRNO = mysql_errno(); $MYSQL_ERROR = mysql_error(); } return "$MYSQL_ERRNO: $MYSQL_ERROR"; } // Print Error Message function error_message($msg) { printf("Error: %s", $msg); exit; }
  3. Hi , I try to develop a cms , i welcome any help or opinion , root file : index.php , .htaccess folders : ==>core --> includes { bootstrap.inc.php , dbconnect.inc.php , patch.inc.php , ...) --> modules {user , content , menu , sys , box } --> style {css , img , template } ==>server --> default {config.php} --> example.com {config.php , modules , style , files} ==>main --> files --> library --> modules --> style ---->default {template , css , img } The index file content : <?php define('ROOT', getcwd()); require_once ROOT . '/core/includes/bootstrap.inc.php'; ?> .htaccess file content : RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.