stem
Members-
Posts
18 -
Joined
-
Last visited
Never
Everything posted by stem
-
i havn't had a chance to upload the new things yet :( Webhost has been down hopefully today or tomorrow the servers will be up again and i can see if it's working lol!!
-
login.php [code] <?php session_start(); session_unset(); session_destroy(); ?> <? 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] eventlist.php [code] <?php 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>Sorry... This is events Staff only Please login <a href="login.php">HERE</a></p>'; } ?> </html> [/code] 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]
-
:D yay well done :) I'm glad i was some help :p
-
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]
-
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
-
i made an account with each group and non worked if you click the link above... and log in using username: ben password: 123 you'll see it just redirects you.
-
what do you mean? ??? if your looking for a basic page layout in html my dreamweaver puts: [code] <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> [/code] if thats any use to you :) you don't really need the top bit thoe
-
I'm not php expert and sorry if this doesn't work but.. define("SCRIPTNAME", "Simple Member"); define("BASEHREF", "http://www.free-php.net/demo/SimpleMember"); define("DOMAIN", "localhost"); define("FROMEMAIL", "drunkenmenace@gmail.com"); define("SITENAME", "Free-Php.net"); define("INC_DIR", "/home/www/codemunkyx/www/www.free-php.net/htdocs/demo/SimpleMember/inc/"); define("PAG_DIR", INC_DIR."pages/"); define("INC_DB", INC_DIR."db.php"); define("MYSQLUSER", "[color=red]your mysql username[/color]"); // mysql username define("MYSQLPASS", "[color=red]your mysql passowrd[/color]"); // mysql password define("MYSQLDB", "[color=red]your mysql databasename[/color]"); // mysql database name require(INC_DB); ?> try that? :p i.e.. your username is Jim password poiuytrewq and table name = members [Code] define("SCRIPTNAME", "Simple Member"); define("BASEHREF", "http://www.free-php.net/demo/SimpleMember"); define("DOMAIN", "localhost"); define("FROMEMAIL", "drunkenmenace@gmail.com"); define("SITENAME", "Free-Php.net"); define("INC_DIR", "/home/www/codemunkyx/www/www.free-php.net/htdocs/demo/SimpleMember/inc/"); define("PAG_DIR", INC_DIR."pages/"); define("INC_DB", INC_DIR."db.php"); define("MYSQLUSER", "Jim"); // mysql username define("MYSQLPASS", "poiuytrewq"); // mysql password define("MYSQLDB", "members"); // mysql database name require(INC_DB); ?>[/code]
-
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! :(
-
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
-
Thank you so much Ray i couldn't of done this without your help :D
-
ok :D Thanks so much for your help too :)
-
ok now i'm guessing i have to link them together somehow? o_O with a db.php file? which allows me to connect to the database?
-
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]
-
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> </p> <p> </p> <p><br /> <br /> </p> <table width="629" height="29" border="0" cellspacing="0"> <tr> <td height="29" background="/images/Images/MB/top.gif"> </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!! </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 </strong></font></div></td><td width="33%" valign="top"> <div><font color="#660066"><strong>Event Type </strong></font></div></td><td width="33%" valign="top"> <div><font color="#660066"><strong>Time/Location/Day </strong></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">Giveaway </font></div></td><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33">Unkown </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"> </font></div></td><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33"> </font></div></td><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33"> </font></div></td></tr><tr><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33"> </font></div></td><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33"> </font></div></td><td width="33%" valign="top" bgcolor="#325c74"> <div><font color="#ccff33"> </font></div></td></tr></tbody></table> </span><br /> </p> <p align="left"> </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> </p> </tr> <tr> <th width="116" scope="col"> </th> <th width="60" scope="col"> </th> <th width="55" scope="col"> </th> <th width="398" scope="col"> </th> </tr> </table> </body> </html> </body> </html>[/code]
-
[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
-
I'm a complete noobie at php... although i have eddited some php, and i've looked and couldn't find anything could you please point me in the right direction?
-
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