Jump to content

jumpenjuhosaphat

Members
  • Posts

    8
  • Joined

  • Last visited

jumpenjuhosaphat's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Okay, what I was doing, for those that would like to know:I was using absolute positioning. Absolute div's don't expand their containers.So I had to create another div to contain the 2 divs that I wanted to expand, and then float the divs, and change all of the div's to relative positioning. Then I had to use the :after pseudo class to clear the floats. If anyone wants an example, let me know, I'd be glad to help out if I can.
  2. I need the main div to automatically expand to fit the elements that are in it. The main class is set up like follows:.main{ width:780px; height:500px; text-align:left; position:relative; margin-left:auto; margin-right:auto; margin-top:0px; border:2px solid black;}Within this is the entire page. This is so that I can center the page in IE and good browsers. Now the problem I am having is the footer class:.footer{ position:absolute; bottom:-36px; height:36px; width:780px; background-image:url('site_images/menu_bottom.jpg'); repeat:x;}I don't have anything in the main div, so the div isn't expanding, and the bottom of the div is still at the top of the page. Is there a way that I can force the main div to expand so that my footer shows up at the bottom of the page?Here is the entier CSS: body{ background-color: #FFFFFF; margin-top:0px; text-align:center;}.main{ width:780px; height:500px; text-align:left; position:relative; margin-left:auto; margin-right:auto; margin-top:0px; border:2px solid black;}.header{ position:absolute; top:0px; background-image:url('site_images/amd_header.jpg'); width:780px; height:129px;}.footer{ position:absolute; bottom:-36px; height:36px; width:780px; background-image:url('site_images/menu_bottom.jpg'); repeat:x;}.menu_bar{ position:absolute; top:129px; width:780px; height:41; background-image:url('site_images/menu_bar_back.jpg'); repeat:x;}.mb_left_side{}.mb_right_side{}.left_menu{ position:absolute; left:0px; top:175px; width:250px; background-image:url('site_images/menu_back.jpg'); repeat:y;}.lm_top{ position:absolute; top:0px; width:250px; height:27px; background-image:url('site_images/menu_top.jpg');}.lm_content{ width:220px; margin-left:15px;}.lm_bottom{ position:absolute; width:250px; bottom:0px; height:22px; background-image:url('site_images/menu_bottom.jpg');}.hr_1{ width:220px; height:7px; left:15px; background-image:url('site_images/hr_1.jpg'); border:0px;}.hr_2{ width:220px; height:3px; left:15px; background-image:url('site_images/hr_2.jpg'); border:0px}.hr_3{ width:220px; height:7px; left:15px; background-image:url('site_images/hr_3.jpg'); border:0px}.content{} And here is the HTML: <html><head><link rel="stylesheet" type="text/css" href="style.css"/></head><title></title><body><div class="main"> <div class="header"> </div> <div class="footer"> write some text here </div> <div class="menu_bar"> </div> <div class="left_menu"> <div class="lm_top"> </div> <br/> <br/> <div class="lm_content"> <div class="hr_1"> </div> Title <div class="hr_2"> </div> </div> <br/> <div class="lm_content"> Some text will go here and should automatically wrap to the next line so that you don't have to worry about overrunning the stuff. </div> <br/> <div class="lm_content"> <div class="hr_2"> </div> Some more here <div class="hr_2"> </div> <br/> </div> <div class="lm_content"> This box will automatically size itself depending on how much stuff you put into it. If you wanted to write a novel, you could, and this menu box would just grow to fit the content. An example of what I am talking about? Remove this text and you will see whatever I mean, the menu box will shrink up to fit just the text that it is holding. </div> <br/> <div class="lm_bottom"></div> </div> </div><br/></div></body></html>
  3. Okay, I got if figured out. For some reason, on my server, you have to use $_POST["username"] instead of $username. I knew that, but I seemed to have forgotten it when coding this bit of code.
  4. else { $result = mysql_query("SELECT * FROM user"); while($row = mysql_fetch_array($result)) { if($row['id']==$_COOKIE["user"]) { $username=$row['username']; } } include("body.php"); } For some reason the variable $username isn't being set when this code returns true. Sorry if it's an obvious answer, I'm a newbie.
  5. Okay, that works, but if feels a bit clumsy. Please forgive the messy coding, I'm new at this still. On all of the pages of my site, I would like to have a form that will allow a user to sign in, and have that form, when submitted, sign the user in, set a cookie, and bring them back to the same page, displaying a message as opposed to the sign in form.<? $con = mysql_connect("localhost","blahblah","blahblah"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("blahblah", $con);if(isset($_POST["signin"])) { $username=$_POST["username"]; $password=$_POST["password"];$result = mysql_query("SELECT * FROM user");while($row = mysql_fetch_array($result)) { if($row['username']==$username&&$row['password']==$password) setcookie("user", $row["id"], time()+3600, "/"); } }if(isset($_POST["logout"])) { setcookie("user","", time()-3600); }?><html><head><?if(isset($_POST["signin"])||isset($_POST["logout"])) echo '<meta http-equiv="Refresh" content="0;url='.$_SERVER['PHP_SELF'].'"/>';?><link rel="stylesheet" type="text/css" href="style.css"/></head><title>Hot actress</title><body><div class="main"><div class="leftside"><?if(isset($_COOKIE["user"])){ echo'<div class="welcome"></div><div class="box">'.$_COOKIE["user"].'<br/><form method="POST" action="'.$_SERVER['PHP_SELF'].'"><input type="submit" name="logout" value="Log Out"></form></div>';}else{echo '<div class="signin"></div><div class="box"><form method="POST" action="'.$_SERVER['PHP_SELF'].'">Username:<br/><input type="text" name="username"/><br/>Password:<br/><input type="password" name="password"/><br/><input type="submit" name="signin" value="Sign In"/><br/></form>Or <a href="http://www.fumbee.com/register.php">Register</a><br/>';}?></div><div class=content></div><div class="boxtop"></div></div></div></body></html>
  6. I am trying to create a user log in feature, and I got everything fine so far, except, when a cookie is set, it doesn't take effect until the next time a page is loaded, so how do I force the page to automatically reload when I set a cookie?
  7. That's awesome. I was overthinking it I guess. That makes sense, and it's easy to do. Thankyou for your help.
  8. I am pretty new to PHP, and am trying to come up with a plan to rebuild one of my sites. It is an image rich site, and I would like to include the ability to rate each photo, as well as vote for the author of the photo. The photo's I was thinking would be on a scale from 1 to 5, but the authors, only vote or no vote. What my question is, is how do I make it so that each member can only make 1 vote on each image, and 1 vote for each author? I thought that maybe I would use a binary system, where each bit would be ticked if the member voted for a particular picture. I think that's too complicated. I also considered giving each image and each author a row in a table, and when a user makes a vote, add that users number to the row, but I'm not sure how that would work. Would each vote need its own cell, or could I just have a long line of text with each members number seperated by a space? That line of text could get pretty long. What is the best way to do this?
×
×
  • Create New...