Jump to content

eddyys

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

eddyys's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Also, && is and, not just & if($row['name'] == $_POST['name'] && $row['password'] == $_POST['password']) {
  2. One suggestion to make, you should put the connection into a handler and then specify that handler when you set the database to use. Ex. $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } http://www.php.net/manual/en/function.mysql-select-db.php
  3. Hi guys, first time on forum, and in desperate need of help. I asked my co workers and they don't have a single clue into what is going wrong. I built a PHP image handler to secure images down to the user too see. When I integrate this into the ajax however, the images only load on the page after all the ajax requests finish. In this case there are 4 ajax requests. I have attached screenshots of the problem before all the ajax requests finish and after. NOTE: This works fine with images that are not being generated PHP. At first I thought it might be a header problem with the image handler but I cant seem to find any people who have seen this problem. Here is the code. class SecureImage { public $user_img_dir; public $db_img_dir; public $temp_img_dir; public $main_img_dir; function __construct(){ global $SESSION; //set the class vars $this->temp_img_dir = BASE_PATH.'webdocs/images/_temp/'; $this->main_img_dir = '/var/images/'; //now check to see if there is a directory for this file //build the directory for the image $user_id = $SESSION->getUserid(); $db_name = $GLOBALS['Config']->db['db_name']; $user_img_dir = "{$this->main_img_dir}{$db_name}/{$user_id}/"; $db_img_dir = $this->main_img_dir.$db_name."/"; //set the class vars $this->user_img_dir = $user_img_dir; $this->db_img_dir = $db_img_dir; //now check to see if the directory is there if(!is_dir($user_img_dir)){ //check to see if the db_name is a dir if(!is_dir($db_img_dir)){ //make the directory mkdir($db_img_dir); } //now make the user id dir mkdir($user_img_dir); } } public function getImage($img){ $img_array = explode('.', $img); switch($img_array[1]){ case 'jpg': case 'jpeg': header('Content-Type: image/jpeg'); break; case 'png': header('Content-Type: image/png'); break; case 'gif': header('Content-Type: image/gif'); break; } header('Content-Disposition: inline;'); //get the file size $img_size = filesize($this->user_img_dir.$img); header('Content-Length: '.$img_size); echo readfile($this->user_img_dir.$img); } } If anyone has any ideas, much appreciated. [attachment deleted by admin]
×
×
  • 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.