<?php
global $db;
global $amp_conf;

$sql = "CREATE TABLE IF NOT EXISTS smsender (
	id int NOT NULL default 0,
	msg varchar(255) NOT NULL default '',
	flag tinyint(1) NOT NULL default 0,
	PRIMARY KEY (id)
)";
$check = $db->query($sql);
if(DB::IsError($check)) {
	die_freepbx("Can not create smsender table");
}

$sql2 = "CREATE TABLE IF NOT EXISTS smsender_messages(
	id int primary key auto_increment,
	port varchar(10) not null default '',
	phone int not null default 0,
	message text(1000) not null default '',
	sendtime varchar(50)  not null default '',
	status varchar(10) not null default ''
)";

$check2 = $db->query($sql2);
if(DB::IsError($check2)) {
	die_freepbx("Can not create smsender_messages table");
}

$sql3 = "CREATE TABLE IF NOT EXISTS smsender_user(
    id int not null default 0,
    username varchar(16) not null default '',
    password  varchar(16) not null default '',
    board varchar(4) not null default '',
    port   varchar(200) not null default '',
    ip_addr char(15) not null default '',
    PRIMARY KEY (id)
)
";

$check3 = $db->query($sql3);
if(DB::IsError($check3)) {
    die_freepbx("Can not create smsender_user table");
}
?>
