talen-script-ip-en-mysql
Gesponsorde koppelingen
PHP script bestanden
Code (php)
1
2
3
4
5
2
3
4
5
<?php
//nl.lang.php
$message = array();
$message['select_lang'] = "Select Your Language Please<br />";
?>
//nl.lang.php
$message = array();
$message['select_lang'] = "Select Your Language Please<br />";
?>
Code (php)
1
2
3
4
5
2
3
4
5
<?php
//eng.lang.php
$message = array();
$message['select_lang'] = "Taal selecteren<br />";
?>
//eng.lang.php
$message = array();
$message['select_lang'] = "Taal selecteren<br />";
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//taalscript.php
<?php
/*
CREATE TABLE `taal` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`ip` VARCHAR( 100 ) NOT NULL,
`lang` VARCHAR( 100 ) NOT NULL,
unique(ip)
) ENGINE = MYISAM ;
*/
$config['db'] = "";
$config['user'] = "";
$config['pw'] = "";
$config['host'] = "localhost";
if(mysql_connect ($config['host'], $config['user'], $config['pw']) && mysql_select_db ($config['db'])){
echo 'Database fout?';
exit;
}
$select_language = "SELECT `lang` FROM `taal` WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."'";
$query_language = mysql_query($select_language) OR DIE (mysql_error());
if(mysql_num_rows($query_language) == 0){
include('eng.lang.php');
$row = 0;
}
else{
$row_language = mysql_fetch_assoc($query_language);
if(file_exists($row_language['lang'] .'.lang.php')){
include($row_language['lang'] .'.lang.php');
}
else{
include('eng.lang.php');
}
$row = 1;
}
if(isset($_GET['lang'])){
$_GET['lang'] = mysql_real_escape_string($_GET['lang']);
if($row == 1){
$query_insert_lang = mysql_query("UPDATE `taal` SET `lang` = '". $_GET['lang'] ."' WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."'") OR DIE (mysql_error());
}
else{
$query_insert_lang = mysql_query("INSERT into `taal` SET `lang` = '". $_GET['lang'] ."', `ip` = '". $_SERVER['REMOTE_ADDR'] ."'") OR DIE (mysql_error());
}
if(file_exists($_GET['lang'] .'.lang.php')){
include($_GET['lang'] .'.lang.php');
}
else{
include('eng.lang.php');
}
}
?>
<?php
/*
CREATE TABLE `taal` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`ip` VARCHAR( 100 ) NOT NULL,
`lang` VARCHAR( 100 ) NOT NULL,
unique(ip)
) ENGINE = MYISAM ;
*/
$config['db'] = "";
$config['user'] = "";
$config['pw'] = "";
$config['host'] = "localhost";
if(mysql_connect ($config['host'], $config['user'], $config['pw']) && mysql_select_db ($config['db'])){
echo 'Database fout?';
exit;
}
$select_language = "SELECT `lang` FROM `taal` WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."'";
$query_language = mysql_query($select_language) OR DIE (mysql_error());
if(mysql_num_rows($query_language) == 0){
include('eng.lang.php');
$row = 0;
}
else{
$row_language = mysql_fetch_assoc($query_language);
if(file_exists($row_language['lang'] .'.lang.php')){
include($row_language['lang'] .'.lang.php');
}
else{
include('eng.lang.php');
}
$row = 1;
}
if(isset($_GET['lang'])){
$_GET['lang'] = mysql_real_escape_string($_GET['lang']);
if($row == 1){
$query_insert_lang = mysql_query("UPDATE `taal` SET `lang` = '". $_GET['lang'] ."' WHERE `ip` = '". $_SERVER['REMOTE_ADDR'] ."'") OR DIE (mysql_error());
}
else{
$query_insert_lang = mysql_query("INSERT into `taal` SET `lang` = '". $_GET['lang'] ."', `ip` = '". $_SERVER['REMOTE_ADDR'] ."'") OR DIE (mysql_error());
}
if(file_exists($_GET['lang'] .'.lang.php')){
include($_GET['lang'] .'.lang.php');
}
else{
include('eng.lang.php');
}
}
?>