English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

$file_rev="041308";
////////////////////////////////////////////////////////
// phpBannerExchange //
// by: Darkrose //
// (darkrose@eschew.net) //
// //
// You can redistribute this software under the terms //
// of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of //
// the License, or (at your option) any later //
// version. //
// //
// You should have received a copy of the GNU General //
// Public License along with this program; if not, //
// write to the Free Software Foundation, Inc., 59 //
// Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// //
// Copyright 2004 by eschew.net Productions. //
// Please keep this copyright information intact. //
////////////////////////////////////////////////////////

include("config.php");
include("lang/common.php");

if($use_gzhandler==1){
ob_start("ob_gzhandler");
}

$uid=$_REQUEST['uid'];
$cat=$_REQUEST['catid'];
$uid = strip_tags($uid);
$uid = htmlentities($uid);

$cat = strip_tags($cat);
$cat = htmlentities($cat);

if (get_magic_quotes_gpc()) {
$uid = stripslashes($uid);
$cat = stripslashes($cat);
}

$uid=mysql_real_escape_string($uid);
$cat=mysql_real_escape_string($cat);

if(!$cat){
$cat="0";
}

//if this is false, will return "Invalid Banner!" (see bottom)
if(ctype_digit($uid) and ctype_digit($cat)){
$db=mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db($dbname,$db);

$status = mysql_query("select * from bannerconfig where name='exchangestate'");
$get_status=mysql_fetch_array($status);
$status=$get_status[data];
if($status == '1'){
//display default banner.
$eligible=mysql_query("select * from bannerurls where uid='0' limit 1");
$defaultbanner="1";
}else{
if($cat=="0" or !$cat){
//display the banner + without category support.
if($use_dbrand == 1){
$eligible=mysql_query("select uid from bannerstats where approved='1' and credits >= '$steexp' and uid != '$uid' order by rand() limit 1");
}else{
$eligible=mysql_query("select uid from bannerstats where approved='1' and credits >= '$steexp' and uid != '$uid'");
}
}else{
if($use_dbrand == 1){
//display the banner + with category support.
$eligible=mysql_query("select uid from bannerstats where approved='1' and credits >= '$steexp' and category = '$cat' and uid != '$uid' order by rand() limit 1");
}else{
$eligible=mysql_query("select uid from bannerstats where approved='1' and credits >= '$steexp' and category = '$cat' and uid != '$uid'");
}
}
//check to see the number of banners found.
$get_number=@mysql_num_rows($eligible);
if($get_number == 0){
if($use_dbrand == 1){
$eligible=mysql_query("select uid from bannerstats where defaultacct='1' and uid != '$uid' and uid != '0' order by rand() limit 1");
}else{
$eligible=mysql_query("select uid from bannerstats where defaultacct='1' and uid != '$uid' and uid != '0'");
}
}
$get_number=@mysql_num_rows($eligible);
if($get_number == 0){
//if none found, display the default account.
$eligible=mysql_query("select bannerurl, targeturl from bannerurls where uid='0' limit 1");
$defaultbanner="1";
}
}

$find_num=@mysql_num_rows($eligible);

//if we STILL can't find a banner, display an error.
if($find_num == '0'){
echo "You're getting this message because there's no default account or default banner set up! Set one up before proceeding!";
die();
}

if($defaultbanner=="1"){
$get_banner=mysql_fetch_array($eligible);
$bannerurl=$get_banner[bannerurl];
$bannerid=$get_banner[id];
$update_uid=mysql_query("update bannerstats set credits=credits+$steexp,histexposures=histexposures+1 where uid='$uid'");
$pick="0";
}else{
while($rand_rows = @mysql_fetch_array($eligible)){
$id_array[] = $rand_rows[uid];
}

if($use_dbrand == 0){
srand((double)microtime()*1000000);
@shuffle($id_array);
srand((double)microtime()*1000000);
@shuffle($id_array);
}

$pick = $id_array[0];
$takecred=mysql_query("update bannerstats set credits=credits-$banexp where uid='$pick'");

//anti-cheat
if($anticheat=="cookies"){
include("cookies.php");
}

if($anticheat=="DB"){
include("dblog.php");
}

if($anticheat==""){
$update_bid=mysql_query("update bannerstats set exposures=exposures+1 where uid='$pick'");
$update_uid=mysql_query("update bannerstats set credits=credits+$steexp,histexposures=histexposures+1 where uid='$uid'");
}

if($use_dbrand == 1){
$get_banner = mysql_query("select * from bannerurls where uid='$pick' order by rand() limit 1");
}else{
$get_banner = mysql_query("select * from bannerurls where uid='$pick'");
}

while($rand_ban = mysql_fetch_array($get_banner)){
$ban_array[] = $rand_ban[id];
}

if($use_dbrand == 0){
srand((double)microtime()*1000000);
@shuffle($ban_array);
srand((double)microtime()*1000000);
@shuffle($ban_array);
}

$bannerid=$ban_array[0];
$get_banner=mysql_query("select bannerurl from bannerurls where id='$bannerid'");
$get_banner_url=mysql_fetch_array($get_banner);
$update_bannerstats=mysql_query("update bannerurls set views=views+1 where id='$bannerid'");
$raw_query=mysql_query("select raw from bannerstats where uid=$pick");
$get_raw=@mysql_fetch_array($raw_query);
$rawcode=$get_raw[raw];
}
if($rawcode != '0'){
echo "$rawcode";
}else{
$bannerurl=$get_banner_url[bannerurl];
}
?>
/click.php?uid=&bid=&ban=" target="_blank">" border=0 width= height=>
}else{
echo "Invalid Banner Code!";
}
?>

2007-02-21 09:30:11 · 4 answers · asked by cwconline 2 in Computers & Internet Programming & Design

I get an Error when connencting to MySql database.

check it out ur self

http://cwc-online.us/view.php

2007-02-21 09:31:14 · update #1

4 answers

Check what value $dbhost contains. If it is localhost, make sure you are running your php application on the same system where mysql is running. Also make sure the user you are using to connect to mysql is allowed to connect mysql from localhost.
If php is running on other system, and mysql is on another, make sure your mysql user is allowed to connect to mysql from the system running php.
If you don't know how to give access to any user here is a solution.
You will have to update the table "user" of database "mysql". In the first column, you will have to change value of "Host". Either give the "localhost" (For php running on same system), "IP-Address" (For PHP running on another system), or you can also give "%" to connect from all systems. Update host for your username and it will start working.

2007-02-21 17:11:07 · answer #1 · answered by Atif Majid 3 · 0 0

It sounds to me like you have a permissions problem in MySQL. Do you have a user named fgn? Do they have permission to access from localhost? Why are you not using a password?

Also you may have the following problem.

"Thanks for the reply. The user did have privileges assigned to the needed database. The problem apparently was that I needed to flush privileges and had to specify the host as localhost rather than using %.

Without the localhost account, the anonymous-user account for localhost that is created by mysql_install_db took precedence when my user connected from the local host. As a result, the user was treated as an anonymous user. The reason for this was that the anonymous-user account has a more specific Host column value than the 'user'@'%' account and thus came earlier in the user table sort order."

2007-02-21 09:55:16 · answer #2 · answered by Ethan 2 · 2 0

i do no longer think of that's needed, however the extra you be attentive to the extra effective your recommendations would be once you're searching for a activity. incredibly as a programmer you want to proceed the build on what you already be attentive to. in case you be attentive to own domicile page i'm specific it incredibly is going to no longer be a difficulty to bounce to javascript, ajax, css ect. i think of that's advisable to %. up a pair of books merely to get attentive to a pair extra scripting languages. once you flow to an interview you could enable them to be attentive to approximately your adventure with own domicile page and likewise at the instant you're researching different languages and it does no longer be a difficulty so you might get attentive to despite the fact that the enterprise classes with.

2016-12-18 08:11:36 · answer #3 · answered by ? 3 · 0 0

Check your config.php file for host name & user name.
make sure the user name specified in file is present in database or just change the user name in config.php file...

2007-02-21 23:29:56 · answer #4 · answered by Shree J 2 · 0 0

fedest.com, questions and answers