define ("Const_dbname", "rocketreader_reciprocal", true);
define ("Const_dbUsername", "root", true);
define ("Const_dbpassword", "l3galadvic3", true);
define ("Const_dbhost", "localhost");
$link = mysql_connect(Const_dbhost, Const_dbUsername, Const_dbpassword)
or die("Could not connect to database");
mysql_select_db(Const_dbname) or die("Could not select database");
?>
define("siteName","www.rocketreader.com");
define("dispSiteName","www.rocketreader.com");
define("searchText","rocketreader.com");
function fnWriteOptionList($id,$fldlist,$table,$where,$debug)
{
$query="select $fldlist from $table $where ";
if($debug == 1){ print $query;}
if($debug == 2){ print $query; exit();}
$recordset=mysql_query($query);
if(!$recordset)
{
//fnErrorLog(mysql_error(),$adminEmail);
}
else
{
$numrows=mysql_num_rows($recordset);
for($counter=0;$counter<$numrows;$counter++)
{
$record=mysql_fetch_row($recordset);
print "
".stripslashes($record[1]);
print " ";
}
mysql_free_result($recordset);
}
return ;
}
function GiveValue($wherecondition,$fields,$tablename,$debug)
{
$retval="";
$strSQL="select $fields from $tablename where $wherecondition";
print ($debug == "1") ? $strSQL: "";
// exit();
if (is_array($row = mysql_fetch_array(mysql_query($strSQL))))
return $row[0];
else
return 0;
}
function insertValue($fields,$values,$tablename,$debug)
{
$sql="insert into $tablename";
if(!empty($fields))
$sql.=" (".$fields.")";
$sql.=" values(".$values.")";
($debug == 1)? print $sql: print "";
mysql_query($sql)
or die("
Unable to save values to table $tablename ".mysql_error()."
");
}
function insertValuefun($fields,$values,$tablename,$debug)
{
$sql="insert into $tablename";
if(!empty($fields))
$sql.="(".$fields.")";
$sql.=" values(".$values.")";
($debug == 1)? print $sql: print "";
mysql_query($sql) or die("
Unable to save values to table $tablename ".mysql_error()."
");
$back= mysql_insert_id();
return $back;
}
function Select_Fun($sqlsel,$debug)
{
$strSQL=$sqlsel;
$resultSet=mysql_query($strSQL);
$i=0;
$arrData = array();
While($rows=mysql_fetch_row($resultSet))
{
$arrData[$i]=$rows;
$i=$i+1;
}
print ($debug == "1") ? $strSQL: "";
return $arrData;
}
function updateValue_fun($sql)
{
// echo $sql."
";
mysql_query ($sql) or die("Unable to update the values:".mysql_error()." SQL: ".$sql);
}
function deleteValue_fun($sql)
{
//echo $sql;
mysql_query ($sql) or die("Unable to delete the values:".mysql_error()." SQL: ".$sql);
}
function SendEmail_fun($strEmailFrom,$strEmailTo,$strEmailBody,$subject,$strName) //Include in orderdetail.php
{
$email_from_name= $strName;
$email_from_mail=$strEmailFrom;
$email_to=$strEmailTo;
$email_subject=$subject;
$emailbody =$strEmailBody;
$header="From:$email_from_name\n";
$header .= "Reply-To: $email_from_mail\n";
if (isset($email_to_bcc))
$header .= "Bcc: $email_to_bcc\n";
$headers = "MIME-Version: 1.0\r\n";
$header .= "X-Mailer: PHP/" . phpversion(). "\n";
$header .= "X-Sender-IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mail_command =
"echo \"$emailbody\" | /bin/mail -s \"$email_subject\" $email_to";
$output = shell_exec($mail_command);
//print $mail_command;
//print "out - $output";
//mail($email_to,$email_subject,$emailbody,$header);
}
function ReturnArrayValue_fun($wherecondition,$fields,$tablename,$debug)
{
$fieldArray=split(",",$fields);
$strSQL="select ".$fields." from ".$tablename." where ".$wherecondition."";
//If ($debug =1)
// echo $strSQL;
$result=mysql_query($strSQL);
$rows=mysql_fetch_row($result);
return $rows;
}
function selectDropDown_fun($str1,$str2)
{
If(strcmp(trim($str1),trim($str2))==0)
return "selected";
Else
return "";
}
function PutHyphen($str)
{
$str=preg_replace("/\t| /","-",$str);
return $str;
}
function RemHyphen($str)
{
$str=str_replace("-"," ",$str);
return $str;
}
function ReplaceChar($str)
{
$str=str_replace("'","",$str);
$str=str_replace("/","",$str);
$str=str_replace("\\","",$str);
return $str;
}
function enter($str)
{
$str=str_replace("\n","
",$str);
return $str;
}
function RepBr($str)
{
$str=str_replace("
","\n",$str);
return $str;
}
function PutBr($str)
{
$str=str_replace("\n","
",$str);
return $str;
}
Function check($string1,$string2)
{
If (trim($string1)==trim($string2))
$check="checked";
Else
$check="";
return $check;
}
function convert2proper($strVal)
{
$splitVal=split("-",$strVal);
for($i=0;$i
".convert2proper($catName)." ($activeCount) ";
}
else
{
$showCatPages=$showCatPages."".convert2proper($catName)." ($activeCount) ";
}
}
$lines=str_replace("#showCatPages#",$showCatPages,$lines);
$strSQL="select UrlRequested,Title,Description from LinkDetails where Status='A' and Category=$updtCatId order by LinkId desc";
$getRows=Select_Fun("$strSQL",0);
For($rowCount=0;$rowCount$title $description $url ";
}
$lines=str_replace("#showLinks#",$showTxt,$lines);
$lines=implode('',$lines);
$fl=fopen($delPath,"w");
fwrite($fl,$lines);
fclose($fl);
}
}
?>