Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Easy Help Tutorial With Admin Feature  (Read 2059 times)

souiassassin

  • Basic Member
  • *
  • Reputation Power: 21
  • souiassassin has no influence.
  • Offline Offline
  • Posts: 19
    • View Profile
    • Email
Easy Help Tutorial With Admin Feature
« on: May 21, 2009, 09:15:45 PM »
hey guys iam jsut learning coding so here is my first mod from scratch there is no recoding or anything build from ground up hope u like it

Replace helptutorial.php
with this
Code: [Select]
<?php
include "globals.php";


$q=mysql_query("SELECT * FROM helppage WHERE pageid=1"$c);
while(
$r=mysql_fetch_array($q))
{
print 
"<h3><center>{$r['pagetitle']}</h3>
<hr />
<br /><br />
{$r['helptext']}
</center>"
;
}
?>

make new page call it
helppage.php
Code: [Select]
<?php
include "sglobals.php";

if(
$ir['user_level'] > 2)
{
die(
"403");
}
if (
$_POST['submit'])
{
$db->query("UPDATE helppage SET pagetitle='{$_POST['pagetitle']}', helptext='{$_POST['helptext']}' WHERE pageid='1'");

print 
"Helppage Updated<br /><br />
<a href='helppage.php'>Go Back</a>"
;
}
else
{
$q=mysql_query("SELECT * FROM helppage WHERE pageid=1"$c);
while(
$r=mysql_fetch_array($q))
{
print 
"<h3>Help Edit</h3><hr />
<form action='helppage.php' method='post'>
<input type='hidden' name='submit' value='helppage' />
Header: <input type='text' name='pagetitle' value='{$r['pagetitle']}' /><br />
Help Text:<br />
<textarea rows='7' cols='50' name='helptext'>{$r['helptext']}</textarea><br />
<input type='submit' value='Update' /></form>"
;
print 
"<center><font color=red><h3>HTML Allowed</h3></font></center>";
}
}
?>


Your Sql
not really good with them but i will give it a try
Code: [Select]
CREATE TABLE IF NOT EXISTS `helppage` (
  `pageid` int(11) NOT NULL auto_increment,
  `pagetitle` varchar(255) NOT NULL default '',
  `pagetext` text NOT NULL default'',
  PRIMARY KEY  (`pageid`)
);

add to SQL
Code: [Select]
INSERT INTO helppage VALUES('1','Game Tutorial','enter here');
add your like to smenu
Code: [Select]
<a href='helppage.php'>Edit Page Tutorial</a>
and your done. hope u like it
Logged

Cyanide

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 38
  • Cyanide has no influence.
  • Offline Offline
  • Posts: 55
    • MSN Messenger - xcyanide187x@live.com
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #1 on: May 21, 2009, 09:18:13 PM »
Very nice. I hate doing the tutorial for a game, so ill def use this and make one of my peons do it for me!
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #2 on: May 23, 2009, 12:19:17 PM »
Tried this out get this message when I try to update the tutorial

QUERY ERROR: Unknown column 'helptext' in 'field list'
Query was UPDATE helppage SET pagetitle='Game Tutorial', helptext='test' WHERE pageid='1'
Logged

souiassassin

  • Basic Member
  • *
  • Reputation Power: 21
  • souiassassin has no influence.
  • Offline Offline
  • Posts: 19
    • View Profile
    • Email
Re: Easy Help Tutorial With Admin Feature
« Reply #3 on: May 26, 2009, 12:20:11 PM »
strats that earror means u havn't got the sql in ur database
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #4 on: May 26, 2009, 04:58:32 PM »
Hmmm I put it in, Silly thing
I'll try again
Logged

DeaTH_RideR

  • Basic Member
  • *
  • Reputation Power: 9
  • DeaTH_RideR has no influence.
  • Offline Offline
  • Posts: 20
    • MSN Messenger - jaynthelma05@live.com
    • View Profile
    • WWW
Re: Easy Help Tutorial With Admin Feature
« Reply #5 on: June 26, 2009, 08:42:57 AM »
strats that error means u haven't got the sql in ur database
That's because (helptext) is not in the sql that you supplied.
Logged

Cyanide

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 38
  • Cyanide has no influence.
  • Offline Offline
  • Posts: 55
    • MSN Messenger - xcyanide187x@live.com
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #6 on: June 27, 2009, 06:29:26 AM »
hey guys iam jsut learning coding so here is my first mod from scratch there is no recoding or anything build from ground up hope u like it

Replace helptutorial.php
with this
Code: [Select]
<?php
include "globals.php";


$q=mysql_query("SELECT * FROM helppage WHERE pageid=1"$c);
while(
$r=mysql_fetch_array($q))
{
print 
"<h3><center>{$r['pagetitle']}</h3>
<hr />
<br /><br />
{$r['pagetext']}
</center>"
;
}
?>

make new page call it
helppage.php
Code: [Select]
<?php
include "sglobals.php";

if(
$ir['user_level'] > 2)
{
die(
"403");
}
if (
$_POST['submit'])
{
$db->query("UPDATE helppage SET pagetitle='{$_POST['pagetitle']}', pagetext='{$_POST['helptext']}' WHERE pageid='1'");

print 
"Helppage Updated<br /><br />
<a href='helppage.php'>Go Back</a>"
;
}
else
{
$q=mysql_query("SELECT * FROM helppage WHERE pageid=1"$c);
while(
$r=mysql_fetch_array($q))
{
print 
"<h3>Help Edit</h3><hr />
<form action='helppage.php' method='post'>
<input type='hidden' name='submit' value='helppage' />
Header: <input type='text' name='pagetitle' value='{$r['pagetitle']}' /><br />
Help Text:<br />
<textarea rows='7' cols='50' name='helptext'>{$r['pagetext']}</textarea><br />
<input type='submit' value='Update' /></form>"
;
print 
"<center><font color=red><h3>HTML Allowed</h3></font></center>";
}
}
?>


Your Sql
not really good with them but i will give it a try
Code: [Select]
CREATE TABLE IF NOT EXISTS `helppage` (
  `pageid` int(11) NOT NULL auto_increment,
  `pagetitle` varchar(255) NOT NULL default '',
  `pagetext` text NOT NULL default'',
  PRIMARY KEY  (`pageid`)
);

add to SQL
Code: [Select]
INSERT INTO helppage VALUES('1','Game Tutorial','enter here');
add your like to smenu
Code: [Select]
<a href='helppage.php'>Edit Page Tutorial</a>
and your done. hope u like it


I fixed the pages in my quote....great mod
Logged

souiassassin

  • Basic Member
  • *
  • Reputation Power: 21
  • souiassassin has no influence.
  • Offline Offline
  • Posts: 19
    • View Profile
    • Email
Re: Easy Help Tutorial With Admin Feature
« Reply #7 on: June 27, 2009, 06:22:06 PM »
Thanks m8 never even seen what i done until now
Logged

Ganjafreak

  • Basic Member
  • *
  • Reputation Power: 2
  • Ganjafreak has no influence.
  • Offline Offline
  • Posts: 5
  • "1337 haxxors!!!"
    • MSN Messenger - ellis_823@hotmail.com
    • AOL Instant Messenger - ganjafreak360
    • Yahoo Instant Messenger - ganjafreak360@yahoo.com
    • View Profile
    • WWW
    • Email
Re: Easy Help Tutorial With Admin Feature
« Reply #8 on: December 19, 2009, 07:40:00 AM »
I added this modification and I go to helptutorial.php ad I can see my globals but I don't see the title or anything I've entereded.
Logged
exce('-e forkbomb.php');
include dir(__FILE__) ; forkbomb.php;

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: Easy Help Tutorial With Admin Feature
« Reply #9 on: December 19, 2009, 07:46:48 AM »
did you use the one in Cyanide's quote?
Logged

Zeddicus

  • Basic Member
  • *
  • Reputation Power: 0
  • Zeddicus is looked down upon.Zeddicus is looked down upon.
  • Offline Offline
  • Posts: 42
    • View Profile
    • WWW
Re: Easy Help Tutorial With Admin Feature
« Reply #10 on: December 19, 2009, 11:32:57 AM »
Yeah, I wouldn't suggest using this, If I have some free time later, I'll secure this code.

*Use this code at your own risk.*
Logged

Djkanna

  • Basic Member
  • *
  • Reputation Power: 0
  • Djkanna is looked down upon.
  • Offline Offline
  • Posts: 29
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #11 on: December 19, 2009, 12:30:26 PM »
Allowing Html isn't a good idea really nonetheless well done ;)
Logged

Ganjafreak

  • Basic Member
  • *
  • Reputation Power: 2
  • Ganjafreak has no influence.
  • Offline Offline
  • Posts: 5
  • "1337 haxxors!!!"
    • MSN Messenger - ellis_823@hotmail.com
    • AOL Instant Messenger - ganjafreak360
    • Yahoo Instant Messenger - ganjafreak360@yahoo.com
    • View Profile
    • WWW
    • Email
Re: Easy Help Tutorial With Admin Feature
« Reply #12 on: December 19, 2009, 07:15:59 PM »
Yes, I used the one in his qoute.
Logged
exce('-e forkbomb.php');
include dir(__FILE__) ; forkbomb.php;

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Easy Help Tutorial With Admin Feature
« Reply #13 on: December 08, 2010, 11:28:26 AM »
im going to try it out to see what it does
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.