/users/patterns/www2_Hacked_x/counter/create.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
<?php

//############################################################################
//##### run this file to create the tables needed for the counter to work #### 
//############################################################################

 
include ('counter_config.php');


$link mysql_connect("$localhost""$dbuser""$dbpass");
if (!
$link
{
    die(
'Could not connect: ' mysql_error());
}

echo 
"- Connected to database at $localhost successfully <br />";

$db_selected mysql_select_db($dbname$link);
if (!
$db_selected
{
    die (
"Can't use database $dbname! : " mysql_error());
}

echo 
"- Using database $dbname <br />" ;


$create1 mysql_query("CREATE TABLE IF NOT EXISTS $dbtableinfo(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), ip_address VARCHAR(30), user_agent VARCHAR(50), datetime VARCHAR(25))");
if (!
$create1
{
    die(
"Could create table $dbtableinfo :" mysql_error());
}

echo 
"- Table $dbtableinfo created.<br />";

$create2 mysql_query("CREATE TABLE IF NOT EXISTS $dbtablehits(page char(100),PRIMARY KEY(page),count int(15))");
if (!
$create2
{
    die(
"Could create table $dbtablehits :" mysql_error());


echo 
"- Table $dbtablehits created<br/>";


mysql_close($link);

echo 
'- You are now ready to start using the statscounter.';

?>