Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. 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>
  2. 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).
  3. 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};".
  4. 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)?
  5. That's cool. It scrolls a little with Opera though.
  6. 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.
  7. 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.
  8. Are you asking a question? You want to know what that code does?
  9. 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.
  10. 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.
  11. 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
  12. The second code will work, but they refer to two different things. IDs work like this: #stylename{ ...}<a id="stylename"></a> Classes work like this: .stylename{ ...}<a class="stylename"></a> Theoretically, with an ID, you are only supposed to have one element on the page that has that ID. But in practice, most browsers will apply the style to all elements with that ID.
  13. justsomeguy

    Center

    In that screenshot it looks like the div on the right is too high, either add a <br> after the top div or giv some more margin.Also, you don't need to make images or banners to fit in 800x600. You can make a banner that will display correctly for both 800 wide or 1600 wide, it will just display less of the image for smaller sizes (but won't scroll). <div style="width: 100%; height: 80px; background-image:url(path/to/image); background-position: center center; background-repeat: no-repeat;"> </div> This will create a div and apply your banner as the background image. It will center the background image in the div (i.e. the center of the image, however big it is, will be in the center of the div). So you can make a large banner, but keep the name smaller than 800px, and center it. On either side of the name you can just put some artwork. If they only see 800px, then they see the name and nothing else. If they are on a larger resolution, then the banner will expand out on either side to show the artwork on the sides, but the title will still be centered.
  14. Just a quick point on this. Most of the time it is not a bug (IE just doesn't support a lot), a lot of the time it's because the CSS spec does not specifically say exactly what to do in every situation, so browser vendors do it how they want or how they think it should be done. Not everyone agrees.
  15. That code will print the page (File -> Print, send it to the printer). If you want to create the page, then that's another story.You need to write a SQL query to get the recordset, loop through the recordset, and display the data however you want, in a table or list or whatever.You need to figure out the requirements of what you want the report to look like, and then make it look like that.
  16. You could create a script or something that runs every hour. You can use Windows Task Scheduler to schedule it to run once an hour. It can check all the dates for all the pages and images, and if any of them were changed in the last hour, it could send out emails to everyone. That's probably the easiest way. If you actually want a popup box to appear on their screen when this happens, then you will need to use the Windows Messenger API to send out those messages, and you would need a language like C++ or something in .NET that would be able to use the API.You can also just create a page that says when the last update was, and the users can check the page as often as they want (or have the page auto-refresh).
  17. You need to put another text box next to the price text box I would assume, and then put a total text box down at the bottom. You have a table in the code, but then everything is in only 1 cell in the table. Use <tr> and <td> to create rows and cells in the table, and put each product on one row. Put the different text boxes and dropdowns in the cells, and then you can put a quantity on the end.You need to add a javascript function that multiplies all the quantities by the prices, and adds them up to calculate total cost. Have that function execute whenever either a dropdown is changed or a quantity is changed. You will also want to disable the price text field so that the user can't change the value.
  18. justsomeguy

    SQL Help needed

    OK, well you don't get one row like that, but you can build it yourself. You will make a query to the database, and get back a bunch of rows, and you can output everything in the same row. I'll give the example in PHP. But this is the query: SELECT * FROM tblText ORDER BY label This will give you a lot of rows. Then you need to loop through the result set, and output the row for each label. When the label changes, you start a new row (for the new label). This is how in PHP: <?php$result = mysql_query("SELECT * FROM tblText ORDER BY label");$last_label = "";while ($row = mysql_fetch_assoc($result)){ if ($row['label'] != $last_label) { echo "<br>"; // new row echo $row['label']; // print the label $last_label = $row['label']; //keep track of the last label } echo $row['text']; // print the text on the row}?> Of course you need some extra formatting in there (spaces between the text, or an html table, whatever), but that's the basic info.
  19. justsomeguy

    Form Problem.

    No problem.I'm not sure what you mean about uploading, I think you're using Dreamweaver to connect and transfer for you though. If you want to use a different FTP client, it will probably be more reliable. I can recommend CoreFTP or FileZilla.
  20. justsomeguy

    Form Problem.

    If you uploaded it, it should have changed. Try uploading again, and look at the size of the source and destination to make sure they are identical, maybe it went to the wrong place last time.Also try emptying your browser cache, IE is notorious for insisting on using the cache and refusing to get an updated page. I don't have much experience with Firefox, but Opera seems good about getting a new copy if I'm insistent enough.Also, I didn't know you wanted a 1-line text field. You can replace the text area with this if you only need 1 line: <input type="text" name="textarea" size="40" id="reason">
  21. c.f. this post: http://w3schools.invisionzone.com/index.ph...indpost&p=19329When I posted reply #11, I received a db error when it tried to send the other guy an email. It did post my message. I didn't copy and paste the message, but it was a SQL syntax error saying it couldn't understand this:t be able to edit this \\n\ challengeIf you see the code in the post, there are some escaped single quotes that probably messed up the SQL statement, I would assume.
  22. There was a database error when it tried to email you to notify about the reply apparently, so this should send another email.
  23. OK, well if you're getting the correct ID then it doesn't matter how it's getting retrieved, as long as it is.I found the problem, the query to select the challenge that was clicked on was not using the ID that was passed to it, it was always getting the first challenge that the user was in (probably copied and pasted the SQL statement that lists all the challenges). I also cleaned up the code and reformatted it so it's a little easier to read. // edits challengesfunction editChallenges($user){ global $bordercolor1, $tablebg1, $submit, $cid, $decline, $idc, $matchdate, $matchreplay, $mapused, $personwon, $deletethis; echo "<table align='center' border='1' cellspacing='0' cellpadding='0' bordercolor='{$bordercolor1}' width='500'> <tr><td background='{$tablebg1}' class='main' align='center'><b>Edit Challenges</b></td></tr>"; if($decline) { echo "<script language='javascript'> if(!confirm('Do really want to decline? You won\'t be able to edit this \\n\ challenge after you decline.')) { window.location = 'console.php?p=EditChallenges&cid={$idc}' } </script>"; $query = "UPDATE challanges SET declined = '{$user}' WHERE id = '{$idc}'"; mysql_query($query) or die(mysql_error()); echo "<script language=\"Javascript\"> alert(\"Success!\"); window.location.href = 'console.php'; </script>"; } if($submit) { $query = "UPDATE challanges SET date = '{$matchdate}', replay = '{$matchreplay}', map = '{$mapused}', winner = '{$personwon}' WHERE id = '{$idc}'"; mysql_query($query) or die(mysql_error()); echo "<script language=\"Javascript\"> alert(\"Success!\"); window.location.href = 'console.php'; </script>"; } if($deletethis) { deleteStuff("challanges", $idc, 112188); } if ($cid == "") { echo "<tr><td class='small'><br> <blockquote> This is where you can edit your challenges. If no challenges are shown that means no one has challenged you <b>OR</b> you have declined from a challange making you unable to now edit it. <br><br>"; $query = "SELECT * FROM challanges WHERE (challanger = '{$user}' OR challanged = '{$user}') AND declined != '{$user}' ORDER BY id DESC"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { echo "<a href='console.php?p=EditChallenges&cid={$row['id']}'>{$row['challanger']} vs. {$row['challanged']}</a> - {$row['date']}<br>"; } echo " </blockquote> </td></tr> "; } else { $query = "SELECT * FROM challanges WHERE id={$cid}"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); if ($row['declined'] == "") { $wannadecline = "<center><input type='submit' name='decline' value='Decline' class='lp'></center><br>"; $wannadelete = ""; } else { $wannadelete = "<center><input type='submit' name='deletethis' value='Delete' class='lp'></center><br>"; $wannadecline = ""; } echo "<tr><td class='small'><form action='console.php?p=EditChallenges&cid={$row['id']}' method='post'> <blockquote><br> <center><b>{$row['challanger']}</b> vs. <b>{$row['challanged']}</b></center><br><br> <input type='hidden' name='idc' value='{$row['id']}'> <b>Date:</b> <input type='text' name='matchdate' value='{$row['date']}' class='textarea'><br> <b>Map:</b> <input type='text' name='mapused' value='{$row['map']}' class='textarea'><br> <b>Winner:</b> <input type='text' name='personwon' value='{$row['winner']}' class='textarea'><br> <b>Replay:</b> <input type='text' name='matchreplay' value='{$row['replay']}' class='textarea'><br><br> {$wannadelete} {$wannadecline} <center><input type='submit' name='submit' value='Submit' class='lp'></center> </form> </td></tr>"; } echo "</table>";}// end editChallenges
  24. justsomeguy

    Form Problem.

    You can do that with a little javascript. <input type="radio" name="CVreference" value="other" onclick="jump_to_element('reason')">Other<br><textarea id="reason" rows="3" cols="40"></textarea><script type="text/javascript">function jump_to_element(elId){ document.getElementById(elId).focus();}</script> Notice here that the textarea has an id ("reason"), which is used by the javascript function getElementById. That function gets the name "reason" from the "onclick" in the radio button. Let me know if that's confusing.
  25. justsomeguy

    Form Problem.

    You need to add a "value" to each of the radio buttons. This entire list needs to be reformatted. All the radio buttons need the same "name" attribute, but each one needs a different "value" attribute. Like this: <input type="radio" name="CVreference" value="something">Something<br><input type="radio" name="CVreference" value="another">Another<br><input type="radio" name="CVreference" value="other">Other<br> Notice that they all have the same "name", and that the "value" is different for each. Then in the PHP page, when you get the value of the radio button from $_POST, it will equal the value of whatever they chose.The way you have it set up now, none of the radio buttons have a name at all, and some have a value and some have an id.Edit: I'm retarded, they do all have a name. But they each need a value, delete the ids.
×
×
  • Create New...