Jump to content

accidently put this in wrong board Help with error . Not sure of prob


valwardon

Recommended Posts

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fehsetfc/public_html/user/admin/index.php on line 19

 

than when i open that file this is what it says

 

<?PHP

session_start();

include "../../affconfig.php";

include "../lang/$language";

 

if ($_POST['userid']!='' && $_POST['password']!='')

{

  // protection against script injection

  $userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['userid']);

  $password = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['password']);

   

  // if the user has just tried to log in

  $db_conn = mysql_connect($server, $db_user, $db_pass)

    or die ("Database CONNECT Error (line 11)");

  mysql_select_db($database, $db_conn);

 

  $query = "select * from admin where user='$userid' and pass='$password'";

  $result = mysql_query($query, $db_conn);

  if (mysql_num_rows($result) >0 )

  {

    // if they are in the database register the user id

    $_SESSION['aff_valid_admin'] = $userid;

    // logout user if he was logged in before

    $_SESSION['aff_valid_user'] = '';

    unset($_SESSION['aff_valid_user']);   

    echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=0;URL=index2.php>";

    exit;

  }

}

 

  include "header.php";

 

  if(aff_admin_check_security())

  {

    aff_redirect('index2.php');

    exit;

  }

  else

  {

    if (isset($_POST['userid']))

    {

      // if they've tried and failed to log in

      echo AFF_I_CANNOTLOG;

    }

    else

    {

      // they have not tried to log in yet or have logged out

      echo AFF_I_NOTLOGGED;

    }

 

    // provide form to log in

?>   

    <form method=post action="index.php">

    <table align=center border=0>

    <tr><td><?=AFF_G_USERNAME?>:</td>

    <td><input type=text name=userid></td></tr>

    <tr><td><?=AFF_G_PASSWORD?>:</td>

    <td><input type=password name=password></td></tr>

    <tr><td colspan=2 align=center>

    <input type=submit value="Log in"></td></tr>

    </table></form>

<?   

  }

?>

</p>

 

 

<?PHP       

include "footer.php";

?>

Does anyone know what is wrong?

Link to comment
Share on other sites

try using this in place of what you have:

 

$result = mysql_query($query, $db_conn) or die("Error: ". mysql_error(). " with query ". $query); // helpful error message

 

That may shed some light on your troubles.

Link to comment
Share on other sites

here is where i defined my data base.

 

<?PHP 

//-------------------------------------------------------------------------------
// CONFIGURATION OPTIONS
//-------------------------------------------------------------------------------
// Your domain name (include www. if used BUT NOT http://)
$domain = "www.freshsitetraffic.com";  

// Your MySQL server address (usually 'localhost') 
$server  = "localhost";
  
// Your MySQL database username
$db_user = "****";
  
// Your MySQL database password
$db_pass = "****";

// Your MySQL database name
$database = "****";

// The currency that your affiliates will be paid in
$currency = "US Dollars"; 

// Your email address
$emailinfo = "****";

// Your sites name
$yoursitename = "Fresh Site Traffic";

// language of control panel (only eng.php so far)
$language = "eng.php";

// cookie expiration in days. If 0, it is "unlimited" (set to 10 yrs)
$cookieExpiration = 0; 

// cookie path, should be always '/'
$cookiePath = '/';

// you can set it to '.yourdomain.com' if you wnt cookie 
// to be available also on subdomains
$cookieDomain = ''; 

// whether to display debug message during sale registration
// activate it by setting it to true
$debugMessage = false;


//-------------------------------------------------------------------------------
// DO NOT MODIFY ANYTHING BELOW THIS POINT UNLESS
// YOU KNOW WHAT YOU ARE DOING
//-------------------------------------------------------------------------------
$clientdate         	= (date ("Y-m-d")); // Do Not Touch 
$clienttime		= (date ("H:i:s")); // Do Not Touch 
$clientbrowser	= getenv("HTTP_USER_AGENT"); // Do Not Touch 
$clientip		= $HTTP_SERVER_VARS['REMOTE_ADDR']; // Do Not Touch 
$clienturl		= getenv("HTTP_REFERER"); // Do Not Touch 

// helper functions
function aff_check_security()
{
  if(!isset($_SESSION['aff_valid_user']) || $_SESSION['aff_valid_user']=='')
    return false;
  else
    return true;
}

function aff_admin_check_security()
{
  if(!isset($_SESSION['aff_valid_admin']) || $_SESSION['aff_valid_admin']=='')
    return false;
  else
    return true;
}

function aff_redirect($url, $time = 0)
{
  echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$time;URL=$url\">";
  echo "If you will be not redirected within few seconds click <a class=leftLink href=$url>".here.'</a>';
}
?> 

as far as getting it to exicute im not sure how to do that part.on my account maintance screen this message is there next to my data bass right under my username

 

Connection Strings

Perl $dbh = DBI->connect("DBI:mysql:f****:localhost","****","<PASSWORD HERE>"); 
PHP $dbh=mysql_connect ("localhost", "****", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("****");  

 

here is the full page

 

MySQL Account Maintenance

 

 

 

--------------------------------------------------------------------------------

 

Current Databases:

**** 

Users in dmname

**** (Privileges: ALL PRIVILEGES)

 

Connection Strings

Perl $dbh = DBI->connect("DBI:mysql:****:localhost","****","<PASSWORD HERE>");

PHP $dbh=mysql_connect ("localhost", "****", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());

mysql_select_db ("****"); 

 

 

 

 

New Database: 

 

 

--------------------------------------------------------------------------------

 

Current Users:

****

 

 

 

Username: 

Password: 

 

 

--------------------------------------------------------------------------------

 

Add Users To Your Databases:

 

User: **** Database: ****

Privileges:

ALL or  SELECT  CREATE

  INSERT  ALTER

  UPDATE  DROP

  DELETE  LOCK TABLES

  INDEX  REFERENCES

  CREATE TEMPORARY TABLES

 

 

 

--------------------------------------------------------------------------------

 

Access Hosts:

localhost

 

 

 

Host (% wildcard is allowed): 

 

 

--------------------------------------------------------------------------------

 

phpMyAdmin

You can use phpMyAdmin to administer your MySQL databases in a web based environment.

 

 

 

 

 

[ Go Back ]

 

mod-edit: user's information removed and replaced with **** for security

 

 

 

 

 

 

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.