Jump to content

Need Help!!!


stem

Recommended Posts

Well obviously i need help i'm in the help forum  :D

the problem is...

i have a webpage that i have made... and i want some members of my site to be able to edit it but not others... but i don't want to give them members access to the Cpanel..

Is there a way of creating a login system that allows the user to change and save the page?

i want them to be able to edit the information within this table:

http://www.habboboom.co.uk/community/events.php

AnyideaS?

thanks
stem
Link to comment
Share on other sites

You would probably use sessions to have there login. you have to do some things.

1. Create a database or table in your database which holds your users
here is an sql of my table structure
[code]CREATE TABLE `users` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `username` varchar(50) NOT NULL default '',
  `password` varchar(50) NOT NULL default '',
  `ugroup` varchar(25) NOT NULL default '0',
  `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;[/code]

2. create form to add users to table preferably  with md5 hashing for the password
3. Create login form with session so user with access can only view the pages

I am not sure what you mean by update a page. In order to do something like that you would have to have a html page show up in a text area for editing. My preference would be to create a php template which pulls information from a table. that way you can just let the user edit the table and the values are plugged into the template when viewed.

EDIT: i just looked at your page and you can hold the events in a table and have php pull the info from the table and populate the page, that way users just need to have access to add/edit events.

Ray
Link to comment
Share on other sites

[quote author=craygo link=topic=119260.msg488272#msg488272 date=1166545801]

2. create form to add users to table preferably  with md5 hashing for the password
3. Create login form with session so user with access can only view the pages

i just looked at your page and you can hold the events in a table and have php pull the info from the table and populate the page, that way users just need to have access to add/edit events.

Ray
[/quote]

It confuses me a little...

i am really a complete noob :(

I know how to build a Mysql table but the rest i'm completely oblivious too
Link to comment
Share on other sites

So far i have:


install.php    - where i add users to the database that you posted

[code]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sign up</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <table width="143" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <th scope="col">Username:</th>
    </tr>
    <tr>
      <td><label>
        <input type="text" name="username" id="username" />
      </label></td>
    </tr>
    <tr>
      <th>Password:</th>
    </tr>
    <tr>
      <td><label>
        <input type="password" name="password" id="password" />
      </label></td>
    </tr>
    <tr>
      <th>Group:</th>
    </tr>
    <tr>
      <td><label>
        <div align="center">
          <select name="ugroup">
            <option value="1">Admin</option>
            <option value="2">Staff</option>
            <option value="3" selected="selected">Trainee</option>
          </select>
          </div>
      </label></td>
    </tr>
  </table>
</form>
</body>
</html>[/code]
--------------------------------------------

and my events page

events.php

[code]<html>
<head>
<title>HabboBoom ~ Events</title>
</head>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta name="Description" content="HabboBoom is a ever exspanding Habbo Hotel Uk Unoffical fansite which is hoping to become Offical in the near further" />
<meta name="Keywords" content="Hab
Habbo Hotel
Habbo
Habbo Fansites
Habbo sites
Habbo Community<br />
HabboBoom<br />
HB<br />
Habbo Radio<br />
Habbo Boom" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<style>

a.navilinks:link {
text-decoration:none;
font-weight:bold;}

a.navilinks:link {
text-decoration:none;
font-weight:bold;}

a.navilinks:link {
text-decoration:none;
font-weight:bold;
}

a.navilinks:hover {
text-decoration:none;
font-weight:bold;
}


body,td,th {
font-family: Verdana;
font-size: 10px;
color: #CCCCCC;
}
body {
background-image: url(background.PNG);
}
.option{

cursor:pointer;
color:#000000;
text-decoration:none;
}
a:link {
color: #00CCFF;
text-decoration: none;
}
a:visited {
color: #00CCFF;
text-decoration: none;
}
a:hover {
color: #006699;
text-decoration: underline;
}
a:active {
color: #00CCFF;
text-decoration: none;
}
a {
font-weight: bold;
#Layer1 {
position:absolute;
width:300px;
height:300px;
z-index:5;
}
#Layer1 {
position:absolute;
width:75;
height:86;
z-index:5;
left: 904px;
top: 7px;
}
.style3 {font-size: 9px; }
.style4 {font-size: 9px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style6 {font-family: Verdana, Arial, Helvetica, sans-serif; }
</style>
</head>

<body>
<center>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br /> 
  <br />
</p>
<table width="629" height="29" border="0" cellspacing="0">
  <tr>
    <td height="29" background="/images/Images/MB/top.gif">&nbsp;</td>
  </tr>
  <tr>
    <td background="/images/Images/MB/middle.gif"><blockquote><b>Dear Habbo,
      <blockquote></b>
        <p align="left"><div><img width="246" height="21" src="/events_logo.gif" alt="" title=""> <font size="1"><br><br><font face="Verdana">Welcome to the Events area of HabboBOOM!</font></font></div>
<div><font size="1"><font face="Verdana">We have taken the time to plan events, for all you lovely habbos!</font></font></div>
<div><font size="1"><font face="Verdana">
Below are the planned events!!&nbsp;</font></font></div><br><br><br>

<img style="margin: 0px;" width="49" height="96" align="right" src="/tele_ani.gif" alt="" title="">
<br>
<table style="border-collapse: collapse;" width="436" cellspacing="0" cellpadding="3" bordercolor="#000000" border="0" bgcolor="#79cdcd"><tbody><tr><td width="33%" valign="top">
<div><font color="#660066"><strong>Event Host&nbsp;</strong></font></div></td><td width="33%" valign="top">
<div><font color="#660066"><strong>Event Type&nbsp;</strong></font></div></td><td width="33%" valign="top">
<div><font color="#660066"><strong>Time/Location/Day&nbsp;</strong></font></div></td></tr><tr><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">MacJonas&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">Giveaway&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">Unkown&nbsp;</font></div></td></tr><tr><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">MacJonas</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">Kick Wars CONTEST!</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">7 PM Wednesday, MacJonas room!</font></div></td></tr><tr><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td></tr><tr><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td><td width="33%" valign="top" bgcolor="#325c74">
<div><font color="#ccff33">&nbsp;</font></div></td></tr></tbody></table>


</span><br />
        </p>
        <p align="left">&nbsp;</p>
      </blockquote>      </td>
  </tr>
</table>
<table width="629" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" scope="col"><div align="left">
      <div align="center">
        <p>| <a href="http://www.habboboom.co.uk/jobapp.php" target="_blank">Job Applications</a> |</p>
      </div>
    </div></td>
    <td align="center" valign="middle" scope="col"><div align="center">
      <p class="navilinks style3"> <a href="http://www.habboboom.co.uk/disclaimer.php" target="_blank">Disclaimer</a></p>
    </div></td>
    <td align="center" valign="middle" scope="col"><div align="center">
      <p class="navilinks style3">| <a href="/forum/" target="_blank">Forum</a></p>
    </div></td>
    <th scope="col"><p>&nbsp;</p>
  </tr>
  <tr>
    <th width="116" scope="col">&nbsp;</th>
    <th width="60" scope="col">&nbsp;</th>
    <th width="55" scope="col">&nbsp;</th>
    <th width="398" scope="col">&nbsp;</th>
  </tr>
</table>
</body>

</html>



</body>


</html>[/code]
Link to comment
Share on other sites

OK make a table for your events with all the fields you would like in it. I know you only have a couple things showing on the events.php page but you can show just a couple things on the events page then have a link which would send you to a page with all the details.

After you make the events table post an sql of the table structure. Make sure you have an auto increment field for each event

Ray
Link to comment
Share on other sites

Ok i made the table in MyphpAdmin and the sql is


[code]CREATE TABLE `event` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `host` varchar(50) NOT NULL default '',
  `event` varchar(50) NOT NULL default '',
  `place` varchar(25) NOT NULL default '0',
   PRIMARY KEY  (`id`)
) ENGINE=MyISAM;[/code]


or should it be..
[code]CREATE TABLE `event` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `host` varchar(50) NOT NULL auto_increment,
  `event` varchar(50) NOT NULL auto_increment,
  `place` varchar(25) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;[/code]
Link to comment
Share on other sites

yes you have to connect to the database. I usually use 2 files. just save these in the same folder. That way they can be called upon anytime you want to connect to the database and you do not have to retype your connection string
config.php
[code]<?php
$dbhost = 'localhost'; // database server
$dbuser = '';      // db username
$dbpass = '';    // db password
$dbname = '';  // db name
?>[/code]
mysql.php
[code]<?php
$mysql_conn = @mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect to Mysql, Please check settings and try again");
@mysql_select_db($dbname, $mysql_conn) or die("DataBase does not exist");
?>[/code]

OK now for the files
login.html
[code]<form method=POST action="<? $_SERVER['PHP_SELF']?>">
<table border=1 cellpadding=3 celspacing=3 align=center width=50%>
<tr><td colspan=2 align=center>Login</td></tr>
<input type=hidden name=action value=login>
<tr><td>Username:</td><td><input type=text name=username size="20"></td><tr>
<tr><td>Password:</td><td><input type=password name=password size="20"></td><tr>
<tr><td colspan=2 align=center><input type=submit name=submit value=Login></td><tr>
</table>
</form>
</body>
</html>[/code]

login.php (this is the main page)
[code]<?
session_start();
require('config.php');
include('mysql.php');
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = md5($_POST['password']);
$getuser = "SELECT * from users WHERE username = '$username' AND password = '$password'";
  $result = mysql_query($getuser) or die (mysql_error());
    $r = mysql_fetch_array($result);
    $qualify = mysql_num_rows($result);
if($qualify > 0){
$_SESSION['username'] = $r['username'];
$_SESSION['ugroup'] = $r['type'];
?>
<head>
<title>Events Login</title>
<META HTTP-EQUIV="Refresh" content="3;url=eventlist.php">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="elder.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p align=center>Please wait... you will now be redirected to your server page.</p>
</body>
</html>
<?
} else {
print '<p align=center>Bad username/password<br>Click <a href="login.php">here</a> to return to login page.';
}
} else {
include('login.html');
}
?>[/code]

elist.php
[code]<form name="list" action="changes.php" method="POST">
<table width=450 align=center>
<tr>
<td width=100>Host</td>
<td width=150>Event</td>
<td width=100>Place</td>
<td width=100>Edit/Delete</td>
</tr>
<?php
$sql = "SELECT * FROM event";
$res = mysql_query($sql) or die (mysql_error());
while($r = mysql_fetch_assoc($res)){
echo "<tr>
      <td>".$r['host']."</td>
      <td>".$r['event']."</td>
      <td>".$r['place']."</td>
      <td><input type=checkbox name=ids[] value=".$r['id']."></td>
      </tr>";
}

echo "<tr>
      <td colspan=4 align=center>
      <input type=submit name=delete value=Delete onclick=\"return confirm('Are you sure you wish to delete the selected item(s)?')\">&nbsp;&nbsp;
      <input type=submit name=edit value=Edit></td>
      </tr>
      </table>
      </form>";
?>[/code]

eventlist.php
[code]<?
session_start();
require('config.php');
include('mysql.php');
// Check if user is logged in
if(isset($_SESSION['username']) && $_SESSION['ugroup'] == 1){
$self = $_SERVER['PHP_SELF'];
echo "<table width=300 align=center>
      <tr>
      <td colspan=2 align=center>Add event here</td>
      </tr>
      <form action='changes.php' method=POST>
      <tr>
      <td width=100>Host:</td>
      <td width=200><input type=text name=ehost></td>
      </tr>
      <tr>
      <td width=150>Event:</td>
      <td width=250><input type=text name=event></td>
      </tr>
      <tr>
      <td width=150>Place:</td>
      <td width=250><input type=text name=place></td>
      </tr>
      <tr>
      <td colspan=2 align=center><input type=submit name=add value=\"Add Event\"></td>
      </tr>
      </form>
      </table><hr>";
include("elist.php");
} else {
print '<p align=center>NO SOUP FOR YOU!!! Please login <a href="login.php">HERE</a></p>';
}
?>
</html>[/code]

changes.php
[code]<?php
session_start();
// Sql connection here
require('config.php');
include('mysql.php');
if(isset($_SESSION['username']) && $_SESSION['ugroup'] == 1){
$self = $_SERVER['PHP_SELF'];

if(isset($_POST['update'])){
echo "<p align=center>";
// Connect to mysql
foreach($_POST['eventid'] as $val){
$id = $_POST['eventid'][$val];
$host = $_POST['host'][$val];
$event = $_POST['event'][$val];
$place = $_POST['place'][$val];

$sql = "UPDATE event SET
        host = '".$host."',
        event = '".$event."',
        place = '".$place."' WHERE id = '".$val."'";
$res = mysql_query($sql);
  if(!$res){
  echo "Could not update event# $id<br>SQL: $sql<br> Error: ".mysql_error();
  } else {
  echo "Event# $id Sucessfully updated<br>";
  }
}
echo "Click <a href=\"eventlist.php\">HERE</a> To return to event list</p>";
} else {
  if(isset($_POST['delete'])){
  echo "<p align=center>";
  // Start array of id's
  $ids = array();
  // Fill array with values
  foreach($_POST['ids'] as $id){
  $ids[] = $id;
  }
  // Loop through array and delete each id
  foreach($ids as $eventid){
  $sql = "DELETE FROM event WHERE id = $eventid";
  $res = mysql_query($sql) or die (mysql_error());
    if(!$res){
    echo "Could not DELETE event# $eventid<br>SQL: $sql<br> Error: ".mysql_error();
    } else {
    echo "Event# $eventid Sucessfully deleted<br>";
    }
  }
  echo "Click <a href=\"eventlist.php\">HERE</a> To return to Event list</p>";
  } else {
    if(isset($_POST['add'])){
    echo "<p align=center>";
    $sql = "INSERT INTO event SET
            host = '".$_POST['ehost']."',
            event = '".$_POST['event']."',
            place = '".$_POST['place']."'";
    $res = mysql_query($sql);
    if(!$res){
    echo "Could not add new event<br>SQL: $sql<br> Error: ".mysql_error()."<br>
          Click <a href=\"eventlist.php\">HERE</a> To return to Event list</p>";
    } else {
    echo "New Event added<br>
          Click <a href=\"eventlist.php\">HERE</a> To return to Event list</p>";
    }

    } else {
// start your array of id's
$ids = array();
// fill your array with the id's selected
    foreach($_POST['ids'] as $id){
    $ids[] = $id;
    }
// start your form
echo "<form name=edit action=\"$self\" method=POST>";
// Loop through the id's. query database to get infor for each id
  foreach($ids as $eventid){
  $sql = "SELECT * FROM event WHERE id = $eventid";
  $res = mysql_query($sql) or die (mysql_error());
  $i=0;
  $r = mysql_fetch_array($res);
// print the form for each id
  echo "<table width=500 align=center>";
  echo "<tr><td colspan=2 align=center><font color=red size=4><b>Now editing EVENT# ".$r['id']."</b></font></td></tr>";
    while($i < mysql_num_fields($res)){
    $meta = mysql_fetch_field($res, $i);
      /*****************
      If you would like to modify the stock number, remove **** && $meta->name <> "stock"  **** below
      ******************/
      if($meta->name <> "id"){
      echo "<input type=hidden name=eventid[".$r['id']."] value=\"".$r['id']."\">";
      print '<tr>
            <td width=150>'.$meta->name.'</td>
            <td width=350><input type=text size=50 name="'.$meta->name.'['.$r['id'].']" value="'.$r[$i].'"></td>
            </tr>';
      }
    $i++;
    }
  echo "<hr>";
  }
  print '<tr>
        <td colspan=2 align=center><input type=submit name=update value=Change></td>
        </tr>
        </table>
        </form>';
    }
  }
}
} else {
print '<p align=center>NO SOUP FOR YOU!!! Please login <a href="login.php">HERE</a></p>';
}
?>[/code]

Now just put all these files in the same directory. I will post the code for your main page in a minute.

Ray
Link to comment
Share on other sites

here is the updated events.php
[code]<html>
<head>
<title>HabboBoom ~ Events</title>
</head>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta name="Description" content="HabboBoom is a ever exspanding Habbo Hotel Uk Unoffical fansite which is hoping to become Offical in the near further" />
<meta name="Keywords" content="Hab
Habbo Hotel
Habbo
Habbo Fansites
Habbo sites
Habbo Community<br />
HabboBoom<br />
HB<br />
Habbo Radio<br />
Habbo Boom" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<style>

a.navilinks:link {
text-decoration:none;
font-weight:bold;}

a.navilinks:link {
text-decoration:none;
font-weight:bold;}

a.navilinks:link {
text-decoration:none;
font-weight:bold;
}

a.navilinks:hover {
text-decoration:none;
font-weight:bold;
}


body,td,th {
font-family: Verdana;
font-size: 10px;
color: #CCCCCC;
}
body {
background-image: url(background.PNG);
}
.option{

cursor:pointer;
color:#000000;
text-decoration:none;
}
a:link {
color: #00CCFF;
text-decoration: none;
}
a:visited {
color: #00CCFF;
text-decoration: none;
}
a:hover {
color: #006699;
text-decoration: underline;
}
a:active {
color: #00CCFF;
text-decoration: none;
}
a {
font-weight: bold;
#Layer1 {
position:absolute;
width:300px;
height:300px;
z-index:5;
}
#Layer1 {
position:absolute;
width:75;
height:86;
z-index:5;
left: 904px;
top: 7px;
}
.style3 {font-size: 9px; }
.style4 {font-size: 9px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style6 {font-family: Verdana, Arial, Helvetica, sans-serif; }
</style>
</head>

<body>
<center>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
  <br />
</p>
<table width="629" height="29" border="0" cellspacing="0">
  <tr>
    <td height="29" background="/images/Images/MB/top.gif">&nbsp;</td>
  </tr>
  <tr>
    <td background="/images/Images/MB/middle.gif"><blockquote><b>Dear Habbo,
      <blockquote></b>
        <p align="left"><div><img width="246" height="21" src="/events_logo.gif" alt="" title=""> <font size="1"><br><br><font face="Verdana">Welcome to the Events area of HabboBOOM!</font></font></div>
<div><font size="1"><font face="Verdana">We have taken the time to plan events, for all you lovely habbos!</font></font></div>
<div><font size="1"><font face="Verdana">
Below are the planned events!!&nbsp;</font></font></div><br><br><br>

<img style="margin: 0px;" width="49" height="96" align="right" src="/tele_ani.gif" alt="" title="">
<br>
<table style="border-collapse: collapse;" width="436" cellspacing="0" cellpadding="3" bordercolor="#000000" border="0" bgcolor="#79cdcd">
<tbody>
  <tr>
    <td width="33%" valign="top"><div><font color="#660066"><strong>Event Host&nbsp;</strong></font></div></td>
    <td width="33%" valign="top"><div><font color="#660066"><strong>Event Type&nbsp;</strong></font></div></td>
    <td width="33%" valign="top"><div><font color="#660066"><strong>Time/Location/Day&nbsp;</strong></font></div></td>
  </tr>
<?php
require('../config.php');
include('../includes/mysql.php');
$sql = "SELECT * FROM event";
$res = mysql_query($sql) or die (mysql_error());
while($r = mysql_fetch_assoc($res)){
  echo '
  <tr>
    <td width="33%" valign="top" bgcolor="#325c74"><div><font color="#ccff33">'.$r['host'].'&nbsp;</font></div></td>
    <td width="33%" valign="top" bgcolor="#325c74"><div><font color="#ccff33">'.$r['event'].'&nbsp;</font></div></td>
    <td width="33%" valign="top" bgcolor="#325c74"><div><font color="#ccff33">'.$r['place'].'</font></div></td>
  </tr>';
}
?>
</tbody>
</table>
</span><br />
        </p>
        <p align="left">&nbsp;</p>
      </blockquote>      </td>
  </tr>
</table>
<table width="629" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" scope="col"><div align="left">
      <div align="center">
        <p>| <a href="http://www.habboboom.co.uk/jobapp.php" target="_blank">Job Applications</a> |</p>
      </div>
    </div></td>
    <td align="center" valign="middle" scope="col"><div align="center">
      <p class="navilinks style3"> <a href="http://www.habboboom.co.uk/disclaimer.php" target="_blank">Disclaimer</a></p>
    </div></td>
    <td align="center" valign="middle" scope="col"><div align="center">
      <p class="navilinks style3">| <a href="/forum/" target="_blank">Forum</a></p>
    </div></td>
    <td align="center" valign="middle" scope="col"><div align="center">
      <p class="navilinks style3">| <a href="login.php">Log into admin</a></p>
    </div></td>
    <th scope="col"><p>&nbsp;</p>
  </tr>
  <tr>
    <th width="116" scope="col">&nbsp;</th>
    <th width="60" scope="col">&nbsp;</th>
    <th width="55" scope="col">&nbsp;</th>
    <th width="398" scope="col">&nbsp;</th>
  </tr>
</table>
</body>

</html>[/code]

Ray
Link to comment
Share on other sites

I am studying it =D

and i found a few mistakes :p!

i've sorted most of them out just the login.php and the install.php

they both need to be validated somehow? because atm their
action is just    action=""
and i can't login it just keeps comming up bad password :o!
and ideas? :p
Link to comment
Share on other sites

Here is the install.php
[code]<?php
if(isset($_POST['submit'])){
// Sql connection here
require('config.php');
include('mysql.php');
$password = md5($_POST['password']);
$sql = "INSERT INTO users SET
        username = '".$_POST['username']."',
        password = '".$password."',
        ugroup = '".$_POST['ugroup']."'";
$res = mysql_query($sql);
if(!$res){
echo "<b>could not insert new user!!</b><br>Error: ".mysql_error()."<br>SQL: ".$sql."<br>Click <a href=\"install.php\">HERE</a> to return to insert page";
} else {
echo "New user entered into database<br>Click <a href=\"install.php\">HERE</a> to return to insert page";
}
} else {
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sign up</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
  <table width="143" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <th scope="col">Username:</th>
    </tr>
    <tr>
      <td><label>
        <input type="text" name="username" id="username" />
      </label></td>
    </tr>
    <tr>
      <th>Password:</th>
    </tr>
    <tr>
      <td><label>
        <input type="password" name="password" id="password" />
      </label></td>
    </tr>
    <tr>
      <th>Group:</th>
    </tr>
    <tr>
      <td><label>
        <div align="center">
          <select name="ugroup">
            <option value="1">Admin</option>
            <option value="2">Staff</option>
            <option value="3" selected="selected">Trainee</option>
          </select>
          </div>
      </label>
      </td>
    </tr>
    <tr>
      <td align=center><br><label>
        <input type="submit" name="submit" value="Submit" id="password" />
      </label></td>
    </tr>
  </table>
</form>
<?php
}
?>
</body>
</html>[/code]

Ray
Link to comment
Share on other sites

Your going to probably hate me for this...

but
i can install fine... login fine... just when it redirects me to the events page it says click here to login!  :(

any idea why? i've looked and i think it has something to do with the session? o_O

i looked around and i found something like:
[Code]

<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}


[/Code]
Will that need to be in my events bit? it looks like it's saying the session is from the previous URL? or am i wrong? :p

if you don't understand whats wrong visit these links :p

http://www.habboboom.co.uk/community/staff/login.php

Username => ben
password => 123


----------------------
and may i ask where is the best place to Learn Php? :o

i'm taking a college course on computer programming... but we don't start php till next year i think... if we start it at all! :(
Link to comment
Share on other sites

Ray!! omg i found the problem!!
haha


on the Eventslist.php

you had

[Code]
if(isset($_SESSION['username']) && $_SESSION['ugroup'] == 1){
[/Code]

i remember seeing something so i changed it and it works it should of been

[code]
if(isset($_SESSION['username']) && $_SESSION['ugroup'] = 1){
[/code]

only 1 = sign :P
Link to comment
Share on other sites

It should be 2 = signs. If you have one that means it is just not going to check the ugroup. I think the problem may be the assignment of the ugroup. Back on the login.php page you assign the session value to the ugroup with a field from the table. Is the field correct?? I have it as
[code]$_SESSION['ugroup'] = $r['type'];[/code]

Is your group field called type?? if not change that line with the field name. or whatever field holds the group.

Ray
Link to comment
Share on other sites

ok on login.php i have


[code]
$_SESSION['username'] = $r['username'];
$_SESSION['ugroup'] = $r['type'];
[/code]

and on install.php
where you select the rank i have;
[Code]
    <div align="center">
          <select name="ugroup">
            <option value="1">Admin</option>
            <option value="2">Staff</option>
            <option value="3" selected="selected">Trainee</option>
          </select>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.