Jump to content

Pandemikk

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Pandemikk

  1. Basically here's how it works: You get your password then you use the md5() function to hash it. Then when the user logs in, it matches the hashed password to the one in the database. So if the passwords in the database aren't the md5 hashes of their password then it's not going to work. You should also add a salt to your passwords to make them harder to crack.
  2. http://www.liquidweb.com Surprised this one hasn't been mentioned yet. Shared, VPS, Dedicated. Great and fast support even on the cheapest of plans.
  3. Those are URL parameters you can retrieve with GET. file.php \\ No url parameters file.php?do=whatever \\ One url parameter file.php?do=whatever&action=whatever&etc=etcetera \\ Multiple url parameters Then you can retrieve these via $_GET super variable. For instance: echo $_GET['do'] \\ Prints out 'whatever' Never trust user submitted data, including url parameters. Always sanitize this data.
  4. I don't know where that code goes. I don't know what you're using or where you got it from. You should look into the PHP file of whatever page the links are shown on.
  5. You'll need to provide us with the code that actually shows how the link is being built.
  6. That's because you aren't paying attention. Your link needs to show something like: cid=36&tid=6 so that you can GET the cid AND the tid. You should also make sure the IDs aren't negative values. if ($cid <= 0 ) { die("This is not a valid Category ID") } if ($tid <= 0 ) { die("This is not a valid Topic ID") }
  7. Notepad++ hands down. It's simple, fast and gets the job done. The syntax highlighting is perfect and it even has heredoc support. Someone said that Notepad++ has a list of PHP functions built-in, how do you take advantage of this? I tried NetBeans but it seems to over complicate what I need to do. I just want to be able to open up a PHP file or make a new one and do my work. The project thing is cool, but I hate constricting my files into one folder. I'm use to working in a vBulletin environment, since that's what my web site largely consists of, so having the entire forums directory as a project doesn't work out. It has some nice features, no doubt, but it's just not for me.
  8. Nope. As you can see there is no ID. You should be sanitizing your input before even using. You shouldn't need a LIMIT in your query. There should one be one value for the category id and thread id. Both these columns in the database should be unsigned integers. The topic id should be auto-increment. Your topic is should NEVER be 0. <?php // sanitize your input! without intval I could perform an sql injection so easy! $cid = intval($_GET['cid']); $tid = intval($_GET['tid']); // numbers dont need single quotes and double quoted strings parse variables. $sql = "SELECT * FROM topics WHERE category_id = $cid AND id = $tid"; $res = mysql_query($sql) or die(mysql_error()); ?> And I don't understand the logic of your code one bit. If you're grabbing one thread, why are you using a while loop? And why are you querying the same data twice? EDIT: And the reason $cid has both your url parameters is because your it looks something like this: cid=36=6 It should look like this: cid=36&tid=6 The ampersand is essential.
  9. You should be pulling unique zip codes from the database, shouldn't you? If the you're using MySQL: SELECT DISTINCT zip code; should do the trick.
  10. Actually no. If $val isn't a valid integer then intval() will return 0. It always returns an integer so is_int(intval($variable)) is always true. That's pretty annoying. I would say check if the value was 0 but 0 itself is a possible integer. Seems like you would have to check if the variable was 0 then echo intval. Seems overcomplicated. I'll stick to not using 0 as an integer.
  11. That bitwise comparison is actually better than the even and odds solution I provided. It's a bit cleaner and faster. You should use that on your ID's if you can trust them, or on $i if you can't. Try the code I used in place of the <tr> tag within the do loop. If you don't get alternating colors please give us what you see in the view source (for the table). If the HTML is correct we'll know where to go from there.
  12. Find your Apache folder. It should have htdocs and conf folders in it. I highly suggest you read the tutorials in that link I provided to you. You should also look up general using Apache with Windows tuts. The questions you are asking aren't related to PHP coding at all. You need help finding where to upload / move your files so that they can be accessed by Apache. This is relatively simple and can be figured out by reading over the contents in the link I provided much better than I could ever hope to. Once you can access your .php files in your browser I'd be happy to help you from there.
  13. Several ways to do this. I think the easiest would be doing based on odds and even numbers. <tr style="background-color:<?php echo ($row_update['id']%2) ? 'black' : 'white'; ?>;"> Odd = True. Even = False. http://php.net/manual/en/language.operators.arithmetic.php Odd (and 1) will always have a remainder of one. Even will always return 0. I'm also suggesting you check that row_update has at least one row, or else you're going to encounter errors. http://php.net/manual/en/function.mysql-num-rows.php
  14. Lol no. You aren't suppose to upload PHP files to the database. PHP files belong in your htdocs folder. Here's a wonderful site for setting up Apache (as well as MySQL and other things) on Windows: http://www.thesitewizard.com/apache/install-apache-on-vista.shtml
  15. Indeed. It may have to be closed for its own benefit since now I've become part of the problem I was talking about earlier.
  16. Oh, I misread. That's funny. You'd think they would have one. I suppose: $val = intval($val); echo is_int($val); Would work.
  17. You'll need a web server with PHP and, I'm assuming here, MySQL support for the server-side language and the database. Do you have that?
  18. Funny. I always keep them in an array. Seems more logical to me. To each his own,
  19. I really don't understand why this thread has caused so much confusion. Reg expressions to check if a variable is an integer... really? Why? Retrieving items from the database will give you an array of strings. So simply convert the strings stored in the integer field to integers either by type casting or using intval(). It's that simple.
  20. Why are you echoing anything at all? I'm not quite sure why it's producing a <br />-like effect, but the obvious and better, solution would be to not echo anything at all if no results turn up. Better yet: $query = "SELECT sizes FROM product WHERE id=" . intval($id); if ($result = mysql_query($query)) { echo 'Small - ', $data['sizes']; } Code is much cleaner now.
  21. $topNavs->title and $nav2s->title will need to be named the same thing if you expect that code to work. Overall your code is gigantic mess and it be a lot easier to help you if you showed us exactly where the problem lies in your code and what you need to be done. You should also be debugging a bit. Make sure $pageName evaluates to the same thing in your top nav and left nav.
  22. Your backslash needs to be next to the double quote you are expecting, methinks. To explain that error for you, since the double quote was not escaped it terminated that string so now the parser is expecting a , to signify a new parameter to be echoed or a ; to end the statement. What you've given it now is random text. PHP hates random text.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.