Jump to content

Php 5


chiefsurf

Recommended Posts

Hello,

 

I recently changed servers. My old server has php 5.0.4 on it. My new server has 5.1.6 both on fedora 6. After setting up my site on the new server, it won't pull my data from my database. I changed the php.ini file to set globals on and long arrays on. There is a connection to the database but it just wont grab the info. My ex-programmer told me to switch back to the older version of php. Before this i would like to see if there something else i can do. to show what i mean here are two links. The first one is my current server which works and the second is my new server.

http://www.singlesmontreal.com/english/search.php?page=0&act=srch

http://74.208.46.212/english/search.php?page=0&act=srch

 

Thank you

Link to comment
Share on other sites

Make sure that the php.ini that you are changing is the one that php is using. Also, did you stop and start your web server to get any changes (or when you copied one over the other) made to php.ini to take effect?

 

Posting the search.php code would help. Someone could identify any php configuration specific thing it is relying on.

 

I changed the php.ini file to set globals on and long arrays on
Are you sure your code is dependent on register globals and register long array variables? Turning them on won't necessarily solve anything. Also, both of these have been removed in php6. If your code is dependent on either of them, it would be better to fix your code now so that it does not completely stop working under php6.

 

I recommend using a program like winmerge http://winmerge.org/ to compare and account for differences between your php.ini files.

Link to comment
Share on other sites

Hi pf.

 

I did stop and start the server and seen the changes take effect. With the globals and long arrays off the site would only show the headers and nothing else and would show a blank page when logging in. With them on everything shows up (except data ) and i am able to login to the site.

 

should i post the whole code from search.php or just a portion of it?

 

Link to comment
Share on other sites

here is some of my error log.

 

[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: A session had already been started - ignoring session_start() in /var/www/vhosts/singlesmontreal.com/httpdocs/english/functions/f_search.php on line 2, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined index: username in /var/www/vhosts/singlesmontreal.com/httpdocs/english/header.php on line 4, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined index: username in /var/www/vhosts/singlesmontreal.com/httpdocs/english/header.php on line 9, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined index: username in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 15, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwithp in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 204, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwithv in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 212, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwitha in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 220, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: slseekinga in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 356, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: psr in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 360, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: slseekinga in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 366, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: slima in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 367, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: slfrom in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 368, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: slto in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 369, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: selectcity in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 370, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwithp in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 398, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwithv in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 402, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: perwitha in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 406, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 980, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:17 2008] [error] [client 129.33.1.37] PHP Notice: Undefined variable: v in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 1110, referer: http://www.phpfreaks.com/forums/index.php?topic=178245.msg793144
[Mon Jan 21 04:12:21 2008] [error] [client 129.33.1.37] PHP Fatal error: Cannot redeclare livebroadcast() (previously declared in /var/www/vhosts/singlesmontreal.com/httpdocs/im/XML2.php:634) in /var/www/vhosts/singlesmontreal.com/httpdocs/im/XML2.php on line 932
[Mon Jan 21 04:34:05 2008] [error] [client 68.39.47.10] PHP Notice: Undefined variable: fid in /var/www/vhosts/singlesmontreal.com/httpdocs/index.php on line 4
[Mon Jan 21 00:08:56 2008] [error] [client 66.130.239.191] PHP Notice: A session had already been started - ignoring session_start() in /var/www/vhosts/singlesmontreal.com/httpdocs/english/functions/f_search.php on line 2, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwithp in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 204, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwithv in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 212, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwitha in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 220, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: psr in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 360, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwithp in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 398, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwithv in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 402, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: perwitha in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 406, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 980, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:57 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: v in /var/www/vhosts/singlesmontreal.com/httpdocs/english/search.php on line 1110, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:08:59 2008] [error] [client 66.130.239.191] PHP Fatal error: Cannot redeclare livebroadcast() (previously declared in /var/www/vhosts/singlesmontreal.com/httpdocs/im/XML2.php:634) in /var/www/vhosts/singlesmontreal.com/httpdocs/im/XML2.php on line 932
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Warning: fopen(/var/www/vhosts/singlesmontreal.com/httpdocs/Logs/200801.doc) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in /var/www/vhosts/singlesmontreal.com/httpdocs/member.php on line 55, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/vhosts/singlesmontreal.com/httpdocs/member.php on line 56, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Warning: fclose(): supplied argument is not a valid stream resource in /var/www/vhosts/singlesmontreal.com/httpdocs/member.php on line 57, referer: http://74.208.46.212/english/index.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Notice: A session had already been started - ignoring session_start() in /var/www/vhosts/singlesmontreal.com/httpdocs/english/functions/f_search.php on line 2, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: vfl in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 180, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: vfl in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 184, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:04 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: page in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 250, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:06 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: codename in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 374, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:06 2008] [error] [client 66.130.239.191] PHP Warning: Division by zero in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 673, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:07 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: page in /var/www/vhosts/singlesmontreal.com/httpdocs/english/user_screen.php on line 861, referer: http://74.208.46.212/member.php
[Mon Jan 21 00:09:09 2008] [error] [client 66.130.239.191] PHP Notice: Undefined variable: fid in /var/www/vhosts/singlesmontreal.com/httpdocs/index.php on line 4, referer: http://74.208.46.212/english/user_screen.php 

Link to comment
Share on other sites

here is the search.php code.

 

<?php
session_start();
/*
require "config.php";
require "functions/f_db.php"; 
mydbconnect();
include("header.php");
*/
require "../config.php";
require "functions/f_db.php"; 
mydbconnect();

include "functions/f_search.php"; 
include("header.php");
$query = "select * from atoken where token='".$HTTP_COOKIE_VARS['username']."'";
$result = mysql_query( $query );
$rows = mysql_fetch_row( $result );
$usn = $rows[0];
$nameuser = $rows[0];
$access = $rows[2];
$nameIDquery = mysql_fetch_row(mysql_query( "SELECT * FROM users WHERE user_name = '".$usn."'" ));
if ($nameIDquery[11] == "Accès Gratuit"){

$typeaccess = "free";
}
if($usn!=NULL)
{
include "functions/security.php";

}


?>


<html>
<head>
<title>Search Result</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="search_style.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<?
if($access>1){

?>
<script language="JavaScript" type="text/JavaScript">
function up_launchChat()
	{
		window.open( "../userplane/ch.php", "UserplaneChatWindow", "width=500,height=400,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1" );
	}
</script>
<?
}
?>
<style type="text/css">
<!--
.style20 {color: #666666}
.linetbt {
border-top-width: 1px;
border-top-style: solid;
border-top-color: #164861;
}

-->
</style>
</head>

<body>

<table width="750" border="0" align="center" cellspacing="0" cellpadding="0">
  <tr>
    <td>    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><?
if($act=="srch" || $act=="fsrch")
{
print "<img src='images/h_search.gif' width='356' height='40'>";
}
if($act=="asrch")
{
print "<img src='images/h_advserch.gif' width='322' height='40'>";
}

if($act=="hmb")
{
print "<img src='images/h_hotmemb.gif' width='356' height='40'>";
}
if($act=="vwd")
{
print "<img src='images/h_viewedmemb.gif' width='356' height='40'>";
}
if($act=="mact")
{
print "<img src='images/h_activem.gif' width='356' height='40'>";
}
if($act=="onl")
{
print "<img src='images/h_online.gif' width='356' height='40'>";
}
if($act=="rb")
{
print "<img src='images/h_rated.gif' width='500' height='40'>";

}
if($act=="vb")
{
print "<img src='images/h_viewpro.gif' width='500' height='40'>";
}
if($act=="vs")
{
print "<img src='images/h_viewvid.gif' width='500' height='40'>";
}
if($act=="pw")
{
print "<img src='images/h_enlpic.gif' width='500' height='40'>";
}
if($act=="fv")
{
print "<img src='images/h_fav.gif' width='207' height='40'>";
}
if($act=="nmb")
{
print "<img src='images/h_newmemb.gif' width='291' height='40'>";
}
if($act=="bl")
{
print "<img src='images/h_blocked.gif' width='291' height='40'>";
}
if($act=="bcl")
{
print "<img src='images/h_buddylist.gif' width='500' height='40'>";
}


?></td>
        </tr>
        <tr>
          <td height="73" align="right" class="text">
<?
if($act!="asrch" && $act!="bcl" && $act!="bl" && $act!="fv" && $act!="pw" && $act!="vs" && $act!="vb" && $act!="rb")
{
?>		  
<form name="fsort" action="search.php?page=0&psr=y&tp=6&act=<?=$act?>" method="post" >	
		  
	   <table width="500" border="0" cellspacing="0" cellpadding="2">
            <tr class="text">
              <td align="right">
<?
if($act!="srch")
{
//<a href='search.php?page=0&act=nmb&gdr=m'>
?>			  
		  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr class="text">
                  <td width="48%" align="right"><strong>Sort by: </strong></td>
                  <td width="5%"><input name="gdr" type="radio" value="M"
<?
if($gdr=="M"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="12%">Males</td>
                  <td width="5%"><input name="gdr" type="radio" value="F"
<?
if($gdr=="F"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="15%">Females</td>
                  <td width="5%"><input name="gdr" type="radio" value="B"
<?
if($gdr=="B"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="10%">Both</td>
                </tr>
              </table>
<?
}
//print $num_results;
?>			  
		  </td>
              <td width="69" rowspan="2"><input name="image" type="image" src="images/go_but.gif" ></td>
            </tr>
            <tr class="text">
              <td align="right">
		  
		  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr class="text">
                  <td width="33%" align="right"><strong>Just Profiles with: </strong></td>
                  <td width="5%"><input name="perwithp" type="checkbox" value="y"
<?
if($perwithp=="y"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="29%">Additional Pictures</td>
                  <td width="5%"><input name="perwithv" type="checkbox" value="y"
<?
if($perwithv=="y"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="12%">Video</td>
                  <td width="5%"><input name="perwitha" type="checkbox" value="y"
<?
if($perwitha=="y"){
echo " checked";
}
?>				  
			  ></td>
                  <td width="11%">Audio</td>
                </tr>
              </table>
		  
		  </td>
              </tr>
          </table>
</form>		  
<?
} //if($act!="asrch")


/*
if($act=="nmb")
{
print "Sort by:  <a href='search.php?page=0&act=nmb&gdr=m'>Males</a> 
				| <a href='search.php?page=0&act=nmb&gdr=f'>Females</a>
				| <a href='search.php?page=0&act=nmb&gdr=b'>Both</a>";
}
if($act=="hmb")
{
print "Sort by:  <a href='search.php?page=0&act=hmb&gdr=m'>Males</a> 
				| <a href='search.php?page=0&act=hmb&gdr=f'>Females</a>
				| <a href='search.php?page=0&act=hmb&gdr=b'>Both</a>";
}	
if($act=="vwd")
{
print "Sort by:  <a href='search.php?page=0&act=vwd&gdr=m'>Males</a> 
				| <a href='search.php?page=0&act=vwd&gdr=f'>Females</a>
				| <a href='search.php?page=0&act=vwd&gdr=b'>Both</a>";
}	
if($act=="mact")
{
print "Sort by:  <a href='search.php?page=0&act=mact&gdr=m'>Males</a> 
				| <a href='search.php?page=0&act=mact&gdr=f'>Females</a>
				| <a href='search.php?page=0&act=mact&gdr=b'>Both</a>";
}	
if($act=="onl")
{
print "Sort by:  <a href='search.php?page=0&act=onl&gdr=m'>Males</a> 
				| <a href='search.php?page=0&act=onl&gdr=f'>Females</a>
				| <a href='search.php?page=0&act=onl&gdr=b'>Both</a>";
}	
*/
if($act=="vb")
{
if($access>=1)
{
	print "<a href=\"#\" onClick=\"MM_openBrWindow('deluser.php?un=".$usn."&act=".$act."&fg=22','',' scrollbars=yes, resizable=yes width=340, height=200')\">";
	print "<img src='images/buttons/del_alluser.gif' width='165' height='22' border=0></a>";
}

}	
if($act=="rb")
{
if($access>=1)
{
	print "<a href=\"#\" onClick=\"MM_openBrWindow('deluser.php?un=".$usn."&act=".$act."&fg=22','',' scrollbars=yes, resizable=yes width=340, height=200')\">";
	print "<img src='images/buttons/del_alluser.gif' width='165' height='22' border=0></a>";
}

}	
if($act=="vs")
{
if($access>=1)
{
	print "<a href=\"#\" onClick=\"MM_openBrWindow('deluser.php?un=".$usn."&act=".$act."&fg=22','',' scrollbars=yes, resizable=yes width=340, height=200')\">";
	print "<img src='images/buttons/del_alluser.gif' width='165' height='22' border=0></a>";
}

}	
if($act=="pw")
{
if($access>=1)
{
	print "<a href=\"#\" onClick=\"MM_openBrWindow('deluser.php?un=".$usn."&act=".$act."&fg=22','',' scrollbars=yes, resizable=yes width=340, height=200')\">";
	print "<img src='images/buttons/del_alluser.gif' width='165' height='22' border=0></a>";
}

}	
?></td>
        </tr>
    </table></td>
    <td><img src='images/spacer.gif' width='170' height='1'></td>
  </tr>
  <tr>
    <td valign="top"><img src='images/spacer.gif' width='560' height='8'><br>
<?
if($page=="0")
{
//print "$page<br>";
		session_unregister("num_results");
		session_unregister("musn");
		session_unregister("nameu");
		session_unregister("sexu");
		session_unregister("sgender");
		session_unregister("aboutu");
		session_unregister("cityu");
		session_unregister("birthua");
		session_unregister("picfname");
		session_unregister("apprp");
		session_unregister("apprpro");			
		session_unregister("ratemeu");
		session_unregister("ratecont");
		session_unregister("rating");			
		session_unregister("viewedm");			
		session_unregister("onlinename");			
		session_unregister("uslev");			
		session_unregister("picuser");
		session_unregister("auser");						
		session_unregister("appaudio");						
		session_unregister("appvid");						
		session_unregister("filevid");						
		session_unregister("promcod");			

		session_unregister("gnum_results");
		session_unregister("gnameu");
		session_unregister("gsexu");
		session_unregister("gsgender");
		session_unregister("gcityu");
		session_unregister("gbirthua");
		session_unregister("gpicfname");
		session_register("gratemeu");						
		session_unregister("grating");			
		session_unregister("gviewedm");			
		session_unregister("gonlinename");			
		session_unregister("guslev");
if($act=="srch") //SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH SEARCH 
{
	if($access<1){	
		session_unregister("ugdr");
		$ugdr= $slseekinga;
		session_register("ugdr");
	}

	if($psr!="y"){
		session_unregister("sgg");
		session_unregister("sii");
		session_unregister("yf");
		session_unregister("yt");
		session_unregister("slcty");
		$sgg= $slseekinga;
		$sii= $slima;
		$yf=$slfrom;
		$yt=$slto;
		$slcty=$selectcity;
		session_register("sgg");
		session_register("sii");
		session_register("yf");
		session_register("yt");
		session_register("slcty");
	}
		$yfrom= (date("Y")-$yf).date("m").date("d");
		$yto= (date("Y")-$yt-1).date("m").date("d");

//				 where (user_name = pf_user_name) and user_name <>'".$usn."' and

		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
 		     						LEFT JOIN audio ON (a_user = user_name)
				 WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5";
		if($sgg!="B")
		{				 
			$sqlstr.= " and sex = '".$sgg."'";
		}
		$sqlstr.= " and seekingender = '".$sii.
					 "' and (birth_date between '".$yto."' and '".$yfrom."')";
//			if($slcty!="ALL" && $slcty!=NULL)
		if($slcty!="ALL")
		{			 
			 $sqlstr.=" and city = '".$slcty."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 

		$sqlstr.=" GROUP BY pf_user_name, p_user
		           ORDER BY lastTimeOnline DESC";
//print $sqlstr."<br> city=".$slcty."<br>";
   
} //if($act="srch")
if($act=="asrch") //ADVANCED SEARCH ADVANCED SEARCH ADVANCED SEARCH ADVANCED SEARCH ADVANCED SEARCH ADVANCED SEARCH ADVANCED SEARCH 
{
	$err_mess="";
//formating seeking string
	$seekf="";
	for($i=0; $i<=7; $i++)
	{
		$pt= "checkseeking".$i;
		if($$pt=="1")
		{
			$seekf.="1";
		}
		else
		{
			$seekf.="_";
		}
	} //for($i=0; $i<=7; $i++)
// formating strings Personal Traits string
	$perstr="";
	for($i=0; $i<=21; $i++)
	{
		$pt= "checkpersonaltraits".$i;
		if($$pt=="1")
		{
			$perstr.="1";
		}
		else
		{
			$perstr.="_";
		}
	}
//Favorite Active Activities string
	$favacac="";
	for($i=0; $i<=18; $i++)
	{
		$pt= "checkfavactivactiv".$i;
		if($$pt=="1")
		{
			$favacac.="1";
		}
		else
		{
			$favacac.="_";
		}
	}
//Music string
		$mu="";
		for($i=0; $i<=18; $i++)
		{
			$pt= "checkmusic".$i;
			if($$pt=="1")
			{
				$mu.="1";
			}
			else
			{
				$mu.="_";
			}
		}
//formating Like to read:
	$ltr="";
	for($i=0; $i<=6; $i++)
	{
		$pt= "checkliketoread".$i;
		if($$pt=="1")
		{
			$ltr.="1";
		}
		else
		{
			$ltr.="_";
		}
	} 
	if($slfrom!="" && $slto!="")
	{
		$yfrom= (date("Y")-$slfrom).date("m").date("d");
		$yto= (date("Y")-$slto-1).date("m").date("d");
	}

//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//				 FROM users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name = uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname

			FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

			 where (user_name = pf_user_name) and user_level>0 and user_level< 5 ";
	if($slfrom!="" && $slto!="")
	{
		$sqlstr.= "and (birth_date between '".$yto."' and '".$yfrom."') ";
	}
	if(trim($txtuname)!="")
	{		 
		$sqlstr.="and LOWER(user_name) LIKE '".strtolower($txtuname)."%' ";	
	} 
//print "txtuname=|".$txtuname."|<br>";
	if($usex=="M" || $usex=="F")
	{

		$sqlstr.="and sex ='".$usex."' ";
	}
	if($selectcity!="ALL")
	{			 
		 $sqlstr.=" and city = '".$selectcity."' ";
	}
	if($selectlanguage!="")
	{
		$sqlstr.=" and lang_preference = '".$selectlanguage."' ";
	}
	if($selecthairolor!="")
	{
		$sqlstr.=" and haircolor = '".$selecthairolor."' ";
	}
	if($selecthairstyle!="")
	{
		$sqlstr.=" and hairstyle = '".$selecthairstyle."' ";
	}
	if($selecteyecolor!="")
	{
		$sqlstr.=" and eyecolor = '".$selecteyecolor."' ";
	}
	if($selectheightfrom!="" || $selectheightto!="")
	{
		$sqlstr.=" and height > '".$selectheightfrom."' ";
		if($selectheightto!="")
		{
			$sqlstr.=" and height < '".$selectheightto."' ";
		}
	}
	if($selectweightfrom!="" || $selectweightto!="")
	{
		$sqlstr.=" and weight > '".$selectweightfrom."' ";
		if($selectweightto!="")
		{
			$sqlstr.=" and weight < '".$selectweightto."' ";
		}
	}
	if($selectbodytype!="")
	{
		$sqlstr.=" and bodytype = '".$selectbodytype."' ";
	}
	if($selectactivitylevel!="")
	{
		$sqlstr.=" and activitylevel = '".$selectactivitylevel."' ";
	}
	if($selectfitnesslevel!="")
	{
		$sqlstr.=" and fitnesslevel = '".$selectfitnesslevel."' ";
	}
	if($selectchildren!="")
	{
		$sqlstr.=" and children = '".$selectchildren."' ";
	}
	if($selectseekingen!="")
	{
		$sqlstr.=" and seekingender = '".$selectseekingen."' ";
	}
	if($slagefrom!="")
	{
		$sqlstr.=" and agedfrom = '".$slagefrom."' ";
	}
	if($slageto!="")
	{
		$sqlstr.=" and agedto = '".$slageto."' ";
	}
	if($selectpolitics!="")
	{
		$sqlstr.=" and politics = '".$selectpolitics."' ";
	}
	if($selectnationality!="")
	{
		$sqlstr.=" and nationality = '".$selectnationality."' ";
	}
	if($selectreligion!="")
	{
		$sqlstr.=" and religion = '".$selectreligion."' ";
	}
	if($selecteducation!="")
	{
		$sqlstr.=" and educationlevel = '".$selecteducation."' ";
	}
	if($selectpastoccupations!="")
	{
		$sqlstr.=" and pastoccupations = '".$selectpastoccupations."' ";
	}
	if($selectcurrentoccupation!="")
	{
		$sqlstr.=" and currentoccupation = '".$selectcurrentoccupation."' ";
	}
	if($selectincomelevel!="")
	{
		$sqlstr.=" and incomelevel = '".$selectincomelevel."' ";
	}
	if($selectrateappimp!="")
	{
		$sqlstr.=" and rateappearanceimp = '".$selectrateappimp."' ";
	}
	if($selectrateintelligimp!="")
	{
		$sqlstr.=" and rateintelligenceimp = '".$selectrateintelligimp."' ";
	}
	if($selectsexpreference!="")
	{
		$sqlstr.=" and sexualpreference = '".$selectsexpreference."' ";
	}
	if($selectmaritalstatus!="")
	{
		$sqlstr.=" and maritalstatus = '".$selectmaritalstatus."' ";
	}
	if($selectsmoker!="")
	{
		$sqlstr.=" and smoker  = '".$selectsmoker."' ";
	}
	if($selectdrinker!="")
	{
		$sqlstr.=" and drinker = '".$selectdrinker."' ";
	}
	if($selectzodiac!="")
	{
		$sqlstr.=" and zodiac = '".$selectzodiac."' ";
	}
	if($selectfavouritecolor!="")
	{
		$sqlstr.=" and favouritecolor = '".$selectfavouritecolor."' ";
	}
	if($seekf!="________")
	{
		$sqlstr.= "and seekingfor LIKE '".$seekf."' ";
	}
	if($perstr!="______________________")
	{
		$sqlstr.= "and personaltraits LIKE '".$perstr."' ";
	}
	if($favacac!="___________________")
	{
		$sqlstr.= "and fav_act_activities LIKE '".$perstr."' ";
	}
	if($mu!="___________________")
	{
		$sqlstr.= "and music LIKE '".$mu."' ";
	}
	if($ltr!="_______")
	{
		$sqlstr.= "and loketoread LIKE '".$ltr."' ";
	}

	$sqlstr.=" GROUP BY pf_user_name, p_user
	           ORDER BY logins DESC";
//print $sqlstr."<br>";				   
}
if($act=="nmb") //NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER NEW MEMBER 
{
		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
  			     						 LEFT JOIN audio ON (a_user = user_name)
			    WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5";
	if($tp<6){ // 6 in sorting form 
		if($ugdr=="M" || $ugdr=="F"){
			$sqlstr.= " and sex = '".$ugdr."'";
		}
	}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 

		$sqlstr.= " GROUP BY pf_user_name, p_user 
					ORDER BY reg_date DESC";

}
if($act=="hmb") //HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER HOTTEST MEMBER 
{
		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
  			     						 LEFT JOIN audio ON (a_user = user_name)
			    WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5";
	if($tp<6){ // 6 in sorting form 
		if($ugdr=="M" || $ugdr=="F"){
			$sqlstr.= " and sex = '".$ugdr."'";
		}
	}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 
		$sqlstr.= " and rate='Y'
				GROUP BY pf_user_name, p_user   
  				ORDER BY hotrate DESC";
}
if($act=="vwd") //MOST VIEWED MEMBERS MOST VIEWED MEMBERS MOST VIEWED MEMBERS MOST VIEWED MEMBERS MOST VIEWED MEMBERS MOST VIEWED MEMBERS 
{

Link to comment
Share on other sites

second half of search.php

[code]$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
  			     						 LEFT JOIN audio ON (a_user = user_name)
			    WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5";
	if($tp<6){ // 6 in sorting form 
		if($ugdr=="M" || $ugdr=="F"){
			$sqlstr.= " and sex = '".$ugdr."'";
		}
	}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 
		$sqlstr.= " and viewed > 0
				GROUP BY pf_user_name, p_user   
				ORDER BY viewed DESC";
}
if($act=="mact") //MOST ACTIVE MEMBERS MOST ACTIVE MEMBERS MOST ACTIVE MEMBERS MOST ACTIVE MEMBERS MOST ACTIVE MEMBERS MOST ACTIVE MEMBERS 
{
		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
  			     						 LEFT JOIN audio ON (a_user = user_name)
			    WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5";
	if($tp<6){ // 6 in sorting form 
		if($ugdr=="M" || $ugdr=="F"){
			$sqlstr.= " and sex = '".$ugdr."'";
		}
	}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 
		$sqlstr.= " GROUP BY pf_user_name, p_user   
  				   ORDER BY logins DESC";
}		
if($act=="onl") //MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE MEMBERS ONLINE 
{
		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
 		     						LEFT JOIN audio ON (a_user = user_name)
				 where (uname = user_name) and (user_name = pf_user_name) and user_level>0 and user_level< 5";
	if($tp<6){ // 6 in sorting form 
		if($ugdr=="M" || $ugdr=="F"){
			$sqlstr.= " and sex = '".$ugdr."'";
		}
	}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 
		$sqlstr.= " GROUP BY uname, p_user ";
}
if($act=="onlall") //MEMBERS ONLINE ALL MEMBERS ONLINE ALL MEMBERS ONLINE ALL MEMBERS ONLINE ALL MEMBERS ONLINE ALL MEMBERS ONLINE ALL 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//				 FROM users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name = uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)
			 where (uname = user_name) and (user_name = pf_user_name) and user_level>0 and user_level< 5 
			 GROUP BY uname, p_user ";
}

if($act=="rb") //RATED BY MEMBER RATED BY MEMBER RATED BY MEMBER RATED BY MEMBER RATED BY MEMBER RATED BY MEMBER RATED BY MEMBER 
{
//		$sqlstr="select pf_user_name, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from voters, users, profiles LEFT JOIN atoken ON pf_user_name= uname
//		where vt_username='".$usn."' and (vt_vtrname = user_name) and (user_name = pf_user_name) and user_name <>'".$usn."' and user_level< 5  and appr_pro='Y'
//		GROUP BY pf_user_name
//		order by reg_date DESC";

//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from voters, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname

			FROM voters, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where vt_username='".$usn."' and (vt_vtrname = user_name) and (user_name = pf_user_name) and user_level>0 and user_level< 5 
	GROUP BY pf_user_name, p_user 
	order by reg_date DESC";
}
if($act=="vb") //VIWED BY MEMBER VIWED BY MEMBER VIWED BY MEMBER VIWED BY MEMBER VIWED BY MEMBER VIWED BY MEMBER VIWED BY MEMBER 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from viewers, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM viewers, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where v_username='".$usn."' and (v_vwrname = user_name) and (user_name = pf_user_name) and user_name <>'".$usn."' and user_level>0 and user_level< 5 
	GROUP BY pf_user_name, p_user 
	order by reg_date DESC";
//		order by hotrate DESC";
}
if($act=="vs") //VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN VIDEO SEEN 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from videoseen, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM videoseen, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where vid_usr_name='".$usn."' and (vid_vwr_name = user_name) and (user_name = pf_user_name) and user_name <>'".$usn."' and user_level>0 and user_level< 5 
	GROUP BY pf_user_name, p_user 
	order by reg_date DESC";
}
if($act=="pw") //PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED PICTURE VIEWED 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from picseen, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM picseen, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where pic_username='".$usn."' and (pic_vwrname = user_name) and (user_name = pf_user_name) and user_name <>'".$usn."' and user_level>0 and user_level< 5 
	GROUP BY pf_user_name, p_user 
	order by reg_date DESC";
}
if($act=="fv") //FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES FAVORITES 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from favorites, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM favorites, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where fusr_name='".$usn."' and (fav_name = user_name) and (user_name = pf_user_name) and user_level>0 and user_level< 5
	GROUP BY pf_user_name, p_user 
	order by hotrate DESC";
}
if($act=="bl") //BLOCKED USERS BLOCKED USERS BLOCKED USERS BLOCKED USERS BLOCKED USERS BLOCKED USERS 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//			   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//		from blocks, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM blocks, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

	where user='".$usn."' and (block = user_name) and (user_name = pf_user_name) and user_level>0 and user_level< 5
	GROUP BY pf_user_name, p_user 
	order by hotrate DESC";
}
if($act=="bcl") //BUDDY CHAT LIST BUDDY CHAT LIST BUDDY CHAT LIST BUDDY CHAT LIST BUDDY CHAT LIST BUDDY CHAT LIST BUDDY CHAT LIST 
{
//		$sqlstr="select pf_user_name, p_user, sex, seekingender, aboutmeshort, city, birth_date, user_level,
//					   picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
//				from chatBuddy, users LEFT JOIN pictures ON user_name = p_user, profiles LEFT JOIN atoken ON pf_user_name= uname
	$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
					picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
			FROM chatBuddy, users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
		     						LEFT JOIN audio ON (a_user = user_name)

			where chatBuddy.userID='".$cbid."' and (chatBuddy.buddy = users.userID) and user_level>0 and user_name = pf_user_name
			GROUP BY pf_user_name, p_user 
			order by hotrate DESC";
}
if($act=="fsrch") //FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS FIREFIGHTERS 
{
		$sqlstr="SELECT pf_user_name, a_user, appr_a, p_user, apprvid, vidfilename, sex, seekingender, aboutmeshort, city, birth_date, promcode, user_level,
						picfilename, apprpic, appr_pro, rate, viewed, logins, rate_cont, ROUND(rate_tot/rate_cont,2) as hotrate, uname
				FROM users, profiles LEFT JOIN pictures ON (p_user = user_name) LEFT JOIN atoken ON (uname = user_name)
  			     						 LEFT JOIN audio ON (a_user = user_name)
			    WHERE (user_name = pf_user_name) and user_level>0 and user_level< 5 AND promcode='4949ladder'";
//		if($tp<6){ // 6 in sorting form 
//			if($ugdr=="M" || $ugdr=="F"){
//				$sqlstr.= " and sex = '".$ugdr."'";
//			}
//		}
		if($gdr=="M" || $gdr=="F"){
			$sqlstr.= " and sex = '".$gdr."'";
		}
		if($perwithp=="y")
		{
			$sqlstr.=" and p_user IS NOT NULL";
		}
		if($perwithv=="y")
		{
			$sqlstr.= " and apprvid = 'Y' and vidfilename<>''";
		}				 
		if($perwitha=="y")
		{
			$sqlstr.= " and a_user IS NOT NULL and appr_a IS NOT NULL";
		}				 

		$sqlstr.= " GROUP BY pf_user_name, p_user 
					ORDER BY reg_date DESC";

}

//if($access==5)
//{
//print $sqlstr."<br>";
//print $gdr."<br>ugdr=$ugdr<br>tp=$tp";
//}
	$result = mysql_query($sqlstr);
	$num_results = mysql_num_rows($result);
//print "num_results= $num_results";
	$gnum_results=0;
	if($num_results<=0)
	{
		print "<p><span class='errortxt'>No matches for your search.</span></p>";
	}
	else
	{
		if($act!="srch" && $act!="onl" && $num_results> $maxViewLimit)
		{
			$num_results= $maxViewLimit;
		}
		$j=0;
		for($i=0; $i<$num_results; $i++)
		{
			$row= mysql_fetch_array($result);
			$nameu[$i]=$row["pf_user_name"];
			$sexu[$i]=$row["sex"];
			$sgender[$i]=$row["seekingender"];
			$aboutu[$i]=$row["aboutmeshort"];
			$cityu[$i]=$row["city"];
			$birthua[$i]=$row["birth_date"];
			$picfname[$i]=$row["picfilename"];
			$apprp[$i]= $row["apprpic"]; 
			$apprpro[$i]= $row["appr_pro"];
			$ratecont[$i]= $row["rate_cont"];
			$ratemeu[$i]= $row["rate"];				
			$rating[$i]= $row["hotrate"];
			$viewedm[$i]= $row["viewed"];
			$onlinename[$i]= $row["uname"];
			$uslev[$i]= $row["user_level"];
			$picuser[$i]= $row["p_user"];
			$auser[$i]= $row["a_user"];
			$appaudio[$i]= $row["appr_a"];
			$appvid[$i]= $row["apprvid"];
			$filevid[$i]= $row["vidfilename"];	
			$promcod[$i]= $row["promcode"]; 							


			// GALLERY STUFF GALLERY STUFF GALLERY STUFF GALLERY STUFF GALLERY STUFF GALLERY STUFF
			if($row["apprpic"]=="Y" && $row["picfilename"]!=NULL)
			{
				$gnum_results+=1;
				$gnameu[$j]=$row["pf_user_name"];
				$gsexu[$j]=$row["sex"];
				$gsgender[$j]=$row["seekingender"];
//					$gaboutu[$i]=$row["aboutmeshort"];
				$gcityu[$j]=$row["city"];
				$gbirthua[$j]=$row["birth_date"];
				$gpicfname[$j]=$row["picfilename"];
				$gratemeu[$j]= $row["rate"];				
				$grating[$j]= $row["hotrate"];
				$gviewedm[$j]= $row["viewed"];
				$gonlinename[$j]= $row["uname"];
				$guslev[$j]= $row["user_level"];

				$j++;
			}
		}
		$musn = $usn;
		session_register("num_results");
		session_register("musn");
		session_register("nameu");
		session_register("sexu");
		session_register("sgender");
		session_register("aboutu");
		session_register("cityu");
		session_register("birthua");
		session_register("picfname");
		session_register("apprp");
		session_register("apprpro");			
		session_register("ratecont");
		session_register("ratemeu");
		session_register("rating");			
		session_register("viewedm");			
		session_register("onlinename");			
		session_register("uslev");			
		session_register("picuser");						
		session_register("auser");						
		session_register("appaudio");						
		session_register("appvid");						
		session_register("filevid");						
		session_register("promcod");

		session_register("gnum_results");
		session_register("gnameu");
		session_register("gsexu");
		session_register("gsgender");
		session_register("gcityu");
		session_register("gbirthua");
		session_register("gpicfname");
		session_register("grating");			
		session_register("gviewedm");			
		session_register("gonlinename");
		session_register("guslev");									

//print "num_results=".$num_results;			
//function get_search_res($namea, $sexa, $sgendera, $aboutua, $cityua, $birthua, $picfnamea, $apprpa, $apprproa, $ratemea, $num_resultsa, $page)
if(!$gdr || $gdr=="")
{
	$gdr="O";
}
		get_search_res($act, $gdr, 1, $access, $musn, $num_results, $nameu, $sexu, $sgender, $aboutu, $cityu, $birthua,
						$picfname, $apprp, $apprpro, $ratecont, $ratemeu, $rating, $viewedm, $onlinename, $uslev,
						$picuser, $auser, $appaudio, $appvid, $filevid, $typeaccess, $promcod, $nameuser);
	}
} //if($page==0)
else 
{
if(!$gdr || $gdr=="")
{
	$gdr="O";
}

	if($v=="g")
	{
		get_gall_search_res($act, $gdr, $page, $gnum_results, $gnameu, $gsexu, $gsgender, $gcityu, $gbirthua, $gpicfname, $gratemeu, $grating, $gviewedm, $gonlinename, $guslev);
	}
	else
	{
//			get_gall_search_res($nameu, $sexu, $sgender, $cityu, $birthua, $picfnamea, $num_resultsa, $page)
		get_search_res($act, $gdr, $page, $access, $musn, $num_results, $nameu, $sexu, $sgender, $aboutu, $cityu, $birthua,
						$picfname, $apprp, $apprpro, $ratecont, $ratemeu, $rating, $viewedm, $onlinename, $uslev,
						$picuser, $auser, $appaudio, $appvid, $filevid, $typeaccess, $promcod, $nameuser);
	}	
}		
?>	</td>
    <td width="169" align="center" valign="top">
<?	
if($v=="g")
{
?>
<img src='images/spacer.gif' width='35' height='65'>
<?
}
else
{
?>
<img src='images/spacer.gif' width='35' height='83'>
<?
}	

if($usn!=NULL)
{
$query2 = "select * from users where user_name='".$usn."'";
$result2 = mysql_query( $query2 );
$rows2 = mysql_fetch_row( $result2 );
$last_date = $rows2[9];
$query3 = "select * from atoken ";
$result3 = mysql_query( $query3 );
$numrows = mysql_num_rows( $result3 );

$count_sqry_n="Select * From message where to_u = '".$usn."' and stat_u = 'n' and subject != 'Teaser' and del_in = 'N'";
$count_sqry_t="Select * From message where to_u = '".$usn."' and subject = 'Teaser' and stat_u = 'n' and del_in = 'N'";
$sent_sqry_t="Select * From message where from_u = '".$usn."' and subject = 'Teaser' and del_out ='N'";
$count_sqry_m="Select * From message where from_u = '".$usn."' and subject != 'Teaser' and del_out ='N'";

$numin_n_query=mysql_query($count_sqry_n);
$numin_n=mysql_num_rows($numin_n_query);
$numin_t_query=mysql_query($count_sqry_t);
$numin_t=mysql_num_rows($numin_t_query);
$sent_t_query=mysql_query($sent_sqry_t);
$sent_t=mysql_num_rows($sent_t_query);
$sent_m_query=mysql_query($count_sqry_m);
$sent_m=mysql_num_rows($sent_m_query);

$stats = "SELECT * FROM profiles WHERE pf_user_name = '".$usn."'";
$doStats = mysql_query(	$stats );
$getStats = mysql_fetch_row($doStats);

	$sqlstr="select * from favorites where fusr_name='".$usn."'";
	$frst = mysql_query($sqlstr);
	$favqtt = mysql_num_rows($frst);

?>	<table id="Table_01" width="169" height="279" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="3">			<img src="images/pi1002_01.gif" width="169" height="28" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/pi1002_02.gif" width="1" height="244" alt=""></td>
	<td width="167" height="244" valign="top">

<table id="Table_01" width="167" height="244" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td>
		<img src="images/spacer.gif" width="131" height="12" alt=""></td>
	<td><img src="images/spacer.gif"></td>
</tr>
<tr>
	<td>
		<a href="search.php?page=0&act=vb"><img src="images/pi1001_01.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? echo $getStats[52];?></font></td>
</tr>
<tr>
	<td>
		<a href="search.php?page=0&act=rb"><img src="images/pi1001_05.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? echo $getStats[48];?></font></td>
</tr>
<tr>
	<td>
		<img src="images/pi1001_09.gif" alt=""></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? echo round(($getStats[47] / $getStats[48]),2);?></font></td>
</tr>
<tr>
	<td>
		<a href="search.php?page=0&act=vs"><img src="images/pi1001_13.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? echo $getStats[56];?></font></td>
</tr>
<tr>
	<td>
		<a href="search.php?page=0&act=pw"><img src="images/pi1001_17.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? echo $getStats[53];?></font></td>
</tr>
<tr>
	<td>
		<a href="mailSystem/ms_mailinbox.php" target="inbx">
		<?
		  	if($numin_n!=0)
			{
		?>
				<img src="images/pi1001_03b.gif" border="0">
		<?	
			}
			else
			{
		?>
				<img src="images/pi1001_03.gif" border="0">
		<?
			}
		 ?>

		</a>
		</td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? print $numin_n; ?></font></td>
</tr>
<tr>
	<td>
		<a href="mailSystem/ms_sentemails.php" target="sent"><img src="images/pi1001_07.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? print $sent_m; ?></font></td>
</tr>
<tr>
	<td>
		<a href="mailSystem/ms_teaserinbox.php" target="inbx">
		<?
		  	if($numin_t!=0)
			{
		?>
				<img src="images/pi1001_11b.gif" border="0">
		<?	
			}
			else
			{
		?>
				<img src="images/pi1001_11.gif" border="0">
		<?
			}
		 ?>
		</a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? print $numin_t; ?></font></td>
</tr>
<tr>
	<td>
		<a href="mailSystem/ms_sentteaser.php" target="sent"><img src="images/pi1001_15.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? print $sent_t; ?></font></td>
</tr>
<tr>
	<td>
		<a href="search.php?page=0&act=fv"><img src="images/pi1001_16.gif" alt="" border="0"></a></td>
	<td align="center"><font face="arial" size="1" color = "#AB0B0B" ><? print $favqtt; ?></font></td>
</tr>
</table>
</td>
	<td>
		<img src="images/pi1002_04.gif" width="1" height="244" alt=""></td>
</tr>
<tr>
	<td colspan="3">
		<img src="images/pi1002_05.gif" width="169" height="7" alt=""></td>
</tr>
</table>
<?
if($access>1){
?>
<!-- <a href="http://www.leskratch.com/" target="_blank"><img src='images/skratchbanner.jpg' border='0'></a> -->

<!-- <a href="luna_index.php"><img src="images/lunabanner.gif" border="0"></a> -->
<?
}
//<a href="faqs.php"><img src="images/blocker-add-eng.gif" border="0"></a></br>

}

if($access<1)
{
?>
<a href='/english/join.php'><?
if(rand(0, 1)==0){
	print "<img src='images/banner-150x60-2a.gif' border='0'>";
}
else{
?>
	<img src='images/banner-150x60-2b.gif' border='0'>
<?	
}
?></a>

<!-- <a href="luna_index.php"><img src="images/lunabanner.gif" border="0"></a> -->
<?

}
elseif($access==1)
{
print "<a href='/english/subscription.php'><img src='images/bannsub.jpg' width='160' height='432' border='0'></a>";
?><br>


<?
}
?>	

[/code]

Link to comment
Share on other sites

This is NOT a problem with the version of php. It is due to configuration differences (and poorly written and out of date code.)

 

You can configure php the same and the code will probably start working. However, there are a few things that have been eliminated in php6. So, if you don't bring the code up to current standards, it will not work under php6 and nothing you do to the php configuration will get it to work.

 

I posted a link above to a utility program that will help compare and resolve differences between the two different php.ini files. Just finding out what is different between the two files will also help tell you what things in the code need to be updated.

Link to comment
Share on other sites

thanks for your replies PF.

 

I used your utility and there were not too many differences. When you say configure php the same, what exactly do you mean. I know this is probably a stupid question but like i said, i know nothing of php or programming but i am good at following instructions.

Link to comment
Share on other sites

The php.ini contains a few server specific path settings and some default settings, but mostly it contains settings that determine what external extensions get loaded and how php behaves.

 

If your main problem is that database queries don't seem to execute, I would suspect either that the database extension is not being loaded, or the queries are failing because the data is not as expected due to a php setting like register globals or magic quotes.

 

From the posted code, the mysql_queries have no error checking (and I would guess that the mysql_connect() and mysql_select_db() function calls don't either) and a query that fails due to a problem with the database server will also output "No matches for your search." The "mysql_num_rows(): supplied argument is not a valid MySQL result" errors in the log are due to this. The code blindly continues execution. If you add the following on to the end of each mysql_query() statement, you will get some meaningful output as to why the query is failing -

 

or die("Query failed: " . mysql_error());

 

From the error log, some of the "Undefined" Notice message are because the variables are not being set, probably because register globals are off. This prevents the parameters on the end of the url from being seen by the code.

 

The messages about a session already started, cannot redeclare a function, and division by zero are simply due to poor programming.

 

The fopen(), fwrite(), and fclose() errors are due to a file/folder permission problem.

 

Edit: Because of the "mysql_num_rows(): ..." error message, at least the mysql extension is present and is being loaded.

Link to comment
Share on other sites

Continuation of the above - The fatal error about "cannot redeclare a function" is actually stopping execution at that point. This type of error is usually caused by an include()/require() that is including the same file more than one time. As to why this is occurring now (perhaps it is occurring on the previous server) would require tracing through the code to find out where and how the function is getting defined.

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.