Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- function doLogin()
- {
- //MySQL Connection Information
- $dbhost = "db2698.perfora.net";
- $dbuser = "dbo348993997";
- $dbpass = "jonsull";
- $dbname = "db348993997";
- //Initialize error variables
- $errUser = false;
- $errPass = false;
- //Encrypt user entered password
- $password = md5($_POST['password']);
- $username = $_POST['username'];
- $query = "SELECT * FROM users WHERE username='$username'";
- // Make SQL Connection
- mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
- mysql_select_db($dbname) or die(mysql_error());
- $result = mysql_query($query) or die(mysql_error());
- //Check for any returns - throw error if no user by that name exists
- if(mysql_num_rows($result)==0) $errUser = true;
- $user = mysql_fetch_array($result);
- //Check if the users passwords match
- if($user['password'] != $password) $errPass = true;
- //Check if any errors occurred, if so redraw from with error flags
- //If all information was correct allow login
- if($errUser || $errPass)
- {
- showForm($errUser, $errPass);
- }
- else
- {
- session_register("username");
- header("Location:/customer");
- }
- }
- function doLogout()
- {
- session_destroy();
- header('Location:/main');
- }
- ?>
- <!DOCTYPE HTML>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Kryptic Networks</title>
- <link rel="shortcut icon" href="favicon.ico">
- <link href="styles/reset.css" rel="stylesheet" type="text/css" />
- <link href="styles/main.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="toptail" class="toptail">
- <div id="info">
- <div id="time"><?php echo date('l, F d, Y g:i');?></div>
- <div id="email"><a href="mailto:support@krypticnetworks.com">support@krypticnetworks.com</a> | <?php if(!session_is_registered("username")) { echo '<a href="/login">Customer Login</a>'; } else { echo 'Welcome back,'.$_SESSION['username'].' | <a href="/logout">Logout</a>'; } ?></div>
- </div>
- <div id="nav">
- <ul>
- <li class="first"><a href="/">Main</a></li>
- <li><a href="/about">About Kryptic <img src="images/downarrow.png"></a>
- <ul>
- <li><a href="/history">History</a></li>
- <li><a href="/team">Our Team</a></li>
- <li><a href="/archive">News Archive</a></li>
- </ul>
- </li>
- <li><a href="/services">Services <img src="images/downarrow.png"></a>
- <ul>
- <li><a href="/infra">Infrastructure</a></li>
- <li><a href="/hardware">Hardware</a></li>
- <li><a href="/monitoring">Monitoring</a></li>
- <li><a href="/security">Security</a></li>
- <li><a href="/routing">Routing</a></li>
- <li><a href="/managed">Managed Services</a></li>
- </ul>
- </li>
- <li><a href="/solutions">Solutions</a></li>
- <li><a href="/support">Support</a></li>
- <li><a href="/contact">Contact us</a></li>
- </ul>
- </div>
- </div>
- <div id="misc" style="clear:left"><div id="logo"><img src="images/logo.png" width="262" height="73"></div>
- <div id="empty">
- </div>
- </div>
- <div id="middle" >
- <?php
- $pid=$_GET['pid'];
- if($pid=='' | $pid=='main') { include('main.php'); }
- else if($pid=='about') { include('about.php'); }
- else if($pid=='history') { include('history.php'); }
- else if($pid=='services') { include('services.php'); }
- else if($pid=='solutions') { include('solutions.php'); }
- else if($pid=='support') { include('support.php'); }
- else if($pid=='contact') { include('contact.php'); }
- else if($pid=='login') { include('login.php'); }
- else if($pid=='customer') { include('customer.php'); }
- else if($pid=='logout') { include('logout.php'); }
- else if($pid=='404') { include('404.php'); }
- else if($pid=='403') { include('403.php'); }
- else if($pid=='401') { include('401.php'); }
- else { include('404.php'); } ?></div>
- <div id="footer">
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement