Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 'On');
  3. //ob_start("ob_gzhandler");
  4. error_reporting(E_ALL);
  5.  
  6. // start the session
  7. session_start();
  8.  
  9. // database connection config
  10. $dbHost = 'localhost';
  11. $dbUser = 'test';
  12. $dbPass = 'test';
  13. $dbName = 'phpwebco_shop';
  14.  
  15. // setting up the web root and server root for
  16. // this shopping cart application
  17. $thisFile = str_replace('\\', '/', __FILE__);
  18. $docRoot = $_SERVER['DOCUMENT_ROOT'];
  19.  
  20. $webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
  21. $srvRoot  = str_replace('library/config.php', '', $thisFile);
  22.  
  23. define('WEB_ROOT', $webRoot);
  24. define('SRV_ROOT', $srvRoot);
  25.  
  26. // these are the directories where we will store all
  27. // category and product images
  28. define('CATEGORY_IMAGE_DIR', 'images/category/');
  29. define('PRODUCT_IMAGE_DIR',  'images/product/');
  30.  
  31. // some size limitation for the category
  32. // and product images
  33.  
  34. // all category image width must not
  35. // exceed 75 pixels
  36. define('MAX_CATEGORY_IMAGE_WIDTH', 75);
  37.  
  38. // do we need to limit the product image width?
  39. // setting this value to 'true' is recommended
  40. define('LIMIT_PRODUCT_WIDTH',     true);
  41.  
  42. // maximum width for all product image
  43. define('MAX_PRODUCT_IMAGE_WIDTH', 300);
  44.  
  45. // the width for product thumbnail
  46. define('THUMBNAIL_WIDTH',         75);
  47.  
  48. if (!get_magic_quotes_gpc()) {
  49.     if (isset($_POST)) {
  50.         foreach ($_POST as $key => $value) {
  51.             $_POST[$key] =  trim(addslashes($value));
  52.         }
  53.     }
  54.    
  55.     if (isset($_GET)) {
  56.         foreach ($_GET as $key => $value) {
  57.             $_GET[$key] = trim(addslashes($value));
  58.         }
  59.     }  
  60. }
  61.  
  62. // since all page will require a database access
  63. // and the common library is also used by all
  64. // it's logical to load these library here
  65. require_once 'database.php';
  66. require_once 'common.php';
  67.  
  68. // get the shop configuration ( name, addres, etc ), all page need it
  69. $shopConfig = getShopConfig();
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement