Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-17-2005, 03:49 PM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
Post php logging in probs

yoyo

my housemate is trying to setup his website, it has basic html page but links to his other stuff, like image galleries and blogging things

e.g's. tikiwiki (check spelling), coppermine, my bloggy

problem is he sets things up / installs them but can never login, with any of them. he's going nuts because hes spent the last week trying everything 20 times and using diff proggies but every time it just wont let him login.


the only thing i can think of is permissions but he says he's done the CHMOD things etc exactly how all the instructions say.


any ideas at all?
Reply With Quote
  #2  
Old 06-17-2005, 03:58 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Any error mesage? He using any special program or script?

Edit NM I am an idiot and didn't see it.
__________________
Reply With Quote
  #3  
Old 06-17-2005, 04:04 PM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Using a professional host? Might be a problem with sessions
__________________
-1PARA-AlexKall

My photography website



Reply With Quote
  #4  
Old 06-17-2005, 04:19 PM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
no errors just enters user and pass then enter, then just reloads current page.

he's using Yahoo business as host
Reply With Quote
  #5  
Old 06-17-2005, 05:51 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Can anyone else log in? Has he tried it on another PC?
__________________
Reply With Quote
  #6  
Old 06-17-2005, 05:56 PM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
yeah he tried otehr computers :/
Reply With Quote
  #7  
Old 06-18-2005, 02:06 AM
katana*GFR* is offline katana*GFR*

Join Date: May 2002
Location: North Sea
Posts: 2,421

Send a message via ICQ to katana*GFR* Send a message via MSN to katana*GFR*
maybe something on the side of the host?
__________________
<- Sponsored by Chris



Found on Youtube:
Quote:
And if Newton Faulkner's voice can be described as "R&B" then Kurt Cobain must be a member of Boyz II Men.
Link here
Reply With Quote
  #8  
Old 06-18-2005, 07:08 AM
Stu is offline Stu
Resident Member

Join Date: Aug 2003
Posts: 3,319

Well if its in php ... Simple logic of it:
--------
- Display the form (login dot php)
- When submit is clicked, go to login_check.php, and check if the user infomation is true, if it is then start a cookie session, if not re-display the form.
--------
Thats what most people follow, I'v dug up some code for you, with the file names ect, and I know for a fact that they work, have a look at them and see if its any different to what he's trying to do, Its from a topic in this forum, I think it was Me, Panther and elite's code combined together to help cobra sort out something ...
login.php (Panthers and elites code ...)
PHP Code:
<?
function login_form() {?>

    <form method="post" action="<?Echo($_SERVER['PHP_SELF']);?>">
    Username: <input type="text" name="username" /><br />
    Password: <input type="password" name="password" /><br />
    <input type="hidden" name="login" value="true" />
    <input type="submit" name="login" value=" Login " /> <input type="reset" value=" Reset " />
    </form>

<?
}

If(
$_POST['login']) {

    
$username=mysql_real_escape_string($_POST['username']);
    
$password=mysql_real_escape_string($_POST['password']);
    
    
$query=mysql_query("SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1");
    
    If(
mysql_num_rows($query) > 0) {
        
setcookie("loggedin","true",time+36000); //1 day
        
sleep(1);
    }
    
mysql_free_result($query);
    
    
header("Location: ".$_SERVER['PHP_SELF']);
    exit;

}



If(
$_COOKIE['loggedin']!="true") {

    Echo(
" You do not have permission to access this page. Please login Below. ");
    
login_form(); // print the login form
    
exit;

}
?>
Successful login content here
mysql_connect.php (My code, everyone can do it anyway):
PHP Code:
<?php
/* mysql_connect.php connects to mysql on server and selects
   a database to use. Thats it. This is a good way of 
   connecting to a database and all you need to do is
   use include("mysql_connect.php"); on any page you need 
   to */
# Mysql values (edit the string values)
 
$m_host "localhost"// Usaly kept as localhost
 
$m_user "username"// Mysql username
 
$m_pass"password"// Mysql username's password
 
$m_database "database"// Mysql database to use
# Start connecting. (You dont need to edit any of this)
# If any errors, print them
mysql_connect($m_host,$m_user,$m_pass) or die("Error connecting to server!<br>" mysql_error());
mysql_select_db($m_database) or die("Cannot select database!<br>" mysql_error());
?>
The comments were to help him, he so begginner.
And if you wanted a register page for users, or even add an admin login ect, use this code, but change it a bit for admin adding ...
PHP Code:
<?php
include("mysql_connect.php");
if(!empty(
$username)) { //if the title is not empty, than do this function
$username addslashes($username);
$password addslashes($password);
$email addslashes($email);
$sql "INSERT INTO users (user_id, username, password, email) VALUES ('NULL', '$username','$password','$email')";
$query mysql_query($sql) or die("Cannot query the database.<br>" mysql_error());
echo 
"Thank you for registering, $username, you can now login using <a href=\"login.php\">this link </a>";
} else {
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Register new user</title>
</head>
<body>
<form name="register" method="post" action="<? echo $PHP_SELF?>">
  <p>Desired username: 
    <input name="username" type="text" id="username">
    <br>
    Desired password: 
    <input name="password" type="password" id="password">
    <br>
    Your email: 
    <input name="email" type="text" id="email">
    <br>
    <input name="register" type="submit" id="register" value="Register new user">
  </p>
</form>
</body>
</html>
<? ?>
Its all simple logic, and I dont see why his wont work. Try some of that code and see what he thinks
-Tecceh2
Reply With Quote
  #9  
Old 06-19-2005, 05:22 AM
Lakie is offline Lakie

Join Date: Mar 2002
Posts: 5,540

try clicking submit with the mouse instead of pressing enter and see if that works, we had something similar here at nhq a while back with the admin cp, you had to press submit with the mouse...

The way around that is to create another hidden field in the form with the same name as the submit button IIRC.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem logging on reddy2die Delta Force 0 01-25-2005 05:18 PM
TS INSTALL PROBS........BIG PROBS!! RooBoy Tech Support 1 02-17-2004 09:10 PM
Problems logging on to nova Rapid12 Delta Force 3 01-12-2004 10:25 AM
DFLW. Logging into stats. FatalitY Delta Force 1 02-13-2003 09:45 PM
Problems Logging Out DeDRAGE General Chat 2 11-24-2002 12:59 PM


All times are GMT -5. The time now is 11:35 PM.




Powered by vBulletin®