Advertisement
fsnoya

mysqli connection by default

May 14th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. //This connection script is mandatory because it is the one used throughout the system
  3. session_start();
  4. if($_SERVER["REMOTE_ADDR"] == "127.0.0.1" or $_SERVER["REMOTE_ADDR"] == "localhost"){
  5. $hostname='localhost';
  6. $username='root';
  7. $password='xxxxxx';
  8. $dbname='netalbal_pedralbesbooking';
  9. }
  10. else{
  11. $hostname='localhost';
  12. $username='netalbal_fsnoya';
  13. $password='xxxxxx';
  14. $dbname='netalbal_pedralbesbooking';
  15. }
  16. $link = mysqli_connect($hostname, $username, $password, $dbname);
  17. mysqli_query($link,"SET CHARACTER SET 'utf8'");
  18. mysqli_query($link,"SET SESSION collation_connection ='utf8_unicode_ci'");
  19. if (!$link) {
  20. die(mysqli_error());
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement