Seite 2 von 2 Erste 12
  1. #11
    Kevin
    Gast

    Standard [H] Mysql mit Datenbank verbinden

    PHP-Code:
    <?php

      
    /* (c) 2011 diSturbia */

      
    function mysql_c($localhost$user1477249$PASSWORD$db1477249-main) {
        
    mysql_connect($localhost$user1477249$PASSWORD) or die(mysql_error());
        
    mysql_select_db($db) or die(mysql_error());
      }
      
      function 
    mysql_q($query) {
        
    $res mysql_query($query);
        if(!
    $res) { die(mysql_error()); }
        return 
    $res;
      }
      
      function 
    mysql_idc($table) {
        
    $r mysql_fetch_array(mysql_q('SELECT * FROM '.$table.' ORDER BY `id` DESC'));
        return 
    $r['id'] + 1;
      }
      
      
      function 
    crypt_ip($ip) {
        for(
    $i 0$i <= 15$i++) {
          
    $ip hash('adler32'hash('ripemd160'md5($ip))); }
        return 
    $ip;
      }
      
      
      function 
    page_c($table) {
        
    $c mysql_result(mysql_q('SELECT COUNT(*) FROM '.$table), 0);
        return (
    $c 20) + 1;
      }
      
      function 
    tool_i($tool) {
        
    $r mysql_fetch_array(mysql_q('SELECT * FROM `tool-icons` WHERE `name` = \''.mysql_real_escape_string($tool).'\''));
        return 
    htmlentities($r['pfad']);
      }
      
      function 
    geoIP($ip) {
        
    $gip geoip_open('inc/GeoIP.dat'GEOIP_STANDARD);
        
    $land geoip_country_code_by_addr($gip$ip);
        
    geoip_close($gip);
        return 
    strtolower($land);
      }

    ?>
    Danke. (YY)

  2. #12

    Registriert seit
    30.11.2011
    Beiträge
    61
    Thanked 0 Times in 0 Posts

    Standard [H] Mysql mit Datenbank verbinden

    Code:
    <?php
    
      /* (c) 2011 diSturbia */
    
      function mysql_c($host, $user, $pass, $db) {
        mysql_connect($host, $user, $pass) or die(mysql_error());
        mysql_select_db($db) or die(mysql_error());
      }
      
      function mysql_q($query) {
        $res = mysql_query($query);
        if(!$res) { die(mysql_error()); }
        return $res;
      }
      
      function mysql_idc($table) {
        $r = mysql_fetch_array(mysql_q('SELECT * FROM '.$table.' ORDER BY `id` DESC'));
        return $r['id'] + 1;
      }
      
      
      function crypt_ip($ip) {
        for($i = 0; $i <= 15; $i++) {
          $ip = hash('adler32', hash('ripemd160', md5($ip))); }
        return $ip;
      }
      
      
      function page_c($table) {
        $c = mysql_result(mysql_q('SELECT COUNT(*) FROM '.$table), 0);
        return ($c / 20) + 1;
      }
      
      function tool_i($tool) {
        $r = mysql_fetch_array(mysql_q('SELECT * FROM `tool-icons` WHERE `name` = \''.mysql_real_escape_string($tool).'\''));
        return htmlentities($r['pfad']);
      }
      
      function geoIP($ip) {
        $gip = geoip_open('inc/GeoIP.dat', GEOIP_STANDARD);
        $land = geoip_country_code_by_addr($gip, $ip);
        geoip_close($gip);
        return strtolower($land);
      }
    
    ?>

Seite 2 von 2 Erste 12

Ähnliche Themen

  1. Antworten: 1
    Letzter Beitrag: 08.09.2013, 18:40
  2. MySQL Datenbank Backup erstellen
    Von Snees im Forum PHP
    Antworten: 1
    Letzter Beitrag: 19.04.2013, 18:34
  3. PHP MYSQL Datenbank Klasse statisch
    Von Minecraft im Forum PHP
    Antworten: 1
    Letzter Beitrag: 11.01.2013, 09:58
  4. [MySQL] Größere Datenbank importieren?
    Von xTracZ im Forum Hosting
    Antworten: 20
    Letzter Beitrag: 13.02.2012, 23:18
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.