Jump to content

new_member

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by new_member

  1. I have resolve the file download issue. Finalized code in htaccess is:

     

    RewriteEngine On
    # you can add whatever extensions you want routed to your php script
    RewriteCond %{REQUEST_URI} \.(doc|zip|pdf)$ [NC]
    RewriteRule ^(.*)$ download.php?filename=$1 [L]
     
    But it is causing the same problem again as if someone access the file without going through site it will open it. Any idea on how to prevent direct access to files  :confused:
  2. preg_match("/[^\/]+$/", $_SERVER['HTTP_REFFERER'], $matches); //get the filename after last slash

    $file_name= $matches[0];

    header("Content-disposition: attachment; filename=".$file_name);

    header('Content-Type: application/octet-stream');

    readfile($file_name".pdf");

  3. I donot have any single which i am referencing. I have multiple files inside the subdirectory download_files and are reffered by multiple places in the site. I want to restrict all of these files so i have applied the above code in htaccess. Now, i am unable to understand where to put the download.php and how to pass the file name to that so that if someone accesses it through website he should have access to that. Please explain me the flow

  4. I want that if a file in accessed by directly copy paste the url in browser it should restrict its access and that is actually happening by adding the above lines in htaccess. But these lines are not allowing me to access the files even if i access them going through my website. I want the files to be accessible if i reach those files through my site. For this i have googled a lot but none of the code worked

  5. Hi,

     

    I want to restrict access to specific folder if some one copies and paste download file link or folder in browser. For that i have modified my htaccess file and added following lines of codes in that

     

    RewriteEngine On

    RewriteCond %{REQUEST_URI} \.(doc|zip|pdf)$ [NC]

    RewriteRule ^(.*)$ /download-pdf.php?filename=$1 [L]

     

    Beside this i have placed plenty of codes searcher from google to make it accessible when accessed from my domainsite.com

     


     


     

    and searched almost every site. But restricting access to my files will not allow me to access it through my site also.

     

    The only solution i came across is to force download the restricted file if accessed through my site. For that i have made forcedownload.php file and reading the contents of file in that. But the problem is that how to add condition in htaccess to go to download page if accessed through my site. Any help??

  6. Hi,

     

    I want to use mysql dumper database. For that i have applied password protected encryption. Before it was giving 404 error but later on modifying the roor htaccess files by adding

     

    AuthName "MySQLDumper"
    AuthType Basic
    AuthUserFile "myfilepath"
    require valid-user
     
    or
     
    Errordocument 401 error.html
    Errordocument 403 error.html
     
    prompts for the user login. But on adding the login credentials it is taking to same window again and again asking for login info again. Any idea how to solve this??
  7. Hi,

     

    I want to know that how to impCross site script rejection using session id and agent hash key pair in yii. I have read many tutorials:

     

    http://htmlpurifier.org/live/smoketests/xssAttacks.php

     

    http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/#hh6

     

    http://www.yiiframework.com/doc/guide/1.1/en/topics.security#cross-site-scripting-prevention

     

    But i am unable to understand where to implement it in yii using session id and agent key has pair.

     

    Any help??

  8. i know i have to use foreach but how to loop and access the content. I am unable to find this.

     

    For serializing i am just using

     

    serialize($this->['testing])

     

    if i print $this->testing it gives me output

     

    [testing] => Array ( [0] => Array ( [test1] => test.com [test2] => test2 [test4] => test4 ) )

     

    but serializing it gives null dont know why

  9. Hi,

     

    I want to know how to access the values of given array values using loop in php:

     

    Array

    (

    [0] => Array

    (

    [test1] => testval

    [test2] => testval2

    )

     

    i dont know what to loop and how to access it.

     

    Moreover if i am serializing the given array using php serialize function it is giving me output as N;. I dont know whats the problem with the serialize function of my code as i use

     

    serialize($this->['testing]);

     

    [testing] => Array

    (

    [0] => Array

    (

    [test1] => test.com

    [test2] => test2

    [test4] => test4

     

    )

     

    )

     

    Any help??

  10. Hi,

     

    I want to get the language defined in html or meta tags using php as <html lang="en"> using php. I have searched a lot in google but cannot find any way. Similarly i also want to get the language in site being used as if the site text is in japanese there shoould be any function to return the japense language using php. Is there any way to do this?? urgent help needed. Thanks

  11. Hi,

     

    I have been using php mailer class to send mail via smtp. I am using my gmail account info

     

    Here is the code:

     

                        $mail = new PHPMailer();

                        $mail->IsSMTP();
                        $mail->Mailer = "smtp";
                        $mail->SMTPDebug   =    0;  
                        $mail->Host        =    "smtp.gmail.com";
                        $mail->SMTPAuth    =    true;    
                        $mail->SMTPSecure  =    "ssl";
                        $mail->Port        =    456;
                        $mail->Username    =    'gmail id';   
                        $mail->Password    =    'my password';
                        $mail->SetFrom('email from id ', 'name');
                        $mail->Subject     =     "Email Verification";
                        $mail->Body        =     'Dear '.$_GET['Name']
                        $mail->AddAddress('test@yahoo.com',$_GET['Name']);
                        $mail->AddReplyTo('admin mail',"Admin");
                        $mail->IsHTML(true);
                        //$mail->ErrorInfo
                        if(!$mail->Send())
                           $error_mail =  "Mailer Error: ".$mail->ErrorInfo ;
                        else
                            $error_mail =  "Message has been sent";

     

     

     

    It always gives me error

     

    SMTP Connect() failed

     

     

    I have also enabled open ssl extension and uncommented from php.ini. Have also changed the port to 25 but it didnt work. I dont know where the actual problem is??

  12. Hi,

     

    I am using snoopy class to pass the json encoded to site. However if i pass the values using url as:

     

    $values= array(
                'val' => 'val1',
                'val_arr' => "val1", "val2")
              );

     

     

     

    $url = 'path to webservice?values='.json_encode($values);

     

    it gives me correct output by using $_GET as in format

     

    {"val":"val1", "val_arr":["val1", "val2"]}

     

    however by using post method of snoopy class

     

     

    $snoopy = new Snoopy();

    $snoopy->submit($url,json_encode($data);

     

    on receivng end of webservice it gives output as:

     

    Array[0]=>({"val":"val1", "val_arr":["val1", "val2"]})

     

    How can i post the data in json encoded string format using snoopy??

  13. Thanks for the reply. The solution you provided actually worked. But i found another problem with my array as i am passing the array values through ajax and getting using $_GET. I have two fields "name" and "email" and values are passed as

     

    name: "abc"

    email: "test@test.com"

     

    which actually gives

     

    $data['name'] = "abc"

    $data['email'] = "test@test.com"

     

    {data:{"name":"abc"}} etc

     

    is there any way to pass the array in format without name and email label and pass the values only

     

    like

     

    data = array("abc", "test@test.com")

     

    i actually dont want to get

  14. Hi,
     
    i have an array with five values. I want to encode the array using json_encode in format:
     
    {"value1":"val","data":["name", "email"]}
     
    where value 1 is a paremeter in php and data is an array. But if i use json_encode it gives me different output

    here is my code: $arr['value1'] = 'val';$arr['data'] = $data //arrayjson_encode($arr); it gives me {"value1":"val1","data":{"name", "email"}} 

     
    can any one tell men how to encode the array in above format??
     
    thanks

×
×
  • 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.