Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. Why don't you just use a table? Is there some reason that everyone is on a CSS div kick? This is exactly what tables do, they display content that is all the same height, and they have been doing it for years in every browser. What's the problem? Is there some inate fuzzy feeling that happens when you don't use a table?
  2. I use ConTEXT for everything. There's no reason to use Notepad when there are all these free text editors around. Notepad is terrible. If it had syntax highlighting (or at a very, very minimum, auto-indenting) I guess I would consider it, but all Notepad does is write text. It wastes a lot of time by not helping the programmer out with auto-indent or highlighting. ConTEXT also has code templates so that you can paste in commonly used blocks of code. I keep the ConTEXT installer on my keychain, never know when I might need it.
  3. I don't know why they want to get rid of the style attribute. Sometimes inline styles are a good way to go, they are messing with the cascading nature of CSS when they remove that. Styles are applied in this order:Browser defaultExternal style sheetInternal style sheet (inside the <head> tag)Inline style (inside an HTML element)So they want to remove the last one, and screw up the cascading order? So if we want one element with different style, it needs its own class?
  4. I answered this in the other place you posted it.
  5. This tag does not have an </li>: <li class="mobile"><a href="tutorials.php" title="A list of avaliable tutorials at avant information Services">Tutorials</a>
  6. File upload. If you upload a file, enctype must be multipart/form-data.
  7. You can also put the password in quotes and make sure you escape any quotes that are in the input.
  8. You can use meta tags to set the expire date for each page to an earlier date, and it would force the browser to get the page each time (no caching). But different browsers do Back differently. Things like Opera just load the page that's already in cache and display exactly what you were looking at, but IE tries to reload the page generally. What are you trying to accomplish?
  9. You need quotes around the attributes. Ideally, all of your attributes should have quotes around them. Do either of these: <?php echo "<input type=\"hidden\" name=\"message\" value=\"{$StartText}\">";?> <input type="hidden" name="message" value="<?php echo $StartText; ?>">
  10. You need this for your post page: <!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"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><?phpif(isset($_POST['add'])){ include 'library/config.php'; include 'library/opendb.php'; $username = $_POST['username']; $post = $_POST['post']; $result = mysql_query("SELECT userid FROM houndusers WHERE username='" . mysql_escape_string($username) . "'") or die(mysql_error()); if(mysql_num_rows($result) == 0) { mysql_query("INSERT INTO houndusers (username) VALUES ('$username')"); $userid = mysql_insert_id(); } else { $row = mysql_fetch_assoc($result); $userid = $row['userid']; } mysql_query("INSERT INTO houndposts (post, userid) VALUES ('" . mysql_escape_string($post) . "', '{$userid}')") or die('Error, insert query failed'); include 'library/closedb.php'; echo "New Post Added";}else{?><form method="post" enctype="multipart/form-data"> <table align="center" cellspacing="15"> <tr> <td align="left" valign="top">Username: <input name="username" type="text" id="username"></td> </tr> <tr valign="top"> <td align="left">Post:<br /> <br /> <textarea name="post" type="textarea" cols="75" rows="10" id="post"></textarea></td> </tr> <tr align="center"> <td valign="top"> <input name="add" type="submit" id="add" value="Add New Post"> <input name="Reset" type="reset" value="Reset"> </td> </tr> </table></form><?php}?></body></html> Look at the differences between that one and yours, you can look on php.net for help about the functions used or ask about them here.To order a result set, you need an 'ORDER BY' clause, where you tell it what to order on. If you want to order by user id, you say 'ORDER BY userid'. If you want to order by username, it's 'ORDER BY username'. You can put ASC or DESC after that. So something like 'ORDER BY username DESC'. ORDER BY goes at the end of your SQL statement.
  11. justsomeguy

    Log in

    Yeah, of course. You should think of your page in terms of sections, or boxes. You probably have a top header or something, which never changes from page to page or if you're logged in or not. Then maybe you have a box on the left side, where you have your page menu. That's another box. Then you have the main page content itself, and maybe a box somewhere to handle the login/welcome stuff. Each of these is its own box, or section.It sounds like you have everything else working, except the login box will kill the page if the user is not logged in. That's just because you threw in a "die()" in the code if they are not logged in, the die function stops page execution at that point. All you need to do is restructure the page to remove the die, which will require an if/else statement (you already have the 'if' part).I pasted the code below. All I did was take the last code I posted above, and I restructured it a little. The way the code works now, is that it builds a message based on if the user is logged in or not (the message is either a login form or a welcome message), and then displays that one message in the spot where it goes. <table width="700" height="100" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#00FF00"> <tr> <td height="81" colspan="4" background="images/header-700-81.jpg"> </td> </tr> <tr> <td width="62" height="19"><?php$msgbox = "";if (!$_COOKIE['id']){ $msgbox .= "<a href=\"signup.html\">Register</a>"; $msgbox .= " "; $msgbox .= "<a href=\"login.html\">Log In</a>";}else{ $msgbox .= "Welcome - "; // Connect to the database $server = "localhost"; $dbuser = "user"; $dbpass = "pass"; $dbname = "bd_name"; mysql_connect($server,$dbuser,$dbpass) or die ("connection error"); // make connection mysql_select_db($dbname); // select database // Get users information $result = mysql_query("SELECT * FROM users WHERE id='".mysql_escape_string($_COOKIE['id'])."'"); $r=mysql_fetch_assoc($result); $msgbox .= $r["username"];}echo $msgbox;?> </td> <td width="212" height="19"> </td> <td width="212" height="19"> </td> <td width="214"> </td> </tr></table>
  12. You can probably just add a check for .txt: If UCase(Right(ObjFileItem.Name, 4)) <> ".ASP" and UCase(Right(ObjFileItem.Name, 4)) <> ".TXT" Then
  13. You need to create a table in the database to hold all of the user information. You need to figure out which fields you want to keep track of, and put all of the fields in the database. You probably want your password field to be 40 characters wide so you can encode passwords with either MD5 or SHA-1. You need to write a register page that collects all of the information and makes sure everything is right, and then inserts the user in the database. Then you need a login page to check with the database if the correct user name and password were entered, and keep track of the user using the session (cookies).Check the references for ASP to learn how to connect to and query the database.
  14. You can open the file and count the number of line breaks if you want. Or if you only want to know how many lines there are of text you can exclude all of the sequential line breaks.
  15. justsomeguy

    Log in

    Try this one, the ID was wrong. This uses the same id that is in the cookie. <table width="700" height="100" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#00FF00"> <tr> <td height="81" colspan="4" background="images/header-700-81.jpg"> </td> </tr> <tr> <td width="62" height="19"> <?php if (!$_COOKIE['id']){ echo "<a href=\"signup.html\">Register</a>"; echo " "; echo "<a href=\"login.html\">Log In</a>"; die(""); } echo "Welcome - "; ?> </td> <td width="212" height="19"> <?php // Connect to the database $server = "localhost"; $dbuser = "user"; $dbpass = "pass"; $dbname = "bd_name"; mysql_connect($server,$dbuser,$dbpass) or die ("connection error"); // make connection mysql_select_db($dbname); // select database // Get users information $result = mysql_query("SELECT * FROM users WHERE id='".mysql_escape_string($_COOKIE['id'])."'"); $r=mysql_fetch_assoc($result)) echo $r["username"]; ?> </td> <td width="212" height="19"> </td> <td width="214"> </td> </tr></table>
  16. justsomeguy

    Log in

    It looks like you took out there WHERE clause in the SQL statement. Use the same SQL statement you had the first time when you search for the ID. Also, it is a good idea to make sure you escape any text strings going into a query: $result = mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_escape_string($u)."' LIMIT 1"); It helps prevent something called SQL injection. You also don't need the LIMIT 1 here (you can probably assume there is only 1 user with the ID).
  17. That almost sounds like a homework question.It depends, if you are talking about an HTML line break, then it's "echo $var1 . "<br>" . $var2;", if you are talking about a newline character, you can write "echo "{$var1}\n{$var2};".
  18. What exactly is Firefox explorer? There's Internet Explorer, and there's Firefox. Is it one of those (Help -> About should tell you what you're using)?
  19. That's cool. It scrolls a little with Opera though.
  20. No, the only way to do that is via javascript. Once the window is open, it doesn't matter what your code says after the fact.
  21. You might also be able to do a <td nowrap>, but probably not if you have a div or something else inside the td. The images need to be children of the td I think.
  22. Are you asking a question? You want to know what that code does?
  23. You can also specify a list of fonts to try in order. If you do this:font-family: "EuroStile", "Tahoma", "Arial", sans-serif;it will go down the list and use the first font that the computer has installed on it.
  24. justsomeguy

    Table width problem

    No, IE doesn't support min-width. If you really need that just find a place where you can put a transparent image that is 1 pixel tall and however many you need wide.
  25. You can do that, just leave out the commas. It's a space-delimited list.If this doesn't work:#content a a:link a:visited a:hover a:activethen try this:#content a :link :visited :hover :active
×
×
  • Create New...