ActaNonVerba1
Members-
Posts
66 -
Joined
-
Last visited
Never
Everything posted by ActaNonVerba1
-
neither of your things seem to work for me. Here are all the pages, can you look over them for me please? Page log in form: <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <article> <h1 class="Title">Log In To Admin</h1> <div class="Textbox"> <form id="adminlogin" action="Log-In-Accept-Deny.php" method="post"> <div style="float:left; width:100px;"> <p>Username</p> <p>Password</p> </div> <input type="text" name="username" style="margin-top:13px;"><br> <input type="password" name="password" style="margin-top:11px;"><br> <input type="submit" value="Log In"> </form> <br> </div> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> Heres the page you go to after the form page, which decides if you are allowed on or not <?php $username = $_POST['username']; $password = $_POST['password']; if ($username==Danny) { if($password==loyalhatter15) { $deniedallowed = "Welcome to the Admin Panel, Michael"; //////////////////////////////////////////////////////////// session_start(); $_SESSION['adminlogin'] = 1; // store session data //////////////////////////////////////////////////////////// } else {$deniedallowed = "Access Denied";} } else {$deniedallowed = "Access Denied";} ?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <?php if ($showlogoff=1) { echo '<div id="logout"> <div style="float:left; width:30%; text-align:left;!important"> <a href="Log-In-Accept-Deny.php">Back to Admin Home</a></p> </div> <div style="float:right; width:70%;"> <a href="Logout.php">Log Out of Admin</a> <p style="font-size:10px;">Always Sign Out when Finished!</p> </div></div>';} ?> <article> <?php echo '<h1 class="Title">'.$deniedallowed.'</h1>'; echo '<div class="Textbox">'; if ($deniedallowed == "Access Denied") { echo 'Username/Password combination is wrong. Please try again, or stop trying ot hack the system!'; } else { echo 'Welcome to the admin panel, what do you want to do?'; echo '<ul> <li><a href="Admin.php">See Newsletter Sign Ups</a></li> </ul>'; } if ($_SESSION['adminlogin'] == 1){ echo "Logged in on server side."; } echo '</div>'; ?> <br> </div> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> Heres the page i want people to only view after theyve logged in <?php if($_SESSION['adminlogin']=1) { $showlogoff=1; } else { header('Location: http://www.worldwidelighthouses.com/Newsletter/Admin/Log-In.php'); exit; if(!$_SESSION['adminlogin']) { die('not logged in');} }?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <?php if ($showlogoff=1) { echo '<div id="logout"> <div style="float:left; width:30%; text-align:left;!important"> <a href="Log-In-Accept-Deny.php">Back to Admin Home</a></p> </div> <div style="float:right; width:70%;"> <a href="Logout.php">Log Out of Admin</a> <p style="font-size:10px;">Always Sign Out when Finished!</p> </div></div>';} ?> <article> <h1 class="Title">Contact Admin Centre</h1> <div class="Textbox"> <?php $user="worldw44_php"; $password="c@rtmeldrive41"; $database="worldw44_newsemail"; mysql_connect(localhost,$user,$password); @mysql_select_db($database) or die( "Unable to select database, please try again later."); $query="SELECT * FROM contactinfo"; $result = mysql_query ($query) or die(mysql_error()); //Everything in MySQL Database $num=mysql_numrows($result); //Find number of rows of MySQL Database $i=0; //Number of times loop to show data has run, starts a 0 like MySQL database while ($i < $num) { $name=mysql_result($result,$i,"name"); //Loop takes data from name $email=mysql_result($result,$i,"email"); // and email echo "<b>$name</b><br>Email: $email<br><hr><br>"; $i++; //Adds to i to tell how many loops, and which row from MySQL to read from. } ?> <br> </div> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> And heres the log out page as of now... <?php session_start(); $_SESSION['adminlogin']; session_unset(); session_destroy(); ?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <article> <?php echo '<h1 class="Title">Successfully Logged Out</h1>'; ?> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> Any help?
-
I was under the impression $_SESSION = array(); would clear the array, thus helping to log the user out? And yes, i have fixed that now, ill see if that solves the problem
-
Hey guys im making a script which allows a user to log in. Then view some data from an SQL file, then click to a log out page and log out... However i cant seem to destroy the session. Any help? Heres logout.php <?php $_SESSION['adminlogin']; session_start(); $_SESSION = array(); session_destroy(); ?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <article> <?php echo '<h1 class="Title">Successfully Logged Out</h1>'; ?> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> If you need any of the other files, ask and ill provide. Thanks in advance. Danny
-
Cannot make header redirect work when session unavaliable.
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
How embarrassing, i just had some white-space before my <?php that i didn't consciously see. Thanks -
Hey guys, i always get the error: Warning: Cannot modify header information - headers already sent by (output started at /home/worldw44/public_html/Newsletter/Admin/Admin.php:1) in /home/worldw44/public_html/Newsletter/Admin/Admin.php on line 6 when im tyring to run: <?php if(isset($_SESSION['adminlogin'])) { $run=yes; } else { header( 'Location: http://www.worldwidelighthouses.com/Newsletter/Admin/Log-In.php'); }?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Mailing List Administration | Worldwide Lighthouses</title> </head> <body> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="../Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="../Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="../Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="../Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="../Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="../Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="../Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <article> <h1 class="Title">Contact Admin Centre</h1> <div class="Textbox"> <div id="Social"> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="WWlighthouses">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <object id="Facebook" data="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fworldwidelighthouses.com/&layout=button_count&show_faces=false&width=450&action=like&colorscheme=light&height=21"></object> </div> </div> </article> <footer> <ul> <li><a href="../About.php">About</a></li> <li><a href="../Contact-us.php">Contact</a></li> <li><a href="../Use-Our-Media.php">Use our media</a></li> <li><a href="../Search/search.php">Search</a></li> <li><a href="../Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> © Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> Cany anyone offer some suggestions as to why? Note i have no ability to change phpconfig.
-
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
How do i do a relative address then? I thought document_root was for a realtive address, seens as its not absolute like http://domain.com/file.extension ? -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
Yes i did mean E And my Server is Windows based I have no idea why i get 500 error either. Im instaling a local version of PHP so i cna check there. Im only learning PHP so im not fussed about a real production environment, just wanna be able to have done it right so i can progress past chapter 2 of "PHP and MySQL Web Development" Lol. Thanks a lot anyway Danny. Dammit, works perfectly on my Localhost, must be a config.php issue. And i cant edit that on fast hosts :/ -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
Yes i did mean E And my Server is Windows based I have no idea why i get 500 error either. Im instaling a local version of PHP so i cna check there. Im only learning PHP so im not fussed about a real production environment, just wanna be able to have done it right so i can progress past chapter 2 of "PHP and MySQL Web Development" Lol. Thanks a lot anyway Danny. -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
I get this. E:\Domains\w\worldwidelighthouses.co.uk\user\htdocs/orders/orders.txt Seems about right So why do i still get error 500? :S Oh wait my bad, that isnt in the DannysTestSite Folder So is Doicument root actually the root of my server? I thought it would be the folder my Writefile is in? :S Sorry to keep posting. Ive just put the orders.txt in the location d:\ domains etc that i echo'd out. And ive found it is posting to the orders.txt now as ive opened it and had a look. However, the user using the form still gets a 500 message when they subm it the form :/ -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
I get this. E:\Domains\w\worldwidelighthouses.co.uk\user\htdocs/orders/orders.txt Seems about right So why do i still get error 500? :S Oh wait my bad, that isnt in the DannysTestSite Folder So is Doicument root actually the root of my server? I thought it would be the folder my Writefile is in? :S -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
I get this. E:\Domains\w\worldwidelighthouses.co.uk\user\htdocs/orders/orders.txt Seems about right So why do i still get error 500? :S -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
Hmm, that is strange. My file i wish to edit is in Htdocs\DannysTestSite\Orders\Orders.txt My "writefile.php" is in Htdocs\Dannystestsite\Writefile.php So, does my code reflect that properly? :S Getting Majorly confused now. Thank you so much in advance for your help Much appreciated. Danny. -
Very new to PHP, Can someone tell me where ive gone wrong?
ActaNonVerba1 replied to ActaNonVerba1's topic in PHP Coding Help
Thanks for oyur help. But i still get a 500 error. You can the form etc here. http://www.worldwidelighthouses.co.uk/dannystestwebsite/Php.php I think there may be an issue with the output string, can you confirm this? Thanks, Danny. -
My code works perfectly at showing my customer what they have ordered, how much it is, including tax etc. However, when i try to write to a flat file (.txt.) I get 500 errors The issue may be with my output string or the writing to file, i dont know :/ Can someone help? Thanks, Danny. CODE: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=9"> <link rel="shortcut icon" href="favicon.png"/> <link href="Navigation.css" rel="stylesheet" type="text/css"> <link href="Buttons.css" rel="stylesheet" type="text/css"> <link href="CSS.css" rel="stylesheet" type="text/css"> <link href="Forms.css" rel="stylesheet" type="text/css"> <title>Welcome to Danny's Test Site - Dannys Test Site</title> <?php //Create Short Variable Names $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; $number = $_POST['number']; $street = $_POST['street']; $town = $_POST['town']; $county = $_POST['county']; $postcode = $_POST['postcode']; $country = $_POST['country']; $find = $_POST['find']; $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; ?> </head> <body> <div id="Logo"><img src="Logo.png" width="633" height="60" alt="Logo"></div> <div id="Navigation"> <ul id="nav"> <li><a href="Index.php">Home</a></li> <li class="current"><a href="Php.php">PHP</a> <ul> <li class="current"><a href="Php.php">Order Form</a></li> <li><a href="Freight.php">Freight Costs</a></li> <li><a href="View-Orders.php">View Orders</a></li> </ul> </li> <li><a href="MySQL.php">MySQL</a></li> <li><a href="HTML-5.php">HTML5</a></li> <li><a href="CSS.php">CSS3</a></li> <li><a href="Blog.php">Blog</a></li> <li><a href="Social-Networking.php">Social Networking</a></li> </ul> </div> <div id="Content"> <div id="style"> <h1> Freight Prices</h1> <h2>Your Order is Complete</h2> <div id="Results"> <?php //Time order made echo '<br />'; echo '<p>Order Processed at '; echo date('H:i jS F Y').'<p>'; //Order Contains echo '<hr />'; echo '<h3> Your order is as follows: </h3>'; echo $tireqty.' Tyres<br />'; echo $oilqty.' Litres of Oil<br />'; echo $sparkqty.' Spark Plugs<br />'; //Assign Values to Variables $totalqty= 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo 'Total number of items ordered: '.$totalqty.'<br />'; $totalamount = 0.00; //Set Price Of Each Product define ('TIREPRICE', 100); define ('OILPRICE', 10); define ('SPARKPRICE', 4); //Total Cost Pre Tax $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; $totalamount=number_format ($totalamount, 2, '.', ' '); echo '<br />'; echo '<hr />'; echo '<h3>Cost</h3>'; echo 'Price without VAT: £'.number_format($totalamount,2).'<br />'; //Tax Added $taxrate = 0.175; //VAT is 17.5% $totalamount = $totalamount * (1 + $taxrate); echo 'Total including VAT: £'.number_format($totalamount,2).'<br />'; //Remind user of Price echo '<hr />'; echo '<h3> Individual Product Prices </h3>'; echo 'Tyres cost £'; echo TIREPRICE; echo ' each <br />'; echo 'Oil costs £'; echo OILPRICE; echo ' Per Litre <br />'; echo 'Spark plugs cost £'; echo SPARKPRICE; echo' each'; //Redirect user if they failed to input data if( $totalqty == 0 ) { header("Location: http://worldwidelighthouses.co.uk/Dannystestwebsite/error.php"); exit;} //How customer found Dannys echo '<hr />'; echo '<h3> How you found us: </h3>'; switch ($find) {case 'a': echo '<p> You're a loyal and regular customer! Thanks for your repeat custom! </p>'; break; case 'b': echo '<p> You were reffered by our TV advert! Stay tuned for more. </p>'; break; case 'c': echo '<p> You found us by internet advertisments, thanks for the click through!'; break; case 'd': echo '<p> You found out about us from a previous satisfied customer! Tell them thanks from us!'; break; } echo '<br />'; //Dispatch Address echo '<hr />'; echo '<h3> We will dispatch your order to </h3>'; echo $number.' '; echo $street.'<br />'; echo $town.'<br />'; echo $county.'<br />'; echo $postcode.'<br />'; echo $country.'<br />'; echo '<br/>'; echo '<FORM METHOD="LINK" ACTION="php.php"><INPUT TYPE="submit" VALUE="Done! Click to Finish"></FORM><br />'; $outputstring = $date."\t".$tireqty." tires \t".$oilqty." oil \t".$sparkqty." Spark plugs\t"."They found us by".$find."\t"."Dispatch order to".$number.$street.$town.$county.$postcode.$country."\n"; //Open File for Appending @ $fp = fopen($_SERVER['DOCUMENT_ROOT']."/orders/orders.txt", 'ab'); if (!fp) { echo'<p><strong>Your Order Could Not Be Processed at This Time. Please Try Again Later</strong></html>'; exit; } fwrite($fp, $outputstring, strlen($outputstring)); fclose($fp); echo'<p>order written</p>'; ?> </div> </div> <div id="Footer">Copyright Danny Brown <?php echo date("Y"); ?></div> </body> </html>