-
16.06.2011, 00:57 #11KevinGast
[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);
}
?>
-
16.06.2011, 00:58 #12
- Registriert seit
- 30.11.2011
- Beiträge
- 61
Thanked 0 Times in 0 Posts[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); } ?>
Ähnliche Themen
-
[MySQL | PHP] Etwas aus der Datenbank ausgeben?
Von ZarneXxX im Forum PHPAntworten: 1Letzter Beitrag: 08.09.2013, 18:40 -
MySQL Datenbank Backup erstellen
Von Snees im Forum PHPAntworten: 1Letzter Beitrag: 19.04.2013, 18:34 -
PHP MYSQL Datenbank Klasse statisch
Von Minecraft im Forum PHPAntworten: 1Letzter Beitrag: 11.01.2013, 09:58 -
[MySQL] Größere Datenbank importieren?
Von xTracZ im Forum HostingAntworten: 20Letzter Beitrag: 13.02.2012, 23:18
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.