Jump to content

virtuexru

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by virtuexru

  1. OK, so I have users write something. Then input it to a "wall post".. kinda like a flat message board. However, since I use mysql_real_escape_string(); for the $_POST variable, when they use the ' character, posts come out jarbled like this: " couldn\'t understand it, I\'m totally new to it" Anyway to fix this or workaround?
  2. Did that, I figured it out, don't know why but I just flipped it around like this: <?php if($_SESSION['member_logged'] == true || $_COOKIE['member_logged'] == true){?> <form action="config/commentadd.php" method="post"> <table width="80%" border="0"> <tr> <td width="20%">Username:</td> <td width="80%"><input name="user" type="text" value="<?php echo $_SESSION['profile']['displayname']; ?>" size="32" disabled="disabled"></td> </tr> <td>Comment:</td> <td><textarea name="comment" cols="45" rows="5"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" value="Send!" name="submit"></td> </tr> </table> <input name="id" type="hidden" value="<?php echo $id; ?>" /> </form> <?php } else { ?> <p/>Please login to post a comment. <?php } ?>
  3. Maybe the fact that the link is launched by using target="_blank" Might that have something to do with it?
  4. OK.. Here is the code to create cookie/session: setcookie("member_logged",true,time()+21600,"/"); $_SESSION['member_logged'] = true; Here is the page code. It should let you post, because you're logged in and its true, but it just says "Please login" as if your not logged in. (This is only in FireFox/Opera). <?php if($_COOKIE['member_logged'] == false || $_SESSION['member_logged'] = false) { ?> <p/>Please login to post a comment. <?php } else { ?> <form action="config/commentadd.php" method="post"> <table width="80%" border="0"> <tr> <td width="20%">Username:</td> <td width="80%"><input name="user" type="text" value="<?php echo $user; ?>" size="32" disabled="disabled"></td> </tr> <td>Comment:</td> <td><textarea name="comment" cols="45" rows="5"></textarea> *</td> </tr> <tr> <td> </td> <td><input type="submit" value="Send!" name="submit"></td> </tr> </table> <input name="id" type="hidden" value="<?php echo $id; ?>" /> </form> <?php } ?>
  5. I am running it.. I checked like everything ughh this is so frustrating. It works seamlessly in Internet Explorer 7, but in FireFox, either the cookie is False or the session is False, yet I know they are both true.
  6. Array ( [phpSESSID] => cd7a2029b67f1c574acfaac256aa5895 ) ?? That's probably bad.
  7. Ok. I have a problem. I have one page, with both a session and a cookie set, and they work when I do if's. When I open a new window, $_COOKIE and $_SESSION start acting wierd in the IF() test and it doesn't work.. like here: if( $_COOKIE['member_logged'] == false || $_SESSION['member_logged'] = false) If I take out the COOKIE part, the SESSION will pick up that its false. But cookie should be false too but it doesn't even pick it up. Is there something wierd I have to do when opening a new window? However, its wierd because everything works in Internet Explorer.. ?
  8. How would I be able to detect, something like this is input: "aaaaaaaaaaaaaaa dddddddddddddd" So basically I need something to catch a string over say 10 characters without spaces.
  9. I've created my own site. Let me know what everyone thinks/how I can improve. http://tinyurl.com/392sz8
  10. Try <form action="" .. I usually do that, it just reloads the page and runs the script in the header. Of course then you'll have to do if() to find out whether or not the fields have been filled out to decide whether or not to put things into the DB.
  11. Ok. Here's my problem. Users on my site are allowed to post on a board. Once they've posted, I put a cookie on their profile. This is the cookie: setcookie("member_posted",true,time()+7200,"/"); It sets the amount for the cookie to last two hours. Is there anyway to display how much time is left on the cookie?
  12. Wow, thanks for all the help guys. Worked perfectly.
  13. You saved me, what a stupid mistake. Thanks B34ST.
  14. OK. So I have a link with an ?id=$username field on the first page that works fine... Here's the code on the next page to try and get it to work but I get an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Here's the code: include('config/config.php'); include('config/connect.php'); $display = "SELECT displayname, joindate, posts FROM userlist WHERE displayname = $id"; $result = mysql_query($display) or die(mysql_error()); $userinfo = mysql_fetch_array($result);
  15. I need some help. I can do email verification on a $_POST string but need help setting up something that will clear a users post of both: 1. URLS 2. Wierd characters (like @, |, <>, etc)
  16. You need to slash them out... For example Say you want to output: <a href="blabla.com">here</a> You would need to do this.. echo "<a href=\"blabla.com\">here</a>";
  17. OK, first off, I know this can be done, but can it be done using PHP? Any feedback is appreciated. I have a registration form, for my users. Basically what I want is this... Once a user fills out a password, he enters a second password to confirm. After he tabs to the next textfield or he's done entering the second pass, I want PHP to run a check on whether or not the passwords match, if they match, load an image of a green checkmark. I've tried doing the "onfocus" and "onkeyup" functions in the form/input, but not sure as to what direction to head.
  18. if (($_SESSION['username'] == 'Joe') and ($_SESSION['userpass'] == '12345')) I'm pretty sure thats incorrect, don't know why, but thats not how I do it. Plus, its a lot more efficient to store things into variables ($) until you want to create sessions, makes the code a lot cleaner. It should probably be if ($_SESSION['username'] == 'Joe' && $_SESSION['userpass'] == '12345') not sure, that could be wrong too :\
  19. oo gotcha, well then just take out the "mysql_real_escape_string" part, and you should be alright anyway.
  20. Why not just do this: $user = mysql_real_escape_string($_POST['user']); $pass = mysql_real_escape_string($_POST['pass']); if ($user == "x" && $pass == "x") { $_SESSION['auth'] = 1; $_SESSION['user'] = $user; $_SESSION['pass'] = $pass; } else { etc
  21. I want to make sure my users are entering their phone in a certain format, namely... 000-000-0000 where 0 = any #. how would i setup a preg_match function to check that?
×
×
  • 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.