Subversion Repositories Transart

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/index.php
0,0 → 1,197
<?
if (isset($_SESSION)) {
session_destroy();
}
?>
<?php require_once('Connections/Transart.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
 
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
 
if (isset($_POST['login'])) {
$loginUsername=$_POST['login'];
$password=md5($_POST['passwort']);
$MM_fldUserAuthorization = "benutzer_level";
$MM_redirectLoginSuccess = "main/index.php";
$MM_redirectLoginFailed = "main/error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Transart, $Transart);
$LoginRS__query=sprintf("SELECT benutzer_login, benutzer_passwort, benutzer_level FROM benutzer WHERE benutzer_login=%s AND benutzer_passwort=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $Transart) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'benutzer_level');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
 
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Transart Login</title>
<link href="stil.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="semantic/semantic.min.js"></script>
<link rel="stylesheet" type="text/css" href="semantic/semantic.min.css">
</head>
<body>
<?php
/////// Deklariere Globale SESSION VARIABLEN
$_SESSION['datumaktuell']=date("Y-m-d");
?>
<table class="ui celled orange striped table">
<tr>
<td valign="top"><table class="ui table">
<tr>
<td><p><img src="img/logo.png" width="206" height="41" /><a class="ui green circular label">V1.307.211</a></td>
<tr>
<td valign="top"><form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<table width="300" class="tabelle1">
<tr>
<td class="optionen">Login</td>
<td class="stil1"><label>
<input name="login" type="text" class="stil2" id="login" />
<script type="text/javascript">
document.form1.login.focus();
</script>
</label></td>
</tr>
<tr>
<td class="optionen">Passwort</td>
<td class="stil1"><label>
<input name="passwort" type="password" class="stil2" id="passwort" />
</label></td>
</tr>
<tr>
<td class="stil1">&nbsp;</td>
<td class="stil1"><label>
<input name="button" type="submit" class="stil2" id="button" value="Senden" />
</label></td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td>
<?php
$apiKey = "0ad385eea94cf2a775c48da2dfc726e9";
$cityId = "2761369";
$googleApiUrl = "http://api.openweathermap.org/data/2.5/weather?id=" . $cityId . "&lang=de&units=metric&APPID=" . $apiKey;
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $googleApiUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
 
curl_close($ch);
$data = json_decode($response);
$currentTime = time();
?>
<div class="report-container">
<h2><?php echo $data->name; ?> Wetter</h2>
<div class="time">
<div><?php echo date("l g:i a", $currentTime); ?></div>
<div><?php echo date("jS F, Y",$currentTime); ?></div>
<div><?php echo ucwords($data->weather[0]->description); ?></div>
</div>
<div class="weather-forecast">
<img
src="http://openweathermap.org/img/w/<?php echo $data->weather[0]->icon; ?>.png"
class="weather-icon" /> <?php echo $data->main->temp_max; ?>°C<span
class="min-temperature"><?php echo $data->main->temp_min; ?>°C</span>
</div>
<div class="time">
<div>Humidity: <?php echo $data->main->humidity; ?> %</div>
<div>Wind: <?php echo $data->wind->speed; ?> km/h</div>
</div>
</div>
 
</td>
</tr>
<tr>
<td class="stil3">
<table class="ui celled green striped table">
<?php
// Die Datei test.xml enthält ein XML-Dokument mit einem Wurzel-Element
// und mindestens einem Element /[root]/title.
 
if ($xml = simplexml_load_file('http://rss.orf.at/news.xml')) {
 
//print_r($xml);
foreach ($xml->item as $item) {
echo "<tr>";
echo "<td>".$item->title."</td>"; echo "<td><a href='".$item->link."' target='_blank'>LINK</a></td>"; echo '</tr>';
}
}
?>
</table>
</td>
 
</tr>
</table> </td>
</tr>
</table>
 
</body>
</html>