0

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");
}
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by JRM
0
/* 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;
}
0
/* 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?

0

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.