Jump to content

schandhok

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by schandhok

  1. Hi Guys Here is my php file that i execute through crontab setting <?php include "register_globals.php"; $sql_user='chandhs'; // user mysql $sql_password='gnome007'; // password mysql 4 user $blas=curl_init(); $db=mysql_connect('localhost',$sql_user,$sql_password); mysql_select_db("blast",$db); $rez=mysql_query("SELECT s_time,s_query_last,s_cdate,u_mail FROM search, users WHERE s_user=u _id"); while(list($response_time,$my_query,$cdate,$mail_respons_addr)=mysql_fetch_row($rez)){ #    $file_mail_respons = fopen('/tmp/.mailrespons.txt', 'w');     $file_mail_respons = fopen('mailrespons.txt', 'w');     $flag=false;   if($my_query!=''){     switch($response_time){           case '0': break;           case '1':$flag=true; break;           case '2':             if(date('w')==='1'){             $flag=true;             }             break;           case '3':             if(date('d')==='01'){             $flag=true;             }             break;         }     } if($flag){ $blas=curl_init(); # curl_setopt($blas,CURLOPT_URL,"http://www.ncbi.nlm.nih.gov/blast/Blast.cgi"); # curl_setopt($blas,CURLOPT_POSTFIELDS,trim($my_guery_h)); curl_setopt($blas,CURLOPT_URL,"http://www.ncbi.nlm.nih.gov/blast/Blast.cgi"); curl_setopt($blas,CURLOPT_POSTFIELDS,$my_query); curl_setopt($blas,CURLOPT_FILE,$file_mail_respons); curl_exec($blas); curl_close($blas); fclose($file_mail_respons);     $file_mail_respons = fopen('mailrespons.txt', 'r'); #    $file_mail_respons = fopen('/tmp/.mailrespons.txt', 'r');     $mail_respons_text = fread($file_mail_respons,100000);     fclose($file_mail_respons); #$temp=$mail_respons_text; $temp_response=str_replace("<form action=\"Blast.cgi\"","<form action=\"http://www.ncbi.nlm.n ih.gov/blast/Blast.cgi\"",$mail_respons_text); #    echo $mail_respons_addr."<br>".$mail_respons_text."<br>",$my_query,"<br>"; #  Mail($mail_respons_addr,"",$mail_respons_text);   Mail($mail_respons_addr,"",$temp_response); #echo $temp_response; } }   mysql_close($db); exit; ?> My problem is that in my site when i choose this file to run daily, i get results in my email around 60 in a day same email. Why doesnt it send me just one email instead of sending 60 at a time? My crontab setting for running this file is : * 0 * * * /home/chandhs/blast_site/myblast4cron.php Pls help. ???
  2. 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; ?>
  3. Hi I had created a few php pages for my site which used register_globals as ON but the version of php has been updated at my server and i can no longer user register_globals to authenticate my login. Here is my code form_login.php file contains this>>> <form action="login.php" method=post> <table border=0> <tr> <td>Login</td> <td><input type=text name=login size=16></td> </tr> <tr> <td>Password</td> <td><input type=password name=password size=16></td> </tr> <tr> <td><a href="prepare_registr.php">REGISTER</a></td> <td><input type=submit value=" login "></td> login.php contains this >>>>> include "header.php"; #session_destroy(); unset($user); #session_start(); [color=red]$login=trim($_POST["login"]); $password=trim($_POST["password"]);[/color] $my_user='abcd'; $my_pass='1234'; $db=mysql_connect(localhost,$my_user,$my_pass); mysql_select_db("blast",$db); $rez = mysql_query("SELECT * FROM users WHERE u_login='$login' and u_password='$password'"); if(mysql_num_rows($rez)!=0){ list($user["id"],$user["login"],$user["password"],$user[ "mail"],$user["ldate"],$user["fname"],$user["lname"])=mysql_fetch_row($rez); session_register("user"); $date=date("Y-m-d"); $id=$user["id"]; mysql_query("UPDATE users SET u_ldate='$date' WHERE u_id='$id'"); mysql_close($db); header("location: index.php"); } else{ include "header1.php"; include "left.php"; ?><center> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&n bsp&nbsp&nbsp&nbsp User not found <a href='form_login.php'>Try again</a><? ALL OF THIS WORKS BUT THE AUTHENTICATION AFTER LOGIN TAKES PLACE in header1.php which is this >>>>>>>>>>>>>>>> [color=red]<?php if($user=@$GLOBALS['user']){ ?><h3>Welcome <? echo $user["login"];[/color] ?> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&n bsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&n bsp <font color="red" ><a href=prepare_edit_user.php>Update Account</a> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&n bsp <a href=logoff.php>LogOff</a></font></h3> <? } ?> [font=Verdana]Since register_globals is off if($user=@$GLOBALS['user']){ never comes true and i cannot open my login pages...what other approach can i use to overcome this problem now?[/font] Please Help Thank You
×
×
  • 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.