Jump to content

query was empty and login form just keeps looping


spike-spiegel

Recommended Posts

The website opens, doesn't show any connection errors, but I can't make any query.

 

If I try to login, I get back to the login page, if I try to make a Search, I get an error inside the website field "Query was empty".

 

 

It happened when I moved the website to a domain folder, I configured everything correctly, so I don't know what's going on...

 

 

Now I moved it to another web host account, the full website's on the root, and I still get those errors.

 

 

Bellow is the main file, it is loaded by every page of the site:

 

 

<?
/*session_start();*/
include "configuration.inc.php";
include "connect.php";

$day = date(d);
$month = date(m);
$year = date(Y);

$del = "delete from job_post where EXday = \"$day\" and EXmonth = \"$month\" and EXyear = \"$year\" ";
$rdel = mysql_query($del) or die(mysql_error());
?>
<HTML>
<HEAD>
<TITLE><?=$sitenameheading?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<?= "$style"; ?>
</style>








<link href="css/common.css" rel="stylesheet" type="text/css" />
<link href="css/our_work.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
        var GB_ROOT_DIR = "./greybox/";
    </script>
<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" /></HEAD>
<BODY link="#000000" vlink="#000000" alink="#000000"  TOPMARGIN=0 MARGINHEIGHT=0">

<table width="900" border="0" cellpadding="0" cellspacing="0" align="center" background="../images/postbg2.jpg">
<tr>
    <td></td>
</tr>
  <tr>
    <td> <TABLE WIDTH=90  CELLPADDING=0 CELLSPACING=0>
   
        <TR>            <TD><div style="
	background:url(../images/header.jpg);
	width:900;
	height:150;
    border-color:#0099FF;


			border-width:1px;
	border-style:solid;"></div>
</TD>
        </TR>
      </TABLE></td>
  </tr>
  <tr>
    <td><table width="100%" class="dott2" border="0" cellspacing="0" cellpadding="4">
        <tr valign="top"> 
          <td width="200">
	  <table width="200" class="dott3" border="0" cellpadding="2" cellspacing="0">
<?
if(!isset($uname) && !isset($upass)) {

echo " 
<tr>
<td bgcolor='$s4employersblock' height='05'></td>

</tr>

<tr> 
                


			<td><strong> <font color='$s3white'><li class='menutext'><a href='http://$myurl/index.php'>HOME</a></font></li>
			 </td>
              </tr>
		  
		  <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/siteadmin/index.php'>Área restrita</a></li>
			 </td>
              </tr>




<td bgcolor='$s4employersblock'><strong> <font color='$s3white'> $JOBSEEKERS</font></strong><br>
<form name=jsl method='post' action='http://$myurl/jobseekers/login.php'>
<table>
<tr>
<td>$USERNAME1</td>
<td align=right> <input type='text' name='uname' size='15'></td>
</tr>

<tr>
<td>$PASSWORD1</td>
<td align=right><input type='password' name='upass' SIZE='15'></td>
</tr>

<tr>
<td colspan=2 align=right>
<input type=hidden name=job_id value=$_GET[job_id]>
<input type='submit' name=submit value='Entrar'></td>
</tr>

<tr><td colspan=2 align=center> <a class=TN href=http://$myurl/jobseekers/forgot.php>Lembrar Senha?</a></td></tr>

</table>
</form>
			</td>
              </tr>
       
<tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/login.php'>$LOGIN</a></li>
			 </td>
              </tr>
<tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/jobseeker_registration.php'>$JOINFORFREE</a></li>
			 </td>
              </tr>
		                <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/post-resume.php'>$POSTRESUME</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu class='menutext'> <li class='menutext'><a href='http://$myurl/jobseekers/edit-resume.php'>$EDITRESUME</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class='menutext'>











			<a href=\"http://$myurl/jobseekers/preview.php\" rel=\"gb_page[630, 500]\">{$VIEWRESUME}</a>

















			</li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/job-search.php'>$SEARCHJOBS</a></li></td>
              </tr>
		  ";
		  
}
else
{

echo "         <tr>     
                <td width='116' bgcolor='$s4employersblock'><strong> <font color='$s3white'> $JOBSEEKERS</font></strong><br>
<tr> 
                <td width='116' bgcolor='#f2f2f2'><strong> <font color='#666666'> $WELCOME ".$_SESSION['uname']."</font></strong></td>
              </tr>
<tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/index.php'>$HOME</a></li></td>
              </tr>
		  <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/post-resume.php'>$POSTRESUME</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu class='menutext'> <li class='menutext'><a href='http://$myurl/jobseekers/edit-resume.php'>$EDITRESUME</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class='menutext'>



						<a href=\"http://$myurl/jobseekers/preview.php\" rel=\"gb_page[630, 500]\">{$VIEWRESUME}</a>





			</li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu class='menutext'> <li class='menutext'><a href='http://$myurl/jobseekers/upload.php'>$UPLOADIMG</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu class='menutext'> <li class='menutext'><a href='http://$myurl/jobseekers/cvupload.php'>$UPLOADCV</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/job-search.php'>$SEARCHJOBS</a></li></td>
              </tr>
		  <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/delete.php'>$DELETEACC</a></li></td>
              </tr>
		  <tr> 
                <td bgcolor=$s12menu> <li class='menutext'><a href='http://$myurl/jobseekers/logout.php'>$LOGOUT</a></li></td>
              </tr>

		  ";
		  
}
?>

<?
$nResult = mysql_query("SELECT * FROM job_employer_info WHERE ename = \"$ename\" ");

$nRow = mysql_fetch_array($nResult);

if(!isset($ename) && !isset($epass)) {

echo "<tr><td height=164 bgcolor=#DEEDFF>





	  <object width='200' height='250'
classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'
codebase='http://fpdownload.macromedia.com/
pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'>
<param name='SRC' value='http://mistercursos.com.br/images/banners/bannermg.swf'>
<param name='scale' value='exactfit'/><embed src='http://mistercursos.com.br/images/banners/bannermg.swf' width='200' height='250'>
</embed>
</object>


<td></tr>";




echo "<tr> 
                <td bgcolor=$s4employersblock><strong><font color=$s3white>  $EMPLOYERS</font></strong><br>
<form name=el method='post' action='http://$myurl/employers/index.php'>
<table>
<tr>
<td>$USERNAME1</td>
<td align=right> <input type='text' name='ename' size='15'></td>
</tr>

<tr>
<td>$PASSWORD1</td>
<td align=right><input type='password' name='epass' SIZE='15'></td>
</tr>

<tr>
<td colspan=2 align=right>
<input type='submit' name=submit value='Entrar'></td>
</tr>

<tr><td colspan=2 align=center> <a class=TN href=http://$myurl/employers/forgot.php>Lembrar Senha?</a></td></tr>

</table>
</form>		</td></tr>
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/PostJob.php'>$LOGIN</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/registre-sua-empresa.php'>$REGISTER</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/PostJob.php'>$POSTJOB</a></li></td>
              </tr>
<tr>
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/EmployerSearch.php'>$SEARCH</a></li></td>
              </tr>";
}
else
{
echo "
<tr> 
                <td bgcolor=$s4employersblock><strong><font color=#FFFFFF>  $EMPLOYERS</font></strong>
			</td></tr>              
<tr> 
                <td width='116' bgcolor='#f2f2f2'><strong> <font color='#666666'> $WELCOME ".$_SESSION['ename']."</font></strong></td>
              </tr>
<tr> 
<tr>
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/index.php'>$HOME</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/PostJob.php'>$POSTJOB</a></li></td>
              </tr>
<tr>
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/employers7.php'>$MANAGEJOBS</a></li></td>
              </tr>
             <!-- <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/employers1.php'>$UPDATEPLAN</a></li></td>
              </tr> !-->
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/employers12.php'>$EDITINFOMENU</a></li></td>
              </tr>
              <tr> 
                <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/upload.php'>$UPLOADLOGO</a></li></td>
              </tr>
              <tr> 
		                  <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/EmployerSearch.php'>$SEARCH</a></li></td>
              </tr>
              <tr> 
		                  <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/delete.php'>$DELETEACC</a></li></td>
              </tr>
              <tr>
              <tr> 
		                  <td bgcolor=$s12menu> <li class=menutext><a href='http://$myurl/employers/logout.php'>$LOGOUT</a></li></td>
              </tr>
              <tr>
		     <td bgcolor='#9FC728'><strong><font color='$s3white'> Disponibilidade da Conta</font></strong></td>
              </tr>
              <tr> 
                <td>	
			$CANPOST <b>vagas.</b><br>
$CANVIEW <b>currículos.</b> 
			</td>
              </tr>";
}
echo"
  <tr>
    <td  bgcolor='$s4employersblock'><strong><font color=$s3white>  </font></strong></td>
  </tr>
  <tr>";

$xa = "SELECT * FROM job_employer_info where featured = '1' order by ename asc LIMIT 10";
$xb = mysql_query($xa) or die(mysql_error());
  while($xc = mysql_fetch_array($xb))
  {
echo "<td bgcolor=$s4employersblock><li class=menutext>



<a href=\"$site/employerview.php?ename=$xc[ename]\" rel=\"gb_page[630, 500]\">$xc[CompanyName]</a>";



  }

?>
            </table>
          </td>
          <td>



</BODY>
</HTML>

 

 

 

 

 

 

 

Please help....

Link to comment
Share on other sites

There is nothing wrong with the code, realized it today in the morning.

 

That appears to be an issue with the session.

 

I can access the website without using the domain name, give it a try:

 

http://mghospedagem.com/~balcaoce/

 

then click the button "Buscar", you will notice that the search works.

 

 

Now do the same thing by going to the domain:

 

http://balcaocerto.com.br

 

 

 

It says "Query was empty"

Link to comment
Share on other sites

Spike, a number of things:

 

1)  "Query was empty" means your query was empty.  That is 100% try and you can't just say "I don't think so," that's what the message says, that's what the message means.  Nothing in your current code seems to be able to cause that particular error (though I didn't read it all), but it IS an error and it IS caused by an empty query.

 

2)  You've mentioned sessions in this thread a couple times but nobody has yet mentioned that sessions are domain-specific.  Your cookies (including the session management cookie) will not transfer to the new domain.

 

 

Link to comment
Share on other sites

Spike, a number of things:

 

1)  "Query was empty" means your query was empty.  That is 100% try and you can't just say "I don't think so," that's what the message says, that's what the message means.  Nothing in your current code seems to be able to cause that particular error (though I didn't read it all), but it IS an error and it IS caused by an empty query.

 

2)  You've mentioned sessions in this thread a couple times but nobody has yet mentioned that sessions are domain-specific.  Your cookies (including the session management cookie) will not transfer to the new domain.

 

 

When I say "I don't think so" I mean that the full code works just fine with the other path, seriously, I tested it, so that's not the code's fault, that's why I opened that other topic.

 

What you mean with IS? Server?

Link to comment
Share on other sites

There's at least 6 8 different things that your code could be doing that works on one server, but not another -

 

1) short_open_tags are not enabled

2) the session start could be failing due to a configuration problem with the session save path

3) the session start could be failing due to the BOM being output and output buffering being off in the php.ini

4) the session.cookie_path setting is not set to match all paths of the domain and you are switching paths

5) same as #4 but for the session.cookie_domain and the host-name/subdomain switching

6) one or both include statements are failing because the file is not present or at the proper path

7) the code in one or both include statement is failing or failing to make a database connection

8) register_globals are off (I see at least two scaler program variables that look like they are from $_POST variables.) Edit: DON'T turn register_globals on if they are off, fix any code that relies on them being on.

 

You need to troubleshoot what your code is actually doing or not doing on the server where it does not work.

 

BTW -  code that uses php's lazy-way short-cuts - short open tags, output_buffering, register_globals, ... is not portable between different server configurations and you often won't have the ability or simply should not to turn the necessary settings on, so it is always best to develop code on a system that has all those short-cut settings turned off.

 

P.S. Is there some reason why the session_start() statement is commented out in the code you posted? That alone could be causing some of the problems or if you were getting an error at that statement, you would need to fix whatever is causing that error.

Link to comment
Share on other sites

I uncommented the session start at main.php, the search worked, but the login still fails.

 

and now I got this: Warning: session_start() [function.session-start]: open(/tmp/sess_d79b5ce9df3d41be643125fce72a29a1, O_RDWR) failed: Permission denied (13) in /home/balcaoce/public_html/jobseekers/accesscontrol.php on line 2

 

Link to comment
Share on other sites

well, the commented start section was part of the problem.

The other part was the /tmp/ folder cache, suddenly, that error described in my last message disappear, so that only means they answered my support ticket to clean the server cache.

 

I've been trying to fix this issue during 3 free days, sleeping only 4 hours a day, and working the website aobut 13 hours a day.

 

Thank you all for the great support, and I'm sorry if I offended someone sometime, cause I noticed some irritation with some of my sentences, it wasn't my intention to offend anyone, seriously, you know, text can be read by many ways.

 

Before coming here, I searched the whole web for support, but your team was the only one who could fully support me. You guys are really php freaks, experts.

 

And sorry for the bad english.

 

See ya .

 

Now I can rest in peace, oops, sleep.

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.