Hi guys, this is my first post. I would also like to make clear that I am totally new to PHP and other languages, I am using a lot of site searches and google to get this working, however I am stuck on one thing.

On the login script that I am using, when it can't find a username, it kills the database saying "Username not registered"

How do I edit the code so that when it can't find a username, it will let me design a page to output which is nicely formatted and better looking than one line of "username not registered"

The code I am using is:

/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){
   die("Username not registered");
}
/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){
   
header( 'Location: http://www.site.com/fancy_page.html' ) ;
exit;
}
/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){
   
header( 'Location: http://www.site.com/fancy_page.html' ) ;
exit;
}

another issue I'm having is with some CSS code, I am trying to get the DIV tag to have a fancy box around it as I'll use it for error messages.

I have a custom div in the css called .divcustom with the following code:

div.custom {
background-color: #ff3;
border: 1px solid black;
color: red;
font size: 100%;
padding: 1em;
}

In the main site I'm using:

/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
!eregi("^([0-9a-z])+$", $req_user) ||
!$database->usernameTaken($req_user)
)
{
echo "<center>
<div class="divcustom">Either our hampsters have screwed things up again or that Kinkster doesn't exist on this site</div>
</center>
</body>
</html>";
exit;
}

but its throwing back errors

any help?

The name of the class ends up being simply class ="custom".
the css definition appends the name to a div, so you can also have a td.custom which could be different. (scope)

If the page issue is solved please mark the thread as solved.
Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.