Jump to content

jarsky

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jarsky's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey sorry been really busy with work and coding my new website. You managed to get the update/delete script working?
  2. nope you dont, easiest way to do it would be to change [code]include("file.inc.php");[/code] to [code]include("../../include/file.inc.php");[/code] for every ../ you add it will jump back 1 directory :)
  3. Thats actually asking a bit more than you probably realise. You may find it easier to start with using a news backend like phpfusion then create your own cms around that to display the pages? [a href=\"http://dcnz.net.nz/oldsite/\" target=\"_blank\"]http://dcnz.net.nz/oldsite/[/a] this is an old site I made a while ago based around phpfusion with my own 'cms' for the rest of the site.
  4. lol alright its 3.20am here and I'm off to bed. Here is another update for you however the update still isnt going through properly as the boxes should be filled in with the existing information, so u can just go over the top of them. This however inserts the id's as needed, so you may need someone bit more experienced to have a look at the script. And also why it is getting a numrows error [a href=\"http://ravestyles.com/downloads/phpClanScript-v0.3.rar\" target=\"_blank\"]http://ravestyles.com/downloads/phpClanScript-v0.3.rar[/a] Remember this is all from scratch, You may also see an install folder I've added in. don't use that as It is for database setup but I haven't finished that script. Goodluck :)
  5. You've changed a small bit of code which is why it's not inserting properly and it isn't reading properly Give this a try [a href=\"http://ravestyles.com/downloads/phpClanScript-v0.2.rar\" target=\"_blank\"]http://ravestyles.com/downloads/phpClanScript-v0.2.rar[/a] and let me know how it goes :) Im quite busy in getting a new BitTorrent site going so don't have to much time to be debugging code but Id be really keen to get some custom code for a clan site Id like to get up for our CS Clan :) Goodluck with it, P.S the files you have shared, you might want to remove the details from the private.inc.php, the reason I made it seperate is to keep it safe and not to share details lol
  6. I'm kinda n00b to the whole php/mysql thing but I shouldnt think it would be to hard You could make a MySQL database to to cover information for both the roster and matches, Ive included some code example below for creating the roster and members page. Goodluck with making this, feel free to send me some finished code lol Note that these pages are NOT secure and that you will need to incorporate some sort of login to secure them. Create Database named 'clanwar' through MySQL then run following SQL Query [code]CREATE TABLE `matches` (   `opponent` varchar(30) NOT NULL default '',   `date` datetime NOT NULL default '0000-00-00 00:00:00',   `maps` varchar(50) NOT NULL default '',   `score` varchar(10) NOT NULL default '' ) TYPE=MyISAM; [/code] [code]CREATE TABLE `members` (   `id` int(4) NOT NULL auto_increment,   `user` varchar(25) NOT NULL default '',   `firstname` varchar(15) NOT NULL default '',   `lastname` varchar(15) NOT NULL default '',   `position` varchar(15) NOT NULL default '',   `email` varchar(30) NOT NULL default '',   `rank` varchar(15) NOT NULL default '',   PRIMARY KEY  (`id`) ) TYPE=MyISAM AUTO_INCREMENT=5; [/code] next a file to hold our MySQL details in, create private.inc.php with following code: [code]<? $username="root";            //MySQL  username $password="pass";            //MySQL  passwrd $database="clanwar";        //MySQL database name ?>[/code] next a script to insert the details into the database, create insert.php with following code note that I havent included a redirect at the bottom because well I couldnt remember the code for that lol [code]<html> <head>   <title>Roster - Insert Details</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <? /* This script written by raVest. Created on the 26/04/2006 Website: http://ravestyles.com Member management system with backend for the creation, updating and deletion of users from a MySQL database. Please contact raVest if you have any concerns or isses on trance@ravestyles.com */ include("private.inc.php"); $user=$_POST['user']; $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $position=$_POST['position']; $email=$_POST['email']; $rank=$_POST['rank']; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO members VALUES ('','$user','$firstname','$lastname','$position','$email','$rank')"; mysql_query($query); mysql_close(); ?>[/code] And also a page to input these details from, signup.html [code]<html> <head>   <title>Signup Page</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <font class="itext"> <form action="insert.php" method="post"> Username:  <input type="text" name="user"><br> First Name: <input type="text" name="firstname"><br> Last Name: <input type="text" name="lastname"><br> Clan Position: <input type="text" name="position"><br> E-mail: <input type="text" name="email"><br> <label for="rank">Rank:</label> <select name="rank" id="rank"> <option selected value="Choose One">Choose One... <option value="Administrator">Administrators <option value="Channel Admin">Channel Admin <option value="Members">Members <option value="Trial">On Trial </select><br> <input type="Submit"> </form> </font>[/code] then we can output all the info onto a roster, this is a basic page which just lists the info from the database, I havent built up a table to display it how u would like but you can play around with this. Create roster.php with following code: [code]<html> <head>   <title>Roster (Members and Admins)</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <? /* This script written by raVest. Created on the 26/04/2006 Website: http://ravestyles.com Member management system with backend for the creation, updating and deletion of users from a MySQL database. Please contact raVest if you have any concerns or isses on trance@ravestyles.com */ include("private.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM members"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<font class=ihead><center>Roster [<a href=signup.php>Add member</a>]</center></font><br><br>"; $i=0; while ($i < $num) { $user=mysql_result($result,$i,"user"); $firstname=mysql_result($result,$i,"firstname"); $lastname=mysql_result($result,$i,"lastname"); $position=mysql_result($result,$i,"position"); $email=mysql_result($result,$i,"email"); $rank=mysql_result($result,$i,"rank"); echo "<font class=itext>Player Name:$user<br>Real Name: $firstname $lastname<br>Position: $position<br>Email: $email<br>Rank: $rank<br></font><hr><br>"; $i++; } ?>[/code] Heres a stylesheet to use with it as well for testing purposes, name it style.css [code]/* website    www.ravestyles.com creator       Jarrod W (www.ravestyles.com) updated    26/04/2006 created for use with the member management system */ .bodyline {background:#E5E8EE;border:1px ridge #000000} body {background: #246193; color:#FF9900; font: Arial; font-weight: bold; font-size: 12px; } A:link      {COLOR: #FFFFFF; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none} A:active    {COLOR: #FFFFFF; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none} A:visited   {COLOR: #FFFFFF; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none} A:hover     {COLOR: #C0C0C0; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none} .ihead {     font-family: Verdana, Helvetica, Arial, sans-serif;     font-size: 24px;     font-weight: bold;     color: #FEEFB4; } .itext {     font-family: Verdana, Helvetica, Arial, sans-serif;     font-size: 10px;     font-weight: bold;     color: #FF9900; } .iheaders {     font-family: Verdana, Helvetica, Arial, sans-serif;     font-size: 12px;     font-weight: bold;     color: #FFFFFF; }[/code] Below is what I have come up with so far for editing/deleting information from the roster but haven't completed yet and not sure if it works, feel free to build on the code if you wish though. Again none of these pages have a redirect on them, sorry about that. This page should be used to collect info for updating or user to be deleted, this should be linked to the $id's pulled from the MySQL database to work with variables, i.e update.php?id=1 here is the code I have so far: [code]<html> <head>   <title>Ravestyles NZ Dev - Test Page</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <? /* This script written by raVest. Created on the 26/04/2006 Website: http://ravestyles.com Member management system with backend for the creation, updating and deletion of users from a MySQL database. Please contact raVest if you have any concerns or isses on trance@ravestyles.com */ $id=$_GET['id']; include("private.inc.php"); mysql_connect(localhost,$username,$password); $query=" SELECT * FROM members WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $user=mysql_result($result,$i,"user"); $firstname=mysql_result($result,$i,"firstname"); $lastname=mysql_result($result,$i,"lastname"); $position=mysql_result($result,$i,"position"); $email=mysql_result($result,$i,"email"); $rank=mysql_result($result,$i,"rank"); ++$i; } ?> <font class="itext"> <form action="updated.php" method="post"> <input type="hidden" name="ud_id" value="<? echo $id; ?>"> Username: <input type="text" name="ud_user" value="<? echo $user; ?>"><br> First Name: <input type="text" name="ud_first" value="<? echo $first; ?>"><br> Last Name: <input type="text" name="ud_last" value="<? echo $last; ?>"><br> E-mail Address: <input type="text" name="ud_email" value="<? echo $email; ?>"><br> Rank: <input type="text" name="ud_rank" value="<? echo $rank; ?>"><br> <input type="Submit" value="Update"> </form> <form action="deleted.php" method="post"> <input type="hidden" name="ud_id" value="<? echo $id; ?>"> <input type="Submit" value="Delete"> </form> </font>[/code] This is the script that will actually update the information, updated.php: [code]<html> <head>   <title>User Updated</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <? $ud_id=$_POST['ud_id']; $ud_user=$_POST['ud_user']; $ud_first=$_POST['ud_first']; $ud_last=$_POST['ud_last']; $ud_email=$_POST['ud_email']; $ud_rank=$_POST['ud_rank']; include("private.inc.php"); mysql_connect(localhost,$username,$password); $query="UPDATE members SET user='$ud_user', first='$ud_first', last='$ud_last', email='$ud_email', rank='$ud_rank' WHERE id='$ud_id'"; mysql_query($query); echo "Roster Updated"; mysql_close(); ?>[/code] This is the script which will actually delete the user, note the only diff between this and the update.php file is the $query sent to the MySQL. this is to be named deleted.php: [code]<html> <head>   <title>Ravestyles NZ Dev - Test Page</title>   <meta http-equiv="Content-Type" content="text/html; charset=unicode">   <meta name="keywords" content="test page">   <link rel=StyleSheet href="style.css" type="text/css"> </head> <? $ud_id=$_POST['ud_id']; $ud_user=$_POST['ud_user']; $ud_first=$_POST['ud_first']; $ud_last=$_POST['ud_last']; $ud_email=$_POST['ud_email']; $ud_rank=$_POST['ud_rank']; include("private.inc.php"); mysql_connect(localhost,$username,$password); $query="DELETE members SET user='$ud_user', first='$ud_first', last='$ud_last', email='$ud_email', rank='$ud_rank' WHERE id='$ud_id'"; mysql_query($query); echo "Roster Updated"; mysql_close(); ?>[/code]
  7. [!--quoteo(post=368663:date=Apr 26 2006, 11:16 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 26 2006, 11:16 AM) [snapback]368663[/snapback][/div][div class=\'quotemain\'][!--quotec--] for the date [code]echo date ('jS F Y g:ia', strtotime($db_date));[/code] [/quote] Cheers for the help, the date code is exactly what I wanted :D The unit conversion works but is not quite what I wanted as I would like it to convert to MB/GB/TB and work out which to display it as, as the figures range between few hundred mb's up to few tb's. I will keep working on that part though :)
  8. Hey Guys, Im fairly newbie with php + mysql still and have written up a script yesterday but am having a few issues as I'm having problems getting my head around variables. I am outputting stats from a program into a mysql database and am outputting these stats with php however there are 2 parts I would like to reformat. The sharesize stored in the database is in bytes which I would like to reformat to kB/mb/gb/tb as appropriate. The other thing is the last logged in date I would like to take from the unix display YYYY-MM-DD Hh:Mm:Ss, to something such as 25th April, 2006 11.58pm for example. Ive attached below my code so far, with $sharesize & $last_used being the variables concerned, if anyone would be able to advise on how to do this :) Also the page can be viewed at [a href=\"http://ravestyle.no-ip.com/ynhub/\" target=\"_blank\"]http://ravestyle.no-ip.com/ynhub/[/a] would really appreciate some help on this. Thanks guys [code] <? /* YnHub User Stats php Script created by raVest for use with the Ravestyles NZ Hub This script is designed to output the stats collected by the DC Hubsoft and display this in a readable format. Any queries or tips please contact on trance@ravestyles.com */ include("private.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM nickstats"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<font class=ihead><b><center>Ravestyles NZ Hub</center></b></font><br>"; /* echo "<font class=ihead><b><center><? echo $hubname; ?></center></b></font><br>"; */ /* echo "<font class=ihead><b><center>Come and visit us at <a href="mailto:<? echo $hubadd; ?>"><? echo $hubadd; ?></a></center></b></font><br><br>"; */ $i=0; while ($i < $num) { $nick=mysql_result($result,$i,"nick"); $dns=mysql_result($result,$i,"dns"); $passive_mode=mysql_result($result,$i,"passive_mode"); $description=mysql_result($result,$i,"description"); $email=mysql_result($result,$i,"email"); $sharesize=mysql_result($result,$i,"sharesize"); $tag=mysql_result($result,$i,"tag"); $client=mysql_result($result,$i,"client"); $hubs=mysql_result($result,$i,"hubs"); $slots=mysql_result($result,$i,"slots"); $muted=mysql_result($result,$i,"muted"); $kennylized=mysql_result($result,$i,"kennylized"); $lunarized=mysql_result($result,$i,"lunarized"); $blocked=mysql_result($result,$i,"blocked"); $kicked_times=mysql_result($result,$i,"kicked_times"); $online=mysql_result($result,$i,"online"); $last_used=mysql_result($result,$i,"last_used"); ?> <tr> <td><font class=itext><? echo $id." ".$nick; ?></font></td> <td><font class=itext><? if ( $online == y ) {     echo "<font color=#00CC33>Online</font>"; } else {     echo "<font color=#FF0000>Offline</font>"; } ?></font></td> <td><font class=itext><? echo $sharesize; ?></font></td> <td><font class=itext><? echo $description; ?></font></td> <td align=center><font class=itext><a href="mailto:<? echo $email; ?>"><img src="images/email1.gif" border="0" alt="Email" title="Email"></a></font></td> <td align=center><font class=itext><? echo $slots; ?></font></td> <td align=center><font class=itext><? if ( $blocked == 9 ) {     echo "<font color=#9966CC>Yes</font>"; } else {     echo "No"; } ?></font></td> <td align=center><font class=itext><? if ( $muted == 9 ) {     echo "<font color=#9966CC>Yes</font>"; } else {     echo "No"; } ?></font></td> <td align=center><font class=itext><? if ( $kennylized == 9 ) {     echo "<font color=#9966CC>Yes</font>"; } else {     echo "No"; } ?></font></td> <td align=center><font class=itext><? if ( $lunarized == 9 ) {     echo "<font color=#9966CC>Yes</font>"; } else {     echo "No"; } ?></font></td> <td><font class=itext><? echo $client; ?></font></td> <td align=center><font class=itext><? echo $hubs; ?></font></td> <td><font class=itext><? if ( $passive_mode == y ) {     echo "<font color=#FF0000>Passive</font>"; } else {     echo "<font color=#00CC33>Active</font>"; } ?></font></td> <td align=center><font class=itext><? echo $kicked_times; ?></font></td> <td><font class=itext><? echo $last_used; ?></font></td> </tr> <? $i++; } echo "</table>"; ?> [/code]
×
×
  • 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.