Nov 22, 2009
Pages: 1, 2

Help With Registration Page, Access Denied.

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Databases

Help With Registration Page, Access Denied.

lonebyrd
I'm coming up with an error that I can't figure out in my registration page. Below I've given the error message and the code.

QUOTE
Warning: mysql_connect(): Access denied for user: 'nobody@localhost' (Using password: NO) in /home/lonebyrd/public_html/db_connect.php on line 33
Access denied for user: 'nobody@localhost' (Using password: NO)


CODE
$Host = "localhost"; // define host name (default: localhost)
$User = "$lonebyrd_razmo"; // define database username
$Password = "$****"; // define database password
$Database = "$lonebyrd_ftv"; // define database name

mysql_connect($host, $user, $password) or die (mysql_error());
mysql_select_db($database) or die (mysql_error());

?>


Now, I've tried making a new user in Sql cpanel and giving it a new password to make sure I had everything correct, because at first it was wrong. But that didn't make a difference. I just can't figure this out. I don't know if it has anything to do with me using my roomates computer. But I don't see why that would make a difference. This was a prewritten script I found somewhere, and it was wrong to begin with, so I had to fix it, but it doesn't seem I'm doing a good job.

 

 

 


Comment/Reply (w/o sign-up)

Vyoma
lonebyrd, I am not sure if I can help at present, but could you tell us which one is the line number 33 in your db_connect.php.

This line:
mysql_connect($host, $user, $password) or die (mysql_error());
Or the one following it:
mysql_select_db($database) or die (mysql_error());

I am not sure it would help, but as far as I know, the use of these set of fuctions is as follows:
CODE

$conn = mysql_connect($host, $username, $password);
mysql_select_db($dbname, $conn);

And later you can use it for querying by:
CODE

mysql_query($query, $conn);

Of course, I am not sure this is the problem, and hence, it would help if you could tell which line is line number 33, because it is failing exactly at that point.

QUOTE
This was a prewritten script I found somewhere, and it was wrong to begin with, so I had to fix it, but it doesn't seem I'm doing a good job.

Could you also show what the original script was?

Another thing you can do is wait for some one who has more expertise to come over this thread and answer your question. smile.gif

 

 

 


Comment/Reply (w/o sign-up)

Houdini
Look at your own code here:
QUOTE
$Host = "localhost"; // define host name (default: localhost)
$User = "$lonebyrd_razmo"; // define database username
$Password = "$****"; // define database password
$Database = "$lonebyrd_ftv"; // define database name

mysql_connect($host, $user, $password) or die (mysql_error());
mysql_select_db($database) or die (mysql_error());[/b]

$host, $password, and $user have no values this is what caused the error either change this
CODE
$Host = "localhost"; // define host name (default: localhost)
$User = "$lonebyrd_razmo"; // define database username
$Password = "$****"; // define database password
$Database = "$lonebyrd_ftv"; // define database name
to this
CODE
$host = "localhost"; // define host name (default: localhost)
$user = "$lonebyrd_razmo"; // define database username
$password = "$****"; // define database password
$database = "$lonebyrd_ftv"; // define database name

or change this
CODE
mysql_connect($host, $user, $password) or die (mysql_error());
mysql_select_db($database) or die (mysql_error());
to this
CODE
mysql_connect($Host, $User, $Password) or die (mysql_error());
mysql_select_db($Database) or die (mysql_error());
Variables in PHP or in most other languages are case sensitive so $Host is not the same as $host or $HOST or anyother combination of lower or uppercase.


Comment/Reply (w/o sign-up)

lonebyrd
Well, that didn't work. There was more to the script than that. At the beginning, it tells me to include another script that it had (a good size one), which holds some admin info along with some other information. I will include both scripts. First is the original db connection script, and second is the additional script it includes.

The original db connect script:
CODE
include("mojt_db.php");

define("HOST", "$localhost"); // define host name (default: localhost)
define("USER", "$lonebyrd_razmo"); // define database username
define("PASSWORD", "$****"); // define database password
define("DATABASE", "$lonebyrd_ftv"); // define database name

$db=mysql_connect(HOST, USER, PASSWORD); // connecting to the database
mysql_select_db(DATABASE, $db);

?>


Here is the 'mojt_db.php' as asked for above:
CODE
$AdminName = "Rikki "; // define administrator name
$AdminUserName = "lonebyrd "; // define admin user name
$AdminPassword = "**** "; // define admin password
$AdminEmail = "lonebyrd@yahoo.com "; // define admin email
$AdminPanel = "login/admin.php"; // define path to the admin panel [without / at the end]

$SiteUrl = "ftv.astahost.com "; // define full site address, ex. http://www.mysite.com
$SiteName = "FTV "; // define what will shell be display as site name
$ContactEmail = "razmodat@aol.com "; // define which email address will be used for contact address
$SupportEmail = "razmodat@aol.com "; // define which email address will be used for support address
$Copyright = "2006 "; // define site copyright, set by user
$Poweredby = "Powered by eVPortal."; // define powered by message (please don't remove this!)
$MojtDir = "public_html "; // define directory where MoJT LS is installed [without / at the end]
$CookieTime = "3600"; // define cookie time (in seconds)
$FirstPage = "index.html "; // define your first protected page

$db_host = "localhost"; // define host name (default: localhost)
$db_username = "lonebyrd_razmo"; // define database username
$db_password = "**** "; // define database password
$db_name = "lonebyrd_ftv"; // define database name

?>


It's probably something really simple that I'm missing, but I just don't see it. Being fairly new to this stuff, I love this forum for the help that I get.

Comment/Reply (w/o sign-up)

Houdini
There are two ways to 'fix' this.
One change this
CODE
define("HOST", "$localhost"); // define host name (default: localhost)
define("USER", "$lonebyrd_razmo"); // define database username
define("PASSWORD", "$****"); // define database password
define("DATABASE", "$lonebyrd_ftv"); // define database name

to
CODE
define("HOST", "$db_host"); // define host name (default: localhost)
define("USER", "$db_username"); // define database username
define("PASSWORD", "$****"); // define database password
define("DATABASE", "$lonebyrd_ftv"); // define database name

or two (one is preferable)
CODE
define("HOST", "localhost"); // define host name (default: localhost)
define("USER", "lonebyrd_razmo"); // define database username
define("PASSWORD", "****"); // define database password
define("DATABASE", "lonebyrd_ftv"); // define database name

Comment/Reply (w/o sign-up)

lonebyrd
Houdini, I must have been typing my post when you posted yours smile.gif . That was exactly the problem though. I didn't realize it was so specific. Once I changed those though I had an error with my other script about an unexpected '?' on my last line. Where else am I supposed to put the ?>...? Any way that's another script for another time. Thanks for the help.

Comment/Reply (w/o sign-up)

Vyoma
Arrg. I feel so dumb. I did not notice the capitalizations. Good catch Houdini. PHP is case sensitive.

Comment/Reply (w/o sign-up)

vhortex
QUOTE(Vyoma @ Jul 6 2006, 09:18 PM) *

Arrg. I feel so dumb. I did not notice the capitalizations. Good catch Houdini. PHP is case sensitive.


Actually it is not.. I have my modules and it worked whatever the case is..
Maybe in some tweak settings or in safe mode the PHP parser turns into case sensitive one.

I am using a self compiled php 5 and apache 2 bin/cgi

--

well the error was simply that on some flavor of PHP.. using define with variables in different files yields nulls..
I never use a define statement when the variable value is easily available..

I only use defines if the variable will come from the database..

---
cheers..

CODE
define("HOST", "$localhost"); // define host name (default: localhost)
define("USER", "$lonebyrd_razmo"); // define database username
define("PASSWORD", "$****"); // define database password
define("DATABASE", "$lonebyrd_ftv"); // define database name


CODE
$db_host = "localhost"; // define host name (default: localhost)
$db_username = "lonebyrd_razmo"; // define database username
$db_password = "**** "; // define database password
$db_name = "lonebyrd_ftv"; // define database name


please see that you have define a variable $db_host and yet the variable you pass to the define HOST is $localhost. $localhost is not the same as "localhost" since the first one is a variable named localhost and the last one is the value localhost.

please see also the username, the variable define to hold the username is$db_username and yet the one use in the define is $lonebyrd_razmo which is a new null variable..

and so goes on..

CODE
define("HOST", "$db_host"); // define host name (default: localhost)
define("USER", "$db_username"); // define database username
define("PASSWORD", "$****"); // define database password
define("DATABASE", "$lonebyrd_ftv"); // define database name


must be coded as

CODE
define("HOST", $db_host); // define host name (default: localhost)
define("USER", $db_username); // define database username
define("PASSWORD", db_password); // define database password
define("DATABASE", $db_name); // define database name


which passes all of the variables to the defines..


see, we must pass a variable not a string constant..
most user confuses between the variables and sting constant declarations..

=)

Comment/Reply (w/o sign-up)

Houdini
QUOTE
Actually it is not.. I have my modules and it worked whatever the case is..
Maybe in some tweak settings or in safe mode the PHP parser turns into case sensitive one.

This is not true of variables, and CONSTANTS are usually written in all uppercase to let you see easily that they are Constants. However a Constant is DEFINED either as lowercase or uppercase it is not called with a $ in front of it.
CODE
define ("AGE","29");
echo AGE;//prints 29 to screen every time it is used
Rules that apply to variables
  1. Begin with a $
  2. Can be any length
  3. Can include letters, numbers and underscores
  4. They must begin with either a letter or an underscore
  5. Upper and lowercase are NOT the Same
Now while you can define a constant with any combination of letter casing using does matter when you use them
CODE
<?php
define ("AGE","29");
define ("age","42");
echo AGE."<br />";//29
echo age."<br />";//43
echo "Age is ".Age;//will print Age is Age
echo "<br />AGE is ".AGE;//wil print AGE is 29
echo "<br />age is ".age;//will print age is 42
?>



Comment/Reply (w/o sign-up)

lonebyrd
Well, I found the the problem with my '?' error. It wasn't actually at the end of my script. It was further up where I put a comment in that had a question mark but I forgot to put // before it. Just goes to show, you need to be careful while coding. Easy mistakes can be made if your not paying attention. I would have caught it quicker if I were using my own computer, but mine just died. I'm using my roomates, so I just installed PHP Designer 2006 (with her permission) and found it that way.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : registration, page, access, denied

  1. Database Access On Remote Server W/jsp
    (2)
  2. Accessing Ms Access Database From A Centralized Location?
    (10)
    Hi I am a manager at a trading/wholesaling company (and have no programming background). I
    customized the Northwind sample access database to make invoices and keep accounts for my company.
    We now opening another office at a distant location. So, the order entry will be done at two
    points(we plan to use the same Access database). I am not able to figure out how to access the same
    MS Access database from two different location(as LAN can't be used). Moreover, we can't
    afford to pay huge sums to the software developers. Can intranet or uploading the database t....
  3. Integrate Access Database Onto Intranet Site
    Looking to integrate access database into my intranet site (5)
    Hey guys, im new here and am looking for answers /tongue.gif" style="vertical-align:middle"
    emoid=":P" border="0" alt="tongue.gif" /> Firstly, i have designed a database using M$ access, it
    consists of multiple forms which i plan to host on an intranet website, i need to be able to add
    records directly from the form on the intranet website aswell as being able to edit/review current
    entries on forms in the database. My question is, how would i go about integrating these forms onto
    the intranet website? i plan on keeping the database and the intranet site on the same d....
  4. Access 97 To Access 2003
    (15)
    I need to convert a database that is in Access 97 to Access 2003 but every time i do it using the
    Convert tools of Access 2003 i got some errors and can't change or add any of the objects
    -tables, querys, etc- of the converted database. All the errors i got are related to the user
    priviligies and permissions of the database, is there exists a way or procedure that allows me to
    reset this permissions??? Best regards,....
  5. Access
    Is this easy to make a login/password? (17)
    I was looking to make a site where people need to create an account, and log in to view the main
    pages. Is it easy, or do-able, to use msoft access to make a database where people are able to sign
    up with a username and password via my website?....
  6. Public Access Oracle Db?
    (5)
    This may be the stupidest question ever, I don't know, but frankly if this exists it would help
    me out a lot haha. What I'm looking for is an oracle database set up somewhere that has an open
    uname/password for the public to use for testing or anything really. I'm just developing
    something that needs to connect to our oracle db here but we don't want the computers to be
    required to have the oracle client installed. Currently though all the computers I have access to
    here DO have it installed and need it to stay for the time being, and I can't access o....
  7. MS Access Validation Rule
    Desperate help needed (4)
    I have to create a whole project using Microfost Access. I have a field which will eventaually
    contain details of a a list of people's DOBs. I have added an input mask, so that it it displays
    the place holder __/__/____ However, how can I validate this field. For example, not it is possible
    to type 30/10/1991 . How can this be changed so that it validates it correctly?....
  8. Access -> Mysql
    Converter (8)
    I have a problem. Is any program wchich converts database Access to Mysql ??....
  9. Read/Write Issues After Copying An Access .mdb File
    (4)
    Alright, I'm currently creating an interface program for a MS Access database. I've only
    used Access once in the past but used other DB's a handful of times so I didn't have any
    trouble getting the general program created. My issue arose when I tried to make it so that the
    users needing to use the program can just copy the .exe and the .mdb files and use it. The program
    doesn't require users to share the database but to store their OWN programs information in their
    OWN database, so basically each needs to have their own database with the exact same d....
  10. MS Access DB To Webpage Connection ?
    (6)
    ok .. i have this little problem i am going through ... Leme explain this project of mine first . I
    have a MS Access DB of student fields like ID no, Name, Marks .. etc .. This one Access DB would be
    updated by just adding more rows and would be done on the server. It looks sumthing like this:
    Now .. I have a HTML page that shows this : I would enter the ID number of a student (no
    authentication .. anyone can access anybodys marks), and when i hit submit .. I would be taken to a
    page that gets the values from the ID specified and shows it in the next page. The pa....
  11. Help Me With My MS-Access Program
    (2)
    Hi anyone can help me with making a form. These are the case; I am using Ms. Access XP, and a
    database for using as a admission database for new students. And using couple table for the base,
    however I want that when the operator is trying to add a students (add button), a form will came up,
    and asking for his/her ID and password and Cliking the LOGIN button and lookup for the ID and
    Password which stored in a "user" table on the database. When the ID and Password 're correct
    the function for adding students can be processed, but when the ID and Password uncorrect....
  12. I Have A Question About MySQL Access & Quotas
    (1)
    On my previous web host, I surpassed my MySQL quota limit. At least, that's what they told me.
    The following message is the error I get. phpBB : Critical Error Error creating new session
    DEBUG MODE SQL Error : 1044 Access denied for user: 'darnem_trials@65.98.98.74' to database
    'darnem_trials' INSERT INTO phpbb_sessions (session_id, session_user_id, session_start,
    session_time, session_ip, session_page, session_logged_in) VALUES
    ('7719681862d0a4bfc392929af1357326', 2, 1125023783, 1125023783, '18d160ac', 0, 1)
    Line : 168 File : ....
  13. Logic To Break Down An Access Tabbe To SQL
    what is the easiest way to split this? (1)
    I have 3 differen tables in this database that are basically repeating the same data. How can I
    split it up and still use it. This is the horse project /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" /> the 3 tables are called Horse, Dam, Sire . the Horse table
    should be enough for all the data. (at least that is what I'm thinking) the Dam & Sire are
    used to track lineage and are setup Like this: CODE SireID; Horse; Sire; Dam; SireSire;
    SireDam; DamSire: DamDam; SireSireSire; SireSireDam; SireDamSire; SireDamDam; DamSireSire;D....
  14. Access
    Lesons (0)
    The HP Learning center offers very good free lessons on creating databases with step by step
    instructions. You can access the learing center at HP Learing Center ....
  15. Access To MySQL Remotely
    (2)
    i am using a software to access to mysql remotely but it display error!(Access denied for
    myusername@my ip address) please help me....
  16. Is php supports MS Access
    Ms Access Database (7)
    I want to know that is php supports MS Access databases. And could anyone told me the complete php
    installation. I have little bit problem during installation.....
  17. How To Transition The Database
    transition the database to access (2)
    i want to transition the records in SQL7 to ACCESS in the condition of VF 6.0 how i can?....
  18. How To Access a Remote MySQL
    (1)
    I try to access to a remote mysql owned by my friend , I have the IP and username and password. but
    I always got this information: Fatal error: Maximum execution time of 30 seconds exceeded in
    XXXXXXXXXXXXXXXX....
  19. How To Dump .SQL File to MS-Access
    (3)
    Is there any way to convert a mySQL dump (.sql file) to an access file? Problem is, I downloaded and
    installed the mySQL server and ran it. But I couldn't restore the dump - it kept complaining
    about charsets and even the guy who created the dump didn't know what was up. So I'm
    looking for another way to access the contents of the database. Help anyone?....

    1. Looking for registration, page, access, denied

See Also,

*SIMILAR VIDEOS*
Searching Video's for registration, page, access, denied
advertisement



Help With Registration Page, Access Denied.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com