• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deployment SW

Hi there,

first of all: Thy very much for taking time for me.

I'm writing a web based deployment website (based on codigniter) which allowes me to upload a file for one specific user. During the upload process a new record will be added into a db with the state 'pending'. Once the user access the download page the state of the entry in the db should change to 'deployed' and the file should be forced to download (by this awesome download-helper-function).

So: User access the download page
if the file is still pending, change it to deployed and download it.
if the file is already deployed, display an error.

My problem is, on the first time the user access the download-page, the db entry changes to 'deployed', he gets NO file but the error message.

Here's a part of my code:

$query = $this->db->query("
  tbl_deployments d
  tbl_zip_files z
   z.id = d.id_zip_file
  WHERE d.access_code = " . $this->db->escape($access_code));

$result = $query->result();
if(count($result) != 0)
if($result[0]->state == "pending")
  $download_file = $result[0];
  $this->db->query("UPDATE tbl_deployments SET state = 'deployed', download_timestamp = ".date("U")." WHERE access_code = '".$access_code."'");
} else {

  echo "the file is not pending";
} else {
echo "wrong access code";

the user uses an access code to access his file. On upload i'm encrypting the file, so I have to decrypt it first

Thank you for all replies!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.