本文整理汇总了PHP中dbDisconnect函数的典型用法代码示例。如果您正苦于以下问题:PHP dbDisconnect函数的具体用法?PHP dbDisconnect怎么用?PHP dbDisconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbDisconnect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeQuery
function executeQuery($query)
{
// call the dbConnect function
$conn = dbConnect();
try {
// execute query and assign results to a PDOStatement object
$stmt = $conn->query($query);
do {
if ($stmt->columnCount() > 0) {
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
//retreive the rows as an associative array
}
} while ($stmt->nextRowset());
// if multiple queries are executed, repeat the process for each set of results
//Uncomment these 4 lines to display $results
// echo '<pre style="font-size:large">';
// print_r($results);
// echo '</pre>';
// die;
//call dbDisconnect() method to close the connection
dbDisconnect($conn);
return $results;
} catch (PDOException $e) {
//if execution fails
dbDisconnect($conn);
die('Query failed: ' . $e->getMessage());
}
}
示例2: getListOfBuyClicks
function getListOfBuyClicks($dt)
{
global $mycatid;
$str = "";
$lnk = dbConnect('localhost', 'root', 'lyntik');
$query = "SELECT b.fdate as fdate,b.ip as cip,b.goodid as gid,b.name as sname,b.source as src,b.price as price FROM buylog b WHERE b.date='{$dt}' AND b.mycat_id={$mycatid} ORDER BY b.ip,b.fdate";
$res = exec_query($query);
$ip = "0.0.0.0";
$i = 0;
$str .= "<div class=\"all_clicks\">";
$str .= "<div class=\"click_row_title\">\n <div class=\"left click_date title\">Дата</div>\n <div class=\"left click_id title\">ID товара</div>\n <div class=\"left click_name title\">Наименование</div>\n <div class=\"left click_id title\">Цена</div>\n <div class=\"left click_name title\">Источник</div>\n " . closeFloat() . "\n </div>";
if (mysql_num_rows($res) == 0) {
$str .= "<div>За выбранную дату нажатий не было</div>";
} else {
while ($rows = fetch_array($res)) {
if ($ip != $rows['cip']) {
$ip = $rows['cip'];
if ($i != 0) {
$str .= "</div>";
}
$str .= "<div class=\"ipclicks\">";
$str .= "<div class=\"client_ip\">Клики с адреса:<b>" . $rows['cip'] . "</b></div>";
}
$str .= "<div class=\"click_row\">\n <div class=\"left click_date\">" . $rows['fdate'] . "</div>\n <div class=\"left click_id\">" . $rows['gid'] . "</div>\n <div class=\"left click_name\">" . $rows['sname'] . "</div>\n <div class=\"left click_id\">" . $rows['price'] . "</div>\n <div class=\"left click_name\">" . $rows['src'] . "</div>\n " . closeFloat() . "\n </div>";
}
$str .= "</div>";
}
$str .= "</div></div>";
mysql_free_result($res);
dbDisconnect($lnk);
return $str;
}
示例3: addContact
function addContact()
{
$conn = dbConnect();
$name = '';
$email = '';
$mobile = '';
$position = '';
if (isset($_POST['name'])) {
$name = $conn->real_escape_string($_POST['name']);
}
if (isset($_POST['email'])) {
$email = $conn->real_escape_string($_POST['email']);
}
if (isset($_POST['mobile'])) {
$mobile = $conn->real_escape_string($_POST['mobile']);
}
if (isset($_POST['position'])) {
$position = $conn->real_escape_string($_POST['position']);
}
$sql = "INSERT into contactus(name,position,email,mobile) VALUES('{$name}','{$position}','{$email}','{$mobile}')";
$result = $conn->query($sql);
dbDisconnect($conn);
if ($result) {
header("location:../contact.php");
} else {
echo "Some error occured..:(";
}
}
示例4: addTeamMember
function addTeamMember()
{
$conn = dbConnect();
$filePath = '';
$name = '';
$category = '';
$title = '';
$long_desc = '';
$short_desc = '';
$fb_link = '';
$l_link = '';
if (isset($_POST['name'])) {
$name = $conn->real_escape_string($_POST['name']);
}
if (isset($_POST['category'])) {
$category = $conn->real_escape_string($_POST['category']);
}
if (isset($_POST['title'])) {
$title = $conn->real_escape_string($_POST['title']);
}
if (isset($_POST['long_desc'])) {
$long_desc = $conn->real_escape_string($_POST['long_desc']);
}
if (isset($_POST['short_desc'])) {
$short_desc = $conn->real_escape_string($_POST['short_desc']);
}
if (isset($_POST['fb_link'])) {
$fb_link = $_POST['fb_link'];
}
if (isset($_POST['l_link'])) {
$l_link = $_POST['l_link'];
}
if (isset($_FILES['file'])) {
$target_dir = "../uploads/team/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
$filePath = 'uploads/team/' . $_FILES["file"]["name"];
}
}
$description = array('long_desc' => $long_desc, 'short_desc' => $short_desc);
$description = json_encode($description);
$links = array('fb_link' => $fb_link, 'l_link' => $l_link);
$links = json_encode($links);
$sql = "INSERT INTO team (name,category,title,description,links,img) VALUES ('" . $name . "','" . $category . "','" . $title . "','" . $description . "','" . $links . "','" . $filePath . "')";
echo $sql;
$result = $conn->query($sql);
dbDisconnect($conn);
if ($result) {
header("location:../team.php");
} else {
echo "Some error occured..:(";
}
}
示例5: doLogin
function doLogin($username, $password)
{
$conn = dbConnect();
$username = $conn->real_escape_string($username);
$password = $conn->real_escape_string($password);
$sql = "SELECT id,societyName,username,isSuperAdmin FROM society WHERE username='" . $username . "' AND password='" . $password . "' LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$_SESSION['user'] = $result->fetch_assoc();
$_SESSION['loggedIn'] = true;
return 1;
}
dbDisconnect($conn);
return 0;
}
示例6: errorHandler
function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL)
{
global $user;
if (!ONLINEDEBUG || !checkUserHasPerm('View Debug Information')) {
cleanSemaphore();
dbDisconnect();
printHTMLFooter();
exit;
}
print "Error encountered<br>\n";
switch ($errno) {
case E_USER_ERROR:
echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n";
echo " Fatal error in line {$errline} of file {$errfile}";
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
echo "Aborting...<br />\n";
cleanSemaphore();
dbDisconnect();
exit(1);
break;
case E_USER_WARNING:
echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n";
break;
case E_USER_NOTICE:
echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
break;
default:
echo "Unkown error type: [{$errno}] {$errstr}<br />\n";
break;
}
if (!empty($errfile) && !empty($errline)) {
print "Error at {$errline} in {$errfile}<br>\n";
}
if (!empty($errcontext)) {
print "<pre>\n";
print_r($errcontext);
print "</pre>\n";
}
print "<br><br><br>\n";
print "<pre>\n";
print getBacktraceString();
print "</pre>\n";
cleanSemaphore();
dbDisconnect();
printHTMLFooter();
exit;
}
示例7: errorHandler
function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL)
{
global $user;
if ($user["adminlevel"] != "developer") {
dbDisconnect();
printHTMLFooter();
semUnlock();
exit;
}
print "Error encountered<br>\n";
switch ($errno) {
case E_USER_ERROR:
echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n";
echo " Fatal error in line {$errline} of file {$errfile}";
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
echo "Aborting...<br />\n";
semUnlock();
exit(1);
break;
case E_USER_WARNING:
echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n";
break;
case E_USER_NOTICE:
echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
break;
default:
echo "Unkown error type: [{$errno}] {$errstr}<br />\n";
break;
}
if (!empty($errfile) && !empty($errline)) {
print "Error at {$errline} in {$errfile}<br>\n";
}
if (!empty($errcontext)) {
print "<pre>\n";
print_r($errcontext);
print "</pre>\n";
}
print "<br><br><br>\n";
print "<pre>\n";
print getBacktraceString();
print "</pre>\n";
dbDisconnect();
printHTMLFooter();
semUnlock();
exit;
}
示例8: addSociety
function addSociety()
{
$conn = dbConnect();
$society_name = '';
$society_username = '';
$password = '';
if (isset($_POST['society_name'])) {
$society_name = $conn->real_escape_string($_POST['society_name']);
}
if (isset($_POST['society_username'])) {
$society_username = $conn->real_escape_string($_POST['society_username']);
}
if (isset($_POST['password'])) {
$password = $conn->real_escape_string($_POST['password']);
}
$sql = "INSERT into society(societyName,username,password) VALUES('{$society_name}','{$society_username}','{$password}')";
$result = $conn->query($sql);
dbDisconnect($conn);
if ($result) {
header("location:../societies.php");
} else {
echo "Some error occured..:(";
}
}
示例9: executeProcedure
function executeProcedure($query)
{
// call the dbConnect function
$conn = dbConnect();
try {
// execute query and assign results to a PDOStatement object
$stmt = $conn->query("EXEC" . $query);
$result = $stmt->execute();
//Uncomment these 4 lines to display $results
// echo '<pre style="font-size:large">';
// echo 'Result=';
// print_r($result);
// echo '</pre>';
// die;
//call dbDisconnect() method to close the connection
dbDisconnect($conn);
return $result;
} catch (PDOException $e) {
//if execution fails
dbDisconnect($conn);
throw new Exception($e->getMessage(), $e->getCode(), $e);
// die ('Query failed: ' . $e->getMessage());
}
}
示例10: updateWinner
function updateWinner()
{
$conn = dbConnect();
$event_name = '';
$winner1 = '';
$winner2 = '';
if (isset($_POST['event_name'])) {
$event_name = $conn->real_escape_string($_POST['event_name']);
}
if (isset($_POST['winner1'])) {
$winner1 = $conn->real_escape_string($_POST['winner1']);
}
if (isset($_POST['winner2'])) {
$winner2 = $conn->real_escape_string($_POST['winner2']);
}
$sql = "UPDATE events SET `winner1`='{$winner1}', `winner2`='{$winner2}' WHERE `name`='{$event_name}'";
$result = $conn->query($sql);
dbDisconnect($conn);
if ($result) {
header("location:../winners.php");
} else {
echo "Some error occured..:(";
}
}
示例11: submitCreateImage
//.........这里部分代码省略.........
print "This is a cluster environment. At least one image in the ";
print "cluster has more than one revision available. Please select ";
print "the revision you desire for each image listed below:<br>\n";
} else {
print "There are multiple revisions of this environment available. Please ";
print "select the revision you would like to check out:<br>\n";
}
print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post><br>\n";
if (!array_key_exists('subimages', $images[$data['imageid']])) {
$images[$data['imageid']]['subimages'] = array();
}
array_unshift($images[$data['imageid']]['subimages'], $data['imageid']);
foreach ($images[$data['imageid']]['subimages'] as $subimage) {
print "{$images[$subimage]['prettyname']}:<br>\n";
print "<table summary=\"lists revisions of the selected environment, one must be selected to continue\">\n";
print " <TR>\n";
print " <TD></TD>\n";
print " <TH>Revision</TH>\n";
print " <TH>Creator</TH>\n";
print " <TH>Created</TH>\n";
print " <TH>Currently in Production</TH>\n";
print " </TR>\n";
foreach ($images[$subimage]['imagerevision'] as $revision) {
print " <TR>\n";
if (array_key_exists($subimage, $data['revisionid']) && $data['revisionid'][$subimage] == $revision['id']) {
print " <TD align=center><INPUT type=radio name=revisionid[{$subimage}] value={$revision['id']} checked></TD>\n";
} elseif ($revision['production']) {
print " <TD align=center><INPUT type=radio name=revisionid[{$subimage}] value={$revision['id']} checked></TD>\n";
} else {
print " <TD align=center><INPUT type=radio name=revisionid[{$subimage}] value={$revision['id']}></TD>\n";
}
print " <TD align=center>{$revision['revision']}</TD>\n";
print " <TD align=center>{$revision['user']}</TD>\n";
print " <TD align=center>{$revision['prettydate']}</TD>\n";
if ($revision['production']) {
print " <TD align=center>Yes</TD>\n";
} else {
print " <TD align=center>No</TD>\n";
}
print " </TR>\n";
}
print "</TABLE>\n";
}
addContinuationsEntry('submitCreateImage', array(), SECINDAY, 1, 0);
// we add this continuation back
// so the currently displayed
// page can be reloaded
$cont = addContinuationsEntry('submitCreateTestProd', $data);
print "<br><INPUT type=hidden name=continuation value=\"{$cont}\">\n";
print "<INPUT type=submit value=Submit>\n";
print "</FORM>\n";
return;
}
$rc = isAvailable($images, $data["imageid"], $start, $end, $data["os"], 0, 0, 0, 1);
if ($rc == -1) {
$printedHTMLheader = 1;
print $HTMLheader;
print "<H2>Create / Update an Image</H2>\n";
print "You have requested an environment that is limited in the number ";
print "of concurrent reservations that can be made. No further ";
print "reservations for the environment can be made for the time you ";
print "have selected. Please select another time to use the ";
print "environment.<br>";
} elseif ($rc > 0) {
$requestid = addRequest(1, $data['revisionid']);
if ($data["time"] == "now") {
header("Location: " . BASEURL . SCRIPT . "?mode=viewRequests");
dbDisconnect();
exit;
} else {
$time = prettyLength($data["length"]);
if ($data["minute"] == 0) {
$data["minute"] = "00";
}
$printedHTMLheader = 1;
print $HTMLheader;
print "<H2>Create / Update an Image</H2>\n";
print "Your request to use <b>" . $images[$data["imageid"]]["prettyname"];
print "</b> on " . prettyDatetime($start) . " for {$time} has been ";
print "accepted.<br><br>\n";
print "When your reservation time has been reached, the ";
print "<b>Current Reservations</b> page will give you more ";
print "information on connecting to the reserved computer. If you ";
print "would like to modify your reservation, you can do that from ";
print "the <b>Current Reservations</b> page as well.<br>\n";
}
} else {
$printedHTMLheader = 1;
print $HTMLheader;
$cdata = array('imageid' => $data['imageid'], 'length' => $data['length']);
$cont = addContinuationsEntry('selectTimeTable', $cdata);
print "<H2>Create / Update an Image</H2>\n";
print "The reservation you have requested is not available. You may ";
print "<a href=\"" . BASEURL . SCRIPT . "?continuation={$cont}\">";
print "view a timetable</a> of free and reserved times to find ";
print "a time that will work for you.<br>\n";
#addLogEntry($nowfuture, unixToDatetime($start),
# unixToDatetime($end), 0, $data["imageid"]);
}
}
示例12: viewRequests
//.........这里部分代码省略.........
$text .= " <TH>Comp ID</TH>\n";
$text .= " <TH>IP address</TH>\n";
$text .= " <TH>Current State</TH>\n";
$text .= " <TH>Last State</TH>\n";
$text .= " <TH>Computer State</TH>\n";
}
$text .= " </TR>\n";
$text .= $imaging;
$text .= "</table>\n";
}
if (!empty($long)) {
if (!empty($normal) || !empty($imaging)) {
$text .= "<hr>\n";
}
$text .= "You currently have the following <strong>long term</strong> reservations:<br>\n";
$text .= "<table id=\"longreslisttable\" summary=\"lists long term reservations you currently have\" cellpadding=5>\n";
$text .= " <TR>\n";
$text .= " <TD colspan=3></TD>\n";
$text .= " <TH>Environment</TH>\n";
$text .= " <TH>Starting</TH>\n";
$text .= " <TH>Ending</TH>\n";
$text .= " <TH>Initially requested</TH>\n";
$computers = getComputers();
if ($viewmode == ADMIN_DEVELOPER) {
$text .= " <TH>Req ID</TH>\n";
$text .= " <TH>Comp ID</TH>\n";
$text .= " <TH>IP address</TH>\n";
$text .= " <TH>Current State</TH>\n";
$text .= " <TH>Last State</TH>\n";
$text .= " <TH>Computer State</TH>\n";
}
$text .= " </TR>\n";
$text .= $long;
$text .= "</table>\n";
}
# connect div
if ($connect) {
$text .= "<br><br>Click the <strong>";
$text .= "Connect!</strong> button to get further ";
$text .= "information about connecting to the reserved system. You must ";
$text .= "click the button from a web browser running on the same computer ";
$text .= "from which you will be connecting to the remote computer; ";
$text .= "otherwise, you may be denied access to the machine.\n";
}
if ($refresh) {
$text .= "<br><br>This page will automatically update ";
$text .= "every 20 seconds until the <font color=red><i>Pending...</i>";
#$text .= "</font> reservation is ready.<br></div>\n";
$text .= "</font> reservation is ready.\n";
$cont = addContinuationsEntry('AJviewRequests', $cdata, SECINDAY);
$text .= "<INPUT type=hidden id=resRefreshCont value=\"{$cont}\">\n";
}
if ($failed) {
$text .= "<br><br>An error has occurred that has kept one of your reservations ";
$text .= "from being processed. We apologize for any inconvenience ";
$text .= "this may have caused.\n";
if (!$refresh) {
$cont = addContinuationsEntry('AJviewRequests', $cdata, SECINDAY);
$text .= "<INPUT type=hidden id=resRefreshCont value=\"{$cont}\">\n";
}
}
if (empty($normal) && empty($imaging) && empty($long)) {
$text .= "You have no current reservations.<br>\n";
}
$text .= "</div>\n";
if ($mode != 'AJviewRequests') {
if ($refresh || $failed) {
$text .= "<div dojoType=FloatingPane\n";
$text .= " id=resStatusPane\n";
$text .= " constrainToContainer=false\n";
$text .= " hasShadow=true\n";
$text .= " resizable=true\n";
$text .= " windowState=minimized\n";
$text .= " displayMinimizeAction=true\n";
$text .= " style=\"width: 350px; height: 280px; position: absolute; left: 130; top: 0px;\"\n";
$text .= ">\n";
$text .= "<div id=resStatusText></div>\n";
$text .= "<input type=hidden id=detailreqid value=0>\n";
$text .= "</div>\n";
$text .= "<script type=\"text/javascript\">\n";
$text .= "dojo.addOnLoad(showScriptOnly);\n";
$text .= "dojo.byId('resStatusPane').title = \"Detailed Reservation Status\";\n";
$text .= "</script>\n";
}
print $text;
} else {
$text = str_replace("\n", ' ', $text);
if ($refresh) {
print "refresh_timer = setTimeout(resRefresh, 20000);\n";
}
print setAttribute('subcontent', 'innerHTML', $text);
print "AJdojoCreate('subcontent');";
if ($incPaneDetails) {
$text = detailStatusHTML($refreqid);
print setAttribute('resStatusText', 'innerHTML', $text);
}
dbDisconnect();
exit;
}
}
示例13: sendHeaders
function sendHeaders()
{
global $mode, $user, $authed, $oldmode, $viewmode, $actionFunction, $skin;
global $shibauthed;
$setwrapreferer = processInputVar('am', ARG_NUMERIC, 0);
if (!$authed && $mode == "auth") {
header("Location: " . BASEURL . SCRIPT . "?mode=selectauth");
dbDisconnect();
exit;
}
switch ($mode) {
case 'logout':
if ($shibauthed) {
$shibdata = getShibauthData($shibauthed);
if (array_key_exists('Shib-logouturl', $shibdata) && !empty($shibdata['Shib-logouturl'])) {
dbDisconnect();
header("Location: {$shibdata['Shib-logouturl']}");
exit;
}
}
case 'shiblogout':
setcookie("ITECSAUTH", "", time() - 10, "/", COOKIEDOMAIN);
setcookie("VCLAUTH", "", time() - 10, "/", COOKIEDOMAIN);
if ($shibauthed) {
$msg = '';
$shibdata = getShibauthData($shibauthed);
# find and clear shib cookies
/*foreach(array_keys($_COOKIE) as $key) {
if(preg_match('/^_shibsession[_0-9a-fA-F]+$/', $key))
setcookie($key, "", time() - 10, "/", $_SERVER['SERVER_NAME']);
elseif(preg_match('/^_shibstate_/', $key))
setcookie($key, "", time() - 10, "/", $_SERVER['SERVER_NAME']);
}*/
doQuery("DELETE FROM shibauth WHERE id = {$shibauthed}", 101);
stopSession();
dbDisconnect();
if (array_key_exists('Shib-logouturl', $shibdata) && !empty($shibdata['Shib-logouturl'])) {
print "<html>\n";
print " <head>\n";
print " <style type=\"text/css\">\n";
print " .red {\n";
print " color: red;\n";
print " }\n";
print " body{\n";
print " margin:0px; color: red;\n";
print " }\n";
print " </style>\n";
print " </head>\n";
print " <body>\n";
print " <span class=red>Done.</span> <a target=\"_top\" href=\"" . BASEURL . "/\">Return to VCL</a>\n";
print " </body>\n";
print "</html>\n";
} else {
print "<html>\n";
print "<head>\n";
print "<META HTTP-EQUIV=REFRESH CONTENT=\"5;url=" . BASEURL . "\">\n";
print "<style type=\"text/css\">\n";
print " .hidden {\n";
print " display: none;\n";
print " }\n";
print "</style>\n";
print "</head>\n";
print "<body>\n";
print "Logging out of VCL...";
print "<iframe src=\"http://{$_SERVER['SERVER_NAME']}/Shibboleth.sso/Logout\" class=hidden>\n";
print "</iframe>\n";
if (array_key_exists('Shib-Identity-Provider', $shibdata) && !empty($shibdata['Shib-Identity-Provider'])) {
$tmp = explode('/', $shibdata['Shib-Identity-Provider']);
$idp = "{$tmp[0]}//{$tmp[2]}";
print "<iframe src=\"{$idp}/idp/logout.jsp\" class=hidden>\n";
print "</iframe>\n";
}
print "</body>\n";
print "</html>\n";
}
exit;
}
header("Location: " . HOMEURL);
stopSession();
dbDisconnect();
exit;
}
if ($mode == "submitviewmode") {
$expire = time() + 31536000;
//expire in 1 year
$newviewmode = processInputVar("viewmode", ARG_NUMERIC);
if (!empty($newviewmode) && $newviewmode <= $user['adminlevelid']) {
setcookie("VCLVIEWMODE", $newviewmode, $expire, "/", COOKIEDOMAIN);
}
stopSession();
header("Location: " . BASEURL . SCRIPT);
dbDisconnect();
exit;
}
if ($mode == "statgraphday" || $mode == "statgraphdayconcuruser" || $mode == "statgraphdayconcurblade" || $mode == "statgraphhour") {
$actionFunction();
dbDisconnect();
exit;
}
if ($mode == "viewNodes") {
//.........这里部分代码省略.........
示例14: dbDisconnect
<td><?php
echo $row['username'];
?>
</td>
<td><?php
echo $row['password'];
?>
</td>
<td><a class='deleteSociety' href="scripts/delete.php?id=<?php
echo $row['id'];
?>
&type=society">Delete</a></td>
</tr>
<?php
}
dbDisconnect($conn);
?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Add Society
</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
示例15: create
public function create()
{
if (isset($_SESSION['TournamentId'])) {
if (isset($_POST) && sizeof($_POST) == 9) {
foreach ($_POST as $key => $value) {
echo $key, " => ", $value, "<br />";
switch ($key) {
case "name":
$this->name = htmlentities($_POST['name'], ENT_QUOTES);
break;
case "round":
$this->round = htmlentities($_POST['round'], ENT_QUOTES);
break;
case "teamcount":
$this->teamcount = htmlentities($_POST['teamcount'], ENT_QUOTES);
break;
case "link":
$this->link = htmlentities($_POST['link'], ENT_QUOTES);
break;
case "logopath":
$this->logopath = htmlentities($_POST['logopath'], ENT_QUOTES);
break;
case "begin":
if (!empty($_POST['begin'])) {
$this->begin = htmlentities($_POST['begin'], ENT_QUOTES);
} else {
$this->begin = date('Y-m-d H:i:s', time());
}
break;
case "end":
if (isset($_POST['end']) && !empty($_POST['end'])) {
$this->end = htmlentities($_POST['end'], ENT_QUOTES);
} else {
$this->withoutend = true;
}
break;
case "bestOfOption":
$this->bestOfOption = htmlentities($_POST['bestOfOption'], ENT_QUOTES);
break;
case "newGroup":
break;
default:
$this->start = false;
}
}
} else {
$this->start = false;
}
if ($this->start) {
$this->dbConnect();
$table = "ftm_group";
if ($this->withoutend) {
$values = array($this->name, $this->teamcount, $this->link, $this->logopath, $this->begin, $this->bestOfOption);
$rows = "name,teamCount,link,logoPath,begin,bestOfOption";
} else {
$values = array($this->name, $this->teamcount, $this->link, $this->logopath, $this->begin, $this->end, $this->bestOfOption);
$rows = "name,teamCount,link,logoPath,begin,end,bestOfOption";
}
if ($this->db->insert($table, $values, $rows)) {
// Turnierdaten des neuen Turniers ermitteln (ID)
$rows = "*";
$table = "ftm.ftm_group";
$where = "ftm_group.begin='" . $this->begin . "'";
$order = "_ID DESC LIMIT 0,1";
$group = "";
$joins = "";
if ($this->db->select($table, $rows, $where, $order)) {
$this_result = $this->db->getResult();
$this->db->clear_results();
$this->id = $this_result['_Id'];
// Turnierdaten des neuen Turniers ermitteln (ID)
$table = "ftm_tournamentgroups";
$values = array($_SESSION['TournamentId'], $this->id, $this->round);
$rows = "tournamentId,groupId,round";
if ($this->db->insert($table, $values, $rows)) {
return true;
} else {
echo "Insert ftm_tournamentgroups Error";
return false;
}
} else {
echo "Select Group Error";
return false;
}
} else {
echo "Insert Group Error";
return false;
}
dbDisconnect();
} else {
echo "No Post";
return false;
}
}
}