Jump to content

therealwesfoster

Members
  • Posts

    345
  • Joined

  • Last visited

Everything posted by therealwesfoster

  1. I'm wanting to restrice how long a dynamic money amount can be. For instance, I want $2.4200000000000004 to be $2.42. I know that you can do this in php using the sprintf function, but how would you go about doing this in javascript? Thanks
  2. Have a column in your user's row named "user_online" or something like that. And when processing the login, check if "user_login" == 1 (if the user is already online), if it is, then don't allow the login. If it == 0 (user not online), then allow the login. Then, have an activity timeout (every 15 minutes of inactivity or so), and set user_online to 0 (and log the user out). Get what i'm saying? that would work, and if a login cookie is present, you can set user_online to 1.
  3. Yes, it will takes alot of time. Thanks for the reply. I appreciate it Anyone else care to share an opinion?
  4. Just wanting some opinions Someone is needing this site: What would you charge for this? Just wondering.. thanks
  5. I can't add any new rows, edit, remove or do anything with my table.. and I think it's because I have a column named "option". I've been able to rename them all except that one. I've tried it with MySQL Front and straight SQL through a PHP program and neither work. I can't delete/rename the column either. Whats the deal? This is the error btw
  6. I don't think you understood me completely.. thanks for the reply though. I want to display all the rows. By default, number1 is left at 0. But if by chance if number1 is greater than 0, I want it to first grab all of those rows and order them by that number, then only AFTER all of the rows that contain a number greater than 0 in the number1 column are used, grab the rest of the rows and order them by their number (number2). See, all of the rows have a number2, but by having something greater than 0 in the number1 column, I want them to get boosted up to the top of the list. I think i explained it a little better this time
  7. I have a question, how can I get information and show it in order according to 2 different columns in the db row? Example: MYTABLE: id name number1 number2 I want to get all the rows from MYTABLE, and IF number1 is greater than 0, order them ASC. After all of the rows where number1 is greater than 0 are gone through, start with all the other rows and order them all ASC by number2. I hope im making sense.. how could I do this with 1 query?
  8. All I can figure is it is a browser problem.. because It's working now all of a sudden.. I don't get it.. I'm using firefox... weird ??? Anyways, thanks for all the replies.. solved for now
  9. Try this: while($r=mysql_fetch_array($result)) { $plus = 6; $sql = "UPDATE table SET points = points+{$plus} WHERE username = '$myusername'"; } First, don't put INTEGERS inside of single or double quotes.. it will take it as a string.. Plus i took out all the php adding stuff and just put it in the SQL query (points=points+{$plus})
  10. No, it's only showing 1 when I echo the cookie. But when I manually view the cookies, it shows 1;77c69387a8c3c1ac68dc654e3652a690 like it's supposed to
  11. Thanks, I will set it. BUT, thats not the issue, like I said: "And when i view my cookies, the cookie show the 1;HASH correctly"
  12. K. <?php $sql = mysql_query(" SELECT THE USER INFO ") or die("Cant figure out who the heck you are...<br />".mysql_error()); $user = mysql_fetch_array($sql); $key_string = $user['user_id'].";".md5($the_hash_variable); $_SESSION['ukey'] = $key_string; if ( isset($cpost['i_remember']) ) // if we want a cookie set { setcookie("ukey", $key_string); } ?> ^ That sets the cookie Also, i've echo'd the $ukey variable on a page BEFORE exploding it, and it only returns 1.. weird THIS IS WHAT IT IS THIS IS WHAT IT SHOULD BE And when i view my cookies, the cookie show the 1;HASH correctly
  13. ^ Thats the same thing. list() is just a way faster way of writing it. But I appreciate the reply Still not solved
  14. Please read the whole thread before replying. Thanks The title of this topic is kind of confusing, but I couldn't think of a perfect one real quick. But check this out. After someone logs in, they get a cookie called ukey and it's value is: 1;77c69387a8c3c1ac68dc654e3652a690 (changing for each user, but i'm using me as example.) The 1 is the user_id, separated from a hashkey with a semi-colon. On every page, I have it explode the cookie like so: $ukey = $_COOKIE['ukey']; list($id, $key) = explode(";",$ukey); I then echo the 2 vars.. it comes out like so: ID = 1 KEY = Why is the KEY left blank when it should be 77c69387a8c3c1ac68dc654e3652a690 Thanks
  15. Awesome.. it works But what is the 3rd argument for? (the true/false) I can't find a clear answer with google
  16. I'm checking on the fly whether or not the username is valid and available. The PHP file is working, and the Ajax is working.. here is my code: function checkUsername(obj) { var pattern = new RegExp("^[a-zA-z0-9_]{3,20}$","i"); var error = 0; if ( !obj.value.match(pattern) ) { error = 1; } if ( obj.value == "" ) { error = 1; } // Setup ajax stuff ajax = GetXmlHttpObject(); if (ajax==null) { alert ("Your browser does not support AJAX!"); return; } var url = "./includes/ajaxcheck.php?username="+obj.value; ajax.onreadystatechange=function() { if (ajax.readyState == 4) { var res = ajax.responseText; alert("Response:"+res+"\nError: "+error+""); // debugging purposes if (res == "1") { error = 1; } } } ajax.open("GET",url,true); ajax.send(null); if (error == 0) { // DO ERROR } else { // DONT DO ERROR } return error; } The alert I have setup returns "Response: 1 Error: 0". If the response-text from the PHP file is 1, i want to throw an error. But if it's 0, I want it to be ok. But it's not throwing an error either way I do it. Whats the problem? (should be around this line) var res = ajax.responseText; alert("Response:"+res+"\nError: "+error+""); // debugging purposes if (res == "1") { error = 1; }
  17. Hey, I have a table structured like this: column1 column2 column3 column4 Can I do this: mysql_query(" INSERT INTO table (column2, column4) VALUES ('data1','data2') "); Or do i have to do this: mysql_query(" INSERT INTO table VALUES ('','data1','','data2') "); ? Thanks
  18. Neat little script you've got there [attachment deleted by admin]
  19. this post is more of an advertisement than anything else
×
×
  • 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.