Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. I think it's only possible by echoing the json encoded (json_encode) $_POST array into the JavaScript.
  2. Actually just found out the file is deleted at the end of the request. In that case then you could move the file to another location, temporarily, while you prompt the user to overwrite the original. Or .. Something as simple as a check box actually as they upload the file could be easier. Edit: Heh, PFMaBiSmAd beat me to it.
  3. I assume you mean 'if file exists, overwrite?'.. You could store the temporary file name ($_FILES['tmp_name']) within a session variable, prompt the user, then if they agree "move_uploaded_file". Would it not be better to use a system where you don't get duplicate file names though?
  4. Glad it's working, mrMarcus was right then. I'll not give session_register() advice anymore It's actually deprecated as of PHP5.3 - the last 'major version' - I dare say not yours.
  5. It's worth giving it a shot! Try removing the session_register() calls.. May as well remove them anyway to be honest! What would make me think against that though is that you're not going back to login.php in between downloads -- are you? So for it to work the first time must mean it's registered the session correctly.
  6. Combining $_SESSION with session_register() wouldn't cause any troubles, it's just session_register() is deprecated as of PHP5.3. Edit: Combining $_SESSION with session_register() wouldn't cause any troubles in the way he's using it **
  7. I'd have to agree too. The place I work have recently taken on 2 contract Java developers to write the site's search engine (as it has to integrate with MS Dynamics)! We also have Java servlets for a lot of B2B stuff.
  8. Yeah sorry, was pretty late there. The second code I provided won't fix your problem though, was merely a suggestion... However if you try dumping out the data, it'll hopefully point out where the problem is.
  9. header("location:thanks.php"); Would suggest "thanks.php" doesn't exist. Are they definitely within the same directory?
  10. I can't see any reason why this would happen *within this code*. Perhaps when you navigate away from the page other code is being run that is affecting the permissions session variable? Have you tried dumping the session data to see what's there when the download fails? For example: else { /* No permission */ echo "You do not have permission to download this file"; print_r($_SESSION); } Edit: Also to build on mrMarcus' suggestions, you could remove the loop altogether: <?php require_once('connections/mseis.php'); ?> <?php /* This code assumes that users may have mulitple permissions but files will only have one set of permissions Therefore set the lowest permission level ('public') on files which should be available to all and grant 'op' to higher ranking users */ session_start(); if (!isset($_GET['id'])) { echo "No ID specified"; die; } mysql_select_db($database_mseis, $mseis); $selectSQL = sprintf("SELECT * FROM downloads WHERE id = %s", GetSQLValueString($_GET['id'], "text")); $result = mysql_query($selectSQL, $mseis) or die(mysql_error()); if(mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); if (strpos($_SESSION["permissions"], $row["permissions"]) !== false || $row["permissions"] == "public") { /* Start download */ $file = $row["file"]; $dir="downloads/"; $file = $dir . $file; header("Content-type: application/force-download"); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($file)); header("Content-disposition: attachment; filename=\"" . basename($file) . "\""); readfile("$file"); } else { /* No permission */ echo "You do not have permission to download this file"; } } else { /*Not found*/ echo "File not found"; } ?>
  11. Could you show the code where these variables are declared? Also echo them out and check they are the values you're expecting.
  12. I'd not include the actual email address within the form (for spam reasons) if I were you. Instead just set the check box value to true and check within your PHP code if they have checked sales/support and send accordingly. Without being able to see the bulk of the code, are you correctly setting the $support / $sales vars?
  13. I don't see what that proves?
  14. That link just times out..
  15. Mmm, not for me it doesn't? Do you have a link or anything that states this?
  16. You may need to restart the web server for the changes to take effect? Edit: Oh wait. The image you posted shows it off..
  17. $PageContent = curl_exec($cUrl); curl_close($cUrl); echo $PageContent; He's storing the return of curl_exec() within the "$PageContent" var, then echoing it out. With RETURNTRANSFER set to true it wouldn't matter because he's echoing the var, with it set to false it also wouldn't matter because the content would be outputted directly by curl_exec().
  18. Actually using 'CURLOPT_RETURNTRANSFER' returns the string, instead of outputting it directly. Either way his code *should* display the result.
  19. Hmm.. shot in the dark but have you tried not using 'short_open_tags'?
  20. As I said, can you show more code -- that creates and returns the HTML?
  21. Thanks, now I can sleep at night!
  22. Don't know if anybody's noticed this (or really cares too much) but there's bit of alignment issue with the 'people viewing this thread' section... [attachment deleted by admin]
  23. Odd. Can't see a reason why it would. Is it definitely doing both? Try adding in some random echo's to check for sure.. while($row = mysql_fetch_array($result)){ $debit = $row['debit']; $credit = $row['credit']; $acnum = $row['acnum']; $query1 = "SELECT cbal FROM accounts WHERE acnum = '$acnum'"; $res = mysql_query($query1); $balancenum=mysql_num_rows($res); while($row1 = mysql_fetch_array($res)){ $cbal = $row1['cbal']; } If (is_numeric($debit)){ $actype = substr($acnum,0,1); settype($actype, "integer"); echo $actype; echo "<br>"; echo gettype($actype); echo "<br>"; If ($actype == 1 || $actype == 5 || $actype == 6 || $actype == { echo 'foo'; $cbal = $cbal - $debit; $sql2="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'"; echo "2" . $sql2; echo "<br>"; mysql_query($sql2); } else { echo 'bar'; $cbal = $cbal + $debit; $sql2="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'"; echo "2". $sql2; echo "<br>"; mysql_query($sql2); } } If (is_numeric($credit)){ $actype = substr($acnum,0,1); settype($actype, "integer"); echo $actype; echo "<br>"; echo gettype($actype); echo "<br>"; If ($actype == 1 || $actype == 5 || $actype == 6 || $actype == { $cbal = $cbal + $credit; $sql="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'"; echo $sql; echo "<br>"; mysql_query($sql); } else { $cbal = $cbal - $credit; $sql="UPDATE accounts SET cbal = '$cbal' WHERE acnum = '$acnum'"; echo $sql; echo "<br>"; mysql_query($sql); } } } (note the 'foo' / 'bar' echos)
  24. Can you post more code? No reason why, if that's all 'ads_display()' returns, that they should be displayed one per line..
  25. Heh noo, don't use tables. As I said before is there any special reason why these images need to be wrapped in a div? Styling purposes or anything? If not just remove it so you just have the image: <a href='http://www.****.com/***/'> <img src=http://www.****.com/./uploads_user/1000/2/0_4230.jpg width=50 border=0> </a>
×
×
  • 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.