![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
aebstract
-
Posts
1,105 -
Joined
-
Last visited
Posts posted by aebstract
-
-
still gotta post that variable twice, and half of my code is setting variables. Would rather just keep it nice and clean and have one function wrote that states both situations.
-
I explained that it was the same information, yeah an if statement.. I guess you still don't understand what I was trying to ask. I'll just input my information twice if there isn't a better way.
-
So I can go with method, but I just have to insert my text twice, both in to the if problem is set and in to the else, cause its gonna be the same information in both cases. It will work, but I was seeing if there was a more straight way to do it, so you don't have to insert the info twice.
-
I think I tried both methods above, the problems I found with them are:
themistral, that is making sure both post and problem are set. I want it to display when submit is not set also.
timmy0320, you can't get to your inside statements if submit isn't set. If it isn't set, it should still display the text. I noticed your else but here is whats going on.
There is a process happening above all of this. There is a form at the bottom of the page, if the form is submitted and there are no problems in the processes at the top, then the form won't be displayed, instead it will be a form of a success message. Problem here is, I put this success message up in that process code I mentioned above. All I need to do to get this to work correctly is make it check for the situation of either if submit is not set or if it is, then problem must be set also. Under those two circumstances, the form at the bottom should be shown.
-
I'm trying to write some sort of if statement, something like this:
I have some text I want to display, under certain circumstances. If submit is not set, the text is displayed. This isn't a problem,
however I also want it to display when submit is set, but only if $problem is also set. How can I make it so that it displays under both situations? If submit is set and problem is not set, it shouldn't display the text.
-
This is why I didn't wanna get moved to this section of the forums. 94 views and 3 days later, no responses. Getting this issue resolved quickly!
-
-
First thing you need to do when posting code here, is put your code in [ code ] tags (no spaces):
<?php $id=$_GET["id"]; $subject="Hi Friend";$headers="From: ".$name."<".$email.">\r\n";$headers.="MIME-Version: 1.0\r\n";$headers.="Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";$headers.= "X-Priority: 1\r\n";$headers.= "X-Mailer: PHP" . phpversion()."\r\n";$name=$_POST["name"];$email=$_POST["email"];$toname=$_POST["name1"];$toemail=$_POST["email1"].",";$message=$name. " refered you following page to browse.http://www.Trans-united.net/jobdetails.php?id=$id Moreover, ".$name." included following message for you.";$message.=$_POST["message"];//$success=mail($toemail,$subject,$message,$headers); if(isset($_POST["email2"]))//$success.=mail($_POST["email2"],$subject,$message,$headers); mail($_POST["email2"],$subject,$message,$headers);//$toemail.=$_POST["email2"].","; if(isset($_POST["email3"]))//$success.=mail($_POST["email3"],$subject,$message,$headers); mail($_POST["email3"],$subject,$message,$headers);//$toemail.=$_POST["email3"].","; if(isset($_POST["email4"])) mail($_POST["email4"],$subject,$message,$headers);//$success.=mail($_POST["email4"],$subject,$message,$headers);//$toemail.=$_POST["email4"].","; if(isset($_POST["email5"])) mail($_POST["email5"],$subject,$message,$headers);//$success.=mail($_POST["email5"],$subject,$message,$headers);//$toemail.=$_POST["email5"].","; if(isset($_POST["email6"])) mail($_POST["email6"],$subject,$message,$headers);//$success.=mail($_POST["email6"],$subject,$message,$headers);//$toemail.=$_POST["email6"].","; if(isset($_POST["email7"])) mail($_POST["email7"],$subject,$message,$headers);//$success.=mail($_POST["email7"],$subject,$message,$headers);//$toemail.=$_POST["email7"].",";//$headers .= 'CC: nthapa3@yahoo.com' . "\r\n";// $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; $success=mail($toemail,$subject,$message,$headers); if($success) echo "Thank you for letting know your friends about the site.";else{echo "Mail couldn't be send.";} ?>
-
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.
-
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
-
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%
-
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
-
<?php require('admin/jscript.inc') ?>
needs the ; ?
<?php require('admin/jscript.inc'); ?>
-
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>
-
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.
-
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'];
-
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.
-
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?
-
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 !
)
-
echo "<table><tr><td class=\"ratingpage\">$title</td><td class=\"ratingpage\">$message</td><td class=\"ratingpage\">$date</td></tr></table> ";
This shouldn't be in the php section..
-
Am I doomed?
-
I don't really get your question, you're having trouble comparing the answer to the answer they original had for the security question?
-
Yeah I did change to what you had said and when I logged in I get the "password doesnt match location" error that I created.
-
on login: The password you entered did not match the plant location you chose.
what problem were you referring to?
I printed my results before and I only had one set of results?
Link back to index.php
in PHP Coding Help
Posted