Jump to content

tamanna

New Members
  • Posts

    7
  • Joined

  • Last visited

tamanna's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I want the user to get authenticated before file download starts Here is my code: <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Your request is cancelled'; exit; } else { //check $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] if (isset ($valid)) { //start download $path = './data/negative_seq_60.txt'; $type = "text/plain"; header("Expires: 0"); header("Pragma: no-cache"); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); } else { //show error } } ?> But on clicking download link, I am getting the following error : " Undefined variable: valid at line no 9". Please help.
  2. I had saved the results in a text file and now trying to send these to the user via provided mail using localhost on ubuntu system. Code : $to=$_POST['email']; $subject='Your results'; $body=$data; (//here $data stores the output file in text format) $from="http://localhost/matepred/blast/bin/new.php"; mail( $from, $to, $subject, $body); But it isn't sending any mail. Can anyone help me to know the problem with the code. Or is this a problem with localhost?
  3. I want to do something like this, I had a html query submission form linked to php. I want to send the output generated after php execution to the user through mail id provided in the form, in a manner such that when user click submit button, he well be redirected to thank you page and php keeps on running in the background and as soon as the output is generated, it will be send to the end user through email. As my query takes time to execute, so I don't want the end user to keep waiting till the program gets finish. Here is my code: <?php $seq = $_POST['seq']; if (isset($_POST['seq'])) { $b = fopen("sequence.txt", "w"); fwrite($b, $seq); fclose($b); system("perl /opt/lampp/htdocs/matepred/blast/bin/scriptforblastcompleterun.pl sequence.txt nr > out"); system("perl /opt/lampp/htdocs/matepred/blast/bin/format.pl > output"); system("perl /opt/lampp/htdocs/matepred/blast/bin/testing.pl output"); echo "<div align='center'><font color='blue'><b>RESULT</font></div>"; $i=1; $files = array(); foreach (glob("file_*.out")as $file) { $files[] = $file; $b = fopen("/opt/lampp/htdocs/matepred/blast/bin/$file", "r"); $s=fgets($b); fclose($b); echo "<table border=10. align=center><tr bgcolor=lightgreen><th>SerialNo</th><th>Value</th><th>Decision</th><th></tr>"; echo '<td>'. $i++. '</td>'; echo "<td>$s</td>"; if($s>=0) { echo "<td>Yes</td>"; } else { echo"<td>No</td>"; } echo "</table>"; } } ?> html table part marked in red here is the output which I want to send back to the user. Can anybody help me in linking my php output to the mail. Thanks in advance.
  4. Yes svm-predict is an executable. pssmout is created but it is an empty file.
  5. I have a PHP script within which I have embedded a Perl program using system command. The Perl program is as under; <code> #!/usr/bin/perl system("perl /opt/lampp/htdocs/matepred/blast/bin/scriptforblastcompleterun.pl sequence.txt uniprot_sprot.fasta > out"); system("perl /opt/lampp/htdocs/matepred/blast/bin/convert.pl"); system("perl /opt/lampp/htdocs/matepred/blast/bin/format.pl > output"); system("/opt/lampp/htdocs/matepred/blast/bin/svm-predict output pssm.scale.model pssm.predict >pssm.out"); <code> The first four commands of this program run correctly, but the last one does not run. This one contains an executable named "svm-predict". I guess this is because I need to grant special permissions to the PHP user for running executables. Please suggest.
  6. I am running a binary exectable through system command in php. Can anyone please tell me how to grant user permissions to it so as to get desired result. Code I used: system("/opt/lampp/htdocs/folder/svm-predict filename modelfile predict >result");
×
×
  • 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.