Guest User

Untitled

a guest
Oct 30th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. config.php file
  2. <?php
  3. /*--Config--*/
  4. $db_name = "koncms";
  5. $db_user = "root";
  6. $db_pass = "dont look :O";
  7. $db_host = "localhost";
  8. //////////////////////////////
  9. define(DB_NAME, $db_name);
  10. define(DB_USER, $db_user);
  11. define(DB_PASS, $db_pass);
  12. define(DB_HOST, $db_host);
  13. //////////////////////////////
  14. ?>
  15. index.php file
  16. <html>
  17. <body>
  18. <?php
  19. include config.php;
  20. $con = mysql_connect(DB_HOST,DB_USER,DB_PASS);
  21. if (!$con)
  22.   {
  23.   die('Failed: ' . mysql_error());
  24.   }
  25. else
  26.   {
  27.   echo "connected";
  28.   }
  29. ?>
  30. </body>
  31. </html>
  32.  
  33. error:
  34. root@home-System-Product-Name:/var/www/cms# php index.php
  35. <html>
  36. <body>
  37. PHP Notice:  Use of undefined constant config - assumed 'config' in /var/www/cms/index.php on line 4
  38. PHP Notice:  Use of undefined constant php - assumed 'php' in /var/www/cms/index.php on line 4
  39. PHP Warning:  include(configphp): failed to open stream: No such file or directory in /var/www/cms/index.php on line 4
  40. PHP Warning:  include(): Failed opening 'configphp' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/cms/index.php on line 4
  41. PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/cms/index.php on line 5
Add Comment
Please, Sign In to add comment