keskese

Topic: Godaddy config problem

I thought it's something wrong with goodady server but it looks like my coding is wrong. I would appreciate this very much - there is a lot of godaddy hosting clients looking forword for tutorial and i hope this might be the first step.

So here is the code for this site:

http://engineeremployment.co.uk/

Code:
<?php
/**
 * jobber job board platform
 *
 * @author     Filip C.T.E. <http://www.filipcte.ro> <me@filipcte.ro>
 * @license    You are free to edit and use this work, but it would be nice if you always referenced the original author ;)
 *             (see license.txt).
 */
  
    header('Content-Type: text/html; charset=UTF-8');
  ini_set('display_errors', 'On');
    error_reporting(E_ALL ^ E_STRICT);
    date_default_timezone_set('Europe/Bucharest');

    // MySQL + misc settings for local environment
    if ($_SERVER['SERVER_NAME'] == 'localhost')
    {
        define('DB_HOST', 'some hosting name from godady');
        define('DB_USER', 'minenamehost');
        define('DB_PASS', 'minecoolpassword');
        define('DB_NAME', 'mainedbname');
        define('LOCATION', 'local');
        define('ENVIRONMENT', 'dev');
    }
    // MySQL + misc settings for production environment
    else
    {
        define('DB_HOST', 'some hosting name from godaddy');
        define('DB_USER', 'minehostname');
        define('DB_PASS', 'coolpassword');
        define('DB_NAME', 'mainname');
        define('LOCATION', 'online');
        define('ENVIRONMENT', 'prod');
    }

    // Global settings definitions
    define('NOTIFY_EMAIL','rob@something.coml');
    define('ADMIN_EMAIL','rob@something.com');
    define('SITE_NAME', 'engineeremployment.co.uk');


    define('MAX_CV_SIZE', 3000000); // approx. 3 mb
    define('FILE_UPLOAD_DIR', 'uploads/');
    define('JOBS_PER_PAGE', 50);
    
    // Type of jobs. Values are the database ids.
    define('JOBTYPE_FULLTIME', 1);
    define('JOBTYPE_PARTTIME', 2);
    define('JOBTYPE_FREELANCE', 3);

    define('APP_PATH',dirname(__FILE__).DIRECTORY_SEPARATOR);

  if(isset($_SERVER['SCRIPT_NAME'])) 
    {
        # on Windows _APP_MAIN_DIR becomes \ and abs url would look something like HTTP_HOST\/restOfUrl, so \ should be trimed too
        # @modified Chis Florinel <chis.florinel@candoo.ro>
        
        $app_main_dir = rtrim(dirname($_SERVER['SCRIPT_NAME']),'/engemp');    
        define('_APP_MAIN_DIR', $app_main_dir);
  } 
    else 
    {
        die('[config.php] Cannot determine APP_MAIN_DIR, please set manual and comment this line');
  }

  if(isset($_SERVER['HTTP_HOST']) && isset($_SERVER['SERVER_PORT'])) 
    {
      if($_SERVER['SERVER_PORT'] == 80) 
    {
      define ('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . _APP_MAIN_DIR . '/');
    } 
    else 
    {
      define ('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'] . _APP_MAIN_DIR . '/');
    }
  } 
  else 
  {
      die('[config.php] Cannot determine BASE_URL, please set manual and comment this line');
  }
    
    
    // Function and classes includes
    require_once '_includes/function.validate_email.php';
    require_once '_includes/function.redirect_to.php';
    require_once '_includes/function.printr.php';
    require_once '_includes/function.escape.php';
    require_once '_includes/functions.php';
    require_once '_includes/class.phpmailer.php';
    require_once '_includes/class.Postman.php';
    require_once '_includes/class.Textile.php';
    require_once '_includes/class.Sanitizer.php';
    require_once '_includes/class.Db.MySql.php';
    require_once '_includes/class.Job.php';
    require_once '_includes/class.JobRequest.php';
    require_once '_includes/class.Paginator.php';
    require_once '_includes/class.Feed.php';
    require_once '_includes/class.SpamReport.php';
    require_once '_includes/class.Api.php';
    require_once '_includes/class.JobApplication.php';
    require_once '_includes/class.SearchKeywords.php';
    require_once '_includes/smarty/libs/Smarty.class.php';

    // Setup database connection
    try 
    {
        $db = new Db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
        $db->Execute('SET CHARSET UTF8');
    }
    catch(ConnectException $exception) 
    {
        if (ENVIRONMENT == 'dev')
        {
            echo "Database Connection Error:<br />";
            printr($exception->getMessage());    
        }
    }
    
    // Setup Smarty
    $smarty = new Smarty();
    $smarty->template_dir = APP_PATH . '_templates/';
    $smarty->compile_dir = APP_PATH . '_templates/_cache/';
    
    
    // Create Textile object
    $textile = new Textile;
    
    // Split URL - get parameters
    $_app_info['params'] = array();
    $_url = str_replace(_APP_MAIN_DIR, '', $_SERVER['REQUEST_URI']);
    $_tmp = explode('?', $_url);
    $_url = $_tmp[0];
    if ($_url = explode('/', $_url))
    {
        foreach ($_url as $tag)
        {
            if ($tag)
            {
                $_app_info['params'][] = $tag;
            }
        }
    }
?>

Tokyoj

Re: Godaddy config problem

Keskese,
Thank you. I'm sure others will benefit from your work.
I moved the thread to the Tutorials section.

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

keskese

Re: Godaddy config problem

this is not a tutorial !!!!

this is a question regarding my coding !!!
'couse as you well know jobber and godaddy DO NOT GET ALONG

just tell me please is there something wrong with this code?
LAdy from godaddy says there is nothing wrong with server only coding is wrong...
i hope will will help then...

THIS IS NOT TUTORIAL !!!

evertsemeijn

Re: Godaddy config problem

I thought it was a tutorial too, because it's posted in the tutorial section and because there is no question in the first post. Hm, might need to move it Tokyoj.

Member of Jobberbase Development Team - Templates/Usability :: Looking for installation and/or custom design? :: Beautiful Wordpress themes

benobo

Re: Godaddy config problem

Are you shure "minenamehost" shouldn't be simply localhost? I've never been using GoDaddy, but as many host proceed like this, it should be the case here too... Good luck!