Current location: Hot Scripts Forums » Programming Languages » PHP » Help Needed! Urgently!


Help Needed! Urgently!

Reply
  #1 (permalink)  
Old 05-09-07, 04:50 PM
staticfire's Avatar
staticfire staticfire is offline
Wannabe Coder
 
Join Date: May 2007
Location: Stockton, England
Posts: 223
Thanks: 0
Thanked 1 Time in 1 Post
Unhappy Help Needed! Urgently!

oh god!! I have to get this site running very soon and i'm getting nothing but errors with the login. Somebody please help.

Here are all my files

login.php
HTML Code:
<head>

<style type="text/css">
INPUT, SELECT, TEXTAREA {
background-color: #000000;
color: #CD0000;
font-family: arial, helvetica;
font-size: 12px;
border: double 1px #CD0000;
padding: 2;
}
</style>

</head>

<body>


<!--This file will create the links section to be displayed on the left of each page-->

<!--begin table-->

<table width="170" border="1" bordercolor="#5C5C5C">

<!--create the title area-->

<tr>
<td width="170" height="25" background="http://www.staticfire.co.uk/images/topbar.png">
<center><b>Login</b></center>
</td>
</tr>

</table>

<table width="170" border="1" bordercolor="#5C5C5C" cellpadding="10">

<tr>
<td width="170" bgcolor="#000000">

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

<font color="#707070">
Username: <input type="text" name="loginname" size="19"><br>
Password: <input type="password" name="password" size="19"><br>
</font>

<br>

<input type="Submit" value="Login">
</form>

<a href="link">Register</a><br>
<a href="link">Forgot Password?</a><br>

</td>

</tr>

</table>

</body>
Register.php
PHP Code:



<!--background and link settings-->

<body bgcolor="#000000" link="#707070" vlink="#707070" alink="#707070">


<!--open scrollbar-->

<?php
require 'scrollbar.css';
?>


<!--open page header-->

<?php
require 'banner.php';
?>


<table width="817" align="center">

<tr>

<td width="215" background="http://staticfire.co.uk/images/sidebar_back.png" 
align="center" valign="top">

<br>

<?php
require 'login.php';
?>

<br>

<?php
require 'links.php';
?>

<br>

<?php
require 'top5.php';
?>


<br>

<?php
require 'active_list.php';
?>

</td>                


<!--Start main section-->


<td width="602" valign="top">

<!--Welcome note-->

<table width="100%" align="center" border="1" bordercolor="#CD0000" cellpadding="10">
<tr>
<td>

<center>

<html>

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

<table>

<tr> <td> <font color="#707070"> id: </font> </td> <td><input type="text" name="id" maxlength="20"></td> </tr>
<tr> <td> <font color="#707070"> loginname: </font> </td> <td><input type="text" name="loginname" maxlength="20"></td> </tr>
<tr> <td> <font color="#707070"> createdate: </font> </td> <td><input type="text" name="createdate"> </td> </tr>
<tr> <td> <font color="#707070"> password: </font> </td> <td><input type="text" name="password" maxlength="20"> </td> </tr>
<tr> <td> <font color="#707070"> name: </font> </td> <td><input type="text" name="name" maxlength="30"> </td> </tr>
<tr> <td> <font color="#707070"> Age: </font> </td> <td><input type="text" name="age" maxlength="2"> </td> </tr>
<tr> <td> <font color="#707070"> Location: </font> </td> <td><input type="text" name="location" maxlength="30"> </td> </tr>
<tr> <td> <font color="#707070"> Description: </font> </td> <td><textarea cols="40" rows="5" name="description">
Text here
</textarea>
<tr> <td> <font color="#707070"> email: </font> </td> <td><input type="text" name="email"> </td> </tr>
 
<tr> <td></td>

<td> <font color="#707070"><input type="checkbox" name="option1" value="age_check"> 
I am 13+ or have a parents permission. </font></td></tr><br>

<tr> <td></td>

<td> <font color="#707070"><input type="checkbox" name="option1" value="age_check"> 
I agree to the Terms of Service </font></td></tr><br><br>

</td></tr>
</table>

<input type="Submit" value="Register">

</form>

</html>

</center>

</td>
</tr>
</table>



</td>
</tr>

</table>

<?php
require 'footer.php';
?>
Check_login.php
PHP Code:

<?php


$username
="staticfire";
$password="xxxxxxxx";
$database="staticfire";

mysql_connect('mysql10.streamline.net',$username,$password);
@
mysql_select_db($database) or die("Unable to select database");

$loginname $_POST['loginname'];
$password $_POST['password'];

$result MYSQL_QUERY("SELECT * from members WHERE loginname='$loginname'and password='$password'")
or die (
"Name and password not found or not matched");

$worked mysql_fetch_array($result);

$loginname $worked['loginname'];
$password $worked['password'];
$email $worked['email']; 

if(
$worked)
 



if(isset(
$_session['loginname'])){ 

echo
"Welcome $_session['loginname']";

}else {echo
"You are not logged in";

}





?>
database.php

PHP Code:

<!--begin the database page-->


<!--create favicon-->

<LINK REL="SHORTCUT ICON" HREF="http://staticfire.co.uk/favicon.ico"> <br><br>


<!--background and link settings-->

<body bgcolor="#000000" link="#707070" vlink="#707070" alink="#707070">


<!--open scrollbar-->

<?php
require 'scrollbar.css';
?>

<?php

$username
="staticfire";
$password="xxxxxxx";
$database="staticfire";

mysql_connect('mysql10.streamline.net',$username,$password);
@
mysql_select_db($database) or die("Unable to select database");

$query="CREATE TABLE members(

id          INT           NOT NULL   AUTO_INCREMENT,
loginname   VARCHAR(20)   NOT NULL,
createdate  DATE          NOT NULL,
password    CHAR(255)     NOT NULL,
name        VARCHAR(40),
age         INT(2),
location    VARCHAR(40),
description CHAR(255),
email       VARCHAR(40)   NOT NULL,
userpage    VARCHAR
blogs       VARCHAR
profile     VARCHAR
warn        INT

PRIMARY KEY(id))"
;

$result=mysql_query($query);

?>


<!--open page header-->

<?php
require 'banner.php';
?>


<table width="817" align="center">

<tr>

<td width="215" background="http://staticfire.co.uk/images/sidebar_back.png" 
align="center" valign="top">

<br>

<?php
require 'login.php';
?>

<br>

<?php
require 'links.php';
?>

<br>

<?php
require 'top5.php';
?>


<br>

<?php
require 'active_list.php';
?>

</td>                


<!--Start main section-->


<td width="602" valign="top">

<!--Welcome note-->

<table width="100%" align="center" border="1" bordercolor="#CD0000" cellpadding="10">
<tr>
<td>

<center><font color="#707070">

<?php

$username
="staticfire";
$password="xxxxxxx";
$database="staticfire";

mysql_connect('mysql10.streamline.net',$username,$password);
@
mysql_select_db($database) or die("Unable to select database");

$query "SELECT * FROM members"
     
$result mysql_query($query) or die(mysql_error());


while(
$row mysql_fetch_array($result)){

echo 
$row['id']. " - "
$row['loginname']. " - ".
$row['createdate']. " - ".
$row['password']. " - "
$row['name']. " - ".
$row['age']. " - ".
$row['location']. " - "
$row['description']. " - ".
$row['email']. " - ".
$row['userpage']. " - ".
$row['blogs']. " - ".
$row['profile']. " - ".
$row['warn']. " - ";

echo 
"<br />";
}
?>



</font></center>

</td>
</tr>
</table>



</td>
</tr>

</table>

<?php
require 'footer.php';
?>
Yes i am a noob.

Yes this is my first php site.

I know it's a lot but i'm desperate for help. I will be forever grateful to whoever helps me.
-Thanks

Oh and may i also add that their is a field for the id and create date in the registration form. It's not because i'm stupid but because i can't get them to work automatically

Last edited by staticfire; 05-09-07 at 05:03 PM. Reason: I needed to point something out.
Reply With Quote
  #2 (permalink)  
Old 05-09-07, 04:54 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
could you post your errors please? it would make it a lot easier for us to help

cheers
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 05-09-07, 04:55 PM
staticfire's Avatar
staticfire staticfire is offline
Wannabe Coder
 
Join Date: May 2007
Location: Stockton, England
Posts: 223
Thanks: 0
Thanked 1 Time in 1 Post
oops i think i used the wrong highlighters. Sorry this is my first post.

oh yes i should have done that. Heres the error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in e:\domains\s\staticfire.co.uk\user\htdocs\check_lo gin.php on line 29

Last edited by Christian; 05-09-07 at 05:17 PM. Reason: Merged
Reply With Quote
  #4 (permalink)  
Old 05-09-07, 06:07 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
This part on check_login.php looks weird?
PHP Code:

$worked mysql_fetch_array($result); 


$loginname $worked['loginname']; 
$password $worked['password']; 
$email $worked['email'];  

if(
$worked
  



if(isset(
$_session['loginname'])){  

echo
"Welcome $_session['loginname']"

}else {echo
"You are not logged in"


Take a look at this: (Untested)
PHP Code:



    
if ($row mysql_fetch_array($result))
    {
    
$_SESSION['loginname'] = $row['loginname'] ;
    
$_SESSION['email'] = $row['email'] ;
    
$_SESSION['Loggedin'] = true ;
    echo 
'WELCOME '.$_SESSION['loginname'] ;
    }
    else
    {
    echo 
'TRY AGAIN' ;
    } 
Tell us how it goes...
__________________
01010000 01001000 01010000
Reply With Quote
  #5 (permalink)  
Old 05-10-07, 02:08 AM
staticfire's Avatar
staticfire staticfire is offline
Wannabe Coder
 
Join Date: May 2007
Location: Stockton, England
Posts: 223
Thanks: 0
Thanked 1 Time in 1 Post
Thanks for that. It worked fine. I'll try and learn from my mistakes.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Fileupload/Email Script Urgently Needed! nicekiwi9 Script Requests 0 03-30-07 09:01 PM
Script URGENTLY needed to make my life easier. scbsmith Script Requests 1 08-29-05 02:51 AM
urgently needed a PHp coder.. ducaat Job Offers & Assistance 6 11-10-04 06:47 AM
Scripts Needed? ezcore General HotScripts Site Discussion 4 08-27-04 03:27 PM
Affiliate script needed urgently jimmy474 Script Requests 0 05-06-04 08:49 AM


All times are GMT -5. The time now is 06:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.