Jump to content

dcro2

Members
  • Posts

    489
  • Joined

  • Last visited

    Never

Everything posted by dcro2

  1. Session cookies are set to expire when the browser closes. There's no way to delete them when you close the tab or window, at least as far as I know. The only thing I can think of is, if the user visits a movie that doesn't match their option for random genre or year, clear those settings so random is completely random again. Or track the last time your visitor visited a movie and ignore session options after a few minutes. But all of those are kind of clumsy. Edit: what if you pass the genre and year data with $_GET instead?
  2. Look very carefully at these two lines: mysql_query("SELECT supporter FROM dbUsers WHERE username='".$_POST["username"]."' and password='".$_POST["password"]."'"); $supporter=$_POST["supporter"]; See the problem yet? Where is the value of $supporter coming from? You have to fetch a row from the query (see mysql_fetch_array) and then get the field from that array. $row = mysql_fetch_array($result); $supporter = $row['supporter']; Also, always run anything you get from $_POST or $_GET through mysql_real_escape_string before passing it through a query or somebody is bound to do this: SELECT * FROM dbUsers WHERE username='username' and password='blah' OR 1=1
  3. Haave you tried clicking the submit button? How else are you going to get data to the script? Anyway, if you don't want it to reload the page, you have to add the onchange attribute to the <select> and use AJAX to POST the value to your PHP script and then replace whatever part of the page it is you want to be dynamic. I think what IrOnMaSk was trying to say was, please put your code inside or tags.
  4. A MySQL insert doesn't change any rows, it just adds new rows. So I'm not sure what you mean.
  5. $FileCount = count($_FILES['imgs']); This will always be 5 if two or more files are uploaded. You'll want to count $_FILES['imgs']['name'] or some other member. Can't figure out why in_array might not be matching though...
  6. You'll need single quotes around that string you're comparing `uname` against: mysql_query(sprintf("UPDATE members SET Age = '%s' WHERE uname = '$_SESSION[user]'", mysql_real_escape_string($age)))
  7. Take a look at: if ( isset($_POST['name']) && $_POST['name'] === 0 ){ The === operator checks if the two sides are equal as well as if the two sides are the same type. All $_POST members are strings and you're comparing them with an integer, so this will always be false. You should just use empty instead for your checks: if ( empty($_POST['name']) ){
  8. dcro2

    eval()

    Orr... you know, use single quotes, since that's what you used to define the string: eval("print_output('$tt');");
  9. Okay, let me be more specific. Post what a few rows from the table would look like, something like this: column1 column2 column3 thesearevalues thesearevalues thesearevalues and then what you would want your output to LOOK like, based on those rows.
  10. A more complete example would be nice, like what you expect the output to look like.
  11. You could just use time instead of REQUEST_TIME. It's pretty much the same thing. $somecontent = time();
  12. Yeah, I don't really think you understand what you're doing with that query. It's failing, so $result_1 is false. First of all, when you specify field names in a query, you either put nothing around them or wrap them in backticks (`). $result_1 = mysqli_query($link, "SELECT $criteria FROM table ORDER BY $criteria ASC"); Second, let's say $criteria is equal to "name". What you'll get back from that query is the `name` field of all the rows in the table. So, when you fetch a row, then $row will be an array, containing: [0] => "value of `name` for current row" And that's it. Now, if $criteria contains more than one field, then $row will contain one consecutive index (0, 1, 2, etc) for each field selected. If you explain what it is you want to fetch, we might be able to help you.
  13. You're missing an ending double quote in your query. But what exactly would $criteria contain? I can't figure out your logic in the array_push() call. $row would contain one row, with whatever number of criteria you selected. I'm not sure why you're accessing indexes 0, 5, and 10 and then accessing a submember?
  14. You're missing some braces to start and end the while() so only this line is being executed for each row: $username = $user[username]; I can't figure out why this brace is here either: $img="<img src=\"$pic\" width=\"88\" height=\"88\" align=\"center\"><br>"; { echo "<table><td><div id='memcontainer'>
  15. You did show the array construction, but what I'm saying it don't build it yourself! Make $_GLOBALS['History'] a PHP array. json_encode will take that array and make it proper JSON like you want it. Right now it's a string, so json_encode converts it to JSON as a string. It doesn't check what's inside to see if you just decided to make your own JSON array. For example, if this was the contents of $liveArray: $array['Stream'] = array('1', '2', '3'); /*Array ( [stream] => Array ( [0] => 1 [1] => 2 [2] => 3 ) )*/ Then json_encode will take that array and convert it into this: {"Stream":["1","2","3"]} I would just do this: $_GLOBALS['History'] = array(); while($row3 = @mysql_fetch_array($result3)){ $number = $row3['db_Id']; $time = $row3['db_Timestamp']; date_default_timezone_set('America/Phoenix'); $time = date("l M j g:i:s a T Y", $time); $_GLOBALS['History'][] = "<img src='../images/avatar/".md5($row['db_UserId']).".jpg'>".$row['db_UserId']."<br>$time<br>"; unset($alert); }
  16. Can you post your new .htaccess?
  17. You understand what I mean by absolute path, right? Something like /var/www/domain.com/show-user.php?user=%1. If you set it to /show-user.php?user=%1, it will redirect to the php file from the same subdomain, causing a loop.
  18. Take out the R(edirect) flag and make the path absolute: RewriteRule ^.*$ /absolute/path/to/show-user.php?user=%1 [L]
  19. You should post more code. Instead of building your own json array, why not just let the function take care of it? Make Stream an array and json_encode will make it a proper json array. Otherwise, why not just build the whole json string by yourself??
  20. Try: <?php $gamertag = 'Oldg Slow'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $online = $json['response'][0]['user']['is_online']; $online_status = $json['response'][0]['user']['online_status']; ?> Unfortunately I can't figure out the right encoding so the copyright mark shows up right.
  21. I posted the solution a few posts ago. Just click the link and put that function into your code. It's the same thing as the built in money_format.
  22. It would be nice if your first link didn't lead to a 404 error
  23. number_format isn't really equivalent to money_format... someone posted a function on the manual page you can use on Windows: http://us2.php.net/manual/en/function.money-format.php#89060. Try using that.
  24. Sorry, here's what I meant: $result = mysql_query("SELECT idvisit FROM piwik_log_visit WHERE location_ip = '" . inet_pton($userIp) . "' ORDER BY visit_last_action_time DESC LIMIT 1")or die(mysql_error()) ; Notice the single quotes around the value of location_ip
×
×
  • 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.