aebstract Posted February 20, 2008 Author Share Posted February 20, 2008 Am I doomed? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 20, 2008 Share Posted February 20, 2008 Try this for your login script. Also, read some of the comments I added: <?php //First, you should probably get rid of this. //That way, if they revisit the login page, they //have the ability to login as something else if(isset($_SESSION["id"])){ header("Location: index.php?page=acchome"); exit(); } mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error()); mysql_select_db("berryequipment_net_db"); if(isset($_POST['submit'])){ if(empty($_POST['password'])) $error .= 'You must fill in a password <br />'; if(!strlen($error)){ $result = mysql_query("SELECT * FROM `plants` WHERE `id` = '".mysql_real_escape_string($_POST['dropdown'])."' AND `password` = '".md5($_POST['password'])."'") or die("Query error: ".mysql_error()); if(mysql_num_rows($result) == 0){ $error .= "The pasword you entered did not match the plant location you chose."; print_r($_POST); exit; }else{ $worked = mysql_fetch_array($result); $_SESSION["id"] = $worked['id']; if($history == 'eqfps348') //Where is this coming from? header("Location: index.php?page=$history"); else header("Location: index.php?page=accounthome"); exit; } } } $content .= '<center><table><tr><td><form action="index.php?page=login" method="post">Location: </td><td><select name="dropdown">'; $result = mysql_query("SELECT * FROM `plants` ORDER BY `plantloc` ASC") or DIE(mysql_error()); while($r = mysql_fetch_array($result)){ $id = $r['id']; $plantloc = $r['plantloc']; $content .= "<option value=\"{$id}\">{$plantloc}</option>\n"; } $content .= '</select></td></tr><tr><td> Password: </td><td> <input type="password" name="password" size="6" /> </td></tr><tr><td></td><td> <input type="submit" name="submit" value="login" /> </td></tr></table></center></form>'; ?> Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 20, 2008 Author Share Posted February 20, 2008 Sweet, working now. What was wrong with it? Let me try to tell you why I did some of the things you had questioned me about: 1) //First, you should probably get rid of this. //That way, if they revisit the login page, they //have the ability to login as something else if(isset($_SESSION["id"])){ header("Location: index.php?page=acchome"); exit(); } The only way they are allowed to log in as another user is if they log out first, thats why I have this like this. 2) if($history == 'eqfps348') //Where is this coming from? Well i am trying to set this variable on my index.php with $_SESSION['history'] = $page; $history = $_SESSION['history']; Though it isn't working the way I want it to. I want it so that obviously if the page was = to eqfps348, then it returns the user to that page after logging in, if not it goes to their account home page. (Don't know whats wrong there, if you do that'd be good help ! ) Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 20, 2008 Author Share Posted February 20, 2008 I'm thinking the reason is because, once I click login, the last page would be login.php and then its throwing me to the account home page since I'm logged in, huh? How would I set my last viewed page as two pages ago? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 20, 2008 Share Posted February 20, 2008 If it's working now, find these two lines and remove them, I had them in there for debugging: print_r($_POST); exit; Not sure exactly what your problem was. I'm guessing it was the parenthesis in your SQL query. To save where they were, but you forward them to the login page, store the current page into session like so: $_SESSION['history'] = $_SERVER['REQUEST_URI']; //now forward them Then, in the login, change this: if($history == 'eqfps348') //Where is this coming from? header("Location: index.php?page=$history"); else header("Location: index.php?page=accounthome"); to if($_SESSION['history']){ $history = $_SESSION['history']; $_SESSION['history'] = null; header("Location: $history"); }else header("Location: index.php?page=accounthome"); And obviously make sure sessions are started with session_start(). But if it's working, then sessions are probably already started somewhere else. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 20, 2008 Author Share Posted February 20, 2008 When I try to login with these changes, I'm getting a white page. I tried adding the { after else, but that didn't really work. I'm wondering, why does your else not have } { around it in the top example? edit: put } else { and now its logging me in but not going to the last page if I just came from that page. Now what I'm doing for pages is index.php?page=fps348. So it's gonna have to read off of that. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 20, 2008 Share Posted February 20, 2008 It's shorthand...if there are no braces, it will assume up to the next semi-colon Ok, a white page, but what is the URL in the browsers navigation bar? Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 20, 2008 Author Share Posted February 20, 2008 I guess the white page stopped when I added the braces.. don't ask me how but this is what I have now: if($_SESSION['history']){ $history = $_SESSION['history']; $_SESSION['history'] = null; header("Location: $history"); } else { header("Location: index.php?page=accounthome"); exit; } This is just taking me to accounthome. Now I could change the url on that second header to see if it's just reloading the same page or if it's going there legit. *minutes later* Okay, it's sending me to the page described if session id is set at the top of the page. I think it's doing what I tried to explain a few posts ago: When the user comes from the fps348 page to the login page the history is set to 348, when I submit the login its already set to the login page? I may be wrong, but is that it? Gonna try and echo out the history variable.. and the result.. <?php if(isset($_SESSION["id"])){ header("Location: index.php?page=accounthome"); exit(); } $history = $_SESSION['history']; mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error()); mysql_select_db("berryequipment_net_db"); if(isset($_POST['submit'])){ if(empty($_POST['password'])) $error .= 'You must fill in a password <br />'; if(!strlen($error)){ $result = mysql_query("SELECT * FROM `plants` WHERE `id` = '".mysql_real_escape_string($_POST['dropdown'])."' AND `password` = '".md5($_POST['password'])."'") or die("Query error: ".mysql_error()); if(mysql_num_rows($result) == 0){ $error .= "The pasword you entered did not match the plant location you chose."; }else{ $worked = mysql_fetch_array($result); $_SESSION["id"] = $worked['id']; if($_SESSION['history']){ $_SESSION['history'] = null; header("Location: $history"); } else { header("Location: index.php?page=accounthome"); exit; } } } $content .= '<center><table><tr><td><form action="index.php?page=login" method="post">Location: </td><td><select name="dropdown">'; $result = mysql_query("SELECT * FROM `plants` ORDER BY `plantloc` ASC") or DIE(mysql_error()); while($r = mysql_fetch_array($result)){ $id = $r['id']; $plantloc = $r['plantloc']; $content .= "<option value=\"{$id}\">{$plantloc}</option>\n"; } $content .= '</select></td></tr><tr><td> Password: </td><td> <input type="password" name="password" size="6" /> </td></tr><tr><td></td><td> <input type="submit" name="submit" value="login" /> </td></tr></table></center></form> $history '; ?> I did this with my login, creating the history variable at the top to use in my content section, and it isn't displaying a value. In my index.php I have this: $_SESSION['history'] = $_SERVER['REQUEST_URI']; Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 20, 2008 Share Posted February 20, 2008 Nope...now you have unbalanced braces. Is this file getting included? If so, I would look there for unmatched braces. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 Unmatched braces causing me to not set my history session, or causing what? Which file should I be looking in you said, my index.php? My content pages are being included in to that. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Yes, look in your index.php file. Maybe even post it here. In your include file, all braces should match. So for every open brace, there needs to be a close brace. Also, you may want to focus on your indenting, that way everything lines up and you can tell when you are missing a close brace. Another way to help keep track of braces is to label them with comments like so: <?php while($start < $end){ if($start == 3){ echo "I found 3"; }//End: if($start == 3) }//End while($start < $end) ?> Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 If I am missing one, I have completely overlooked it. Wouldn't missing a brace completely white out my page or something? <?php session_start(); header("Cache-control: private"); if(isset($logout)) { unset ($_SESSION); session_destroy(); header("Location: index.php"); } $content = ''; if (isset($_GET['page']) && file_exists($_GET['page'] . '.php')) { $page = ($_GET['page']); } else { $page = "home"; } $_SESSION['history'] = $_SERVER['REQUEST_URI']; include "gconnect.php"; if (isset($_SESSION[id])){ include "connect.php"; } include "$page.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Berry Plumbing & Equipment</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" title="default" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript"> function showPic(whichpic) { var placeholder = document.getElementById('placeholder'); if (placeholder) { placeholder.src = whichpic.href; var tempParent = placeholder.parentNode; if (tempParent && tempParent.nodeType == 1 && tempParent.nodeName.toLowerCase() == 'a') { var tempHref = whichpic.href; tempHref = tempHref.substring(0, tempHref.length-4); tempParent.href = tempHref + 'L' + '.jpg'; } return false; } else { return true; } } </script> </head> <body onload="start()"> <div id="container"> <div id="center"> <div id="header"></div> <div id="topright"> <?php if (isset($_SESSION[id])){ echo "<div class=\"topr\"><a href=\"index.php?page=cart\"><img src=\"images/cart.jpg\" border=\"0\" /></a> <a href=\"index.php?logout=true\">Logout</a></div>"; } ?> </div> <div id="user"> </div> <div id="bbar1"></div> <div id="products"> <script type="text/javascript"> //Specify the slider's width (in pixels) var sliderwidth="804px" //Specify the slider's height var sliderheight="175px" //Specify the slider's slide speed (larger is faster 1-10) var slidespeed=2 //configure background color: slidebgcolor="" //Specify the slider's images var leftrightslide=new Array() var finalslide='' leftrightslide[0]='<a href="index.php?page=eqph"><img src="ptop/ph.jpg" border=0></a>' leftrightslide[1]='<a href="index.php?page=eqdp"><img src="ptop/dpump.jpg" border=0></a>' leftrightslide[2]='<a href="index.php?page=eqbs4"><img src="ptop/bs.jpg" border=0></a>' leftrightslide[3]='<a href="index.php?page=eqbfu"><img src="ptop/fu.jpg" border=0></a>' leftrightslide[4]='<a href="index.php?page=eqprs"><img src="ptop/prs.jpg" border=0></a>' leftrightslide[5]='<a href="index.php?page=eqpws6"><img src="ptop/ws.jpg" border=0></a>' leftrightslide[6]='<a href="index.php?page=eqpu"><img src="ptop/pu.jpg" border=0></a>' leftrightslide[7]='<a href="index.php?page=eqfp4"><img src="ptop/fp10.jpg" border=0></a>' leftrightslide[8]='<a href="index.php?page=eqhs"><img src="ptop/hs.jpg" border=0></a>' leftrightslide[9]='<a href="index.php?page=eqbchs"><img src="ptop/bchs.jpg" border=0></a>' leftrightslide[10]='<a href="index.php?page=eq4016"><img src="ptop/gc.jpg" border=0></a>' leftrightslide[11]='<a href="index.php?page=eqss"><img src="ptop/ss.jpg" border=0></a>' leftrightslide[12]='<a href="index.php?page=eqgd"><img src="ptop/gd.jpg" border=0></a>' //Specify gap between each image (use HTML): var imagegap=" " //Specify pixels gap between each slideshow rotation (use integer): var slideshowgap=0 ////NO NEED TO EDIT BELOW THIS LINE//////////// var copyspeed=slidespeed leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>' var iedom=document.all||document.getElementById if (iedom) document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>') var actualwidth='' var cross_slide, ns_slide function fillup(){ if (iedom){ cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2 cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3 cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth cross_slide2.style.left=actualwidth+slideshowgap+"px" } else if (document.layers){ ns_slide=document.ns_slidemenu.document.ns_slidemenu2 ns_slide2=document.ns_slidemenu.document.ns_slidemenu3 ns_slide.document.write(leftrightslide) ns_slide.document.close() actualwidth=ns_slide.document.width ns_slide2.left=actualwidth+slideshowgap ns_slide2.document.write(leftrightslide) ns_slide2.document.close() } lefttime=setInterval("slideleft()",30) } window.onload=fillup function slideleft(){ if (iedom){ if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+) cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px" else cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px" if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+) cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px" else cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px" } else if (document.layers){ if (ns_slide.left>(actualwidth*(-1)+) ns_slide.left-=copyspeed else ns_slide.left=ns_slide2.left+actualwidth+slideshowgap if (ns_slide2.left>(actualwidth*(-1)+) ns_slide2.left-=copyspeed else ns_slide2.left=ns_slide.left+actualwidth+slideshowgap } } if (iedom||document.layers){ with (document){ document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') if (iedom){ write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">') write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">') write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>') write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>') write('</div></div>') } else if (document.layers){ write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>') write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('</ilayer>') } document.write('</td></table>') } } </script> </div> <div id="bbar2"></div> <div id="navbar"> <div id="multi-level"> <ul class="menu"> <li class="top p1"><a href="index.php" id="aboutus" class="top_link"><span>About Us</span></a></li> <li class="top p2"><a href="#" id="equipment" class="top_link"><span>Equipment</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="#" class="fly">Picking<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="#" class="fly">Foot Pad Scrubber<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfps348">B-FPS-LH/RH-3-48</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcb">Cuticle Brush</a></li> <li><a href="#" class="fly">Foot Pickers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfp3">B-FP-3</a></li> <li><a href="index.php?page=eqfp4">B-FP-4</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqhp">Hock Picker</a></li> <li><a href="index.php?page=eqph">Paw Harvester</a></li> <li><a href="index.php?page=eqpu">Paw Untanglers</a></li> <li><a href="index.php?page=eqprs">Paw Recovery System</a></li> <li><a href="index.php?page=eqpit">Paw Inspection Table</a></li> <li><a href="index.php?page=eqbfu">Backup Foot Unloader</a></li> <li><a href="index.php?page=eqbc">Bird Counter</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Evisceration<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqbs4">Bird Scrubber</a></li> <li><a href="index.php?page=eqbw">Bird Washer</a></li> <li><a href="index.php?page=eqosc">Oil Sac Cutter</a></li> <li><a href="index.php?page=eqrws">Rework & Wash Station</a></li> <li><a href="#" class="fly">Water Screens<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqws6">B-WS-60</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqipss">IP Salvage Station</a></li> <li><a href="index.php?page=eqtg">Turn Guard</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Giblet Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqdp">Diaphragm Pump</a></li> <li><a href="#" class="fly">Giblet Chillers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eq3015">B-GC-3015</a></li> <li><a href="index.php?page=eq4016">B-GC-4016</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqge">Giblet Elevator</a></li> <li><a href="index.php?page=eqgwc">Giblet Water Changer</a></li> <li><a href="index.php?page=eqgd">Gizzard Defatter</a></li> <li><a href="index.php?page=eqgt">Gizzard Inspection Table</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Further Processing<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhs">Halving Saw</a></li> <li><a href="index.php?page=eqss">Saddle Saw</a></li> <li><a href="index.php?page=eqcs">Cut-up Saw</a></li> <li><a href="index.php?page=eqocs">OSHA Cut-up Saw</a></li> <li><a href="index.php?page=eqbchs">Breast Cart. Harvest Sys.</a></li> <li><a href="#" class="fly">Cone Deboning Line<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqcd2">B-CD-2</a></li> <li><a href="index.php?page=eqcd3">B-CD-3</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcc">Carcass Crusher</a></li> <li><a href="index.php?page=eqtd">Tub Dumper</a></li> <li><a href="index.php?page=eqwm">Wing Machine</a></li> <li><a href="index.php?page=eqcdl">Front Half Deboning Line</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Conveyor & Mat. Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfbcc">Full Box Comp. Conveyor</a></li> <li><a href="index.php?page=eqfc">Conveyors</a></li> <li><a href="index.php?page=eqtcs">Traffic Cop Spur</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Miscellaneous<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhpu">Hydraulic Power Unit</a></li> <li><a href="index.php?page=eqsw">Stands & Walkovers</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqtr">Turbo Rinser</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p3"><a href="index.php?page=featured" id="featured" class="top_link"><span>Featured Products</span></a></li> <li class="top p4"><a href="#" id="information" class="top_link"><span>Information</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="index.php?page=drafting">Drafting</a></li> <li><a href="index.php?page=machining">Machining</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p6"><a href="index.php?page=contact" id="contact" class="top_link"><span>Contact</span></a></li> </ul> </div> </div> <div id="body"> <div id="bodyspace"> <?php echo "$content"; if (isset($error)){ echo "<div id=\"error\"><img src=\"images/error.jpg\" />$error</div>"; } if (!isset($content)){ echo "error"; } ?> </div> </div> <div id="footer"><br /> © 2008 - Berry Plumbing & Equipment<br /><br /> <a href="index.php?page=contact">Contact</a> </div> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3613339-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 I noticed I posted the wrong index file, here it is: <?php session_start(); header("Cache-control: private"); if(isset($logout)) { unset ($_SESSION); session_destroy(); header("Location: index.php"); } $content = ''; if (isset($_GET['page']) && file_exists($_GET['page'] . '.php')) { $page = ($_GET['page']); } else { $page = "home"; } $_SESSION['history'] = $_SERVER['REQUEST_URI']; include "gconnect.php"; if (isset($_SESSION[id])){ include "connect.php"; } include "$page.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Berry Plumbing & Equipment</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" title="default" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript"> function showPic(whichpic) { var placeholder = document.getElementById('placeholder'); if (placeholder) { placeholder.src = whichpic.href; var tempParent = placeholder.parentNode; if (tempParent && tempParent.nodeType == 1 && tempParent.nodeName.toLowerCase() == 'a') { var tempHref = whichpic.href; tempHref = tempHref.substring(0, tempHref.length-4); tempParent.href = tempHref + 'L' + '.jpg'; } return false; } else { return true; } } </script> </head> <body onload="start()"> <div id="container"> <div id="center"> <div id="header"></div> <div id="topright"> <?php if (isset($_SESSION[id])){ echo "<div class=\"topr\"><a href=\"index.php?page=cart\"><img src=\"images/cart.jpg\" border=\"0\" /></a> <a href=\"index.php?logout=true\">Logout</a></div>"; } ?> </div> <div id="user"> </div> <div id="bbar1"></div> <div id="products"> <script type="text/javascript"> //Specify the slider's width (in pixels) var sliderwidth="804px" //Specify the slider's height var sliderheight="175px" //Specify the slider's slide speed (larger is faster 1-10) var slidespeed=1 //configure background color: slidebgcolor="" //Specify the slider's images var leftrightslide=new Array() var finalslide='' leftrightslide[0]='<a href="index.php?page=eqph"><img src="ptop/ph.jpg" border=0></a>' leftrightslide[1]='<a href="index.php?page=eqdp"><img src="ptop/dpump.jpg" border=0></a>' leftrightslide[2]='<a href="index.php?page=eqbs4"><img src="ptop/bs.jpg" border=0></a>' leftrightslide[3]='<a href="index.php?page=eqbfu"><img src="ptop/fu.jpg" border=0></a>' leftrightslide[4]='<a href="index.php?page=eqprs"><img src="ptop/prs.jpg" border=0></a>' leftrightslide[5]='<a href="index.php?page=eqpws6"><img src="ptop/ws.jpg" border=0></a>' leftrightslide[6]='<a href="index.php?page=eqpu"><img src="ptop/pu.jpg" border=0></a>' leftrightslide[7]='<a href="index.php?page=eqfp4"><img src="ptop/fp10.jpg" border=0></a>' leftrightslide[8]='<a href="index.php?page=eqhs"><img src="ptop/hs.jpg" border=0></a>' leftrightslide[9]='<a href="index.php?page=eqbchs"><img src="ptop/bchs.jpg" border=0></a>' leftrightslide[10]='<a href="index.php?page=eq4016"><img src="ptop/gc.jpg" border=0></a>' leftrightslide[11]='<a href="index.php?page=eqgt"><img src="ptop/gt.jpg" border=0></a>' leftrightslide[12]='<a href="index.php?page=eqhp"><img src="ptop/hp.jpg" border=0></a>' leftrightslide[13]='<a href="index.php?page=eqpit"><img src="ptop/pit.jpg" border=0></a>' leftrightslide[14]='<a href="index.php?page=eqbw"><img src="ptop/bw.jpg" border=0></a>' leftrightslide[15]='<a href="index.php?page=eqpsc"><img src="ptop/osc.jpg" border=0></a>' leftrightslide[16]='<a href="index.php?page=eqrws"><img src="ptop/rws.jpg" border=0></a>' leftrightslide[17]='<a href="index.php?page=eqipss"><img src="ptop/ipss.jpg" border=0></a>' leftrightslide[18]='<a href="index.php?page=eqtg"><img src="ptop/tg.jpg" border=0></a>' leftrightslide[18]='<a href="index.php?page=eqge"><img src="ptop/ge.jpg" border=0></a>' //Specify gap between each image (use HTML): var imagegap=" " //Specify pixels gap between each slideshow rotation (use integer): var slideshowgap=0 ////NO NEED TO EDIT BELOW THIS LINE//////////// var copyspeed=slidespeed leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>' var iedom=document.all||document.getElementById if (iedom) document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>') var actualwidth='' var cross_slide, ns_slide function fillup(){ if (iedom){ cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2 cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3 cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth cross_slide2.style.left=actualwidth+slideshowgap+"px" } else if (document.layers){ ns_slide=document.ns_slidemenu.document.ns_slidemenu2 ns_slide2=document.ns_slidemenu.document.ns_slidemenu3 ns_slide.document.write(leftrightslide) ns_slide.document.close() actualwidth=ns_slide.document.width ns_slide2.left=actualwidth+slideshowgap ns_slide2.document.write(leftrightslide) ns_slide2.document.close() } lefttime=setInterval("slideleft()",30) } window.onload=fillup function slideleft(){ if (iedom){ if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+) cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px" else cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px" if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+) cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px" else cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px" } else if (document.layers){ if (ns_slide.left>(actualwidth*(-1)+) ns_slide.left-=copyspeed else ns_slide.left=ns_slide2.left+actualwidth+slideshowgap if (ns_slide2.left>(actualwidth*(-1)+) ns_slide2.left-=copyspeed else ns_slide2.left=ns_slide.left+actualwidth+slideshowgap } } if (iedom||document.layers){ with (document){ document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') if (iedom){ write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">') write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">') write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>') write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>') write('</div></div>') } else if (document.layers){ write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>') write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('</ilayer>') } document.write('</td></table>') } } </script> </div> <div id="bbar2"></div> <div id="navbar"> <div id="multi-level"> <ul class="menu"> <li class="top p1"><a href="index.php" id="aboutus" class="top_link"><span>About Us</span></a></li> <li class="top p2"><a href="#" id="equipment" class="top_link"><span>Equipment</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="#" class="fly">Picking<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="#" class="fly">Foot Pad Scrubber<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfps348">B-FPS-LH/RH-3-48</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcb">Cuticle Brush</a></li> <li><a href="#" class="fly">Foot Pickers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfp3">B-FP-3</a></li> <li><a href="index.php?page=eqfp4">B-FP-4</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqhp">Hock Picker</a></li> <li><a href="index.php?page=eqph">Paw Harvester</a></li> <li><a href="index.php?page=eqpu">Paw Untanglers</a></li> <li><a href="index.php?page=eqprs">Paw Recovery System</a></li> <li><a href="index.php?page=eqpit">Paw Inspection Table</a></li> <li><a href="index.php?page=eqbfu">Backup Foot Unloader</a></li> <li><a href="index.php?page=eqbc">Bird Counter</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Evisceration<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqbs4">Bird Scrubber</a></li> <li><a href="index.php?page=eqbw">Bird Washer</a></li> <li><a href="index.php?page=eqosc">Oil Sac Cutter</a></li> <li><a href="index.php?page=eqrws">Rework & Wash Station</a></li> <li><a href="#" class="fly">Water Screens<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqws6">B-WS-60</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqipss">IP Salvage Station</a></li> <li><a href="index.php?page=eqtg">Turn Guard</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Giblet Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqdp">Diaphragm Pump</a></li> <li><a href="#" class="fly">Giblet Chillers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eq3015">B-GC-3015</a></li> <li><a href="index.php?page=eq4016">B-GC-4016</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqge">Giblet Elevator</a></li> <li><a href="index.php?page=eqgwc">Giblet Water Changer</a></li> <li><a href="index.php?page=eqgd">Gizzard Defatter</a></li> <li><a href="index.php?page=eqgt">Gizzard Inspection Table</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Further Processing<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhs">Halving Saw</a></li> <li><a href="index.php?page=eqss">Saddle Saw</a></li> <li><a href="index.php?page=eqcs">Cut-up Saw</a></li> <li><a href="index.php?page=eqocs">OSHA Cut-up Saw</a></li> <li><a href="index.php?page=eqbchs">Breast Cart. Harvest Sys.</a></li> <li><a href="#" class="fly">Cone Deboning Line<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqcd2">B-CD-2</a></li> <li><a href="index.php?page=eqcd3">B-CD-3</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcc">Carcass Crusher</a></li> <li><a href="index.php?page=eqtd">Tub Dumper</a></li> <li><a href="index.php?page=eqwm">Wing Machine</a></li> <li><a href="index.php?page=eqcdl">Front Half Deboning Line</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Conveyor & Mat. Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfbcc">Full Box Comp. Conveyor</a></li> <li><a href="index.php?page=eqfc">Conveyors</a></li> <li><a href="index.php?page=eqtcs">Traffic Cop Spur</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Miscellaneous<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhpu">Hydraulic Power Unit</a></li> <li><a href="index.php?page=eqsw">Stands & Walkovers</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqtr">Turbo Rinser</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p3"><a href="index.php?page=featured" id="featured" class="top_link"><span>Featured Products</span></a></li> <li class="top p4"><a href="#" id="information" class="top_link"><span>Information</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="index.php?page=drafting">Drafting</a></li> <li><a href="index.php?page=machining">Machining</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p6"><a href="index.php?page=contact" id="contact" class="top_link"><span>Contact</span></a></li> </ul> </div> </div> <div id="body"> <div id="bodyspace"> <?php echo "$content"; if (isset($error)){ echo "<div id=\"error\"><img src=\"images/error.jpg\" />$error</div>"; } if (!isset($content)){ echo "error"; } ?> </div> </div> <div id="footer"><br /> © 2008 - Berry Plumbing & Equipment<br /><br /> <a href="index.php?page=contact">Contact</a> </div> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3613339-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> </body> </html> Similar code Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 Moving right along... I realized I was looking in the testing site that I had up before I launched the actual site, but I've been uploading these tests to the real site. Therefore I would make a change and then test and get no result. yay, huh? Anyway, here is what I have for my login.php (which is a blank white atm) <?php if(isset($_SESSION["id"])){ header("Location: index.php?page=accounthome"); exit(); } $history = $_SESSION['history']; mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error()); mysql_select_db("berryequipment_net_db"); if(isset($_POST['submit'])){ if(empty($_POST['password'])) { $error .= 'You must fill in a password <br />'; if(!strlen($error)){ $result = mysql_query("SELECT * FROM `plants` WHERE `id` = '".mysql_real_escape_string($_POST['dropdown'])."' AND `password` = '".md5($_POST['password'])."'") or die("Query error: ".mysql_error()); if(mysql_num_rows($result) == 0){ $error .= "The pasword you entered did not match the plant location you chose."; }else{ $worked = mysql_fetch_array($result); $_SESSION["id"] = $worked['id']; if($_SESSION['history']){ $_SESSION['history'] = null; header("Location: $history"); } else { header("Location: index.php?page=accounthome"); exit; } } } $content .= "<center><table><tr><td><form action=\"index.php?page=login\" method=\"post\">Location: </td><td><select name=\"dropdown\">"; $result = mysql_query("SELECT * FROM `plants` ORDER BY `plantloc` ASC") or DIE(mysql_error()); while($r = mysql_fetch_array($result)){ $id = $r['id']; $plantloc = $r['plantloc']; $content .= "<option value=\"{$id}\">{$plantloc}</option>\n"; } $content .= "</select></td></tr><tr><td> Password: </td><td> <input type=\"password\" name=\"password\" size=\"6\" /> </td></tr><tr><td></td><td> <input type=\"submit\" name=\"submit\" value=\"login\" /> </td></tr></table></center></form> $history "; ?> The lines: if(empty($_POST['password'])) $error .= 'You must fill in a password <br />'; Are a problem, are they not? No braces.. though this was your redo on the code, so I'm not 100% Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Those two lines are perfectly fine. But I put the braces back just for you Here are the two files, with some comments, and also with error reporting turned on. index.php <?php session_start(); header("Cache-control: private"); //Turn on error reporting ini_set('display_errors', 1); error_reporting (E_ALL); if(isset($logout)) //How does $logout get set? { unset ($_SESSION); session_destroy(); header("Location: index.php"); exit; //Always put an exit after a header('Location:...') call } $content = ''; //Security risk here. Someone could access a file that isn't allowed. //I added a regex match to make sure all page names only contain letters, numbers, and underscores if (isset($_GET['page']) && preg_match('/^\w+$/',$_GET['page']) && file_exists($_GET['page'] . '.php')) { $page = ($_GET['page']); } else { $page = "home"; } //You don't want to set this if it's the login page if($page != 'login') { $_SESSION['history'] = $_SERVER['REQUEST_URI']; } // You should move these files to their own directory, so someone // can't provide a page name of gconnect or connect. The standard // is to create a directory called 'include', and then change // these to include "include/gconnect.php"; include "gconnect.php"; if (isset($_SESSION['id'])) { include "connect.php"; } include "$page.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Berry Plumbing & Equipment</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" title="default" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript"> function showPic(whichpic) { var placeholder = document.getElementById('placeholder'); if (placeholder) { placeholder.src = whichpic.href; var tempParent = placeholder.parentNode; if (tempParent && tempParent.nodeType == 1 && tempParent.nodeName.toLowerCase() == 'a') { var tempHref = whichpic.href; tempHref = tempHref.substring(0, tempHref.length-4); tempParent.href = tempHref + 'L' + '.jpg'; } return false; } else { return true; } } </script> </head> <body onload="start()"> <div id="container"> <div id="center"> <div id="header"></div> <div id="topright"> <?php if (isset($_SESSION[id])){ echo "<div class=\"topr\"><a href=\"index.php?page=cart\"><img src=\"images/cart.jpg\" border=\"0\" /></a> <a href=\"index.php?logout=true\">Logout</a></div>"; } ?> </div> <div id="user"> </div> <div id="bbar1"></div> <div id="products"> <script type="text/javascript"> //Specify the slider's width (in pixels) var sliderwidth="804px" //Specify the slider's height var sliderheight="175px" //Specify the slider's slide speed (larger is faster 1-10) var slidespeed=1 //configure background color: slidebgcolor="" //Specify the slider's images var leftrightslide=new Array() var finalslide='' leftrightslide[0]='<a href="index.php?page=eqph"><img src="ptop/ph.jpg" border=0></a>' leftrightslide[1]='<a href="index.php?page=eqdp"><img src="ptop/dpump.jpg" border=0></a>' leftrightslide[2]='<a href="index.php?page=eqbs4"><img src="ptop/bs.jpg" border=0></a>' leftrightslide[3]='<a href="index.php?page=eqbfu"><img src="ptop/fu.jpg" border=0></a>' leftrightslide[4]='<a href="index.php?page=eqprs"><img src="ptop/prs.jpg" border=0></a>' leftrightslide[5]='<a href="index.php?page=eqpws6"><img src="ptop/ws.jpg" border=0></a>' leftrightslide[6]='<a href="index.php?page=eqpu"><img src="ptop/pu.jpg" border=0></a>' leftrightslide[7]='<a href="index.php?page=eqfp4"><img src="ptop/fp10.jpg" border=0></a>' leftrightslide[8]='<a href="index.php?page=eqhs"><img src="ptop/hs.jpg" border=0></a>' leftrightslide[9]='<a href="index.php?page=eqbchs"><img src="ptop/bchs.jpg" border=0></a>' leftrightslide[10]='<a href="index.php?page=eq4016"><img src="ptop/gc.jpg" border=0></a>' leftrightslide[11]='<a href="index.php?page=eqgt"><img src="ptop/gt.jpg" border=0></a>' leftrightslide[12]='<a href="index.php?page=eqhp"><img src="ptop/hp.jpg" border=0></a>' leftrightslide[13]='<a href="index.php?page=eqpit"><img src="ptop/pit.jpg" border=0></a>' leftrightslide[14]='<a href="index.php?page=eqbw"><img src="ptop/bw.jpg" border=0></a>' leftrightslide[15]='<a href="index.php?page=eqpsc"><img src="ptop/osc.jpg" border=0></a>' leftrightslide[16]='<a href="index.php?page=eqrws"><img src="ptop/rws.jpg" border=0></a>' leftrightslide[17]='<a href="index.php?page=eqipss"><img src="ptop/ipss.jpg" border=0></a>' leftrightslide[18]='<a href="index.php?page=eqtg"><img src="ptop/tg.jpg" border=0></a>' leftrightslide[18]='<a href="index.php?page=eqge"><img src="ptop/ge.jpg" border=0></a>' //Specify gap between each image (use HTML): var imagegap=" " //Specify pixels gap between each slideshow rotation (use integer): var slideshowgap=0 ////NO NEED TO EDIT BELOW THIS LINE//////////// var copyspeed=slidespeed leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>' var iedom=document.all||document.getElementById if (iedom) document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>') var actualwidth='' var cross_slide, ns_slide function fillup(){ if (iedom){ cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2 cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3 cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth cross_slide2.style.left=actualwidth+slideshowgap+"px" } else if (document.layers){ ns_slide=document.ns_slidemenu.document.ns_slidemenu2 ns_slide2=document.ns_slidemenu.document.ns_slidemenu3 ns_slide.document.write(leftrightslide) ns_slide.document.close() actualwidth=ns_slide.document.width ns_slide2.left=actualwidth+slideshowgap ns_slide2.document.write(leftrightslide) ns_slide2.document.close() } lefttime=setInterval("slideleft()",30) } window.onload=fillup function slideleft(){ if (iedom){ if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+) cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px" else cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px" if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+) cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px" else cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px" } else if (document.layers){ if (ns_slide.left>(actualwidth*(-1)+) ns_slide.left-=copyspeed else ns_slide.left=ns_slide2.left+actualwidth+slideshowgap if (ns_slide2.left>(actualwidth*(-1)+) ns_slide2.left-=copyspeed else ns_slide2.left=ns_slide.left+actualwidth+slideshowgap } } if (iedom||document.layers){ with (document){ document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') if (iedom){ write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">') write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">') write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>') write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>') write('</div></div>') } else if (document.layers){ write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>') write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>') write('</ilayer>') } document.write('</td></table>') } } </script> </div> <div id="bbar2"></div> <div id="navbar"> <div id="multi-level"> <ul class="menu"> <li class="top p1"><a href="index.php" id="aboutus" class="top_link"><span>About Us</span></a></li> <li class="top p2"><a href="#" id="equipment" class="top_link"><span>Equipment</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="#" class="fly">Picking<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="#" class="fly">Foot Pad Scrubber<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfps348">B-FPS-LH/RH-3-48</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcb">Cuticle Brush</a></li> <li><a href="#" class="fly">Foot Pickers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfp3">B-FP-3</a></li> <li><a href="index.php?page=eqfp4">B-FP-4</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqhp">Hock Picker</a></li> <li><a href="index.php?page=eqph">Paw Harvester</a></li> <li><a href="index.php?page=eqpu">Paw Untanglers</a></li> <li><a href="index.php?page=eqprs">Paw Recovery System</a></li> <li><a href="index.php?page=eqpit">Paw Inspection Table</a></li> <li><a href="index.php?page=eqbfu">Backup Foot Unloader</a></li> <li><a href="index.php?page=eqbc">Bird Counter</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Evisceration<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqbs4">Bird Scrubber</a></li> <li><a href="index.php?page=eqbw">Bird Washer</a></li> <li><a href="index.php?page=eqosc">Oil Sac Cutter</a></li> <li><a href="index.php?page=eqrws">Rework & Wash Station</a></li> <li><a href="#" class="fly">Water Screens<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqws6">B-WS-60</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqipss">IP Salvage Station</a></li> <li><a href="index.php?page=eqtg">Turn Guard</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Giblet Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqdp">Diaphragm Pump</a></li> <li><a href="#" class="fly">Giblet Chillers<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eq3015">B-GC-3015</a></li> <li><a href="index.php?page=eq4016">B-GC-4016</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqge">Giblet Elevator</a></li> <li><a href="index.php?page=eqgwc">Giblet Water Changer</a></li> <li><a href="index.php?page=eqgd">Gizzard Defatter</a></li> <li><a href="index.php?page=eqgt">Gizzard Inspection Table</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Further Processing<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhs">Halving Saw</a></li> <li><a href="index.php?page=eqss">Saddle Saw</a></li> <li><a href="index.php?page=eqcs">Cut-up Saw</a></li> <li><a href="index.php?page=eqocs">OSHA Cut-up Saw</a></li> <li><a href="index.php?page=eqbchs">Breast Cart. Harvest Sys.</a></li> <li><a href="#" class="fly">Cone Deboning Line<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqcd2">B-CD-2</a></li> <li><a href="index.php?page=eqcd3">B-CD-3</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqcc">Carcass Crusher</a></li> <li><a href="index.php?page=eqtd">Tub Dumper</a></li> <li><a href="index.php?page=eqwm">Wing Machine</a></li> <li><a href="index.php?page=eqcdl">Front Half Deboning Line</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Conveyor & Mat. Handling<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqfbcc">Full Box Comp. Conveyor</a></li> <li><a href="index.php?page=eqfc">Conveyors</a></li> <li><a href="index.php?page=eqtcs">Traffic Cop Spur</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="#" class="fly">Miscellaneous<!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="index.php?page=eqhpu">Hydraulic Power Unit</a></li> <li><a href="index.php?page=eqsw">Stands & Walkovers</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li><a href="index.php?page=eqtr">Turbo Rinser</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p3"><a href="index.php?page=featured" id="featured" class="top_link"><span>Featured Products</span></a></li> <li class="top p4"><a href="#" id="information" class="top_link"><span>Information</span><!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul class="sub"> <li><a href="index.php?page=drafting">Drafting</a></li> <li><a href="index.php?page=machining">Machining</a></li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> <li class="top p6"><a href="index.php?page=contact" id="contact" class="top_link"><span>Contact</span></a></li> </ul> </div> </div> <div id="body"> <div id="bodyspace"> <?php //Let's use strlen instead if(strlen($content)) { //You don't need quotes if it's just a variable echo $content; } if(strlen($error)) { echo "<div id=\"error\"><img src=\"images/error.jpg\" />$error</div>"; } if(!strlen($content) || !strlen($error)) { echo "error"; } ?> </div> </div> <div id="footer"><br /> © 2008 - Berry Plumbing & Equipment<br /><br /> <a href="index.php?page=contact">Contact</a> </div> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3613339-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> </body> </html> login.php <?php if(isset($_SESSION["id"])) { header("Location: index.php?page=accounthome"); exit(); } //Doesn't this happen in the include('connect.php') in index.php? mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error()); mysql_select_db("berryequipment_net_db"); if(isset($_POST['submit'])) { if(empty($_POST['password'])) { $error .= 'You must fill in a password <br />'; } if(!strlen($error)) { $result = mysql_query("SELECT * FROM `plants` WHERE `id` = '".mysql_real_escape_string($_POST['dropdown'])."' AND `password` = '".md5($_POST['password'])."'") or die("Query error: ".mysql_error()); if(mysql_num_rows($result) == 0) { $error .= "The pasword you entered did not match the plant location you chose."; } else { $worked = mysql_fetch_array($result); $_SESSION["id"] = $worked['id']; if($_SESSION['history']) { $history = $_SESSION['history']; $_SESSION['history'] = null; header("Location: $history"); exit; } header("Location: index.php?page=accounthome"); exit; } } } $content .= '<center><table><tr><td><form action="index.php?page=login" method="post">Location: </td><td><select name="dropdown">'; $result = mysql_query("SELECT * FROM `plants` ORDER BY `plantloc` ASC") or DIE(mysql_error()); while($r = mysql_fetch_array($result)) { $id = $r['id']; $plantloc = $r['plantloc']; $content .= "<option value=\"{$id}\">{$plantloc}</option>\n"; } $content .= '</select></td></tr><tr><td> Password: </td><td> <input type="password" name="password" size="6" /> </td></tr><tr><td></td><td> <input type="submit" name="submit" value="login" /> </td></tr></table></center></form> $history '; ?> Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 I'm getting a couple undefined variable errors on all of my pages now (obviously from the index.php code reporting) though I went ahead to see how the login worked, and submitted it I get a white page and this: Notice: Undefined variable: error in /home/virtual/site21/fst/var/www/html/login.php on line 18 Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 21, 2008 Author Share Posted February 21, 2008 It's displaying: "$history error" on the login page, before you do anything. I took error reporting off just because I am running the live site right now, and it throws the css around a bit. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.