Log in

View Full Version : Login system. Need a quick hand.



Luckyrare
25-09-2005, 12:23 PM
I am working on a DJ login for Bobboid.
With 2 tools. DJ requests and a DJ says.

I am working on the DJ says first because that should be easyer.

[Can I ask you not to use it for the time being, I may let people use it once Its been writen]

In the files I have

- index.htm [Login page]
- login.php [Form handler]
- djsays.txt [Holds the Data for dj says]
- config.php [Holds data like username, passwords ect]
- admin.php [Holds admin tools, and links]
- show.php [Shows data submitten via admin cp, from "djsays.txt"]

Faults are in index.htm [I need to no how to send it to the form handler], admin.php [How can I protect it, via the login? Need help (Dont no how) to use cookies do save your login for "x" seconds]


Here the codes I have writen

index.htm


<html>
<form name="form1" method="post">
<div>Username:
<input id="userinput" type="text" value="" name="userinput">
<br>
<br>Password:
<input id="passinput" type="password" value="" name="passinput">
<br>
<br>
<input type="submit" value="Submit" name="Submit">
<input type="reset" value="Reset" name="Reset">
<input id="action" type="hidden" value="submit" name="action"> </div></form>
</html>

login.php


<?php
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$info";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
} else {
echo "$fail";
}
}
}
include('form.php') ;
?>

djsays.txt

Anything you want.

config.php

<?PHP
//Config
//Writen by Danny for Bobboid.NET
$user = "User";
$pass = "Password";
$email = "[email protected]";
$url = "http://www.test.com/admin.php";
$fail = "Wrong password/user";
$info = "No information";
//End config
?>

admin.php

Nothing been writen for it yet.

show.php

<?php
include ("config.php");
include ("djsays.txt");
?>
</font>


Okay!

Can anyone help me with...

- Making a form to edit the data in "djsays.txt"
- Fix index.htm
- Make admin.php safe...


Thanks people <3

Mentor
25-09-2005, 12:28 PM
I dont see how it works.
Ok conspetualy.
Form submits and data is writen to djsays.txt

Then when u inslude a txt file it would just be a jumble of lines, youd realy need to put it in to a loop and form it?
And is jdsays holding public submitions or what the dj is actaly saying?

I dont get what this systems supposed to do, could u give a expnition to conspet and what all the bits are supposedly doing as it would make it easyer to help "/

the wombats
25-09-2005, 12:32 PM
Carl, it lets people type something into a box on the site. And anyone can see the box but he needs help with the login system for it.

I hope thats what he means :/

Luckyrare
25-09-2005, 12:32 PM
Okay,

The index.htm is the login for DJ's ect.

admin.php will have a form for where you can edit the djsays.php


But. index.htm need sorting, it needs to go onto login.php.

And the admin.php needs protecting, as the login system wouldnt protect it.


Edit: Yes mr craig "_" your correct, and the data is saved onto .txt file.

Mentor
25-09-2005, 12:46 PM
Ok, so index.htm should probaly be index.php then u can ether header redirect or include the pages you want, your login system should place a cookie, wich cvan then be checked for on admin.php that would act as securty for that and any other pages?

Luckyrare
25-09-2005, 12:54 PM
Yep, I need help me with the cookies and the index.php for the login.

I realy dont get this stuff "_"

You/ anyone else who can help will be thanked on the Read me and config.


Thanks!

splintercell!
25-09-2005, 01:51 PM
so for sercurity maybe use:


<?php
session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$info";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('form.php') ;
?>
and then on the pages you want secured add:


session_start();
if (!$_SESSION['name']) {
echo "You aren't logged in.";
include("login_form.html");
exit();
}

o and to add it to the the formhandler use:


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

:Blob
25-09-2005, 02:57 PM
I am working on a DJ login for Bobboid.
With 2 tools. DJ requests and a DJ says.

I am working on the DJ says first because that should be easyer.

[Can I ask you not to use it for the time being, I may let people use it once Its been writen]

In the files I have

- index.htm [Login page]
- login.php [Form handler]
- djsays.txt [Holds the Data for dj says]
- config.php [Holds data like username, passwords ect]
- admin.php [Holds admin tools, and links]
- show.php [Shows data submitten via admin cp, from "djsays.txt"]

Faults are in index.htm [I need to no how to send it to the form handler], admin.php [How can I protect it, via the login? Need help (Dont no how) to use cookies do save your login for "x" seconds]


Here the codes I have writen

index.htm


<html>
<form name="form1" method="post">
<div>Username:
<input id="userinput" type="text" value="" name="userinput">
<br>
<br>Password:
<input id="passinput" type="password" value="" name="passinput">
<br>
<br>
<input type="submit" value="Submit" name="Submit">
<input type="reset" value="Reset" name="Reset">
<input id="action" type="hidden" value="submit" name="action"> </div></form>
</html>

login.php


<?php
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$info";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
} else {
echo "$fail";
}
}
}
include('form.php') ;
?>

djsays.txt


config.php

<?PHP
//Config
//Writen by Danny for Bobboid.NET
$user = "User";
$pass = "Password";
$email = "[email protected]";
$url = "http://www.test.com/admin.php";
$fail = "Wrong password/user";
$info = "No information";
//End config
?>

admin.php


show.php

<?php
include ("config.php");
include ("djsays.txt");
?>
</font>


Okay!

Can anyone help me with...

- Making a form to edit the data in "djsays.txt"
- Fix index.htm
- Make admin.php safe...


Thanks people <3

Admin center for only admins is (IF you set rank as admin)

if ($admin)

echo "Site here"

if ($!admin)

echo "Sorry your not a admin"

Luckyrare
25-09-2005, 03:25 PM
Thanks Mate!

Now I keep getting a error,

I can re type the password again and again but no luck...
I have moved it into different places on the .php page.

Have a look.

http://www.bobboid.net/danny/test/DJ/index.htm

User: demo
Pass: demo

PHP Coding for Admin Page:


<font face=verdana size=1>
<br>Navigator: <a href="admin.php" target="_self">Home</a>

<?php

session_start();
if (!$_SESSION['name']) {
echo "You aren't logged in.";
include("login_form.html");
exit();
}
if(!$show){ $show = $HTTP_GET_VARS['show']; }

if($show=="stats"){
include ("stats.php");
?>

<?php
}
else{
include ("config.php");
echo "<br>";
echo "<br>Welcome to $scdef DJ tool!<br>";
echo "<br><b>Shoutcast details</b>";
echo "<br>IP: $ip";
echo "<br>Port: $port";
?>

<?php
}
?>
<BR><BR><BR><BR><CENTER>Bobboid.NET</CENTER>
</font>


Thanks mate ;)


Thanks cr, I needed that. Rep Added. and also to splint

the wombats
25-09-2005, 03:29 PM
Navigator: Home
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/bobboid/public_html/danny/test/DJ/admin.php:4) in /home2/bobboid/public_html/danny/test/DJ/admin.php on line 6
You aren't logged in.
Warning: main(login_form.html): failed to open stream: No such file or directory in /home2/bobboid/public_html/danny/test/DJ/admin.php on line 9

Warning: main(login_form.html): failed to open stream: No such file or directory in /home2/bobboid/public_html/danny/test/DJ/admin.php on line 9

Warning: main(): Failed opening 'login_form.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/bobboid/public_html/danny/test/DJ/admin.php on line 9
Thats what it says for lazy people

Luckyrare
25-09-2005, 03:35 PM
Woops! I no.

Sorry.

Now Iam just getting...

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/bobboid/public_html/danny/test/DJ/admin.php:4) in /home2/bobboid/public_html/danny/test/DJ/admin.php on line 6

:Blob
25-09-2005, 03:41 PM
make sure theres no spaces between the bottom and ?>

Mentor
25-09-2005, 03:47 PM
Yea, you want the first php setting the session to appear before any html or balnk space on the page or your will cause header errors "/

Luckyrare
25-09-2005, 03:55 PM
The problem its saying is... session_start();



<font face=verdana size=1>
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

:Blob
25-09-2005, 03:57 PM
The problem its saying is... session_start();



<font face=verdana size=1>
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

isnt it

[QUOTE=Luckyrare™]The problem its saying is... session_start();



<font face="verdana" size="1">
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

Luckyrare
25-09-2005, 04:08 PM
Ummmm... Whats up with it ;(

:Blob
25-09-2005, 04:10 PM
Ummmm... Whats up with it ;(

Try

<font face="verdana" size="1">
<?php
session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

Mentor
25-09-2005, 04:12 PM
Liek i said, your utilisng headers before sesion.


<font face=verdana size=1>
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>
Notice the varda font info?

shoudl be

<?php

session_start();
include('config.php');
echo "<font face=verdana size=1>";
if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

splintercell!
25-09-2005, 04:12 PM
you could just replace the headers(); with some kind of javascript redirect ;) Works in the same way... its the easy way out really..

Luckyrare
25-09-2005, 04:15 PM
Liek i said, your utilisng headers before sesion.


<font face=verdana size=1>
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>
Notice the varda font info?

shoudl be

<?php

session_start();
include('config.php');
echo "<font face=verdana size=1>";
if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

o.O I get you now.

Thanks mate!

Edit: This is starting to do my head in now.

The password doesnt even work >:(

Flisker
25-09-2005, 04:19 PM
Can someone please put it in a replay form on how i am meant to do this proply i am very confused in what ppl are saying and its wasn't working for me thats why i need help !!!! Thanx

Luckyrare
25-09-2005, 04:21 PM
Can someone please put it in a replay form on how i am meant to do this proply i am very confused in what ppl are saying and its wasn't working for me thats why i need help !!!! Thanx

NOTE: This isnt a tutorial, its a script that I needed help on.

Also you may not use the script unless I say so.



[Can I ask you not to use it for the time being, I may let people use it once Its been writen]

splintercell!
25-09-2005, 04:22 PM
what you want the code for a reply form?? or you want to be told how to do this "/

:Blob
25-09-2005, 04:27 PM
Liek i said, your utilisng headers before sesion.


<font face=verdana size=1>
<?php

session_start();
include('config.php');

if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>
Notice the varda font info?

shoudl be

<?php

session_start();
include('config.php');
echo "<font face=verdana size=1>";
if($action == "submit"){
if(($userinput == "")||($passinput == "")){
echo "$noinfo";
} else {
if(($userinput == $user)&&($passinput == $pass)){
header( "Location: $url" );
$_SESSION['user'] = $user;
} else {
echo "$fail";
}
}
}
include('admin.php') ;
?>
</font>

isnt the font code for php meant to be like

<font face=\"verdana\" size=\"1\">

Luckyrare
25-09-2005, 04:28 PM
For this or for a norml form?

Mentor
25-09-2005, 04:29 PM
isnt the font code for php meant to be like

<font face=\"verdana\" size=\"1\">
No need since there arnt any " in it, plus its easyer to just swich between ' and " makrs that slash them "/

Luckyrare
25-09-2005, 04:45 PM
I have taken away the font headers and still no luck.

Want to hide these adverts? Register an account for free!