Jump to content

register_globals off solution required!!


schandhok

Recommended Posts

Hey guys
I have been trying to fix each and every page of my site to overcome the register_globals off code changes. I was able to fix session problems with the help of ninja to the point that my search.php page now opens easily as i changed the code in my valodator.php header file with this

php:
<?php
//if(!$user){
  //  header("location: form_login.php");
  // }
     
        if(!$_SESSION['user']){
    header("location: form_login.php");
    }


The only problem now i am encountering is that after i input my parameters for search and submit. I get the following error
Warning: fopen(new_gateway.txt) [function.fopen]: failed to open stream: Permission denied in /usr/local/www/apache22/data/new_gateway.php on line 4

Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /usr/local/www/apache22/data/new_gateway.php on line 9

THis is my new_gateway.php file which is the form action of mysearch.php file...
php:
<?php
    session_start();
  // include "valodator.php";
$file_gateway_respons = fopen('new_gateway.txt', 'w');
$blas=curl_init();
#curl_setopt($blas,CURLOPT_URL,"http://localhost/artur/prob.php");
curl_setopt($blas,CURLOPT_URL,"http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi");
curl_setopt($blas,CURLOPT_POSTFIELDS,$GLOBALS["QUERY_STRING"]);
curl_setopt($blas,CURLOPT_FILE,$file_gateway_respons);
curl_exec($blas);
curl_close($blas);
fclose($file_gateway_respons);
    $file_gateway_respons = fopen('new_gateway.txt', 'r');
    $gateway_respons_text = fread($file_gateway_respons,100000);
    fclose($file_gateway_respons);
 
    if(strpos($gateway_respons_text,"<font color=¥"red¥">ERROR:")==0){
        $gateway_respons_text=str_replace("<form action=¥"http://www.ncbi.nlm.nih.gov/BLAST/Blast.cgi¥" enctype=¥"application/x-www-form-urlencoded¥" method=¥"POST¥" NAME=¥"FormatForm¥">","<form action=new_setparams.php method=get NAME=¥"FormatForm¥" enctype=¥"application/x-www-form-urlencoded¥">",$gateway_respons_text);
        $gateway_respons_text=str_replace("<form action=¥"Blast.cgi¥" enctype=¥"application/x-www-form-urlencoded¥" method=¥"POST¥" NAME=¥"FormatForm¥">","<form action=new_setparams.php method=get NAME=¥"FormatForm¥" enctype=¥"application/x-www-form-urlencoded¥">",$gateway_respons_text);
        $s_query_first=$GLOBALS["QUERY_STRING"];
        session_register("s_query_first");
        }
        else{
            $my_user='chandhs';
            $my_pass='gnome007';
            // $my_pass='';
            $db=mysql_connect(localhost,$my_user,$my_pass);
            mysql_select_db("blast",$db);
           
            $u_id=$user["id"];
            $date=date("Y-m-d");
            $s_query_first=$GLOBALS["QUERY_STRING"];
            $rez=mysql_query("INSERT INTO search (s_user,s_time,s_query_first,s_query_last,s_cdate) VALUES($u_id,'0','$s_query_first','','$date')");
            mysql_close($db);
            $gateway_respons_text=str_replace("<!--  the header  -->",
"<center>
<h2>Western Washington Periodic Search Agent for<br> Protein Database Information</h2>
<img src='NCBI%20Blast.files/wwu_header.gif' width='291' height='90'><BR>
<table>
    <tr>
        <td><a href='index.php'>HOME</a></td>
        <td>  &nbsp&nbsp&nbsp&nbsp</td>
        <td><a href='form_login.php'>LOGIN/REGISTER</a></td>
        <td>  &nbsp&nbsp&nbsp&nbsp</td>
        <td><a href='mysearch.php'>SEARCH</a></td>
        <td>  &nbsp&nbsp&nbsp&nbsp</td>
        <td><a href='info.php'>INFO</a></td>
        <td>  &nbsp&nbsp&nbsp&nbsp</td>
        <td><a href='contacts.php'>CONTACT US</a></td>
    </tr>
</table>
</center>",$gateway_respons_text);
            }
    echo $gateway_respons_text;

?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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