-
Posts
1,150 -
Joined
-
Last visited
-
Days Won
4
Content Type
Profiles
Forums
Events
Everything posted by Script47
-
So I've been messing with some code and think I've got the hang of it. Is it basically like this? index.php <?php include 'links.php'; if(isset($_GET['module'])) { include 'modules/'.$_GET['module'].'/index.php'; } links.php <?php echo '<a href="index.php?module=about">About</a>'; modules/about/index.php <?php echo 'Some about'; That module page even shows up, but it seems too easy to be true. So have I got the basic idea of it or have got it completely wrong?
-
The mod? Erm probably but I've not seen one recently, so I thought why not.
-
Empty strings are meant to be <br/> but MWG has an error so it's shows up like that, that's why I put the pastebin link.
-
Personally I have it like that because I think it's cleaner because as it's all separate.
-
I got bored so I coded this, post any bugs on here. Enjoy! Suggestion Box (PasteBin) suggestionBox.php <html> <head> <title>Suggestion Box</title> </head> <style> textarea { resize: none; } </style> </html> <?php /* * Developer: Script47 * Module Name: Suggestion Box * Description: Allows users to post suggestions which you can then implement in to your game. * Price: Free * Support: [email protected] * MWG Contact: http://makewebgames.io/member.php/69670-Script47 * Thread: http://makewebgames.io/showthread.php/44236-Suggestion-Box?p=298646#post298646 */ include 'globals.php'; echo '<h3>Suggestion Box</h3>'; echo '<br/>'; echo '[<a href="suggestionBox.php?newPost">New Suggestion</a>]'; if($ir['userid'] == 1) { echo ' [<a href="suggestionBox.php?truncate=true">Truncate Suggestion Box</a>]'; if(isset($_GET['truncate']) && $ir['userid'] == 1) { $truncate = $db->query("TRUNCATE TABLE `suggestion_box`"); if($truncate) { header("Location: suggestionBox.php"); exit(); } } } if(isset($_GET['newPost'])) { echo '<br/>'; echo '<br/>'; echo '<form method="post"> <input type="text" name="title" placeholder="Suggestion title" title="Suggestion title" spellcheck="true" autofocus required> <br/> <textarea rows="10" cols="45" name="description" placeholder="Detailed description of suggestion" title="Detailed description of suggestion" spellcheck="true" required></textarea> <br/> <input type="submit" name="postSuggestion" value="Post Suggestion"> </form>'; if(isset($_POST['postSuggestion'])) { if(!isset($_POST['title']) || empty($_POST['title'])) { exit('Title field empty.'); } else if(!ctype_alnum($_POST['title'])) { exit('Title field can only be letters and or numbers.'); } else if(!isset($_POST['description']) || empty($_POST['description'])) { exit('Description field empty.'); } else if(!ctype_alnum($_POST['description'])) { exit('Description field can only be letters and or numbers.'); } else { $title = htmlspecialchars(trim($_POST['title'])); $description = htmlspecialchars(trim($_POST['description'])); $username = $ir['username']; $insertSuggestion = $db->query("INSERT INTO `suggestion_box` (Title, Description, Suggester) VALUES ('$title', '$description', '$username')", $db->escape($title), $db->escape($description), $db->escape($username)); if($insertSuggestion) { echo 'Suggestion added.'; header("Refresh:2; URL=suggestionBox.php"); exit(); } else { echo 'Error executing query.'; header("Refresh:2; URL=suggestionBox.php"); exit(); } } } } echo '<br/>'; echo '<br/>'; echo '<table align="center" border="1" cellpadding="10">'; echo '<th>ID</th>'; echo '<th>Title</th>'; echo '<th>Description</th>'; echo '<th>Suggester</th>'; echo '<th>Date</th>'; if($ir['user_level'] == 2) { echo '<th>Actions</th>'; } $selectSuggestion = $db->query("SELECT * FROM `suggestion_box"); while ($results = $db->fetch_row($selectSuggestion)) { echo '<tr><td>'; echo $results['ID']; echo '</td><td>'; echo $results['Title']; echo '</td><td>'; echo $results['Description']; echo '</td><td>'; echo $results['Suggester']; echo '</td><td>'; echo date('d/m/Y g:i:s A', strtotime($results['Date'])); if($ir['user_level'] == 2) { echo '</td><td>'; echo "[<a href='suggestionBox.php?delete=true&ID={$results['ID']}'>Delete Suggestion</a>]"; } echo '</td><tr>'; } echo '</table>'; if(isset($_GET['delete'])) { echo '<br/>'; if($ir['user_level'] != 2) { header("Location: suggestionBox.php"); exit(); } else if(!ctype_digit($_GET['ID'])) { echo 'ID has to be an integer.'; exit(); } else { $ID = htmlspecialchars($_GET['ID'])+0; $deleteSuggestion = $db->query("DELETE FROM `suggestion_box` WHERE ID=$ID"); if($deleteSuggestion) { header("Location: suggestionBox.php"); exit(); } } } ?> SQLs CREATE TABLE IF NOT EXISTS `suggestion_box` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Title` varchar(200) NOT NULL, `Description` text NOT NULL, `Suggester` varchar(80) NOT NULL, `Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 Slap this link where you want it to show up. Normally in mainmenu.php under line 100. <a href='suggestionBox.php'>Suggestion Box</a><br/>
-
Resurrecting an Old Project (GRPG codebase)
Script47 replied to MuskogeeWil's topic in Game Projects
Hahaha, ah, well I'm like that. I ain't got any pictures of me on the net (as far as I'm aware). -
Resurrecting an Old Project (GRPG codebase)
Script47 replied to MuskogeeWil's topic in Game Projects
Congratulations and good luck mate. :) -
Any casino/game-mod you've got - I want it!
Script47 replied to dnenb's topic in Requests & In Production
Thanks. :) Glad you like it. -
Updated, check OP.
-
Any casino/game-mod you've got - I want it!
Script47 replied to dnenb's topic in Requests & In Production
Check this one out too: Player Spotlight (Weekly) -
Any casino/game-mod you've got - I want it!
Script47 replied to dnenb's topic in Requests & In Production
I made a 50/50 mod: 50/50. Read the first post as there is a bug on MWG. -
It looks, nice. Good job. Much better, keep it up. :)
-
Congratulations pal, good job. :)
-
Maybe if you went in to a bit more detail. I mean he is making you the mod so why not tell him at least what you want.
-
Thanks a lot mate. :) Haha thanks Sniko, just saying I knew he was right I was joking.
-
I am making a new module, suggestion box. Players can post suggestion for admins. Module Complete [ATTACH=CONFIG]1231[/ATTACH] Notice: Currently to change status you must change from the tables. If you wish I can implement in-game feature for admins. Tested, however if found post bug(s) here.
-
'S fine, we're all learning things in the process. :D
-
Modules: Modules Post here to inform me about any bugs/suggestions.
-
Hahaha, fair point I guess I could say because you could either win or lose, 50/50. ;) I probably should have named it Number Guess or something along them lines! :D I will fix that Yes I will fix that too, thought I would like to point out, throughout the times I have made mod for anything, I have tried to make sure that spelling/grammar is correct. I accept my mistake sure I will fix that too. However I feel it a bit hypocritical complaining about my spelling/grammar when yours is not at all up to standards. What I must say is I do like the fact you gave me criticism which is always good as it helps for the future. I tested number 3 on your list this is what I got: [ATTACH=CONFIG]1230[/ATTACH] I did not once say they will or will not be free. User(s) Online list has been submitted again, 50/50 has been fixed and submitted again. Both are awaiting replies. Once they are ready I will notify you on the OP. On the weekends I will finish the Player Search along with some more *hopefully*. However I apologise for the hassle you've been through, I have fixed them errors, if you see any more point them out I will fix. Keep checking to see if you need to update the 50/50 module.
-
50/50 is done, you will find it on the market. I have been quite busy recently, will sort them out then submit them again.
-
Off Topic: I must say I am impressed man! Shame you did all this and are now stopping, it looks very good.