-
Posts
727 -
Joined
-
Last visited
-
Days Won
40
Content Type
Profiles
Forums
Events
Everything posted by peterisgb
-
After Checking, This has now been resolved.
-
Lol, ticket open, We did this last year when it was incorrectly flagged 😄
-
My main site is now showing account suspended.......
-
I run 2 sites, my main is good, but my other has been deemed the same. Bloody Google controlling the internet telling lies, grrr. I think all name.makeweb.games is being effected by this currently.
-
His website claims that what he has is a game engine. Should mention that the game engine isn't his.
-
Oh. Over the last 15 years, I've watched people come and go. Uridium/Illusions joining just a month before i did hehe. I'll be here lurking around till the server goes offline (again)
-
Simple Library to Add, Read, Edit and delete books. create php file library.php <?php include "globals.php"; $version = '0.1.0'; $bookcount = $db->fetch_single($db->query('SELECT COUNT(*) FROM library')); if (!isset($_GET['a'])) { $_GET['a'] = ''; } switch ($_GET['a']) { case 'read': read(); break; case 'createbook': createBook(); break; case 'editbook': editBook(); break; case 'deletebook': deleteBook(); break; default: home(); break; } function bbcode_format($text) { // Convert [b]...[/b] tags to <strong>...</strong> $text = preg_replace('/\[b\](.*?)\[\/b\]/s', '<strong>$1</strong>', $text); // Convert [i]...[/i] tags to <em>...</em> $text = preg_replace('/\[i\](.*?)\[\/i\]/s', '<em>$1</em>', $text); // Convert [u]...[/u] tags to <u>...</u> $text = preg_replace('/\[u\](.*?)\[\/u\]/s', '<u>$1</u>', $text); // Convert [url=URL]text[/url] tags to <a href="URL">text</a> $text = preg_replace('/\[url=(.*?)\](.*?)\[\/url\]/s', '<a href="$1">$2</a>', $text); // Convert [img]URL[/img] tags to <img src="URL" alt="" /> $text = preg_replace('/\[img\](.*?)\[\/img\]/s', '<img src="$1" alt="" />', $text); // Convert [color=COLOR]...[/color] tags to <span style="color:COLOR">...</span> $text = preg_replace('/\[color=(.*?)\](.*?)\[\/color\]/s', '<span style="color:$1">$2</span>', $text); // Return the formatted text return $text; } function bbcode_legend() { $legend = '<h3>BBCode Legend:</h3>'; $legend .= '<ul>'; $legend .= '<li><strong>[b]text[/b]</strong>: <strong>bold</strong></li>'; $legend .= '<li><em>[i]text[/i]</em>: <em>italic</em></li>'; $legend .= '<li><u>[u]text[/u]</u>: <u>underline</u></li>'; $legend .= '<li><a href="URL">[url=URL]text[/url]</a>: <a href="URL">link</a></li>'; $legend .= '<li><img src="URL" alt="">[img]URL[/img]: image</li>'; $legend .= '<li><span style="color:red">[color=red]text[/color]</span>: <span style="color:red">colored text</span></li>'; // Add more BBCode options as needed $legend .= '</ul>'; return $legend; } function home() { global $db, $ir, $userid, $h, $version, $bookcount; // Check if a search query is submitted $searchQuery = isset($_GET['q']) ? $db->escape($_GET['q']) : ''; // Check if an order value is specified $order = isset($_GET['order']) ? $db->escape($_GET['order']) : 'id'; // Define the available order options and their corresponding column names $orderOptions = array( 'id' => 'id', 'created' => 'Created', 'views' => 'Views', 'title' => 'Title' ); // Check if the specified order is valid; otherwise, use the default order if (!array_key_exists($order, $orderOptions)) { $order = 'created'; } // Get the current page number $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1; // Set the number of books to display per page $booksPerPage = 20; ?> <h2 class='fontface'><a href="?a=home"><span class='green'>L</span>ibrary - Books: <?php echo $bookcount; ?> - v<?php echo $version; ?></a> - <small><a href="?a=createbook">Create a Book</a></small></h2> <div style="max-width: 1000px; margin: 0 auto;"> <form action="?a=home" method="GET"> <input type="text" name="q" placeholder="Search books..." value="<?php echo $searchQuery; ?>"> <input type="submit" value="Search"> | Order by: <select name="order"> <?php // Display the order options foreach ($orderOptions as $optionValue => $optionText) { $selected = ($order == $optionValue) ? 'selected' : ''; echo "<option value=\"$optionValue\" $selected>$optionText</option>"; } ?> </select> <input type="submit" value="Apply"> </form> <table width="100%"> <tr class="min"> <td align="center"><span class="black"><b>Book</b></span></td> <td align="center"><span class="black"><b>Book Info</b></span></td> <td align="center"><span class="black"><b>Views</b></span></td> <td align="center"><span class="black"><b>Pages</b></span></td> <td align="center"><span class="black"><b>Options</b></span></td> </tr> <?php // Calculate the offset for pagination $offset = ($currentPage - 1) * $booksPerPage; // Modify the query to include search functionality and order by clause if (!empty($searchQuery)) { $countQuery = $db->query("SELECT COUNT(*) FROM library WHERE title LIKE '%$searchQuery%'"); $fetchbooks = $db->query("SELECT * FROM library WHERE title LIKE '%$searchQuery%' ORDER BY $order DESC LIMIT $offset, $booksPerPage"); } else { $countQuery = $db->query("SELECT COUNT(*) FROM library"); $fetchbooks = $db->query("SELECT * FROM library ORDER BY $order DESC LIMIT $offset, $booksPerPage"); } while ($book = $db->fetch_row($fetchbooks)) { if ($book['lastedited'] == '0000-00-00 00:00:00') { $edited = ''; } else { $edited = 'Edited: '.$book['lastedited']; } $owner = $book['author']; $getuser = $db->query("SELECT * FROM users WHERE userid=$owner"); $r = $db->fetch_row($getuser); echo '<td align=center>'.number_format($book['id']).'</td> <td> <table> <tr> <td><a href="?a=read&book='.$book['id'].'">'; if($book['cover']) { echo '<img src="'.$book['cover'].'" height="150px" width="150px">'; } else { echo '<img src="images/library/no.png" height="150px" width="150px">'; } echo '</a></td> <td> </td> <td><strong>'.$book['title'].'</strong><br /> Description: <a href="#" class="see-more-link" data-description="'.$book['content'].'"><u>See More</u></a><br /> Author: <a href="viewuser.php?u='.$r['userid'].'"><font color="lightblue">'.$r['username'].' ('.$r['userid'].')</font></a><br /> Created: '.$book['created'].'<br /> '.$edited.'</td> </tr> </table> </td> <td>'.number_format($book['views']).'</td> <td>'.number_format(getBookPageCount($book)).'</td> <td> <a href="?a=read&book='.$book['id'].'"><font color="lightblue">READ</font></a><br />'; if ($userid == $book['author']) { echo '<a href="?a=editbook&book='.$book['id'].'"><font color="lightgreen">EDIT</font></a><br /><br />'; } if ($userid == '1') { echo '<a href="?a=deletebook&book='.$book['id'].'"><font color="red">DELETE</font></a>'; } echo '</td></tr>'; } ?> </table> <hr /> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { $(".see-more-link").click(function(e) { e.preventDefault(); var description = $(this).data("description"); alert(description); // Replace alert with a pop-up/modal to show the description }); }); </script> <div> <?php // Get the total number of books for pagination $totalBooks = $db->fetch_single($countQuery); $totalPages = ceil($totalBooks / $booksPerPage); // Display pagination buttons echo "Pages: "; for ($page = 1; $page <= $totalPages; $page++) { $isActive = ($page == $currentPage) ? 'active' : ''; echo "<a href='?a=home&page=$page&q=$searchQuery&order=$order' class='$isActive'><u>$page</u></a> "; } ?> </div> </div> <?php } function read() { global $db, $ir, $userid, $h; ?><br /><hr /> <div style="text-align: center;"> <a href="?a=home">BACK TO HOME</a><hr /> </div> <div style="text-align: left;"> <div style="max-width: 750px; margin: 0 auto;"> <?php $bookid = $_GET['book']; $fetchbook = $db->query("SELECT * FROM library WHERE id=$bookid"); $book = $db->fetch_row($fetchbook); $currentPage = isset($_GET['page']) ? $_GET['page'] : 1; $pagesPerBook = getBookPageCount($book); $pageSize = 1; $startPage = ($currentPage - 1) * $pageSize; $endPage = $startPage + $pageSize; // Get the title of the book $bookTitle = $book['title']; // Display the book title and page information echo "<h3>$bookTitle - Page $currentPage / $pagesPerBook</h3><hr />"; for ($i = $startPage; $i < $endPage; $i++) { $page = "page" . str_pad($i + 1, 2, "0", STR_PAD_LEFT); // Generate the column name (page01, page02, ...) if (!empty($book[$page])) { echo bbcode_format($book[$page]) . "<br>"; echo "<hr />"; } } // Check if it's the first page (initial access) if ($currentPage == 1) { // Increment the views count by 1 $db->query("UPDATE library SET views = views + 1 WHERE id = $bookid"); } ?> </div> </div> <div style="text-align: right;"> <?php if ($currentPage > 1) { $prevPage = $currentPage - 1; echo '<a href="?a=read&book='.$book['id'].'&page='.$prevPage.'">Back Page</a> | '; } if ($currentPage < $pagesPerBook) { $nextPage = $currentPage + 1; echo '<a href="?a=read&book='.$book['id'].'&page='.$nextPage.'">Next Page</a>'; } ?> </div> <?php } function getBookPageCount($book) { $pageCount = 0; for ($i = 1; $i <= 26; $i++) { $page = "page" . str_pad($i, 2, "0", STR_PAD_LEFT); if (!empty($book[$page])) { $pageCount++; } } return $pageCount; } function createBook() { global $db, $ir, $userid, $h; // Check if the form is submitted if (isset($_POST['submit'])) { // Get the form data $author = $db->escape($_POST['author']); $title = $db->escape($_POST['title']); $cover = $db->escape($_POST['cover']); $content = $db->escape($_POST['content']); $created = date('Y-m-d H:i:s'); $lastedited = '0000-00-00 00:00:00'; // Create an array to store the page content $pages = array(); // Iterate over the page fields and store the content in the array for ($i = 1; $i <= 26; $i++) { $page = "page" . str_pad($i, 2, "0", STR_PAD_LEFT); if (!empty($_POST[$page])) { $pages[$page] = $db->escape($_POST[$page]); } } // Prepare the SQL query to insert the book data $insertQuery = "INSERT INTO library (author, title, cover, content, created, lastedited"; foreach ($pages as $pageField => $pageContent) { $insertQuery .= ", $pageField"; } $insertQuery .= ") VALUES ('$author', '$title', '$cover', '$content', '$created', '$lastedited'"; foreach ($pages as $pageField => $pageContent) { $insertQuery .= ", '$pageContent'"; } $insertQuery .= ")"; // Execute the SQL query $db->query($insertQuery); // Redirect the user to the home page or display a success message echo "Book created successfully.<br /><br />"; echo "<a href='?a=home'>Back to Home</a>"; exit(); } // Display the book creation form ?><style> .form-container { max-width: 500px; margin: 0 auto; } .form-container input[type="text"], .form-container textarea { width: 100%; padding: 10px; margin-bottom: 10px; } .form-container #pagesContainer textarea { margin-top: 10px; } .form-container .button { padding: 10px 20px; background-color: #4CAF50; color: #fff; border: none; cursor: pointer; } .form-container .button:hover { background-color: #45a049; } .form-container hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #ccc; } </style> <h2 class="fontface">Creating New Book - <small><a href="?a=home">Back to Library</a></small></h2> <?php echo bbcode_legend(); ?><hr /> <div class="form-container"> <form action="?a=createbook" method="POST" id="createBookForm"> <input type="hidden" name="author" value="<?php echo $userid; ?>"><br> <label>Book Title:</label> <input type="text" name="title"><br> <label>Book Cover:</label> <input type="text" name="cover"><br> <label>Description:</label> <textarea name="content" rows="5"></textarea><br> <label>Pages:</label><br> <div id="pagesContainer"> <textarea name="page01" rows="4" cols="50" placeholder="Page 1:"></textarea><br> </div> <button type="button" id="addPageButton" class="button">Add Page</button> <hr> <input type="submit" name="submit" value="Create Book" class="button"> </form> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { var totalPages = 1; // Event listener for the "Add Page" button $("#addPageButton").click(function() { totalPages++; // Generate the page number in the format "Page X:" var pageNumber = "Page " + totalPages + ":"; // Generate the name attribute for the textarea var fieldName = "page" + ("0" + totalPages).slice(-2); // Create a new textarea for the page with the placeholder and name attributes set var newTextarea = $("<textarea name='" + fieldName + "' rows='4' cols='50' placeholder='" + pageNumber + "'></textarea><br>"); // Append the new textarea to the pages container $("#pagesContainer").append(newTextarea); }); }); </script> <?php } function editBook() { global $db, $ir, $userid, $h; // Check if the form is submitted if (isset($_POST['submit'])) { // Get the book ID from the URL $bookId = (int)$_GET['book']; // Verify if the user is the owner of the book $bookQuery = $db->query("SELECT author FROM library WHERE id = $bookId"); $book = $db->fetch_row($bookQuery); $bookAuthor = (int)$book['author']; // Get the form data $author = $db->escape($_POST['author']); $title = $db->escape($_POST['title']); $cover = $db->escape($_POST['cover']); $content = $db->escape($_POST['content']); $lastedited = date('Y-m-d H:i:s'); if ($userid !== $author) { echo "You are not authorized to edit this book."; return; } // Create an array to store the page content $pages = array(); // Iterate over the page fields and store the content in the array for ($i = 1; $i <= 26; $i++) { $page = "page" . str_pad($i, 2, "0", STR_PAD_LEFT); $pages[$page] = $db->escape($_POST[$page]); } // Prepare the SQL query to update the book data $updateQuery = "UPDATE library SET author = '$author', title = '$title', cover = '$cover', content = '$content', lastedited = '$lastedited'"; foreach ($pages as $pageField => $pageContent) { $updateQuery .= ", $pageField = '$pageContent'"; } $updateQuery .= " WHERE id = $bookId"; // Execute the SQL query $db->query($updateQuery); // Redirect the user to the home page or display a success message echo "Book edited successfully.<br /><br />"; echo "<a href='?a=home'>Back to Home</a>"; exit(); } // Display the book editing form $bookId = (int)$_GET['book']; $fetchbook = $db->query("SELECT * FROM library WHERE id = $bookId"); $book = $db->fetch_row($fetchbook); ?> <style> .form-container { max-width: 500px; margin: 0 auto; } .form-container input[type="text"], .form-container textarea { width: 100%; padding: 10px; margin-bottom: 10px; } .form-container .button { padding: 10px 20px; background-color: #4CAF50; color: #fff; border: none; cursor: pointer; } .form-container .button:hover { background-color: #45a049; } .form-container hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #ccc; } </style> <h2 class="fontface">EDIT BOOK - <small><a href="?a=home">Back to Home</a></small></h2> <?php echo bbcode_legend(); ?> <hr /> <div class="form-container"> <form action="?a=editbook&book=<?php echo $bookId; ?>" method="POST"> <input type="hidden" name="author" value="<?php echo $book['author']; ?>"><br> <label>Title:</label> <input type="text" name="title" value="<?php echo $book['title']; ?>"><br> <label>Cover:</label> <input type="text" name="cover" value="<?php echo $book['cover']; ?>"><br> <label>Content:</label> <textarea name="content" rows="5"><?php echo $book['content']; ?></textarea><br> <label>Pages:</label><br> <?php for ($i = 1; $i <= 26; $i++) { $page = "page" . str_pad($i, 2, "0", STR_PAD_LEFT); echo "<label>$page:</label><br>"; echo "<textarea name='$page' cols='50' rows='10'>{$book[$page]}</textarea><br>"; } ?> <input type="submit" name="submit" value="Save Changes" class="button"> </form> </div> <?php } function deleteBook() { global $db, $ir, $userid, $h; // Check if the user is authorized to delete the book if ($userid != 1) { echo "You are not authorized to delete books."; return; } // Check if the book ID is provided if (!isset($_GET['book'])) { echo "Invalid book ID."; return; } $bookID = intval($_GET['book']); // Check if the book exists $checkQuery = $db->query("SELECT id FROM library WHERE id=$bookID"); if ($db->num_rows($checkQuery) == 0) { echo "Book not found."; return; } // Delete the book $deleteQuery = $db->query("DELETE FROM library WHERE id=$bookID"); if ($deleteQuery) { echo "Book deleted successfully."; } else { echo "Error deleting book."; } echo "<br /><br />"; echo "<a href='?a=home'>Back to Home</a>"; exit(); } $h->endpage(); ?> And here is your SQL CREATE TABLE `library` ( `id` int(11) NOT NULL AUTO_INCREMENT, `author` int(11) NOT NULL, `title` varchar(255) NOT NULL, `cover` varchar(255) DEFAULT NULL, `content` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `lastedited` datetime DEFAULT NULL, `views` int(11) DEFAULT NULL, `page01` varchar(255) DEFAULT NULL, `page02` varchar(255) DEFAULT NULL, `page03` varchar(255) DEFAULT NULL, `page04` varchar(255) DEFAULT NULL, `page05` varchar(255) DEFAULT NULL, `page06` varchar(255) DEFAULT NULL, `page07` varchar(255) DEFAULT NULL, `page08` varchar(255) DEFAULT NULL, `page09` varchar(255) DEFAULT NULL, `page10` varchar(255) DEFAULT NULL, `page11` varchar(255) DEFAULT NULL, `page12` varchar(255) DEFAULT NULL, `page13` varchar(255) DEFAULT NULL, `page14` varchar(255) DEFAULT NULL, `page15` varchar(255) DEFAULT NULL, `page16` varchar(255) DEFAULT NULL, `page17` varchar(255) DEFAULT NULL, `page18` varchar(255) DEFAULT NULL, `page19` varchar(255) DEFAULT NULL, `page20` varchar(255) DEFAULT NULL, `page21` varchar(255) DEFAULT NULL, `page22` varchar(255) DEFAULT NULL, `page23` varchar(255) DEFAULT NULL, `page24` varchar(255) DEFAULT NULL, `page25` varchar(255) DEFAULT NULL, `page26` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; You'll need to create the Directory images/library/ in your File Manager, Upload the image attached that i've used for no cover image. Please note that this is the VERY first Version and Revision, I'll update this with changes i made. Here is a Screenshot
-
5 minutes for you, I've heard and seen you type. You type like soooooo fast that my brain can't keep up with it. We ain't all as fast as you, i'm deffo not.
-
I think you should add a picture of ingame so that the person who reads this will get some idea of where you are going as i find its best to keep the same theme ingame as on the login page.
-
I like the idea, but its more hassle than its worth to do it. I use a PC and not a mobile and i only use this within my website. Plus i gunna refer back to my old rule. Its free and unless i'm being paid its not worth going full out on it 😄 Had this been paid mod i would be on it like a hawk as if you are paying for it you'd expect the best and support as i do with all my paid mods (1% of them are paid lol) Thanks for the feedback. Edit. I did post this up further in the post but with some basic skill you could use this part. function getFormField($fieldName, $fieldValue) { // Define an array of fields that should be displayed as select dropdowns $selectFields = array('field1', 'field2', 'field3'); if (in_array($fieldName, $selectFields)) { // Display select dropdown return '<select name="'.$fieldName.'"> <option value="option1"'.($fieldValue == 'option1' ? ' selected' : '').'>Option 1</option> <option value="option2"'.($fieldValue == 'option2' ? ' selected' : '').'>Option 2</option> <option value="option3"'.($fieldValue == 'option3' ? ' selected' : '').'>Option 3</option> </select>'; } else { // Display text box return '<input type="text" name="'.$fieldName.'" value="'.$fieldValue.'" />'; } }
-
Yeah, to be honest, its not great look but then it doesn't bother me. I dont make any money out of it to make it a viable option to put loads of work into it. Its was made and for use for free, maybe a donation on it would encourage me to improove it but as is, there isn't any point, It works, gives links and quick access to all my mods in one place. Maybe in a couple years i'll update it, but for now, it will be as is. Thank you for your input and if i ever update it i will take your inputs and impliment it.
-
More mods added and looks tweeked.
-
You could do something like this? $query = $db->query("SELECT * FROM users WHERE userid={$r['userid']}"); while ($row = $db->fetch_row()) { foreach ($row as $val => $value) { echo '<tr> <td>'.$val.'</td> <td>'.getFormField($val, $value).'</td> </tr>'; } } echo '<tr> <td colspan="2" class="min"><span class="black">USER STATS</span></td> </tr>'; $query = $db->query("SELECT * FROM userstats WHERE userid={$r['userid']}"); while ($row = $db->fetch_row()) { foreach ($row as $val => $value) { echo "<tr> <td>".$val."</td> <td>".getFormField($val, $value)."</td> </tr>"; } } function getFormField($fieldName, $fieldValue) { // Define an array of fields that should be displayed as select dropdowns $selectFields = array('field1', 'field2', 'field3'); if (in_array($fieldName, $selectFields)) { // Display select dropdown return '<select name="'.$fieldName.'"> <option value="option1"'.($fieldValue == 'option1' ? ' selected' : '').'>Option 1</option> <option value="option2"'.($fieldValue == 'option2' ? ' selected' : '').'>Option 2</option> <option value="option3"'.($fieldValue == 'option3' ? ' selected' : '').'>Option 3</option> </select>'; } else { // Display text box return '<input type="text" name="'.$fieldName.'" value="'.$fieldValue.'" />'; } }
-
nope, go for it. I got tired a couple years ago of adding new inputs into edit users so made this. Just feel time its given to the public 😄
-
What is it? Well its a Better edit user for mccodes v2. This mod collects all fields from the users table and displays it out instead of having to add new fields each time you add something new to the users table. (which we know is a pain in the bum) Also included is the users inventory so you can see and delete stuff. (yes this is in mccodes but for myself i added it for ease of use). Save the page as whatever you want <?php include 'sglobals.php'; // Use if you want to only allow yourself if ($userid != '1') { die('No Access'); } // Use if you wish All admins to have access //if ($ir['user_level'] != '2') { die('No Access'); } switch($_GET['action']) { case 'invuser': inv_user_view(); break; case 'editUser': editUser(); break; case 'deleinv': inv_delete(); break; default: home(); break; } function home() { global $db,$ir,$c,$userid,$h; if (empty($_GET['u'])) { ?><br /><br /> Please Enter User ID to continue<br /> <form action="?u=<?php echo $r['userid']; ?>" method="GET"> <input type="text" name="u" value="<?php $r['userid']; ?>" length="4" placeholder="enter ID to search" /> <input type="submit" value="Go" /> </form> <?php $h->endpage(); exit; } else { $userInfo = $db->query('SELECT * FROM `users` WHERE (`userid` = '.$_GET['u'].')'); if ($db->num_rows($userInfo) > 0) { $r = $db->fetch_row($userInfo); } $userInfo = $db->query('SELECT * FROM `userstats` WHERE (`userid` = '.$_GET['u'].')'); if ($db->num_rows($userInfo) > 0) { $e = $db->fetch_row($userInfo); } } ?> <center> <table class="minimalistBlack"> <tr class="min"> <td><form action="?action=invuser" method="POST"> <input type="hidden" name="user" value="<?php echo $r['userid']; ?>" /> <input type="submit" value="View Inventory" /></form></td> <td><form action="jailuser.php?userid=<?php echo $r['userid']; ?>" method="POST"> <input type="submit" value="FedJail" /></form></td> <td><form action="mailban.php?userid=<?php echo $r['userid']; ?>" method="POST"> <input type="submit" value="Mail Ban" /></form></td> <td><form action="staff_punit.php?action=ipsub" method="POST"> <input type="hidden" name="ip" value="<?php echo $r['lastip']; ?>" /> <input type="submit" value="Check IP" /></form></td> <td><form action="viewuser.php?u=<?php echo $r['userid']; ?>" method="POST"> <input type="submit" value="VIEW PROFILE" /></form></td> <td><form action="?u=<?php echo $r['userid']; ?>" method="POST"> <input type="submit" value="RELOAD" /></form></td> </tr> <tr> <td colspan="5"><form action="?u=<?php echo $r['userid']; ?>" method="GET"> <input type="text" name="u" value="<?php $r['userid']; ?>" length="4" placeholder="enter ID to search" /> <input type="submit" value="Go" /></form></td> </tr> </table> Editing user: <?php echo $r['username']; ?> (<?php echo $r['userid']; ?>) <br /> <br /> <form action="?action=editUser&u=<?php echo $r['userid']; ?>" method="POST"> <input type="hidden" name="user" value="<?php echo $r['userid']; ?>" /> <table class="minimalistBlack"> <tr class="min"> <td><span class="black">FIELD</span></td> <td><span class="black">DATA</span></td> </tr> <?php $query = $db->query("SELECT * FROM users WHERE userid={$r['userid']}"); while ($row = $db->fetch_row()) { foreach($row as $val => $value) { echo '<tr> <td>'.$val.'</td> <td><input type="text" name="'.$val.'" value="'.$value.'" /></td> </tr>'; } } echo '<tr> <td colspan="2" class="min"><span class="black">USER STATS</span></td> </tr>'; $query = $db->query("SELECT * FROM userstats WHERE userid={$r['userid']}"); while ($row = $db->fetch_row()) { foreach($row as $val => $value) { echo "<tr> <td>".$val."</td> <td><input type='text' name='".$val."' value='".$value."' /></td> </tr>"; } } ?> <tr> <td colspan="2" class="min"></td> </tr> </table> <input type='submit' value='Edit User' /> </form> <?php } function editUser() { global $db, $ir, $c, $userid, $h; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $userId = (int)$_GET['u']; $user = $_POST['user']; foreach ($_POST as $fieldName => $fieldValue) { $fieldName = $db->escape($fieldName); $fieldValue = $db->escape($fieldValue); // Check if the field belongs to the users table $userFieldsQuery = $db->query("SHOW COLUMNS FROM users"); while ($userField = $db->fetch_row($userFieldsQuery)) { if ($fieldName === $userField['Field']) { $db->query("UPDATE users SET $fieldName = '$fieldValue' WHERE userid = $userId"); break; } } // Check if the field belongs to the userstats table $userStatsFieldsQuery = $db->query("SHOW COLUMNS FROM userstats"); while ($userStatsField = $db->fetch_row($userStatsFieldsQuery)) { if ($fieldName === $userStatsField['Field']) { $db->query("UPDATE userstats SET $fieldName = '$fieldValue' WHERE userid = $userId"); break; } } } echo 'User data updated successfully.<br /><br />'; } else { echo 'Invalid request method.'; } echo '<a href="?action=home&u='.$user.'">Back</a>'; } function inv_user_view() { global $db,$c,$h,$userid; $userids = $_POST['user']; $d = $db->query("SELECT username FROM users WHERE userid={$userids}"); $un = $db->fetch_single($d); $inv = $db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$userids}"); if (0 == $db->num_rows($inv)) { echo '<b>This person has no items!</b>'; } else { echo "<b>Their items are listed below.</b><br /> <table width=100%><tr style='background-color:gray;'><th>Item</th><th>Sell Value</th><th>Total Sell Value</th><th>Links</th></tr>"; while ($i = $db->fetch_row($inv)) { echo "<tr><td>{$i['itmname']}"; if ($i['inv_qty'] > 1) { echo " x{$i['inv_qty']}"; } echo "</td><td>\${$i['itmsellprice']}</td><td>"; echo '$'.($i['itmsellprice'] * $i['inv_qty']); echo "</td><td>[<a href='?action=deleinv&ID={$i['inv_id']}'>Delete</a>]"; echo '</td></tr>'; } echo '</table><br /> <form action="?u='.$userids.'" method="POST"> <input type="submit" value="Back" /></form> '; } } function inv_delete() { global $db,$ir,$c,$h,$userid; if (1 != $ir['userid']) { die('Function Disabled'); } $db->query("DELETE FROM inventory WHERE inv_id={$_GET['ID']}"); echo 'Item deleted from inventory.'; stafflog_add("Deleted inventory ID {$_GET['ID']}"); } $h->endpage(); ?>
-
Ok, Here are two little functions made for mccodes, Enjoy. This First mod. This creates 1,000 bots with stats to add to your game. Edit Where needed. Change the $add to how many bots you wish to add. function gen() { global $db; $maxUserIdResult = $db->query("SELECT MAX(userid) AS max_userid FROM users"); $maxUserIdRow = $maxUserIdResult->fetch_assoc(); $maxUserId = $maxUserIdRow['max_userid']; $add = 1000; for ($i = $maxUserId + 1; $i <= $maxUserId + $add; $i++) { $username = "user{$i}"; // Generate a unique username for each user $level = 10 + $i - $maxUserId - 1; // Level starts at 10 and increments by 1 // Calculate user stats based on level $statsMultiplier = $level * 1000000; $money = $level * 1000; $gold = $level * 100; $energy = 12 + $level * 2; $will = 100 + $level * 50; $brave = 5 + $level * 2; $hp = 100 + $level * 50; $strength = $statsMultiplier; $agility = $statsMultiplier; $guard = $statsMultiplier; $labour = $statsMultiplier; $IQ = $statsMultiplier; $email = $username."@infamous-wars.com"; $ip = "127.0.0.1"; $ran = rand(1,2); if ($ran == '1') { $gender = "Male"; } else { $gender = "Female"; } // Insert the new user into the users table $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES ('{$username}', '{$username}', 'password', '$level', '$money', '$gold', 0, 0, '$energy', '$energy', '100', '100', '$brave', '$brave', '$hp', '$hp', 1, '$gender', unix_timestamp(), '$email', -1, '$ip', '$ip')"); // Insert the user stats into the userstats table $db->query("INSERT INTO userstats (userid, strength, agility, guard, labour, IQ) VALUES ($i, $strength, $agility, $guard, $labour, $IQ)"); } echo "1000 new users inserted successfully."; } The case -> case 'gen': gen(); break; Thats that one, Random hehe. Ok this next mod is to change users ID to another ID. NOTE: Please edit the 3rd function cuseriddo and remove/add what is needed for your tables. As this is free i ain't removing mine. function cuseri() { global $db, $c; ?> <h2>Change Userid</h2> <form action="?action=cuserid" method="post"> User: <?php echo user_dropdown($c, 'user'); ?><br /><br /> <input type='submit' value='Select User' /> </form> <?php } function cuserid() { global $db; $userid = $_POST['user']; $detail = $db->query("SELECT * FROM users WHERE userid=$userid"); $de = $db->fetch_row($detail); ?><br /> Editing user: <?php echo $de['username']; ?><br /> <form action="?action=cuseriddo" method="post"> Current userid: <input type="text" name="useridold" value="<?php echo $userid; ?>" /><br /> New userid: <input type="text" name="useridnew" /><br /><br /> <input type='submit' value='Set User ID' /> </form> <?php } function cuseriddo() { global $db, $userid; $useridold = $_POST['useridold']; $useridnew = $_POST['useridnew']; $tablesToUpdate = array( 'academy_enrolled' => 'user_id', 'applications' => 'appUSER', 'attacklogs' => array('attacker', 'attacked'), 'bankxferlogs' => array('cxFROM', 'cxTO'), 'blackjack' => 'userid', 'blacklist' => array('bl_ADDER', 'bl_ADDED'), 'bugreports' => 'reporter', 'businesses' => 'busDirector', 'businesses_apps' => 'appMember', 'businesses_members' => 'bmembMember', 'cashxferlogs' => array('cxFROM', 'cxTO'), 'chat_box' => 'chat_user', 'city' => 'owner', 'comments' => array('cmtTO', 'cmtFROM'), 'contactlist' => array('cl_ADDER', 'cl_ADDED'), 'coursesdone' => 'userid', 'courses_enrolled' => 'user_id', 'crystalmarket' => 'cmADDER', 'crystalxferlogs' => array('cxFROM', 'cxTO'), 'enemieslist' => array('uid', 'aid'), 'events' => 'evUSER', 'facilities' => 'owner', 'forum_forums' => 'ff_lp_poster_id', 'forum_posts' => array('fp_poster_id', 'fp_editor_id'), 'forum_topics' => array('ft_owner_id', 'ft_last_id'), 'friendslist' => array('fl_ADDER', 'fl_ADDED'), 'gangs' => array('gangPRESIDENT', 'gangVICEPRES'), 'gangdonatelogs' => array('ixFROM', 'ixTO'), 'gdonatelogs' => array('ixFROM', 'ixTO'), 'hospital' => 'uid', 'imarketaddlogs' => 'imaADDER', 'imbuylogs' => array('imbADDER', 'imbBUYER'), 'imremovelogs' => array('imrADDER', 'imrREMOVER'), 'inventory' => 'inv_userid', 'itembuylogs' => 'ibUSER', 'itemmarket' => 'imADDER', 'itemscreated' => 'iUSER', 'itemselllogs' => 'isUSER', 'itemxferlogs' => array('ixFROM', 'ixTO'), 'jaillogs' => array('jaJAILER', 'jaJAILED'), 'mail' => array('mail_from', 'mail_to'), 'marriages' => array('marriage_from', 'marriage_to'), 'minemarket' => 'cmADDER', 'minesxferlogs' => array('cxFROM', 'cxTO'), 'modules_enrolled' => 'user_id', 'monthly_winners' => 'userid', 'npaper' => 'npADDER', 'owned_houses' => array('uhouseOwner', 'uhouseTenant'), 'pets' => 'petowner', 'preports' => array('prREPORTER', 'prREPORTED'), 'proposals' => array('proposal_from', 'proposal_to'), 'referrals' => array('r_referrer', 'r_referred'), 'skills' => 'userid', 'stafflog' => 'user', 'staffnotelogs' => array('snCHANGER', 'snCHANGED'), 'suggestions' => 'sugPlayer', 'suggestionVotes' => 'vPlayer', 'unjaillogs' => array('ujaJAILER', 'ujaJAILED'), 'users' => 'userid', 'userstats' => 'userid', 'usershops' => 'userid', 'usershoplogs' => array('buyer', 'seller'), 'votes' => 'userid', ); foreach ($tablesToUpdate as $table => $useridFields) { if (is_array($useridFields)) { $conditions = ''; foreach ($useridFields as $field) { $conditions .= "`$field`='$useridold' OR "; } $conditions = rtrim($conditions, ' OR '); $db->query("UPDATE $table SET " . implode(", ", array_map(function($field) use ($useridnew) { return "`$field`='$useridnew'"; }, $useridFields)) . " WHERE $conditions"); } else { $db->query("UPDATE $table SET `$useridFields`='$useridnew' WHERE `$useridFields`='$useridold'"); } echo "ID changed from $useridold to $useridnew in table $table<br>"; } $usern = $db->fetch_row($db->query("SELECT * FROM users WHERE userid=$userid")); $username = $usern['username']; stafflog_add("$username Has changed UserID $useridold ID to $useridnew "); } And here are your cases for this -> case 'cuseri': cuseri(); break; case 'cuserid': cuserid(); break; case 'cuseriddo': cuseriddo(); break; 2 simple mods. Enjoy
- 1 reply
-
- 2
-
-
Mccodes does indeed have one, Head to lib/basic_error_handler.php and edit line 31. define('DEBUG', false); to define('DEBUG', true);
-
Just the basic. https://chat.openai.com/
-
-
I use chat in mine hehe. Well I've never really had any successfull sites, but always maintained people coming back. All i can do is keep at it, my dedication shows in my game and work which is what most people come back for. I guess not having loads of users allows me to listen to what users i have to improove things. Game eco. Well with Mccodes based, theres no chance, I've found they keep getting out of control.
-
Do you have a link or an image/screenshot?
-
Ok, Well. So I don't have this on my game, this being made LONG ago and i can't be bother to optimize, So I've decided to use AI to sort it. I didn't know the bot could read pastebin!!!. This is what the bot said and now it got it to sort it haha. If you're concerned about the character limit for posting your code here, you can try breaking it down into smaller chunks and sharing them one by one. Alternatively, you can use online code-sharing platforms like GitHub Gist or Pastebin to share your code and provide the link here. That way, you can share the entire code without worrying about any character limits.
-
yeah, it is quite a code. Not my longest at all but pretty long 😄 My biggest mod is still in production but its upto 2300 lines and still going 😄