
TheBigChief
Members-
Posts
76 -
Joined
-
Last visited
Never
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
TheBigChief's Achievements
Newbie (1/14)
0
Reputation
-
Just added a little more to this mod: Create a folder named carpics on your file directory. [mysql] -- -- Table structure for table `cars` -- CREATE TABLE IF NOT EXISTS `cars` ( `id` int(11) NOT NULL AUTO_INCREMENT, `model` text NOT NULL, `make` text NOT NULL, `value` int(11) NOT NULL, `quantity` int(11) NOT NULL, `carpics` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; [/mysql] Now using a modified Isomerizer uploadpics.php script create: uploadcarpics.php <?php /*----------------------------------------------------- -- Isomerizer -- Copyright held 2007-2008 ? Isomerizer.com -- uploadpic.php -----------------------------------------------------*/ require("sglobals.php"); if(empty($_FILES['imagefile'])) { echo ' Upload an image for your cars: <form name="imageuploader" method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"> [i]Path of Image:[/i] <input type="file" name="imagefile" /> <input type="submit" name="Submit" value="Upload Image" /> </form> (Max 10000 file bytes , Must be file extention gif, jpg, jpeg, png, bmp....) (Images are resized to 150 x 150) '; } else { //Edit below for max fb size of the pic $maxsize = 1000000; /*Basic security procedures*/ if(!$_SERVER['REQUEST_METHOD'] == "POST" || !isset($_SERVER['HTTP_USER_AGENT'])){ echo 'Hack Attempt!'; $h->endpage(); exit; } $headerinject = array("Content-Type:", "MIME-Version:", "Content-Transfer-Encoding:", "bcc:", "cc:"); foreach($_POST as $k => $v){ foreach($headerinject as $v2){ if(strpos($v, $v2) !== false){ logBadRequest(); header("HTTP/1.0 403 Forbidden"); exit; } } } /*What extensions can be used?*/ $valid = array('image/gif', 'image/png', 'image/pjpeg','image/jpeg', 'image/jpg'); /*If the extension isnt allowed...*/ if(!in_array($_FILES['imagefile']['type'], $valid)) { $type = strrchr($_FILES['imagefile']['name'], '.'); echo 'This file type '.$type.' is not allowed. [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; $h->endpage(); exit; } /*Check image size*/ if ($_FILES['imagefile']['size'] > $maxsize) { echo 'Image to large [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; $h->endpage(); exit; } $check = ''.$_FILES['imagefile']['tmp_name'].''; /*Check for .exe files*/ if (is_executable($check) || !is_file($check)) { echo 'The file '.$_FILES['imagefile']['name'].' seems to be harmful to the server [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; @unlink($check); $h->endpage(); exit; } /*Now to create the correct image using php*/ if ($_FILES['imagefile']['type']=="image/jpeg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'carpics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/png") { $create = @ImageCreateFromPNG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagepng($create, 'carpics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/jpg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'carpics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/gif") { $create = @ImageCreateFromGIF(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagegif($create, 'carpics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/pjpeg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'carpics/'.$_FILES['imagefile']['name'].''); } /*Destroy the php image*/ @unlink(''.$_FILES['imagefile']['tmp_name'].''); @ImageDestroy($create); /*If php could not create the image*/ if (!$create) { echo 'The image you are trying to upload seems to be corrupt please try again! [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; $h->endpage(); exit; } $path = 'carpics/'; $pic = $_FILES['imagefile']['name']; $picture = $path.$pic; $oldpic = $ir['carpics']; /*Check to see if its already uploaded*/ if ($picture == $oldpic) { echo ' Image already uploaded![url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; $h->endpage(); exit; } /*Delete previous image to save space*/ $delete = @unlink($oldpic); if ($delete) { echo 'Previous image deleted from system... '; } if (!$delete) { echo 'No Previous image to be deleted... '; } $dataa = $_FILES['imagefile']['size']; $datab = $_FILES['imagefile']['type']; $datad = $_FILES['imagefile']['name']; /*Information for user*/ echo 'Old Image Location: '.$oldpic.' New Image Location: '.$picture.' Image Uploaded <u>Info:</u> Image Name: '.$datad.' Image Size: '.$dataa.' bytes Type: '.$datab.' [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; /*Check DB*/ $check = mysql_query( sprintf("SELECT COUNT(*) FROM `cars` WHERE `carpics` = '%s'", mysql_real_escape_string($picture))); $checks = mysql_fetch_array($check); if ($checks['cnt'] > 0) { echo 'Please use another image name [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]'; $h->endpage(); exit; } /*Update DB*/ mysql_query( sprintf("UPDATE `cars` SET `carpics` = '%s' WHERE `carpics` = %u", mysql_real_escape_string($picture), $userid)); } $h->endpage(); exit; ?> on staff_cars.php go to line 21, create a new line and add: $carpics = $_POST['carpics']; Find: $db->query("INSERT INTO cars VALUES('', '$model', '$make', '$value', '$quantity')"); Replace with: $db->query("INSERT INTO cars VALUES('', '$model', '$make', '$value', '$quantity' , '$carpics')"); Find: <input type='submit' value='Add Car' /></form> Below add: <hr /> If you have not yet uploaded an image you can do so by visiting the [url='uploadcarpics.php']<u>Image Uploader</u>[/url]"; In the editcar function (which if you followed me should be line 62) Find: $quantity=$_POST['quantity']; Below add: $carpics = $_POST['carpics']; Change line 72 which should be: $db->query("UPDATE cars SET value='$value', make='$make', model='$model', quantity='$quantity' WHERE model={$_POST['model']}"); To: $db->query("UPDATE cars SET value='$value', make='$make', model='$model', quantity='$quantity' , carpics='$carpics' WHERE model={$_POST['model']}"); And that should be it - you can now have images for your cars too.
-
Oh and remember to add this to your smenu.php <hr />[b]Cars[/b] > [url='staff_cars.php?action=addcar']Add Car[/url] > [url='staff_cars.php?action=editcar']Edit Car[/url] > [url='staff_cars.php?action=delcar']Delete Car[/url]
-
This is my first mod so please be fair with comments. I created this mod to allow me to set up a decent GTA, User Garage and Races (all of which will come soon) but you can do whatever you want with it. I know there is already a cars mod out there somewhere but to be honest it didn't suit my needs and was kinda dated I think. This mod is an amendment of the cities inbuild mod. [mysql] -- -- Table structure for table `cars` -- CREATE TABLE IF NOT EXISTS `cars` ( `id` int(11) NOT NULL AUTO_INCREMENT, `model` text NOT NULL, `make` text NOT NULL, `value` int(11) NOT NULL, `quantity` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; [/mysql] Open global_func.php and find: function shop_dropdown($connection,$ddname="shop",$selected=-1) On a new line above that add: function cars_dropdown($connection,$ddname="cars",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM cars ORDER BY make ASC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['id']}'"; if ($selected == $r['id'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.= ">{$r['make']}</option>"; } $ret.="\n</select>"; return $ret; } Create a new file named staff_cars.php <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //Cars Scripting switch($_GET['action']) { case "addcar": addcar(); break; case "editcar": editcar(); break; case "delcar": delcar(); break; default: echo "Error: This script requires an action."; break; } function addcar() { global $db, $ir, $c, $h, $userid; $value=abs((int) $_POST['value']); $model=$_POST['model']; $make=$_POST['make']; $quantity=$_POST['quantity']; if($value and $make and $model and $quantity) { $q=$db->query("SELECT * FROM cars WHERE model='{$model}'"); if($db->num_rows($q)) { echo "Sorry, you cannot have two cars with the same model."; $h->endpage(); exit; } $db->query("INSERT INTO cars VALUES('', '$model', '$make', '$value', '$quantity')"); echo "[b]You just added the $make $model to the game.[/b]"; stafflog_add("Created car $make $model"); } else { echo "<h3>Add Car</h3><hr /> <form action='staff_cars.php?action=addcar' method='post'> Make: <input type='text' name='make' /> Model: <input type='text' name='model' /> Value: <input type='text' name='value' /> Quantity: <input type='test' name='quantity' /> <input type='submit' value='Add Car' /></form>"; } } function editcar() { global $db, $ir, $c, $h, $userid; switch($_POST['step']) { case "2": $value=abs((int) $_POST['value']); $model=$_POST['model']; $make=$_POST['make']; $quantity=$_POST['quantity']; $q=$db->query("SELECT * FROM cars WHERE make='{$make}' AND model!={$_POST['model']}"); if($db->num_rows($q)) { echo "Sorry, you cannot have two cars with the same model."; $h->endpage(); exit; } $model=$_POST['model']; $q=$db->query("SELECT * FROM cars WHERE model={$_POST['model']}"); $old=$db->fetch_row($q); $db->query("UPDATE cars SET value='$value', make='$make', model='$model', quantity='$quantity' WHERE model={$_POST['model']}"); echo "You just changed the details for the $make $model"; stafflog_add("Edited car $make $model"); break; case "1": $q=$db->query("SELECT * FROM cars WHERE id={$_POST['car']}"); $old=$db->fetch_row($q); echo "<h3>Editing a car</h3><hr /> <form action='staff_cars.php?action=editcar' method='post'> <input type='hidden' name='step' value='2' /> <input type='hidden' name='id' value='{$_POST['car']}' /> Model: <input type='text' name='model' value='{$old['model']}' /> Make: <input type='text' name='make' value='{$old['make']}' /> Value: <input type='text' name='value' value='{$old['value']}' /> Quantity: <input type='text' name='quantity' value='{$old['quantity']}' /> <input type='submit' value='Edit Car' /></form>"; break; default: echo "<h3>Editing a Car</h3><hr /> <form action='staff_cars.php?action=editcar' method='post'> <input type='hidden' name='step' value='1' /> car: ".cars_dropdown($c, "car")." <input type='submit' value='Edit car' /></form>"; break; } } function delcar() { global $db,$ir,$c,$h,$userid; if($_POST['car']) { $q=$db->query("SELECT * FROM cars WHERE id={$_POST['car']}"); $old=$db->fetch_row($q); if($old['id']==1) { die("This car cannot be deleted."); } $db->query("DELETE FROM cars WHERE id={$old['id']}"); echo "You just deleted the {$old['make']} {$old['model']} from the game."; stafflog_add("Deleted car {$old['make']} {$old['model']}"); } else { echo "<h3>Delete car</h3><hr /> <font color='red'><blink>[b]DELETING A CAR IS PERMANENT![/b]</font></blink> Any users that have this car will have it removed from their garage, auctions, races and any other place it is used. <form action='staff_cars.php?action=delcar' method='post'> Car to be deleted: ".cars_dropdown($c, "car")." <input type='submit' value='Delete Car' /></form>"; } } $h->endpage(); ?> And there you have it, the starting point for a multitude of new mods. Please also use this post to make the mod better if you so wish :thumbsup:
-
Hi there, Wondering if anyone can help me with my registration script? I am trying to customise it to suit the login page which works great but getting it to display properly is proving mighty difficult. I am sure that the people who have changed their register.php script before to suit new designs will see this and find my problem in seconds but maybe it just needs a fresh set of eyes lol. I don't want my page shown publicly just now until I sort the problem out so would be very grateful if someone can help me via MSN ([email protected]) Thanks much guys!
-
Works perfect up till the last changes. Get error on line 34 so I kept it the the last working version and its ok
-
Now running over a year on Alpha and attracting more players daily. Like every game that is out there live we still need to know what else we can do and whats missing to make the game more popular. I would like you to share your thoughts on it and tell me on Make Web Games what you think. Have a look guys and gals and share your thoughts. http://www.gangster-game.com/?a=27
-
I think crimson offers the ability to choose files from the left hand side which is a great addition. Notepad ++ (to my knowledge) doesn't offer this.
-
I personally use Notepad ++
-
Lets hope so, it's not as in depth as mccode v2 or does it have as many free mods but it offers loads that I needed like killing (I asked so many people for that on mccode and not 1 person could do it.)
-
Hey mate, thanks for the reply, I got it last night (as you can see in my free mod script) but it helps to know you and Jamie are also around when I get stuck.
-
This is my first ever script so please be kind with comments. I would also like to point out that this is an edit of the user statistics script by Jaimee Make ipdetails.php and add the code below: <?php require("top.php"); ?> <form method="post"> <?php if (in_array($name, $admin_array) or in_array($name, $manager_array)){ ?> <fieldset style="color: #ffffff; border: 1px solid #ffffff; width: 600px; text-align: left; padding: 5px;"> <table width="550" border="0" align="center" cellpadding="0" cellspacing="2" class="table"> <tr> <td colspan="3" align="left" class="head">IP Details: </td> </tr> <tr> <td width="150" align="left" class="sub">Name:</td> <td width="150" align="left" class="sub">Signup_IP:</td> <td width="250" align="left" class="sub">Login_IP:</td> </tr> <? $result = mysql_query("SELECT name,signup_ip,login_ip FROM login WHERE sitestate='0'") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ?> <tr> <td width="150" align="left" class="cell"><?php echo "<a href=\"view_profile.php?name=". $row['name'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['name']."</a>"; ?></td> <td width="150" align="left" class="cell"><?php echo $row['signup_ip']; ?></td> <td width="250" align="left" class="cell"><?php echo $row['login_ip']; ?></td> </tr> <?php } // while ?> </table> </fieldset> </p> </form> <?php } include('information_bar.php'); ?> <?php require("bottom.php"); ?> add the below code to information_bar.php <a href=\"ipdetails.php\" onFocus=\"if(this.blur)this.blur()\">Player IP Details</a> ||
-
Change to the code that belongs to "Its not allowed to use this function on staff members." to : if (1==2) { echo "Its not allowed to use this function on staff members."; }else{ I have also fixed the IP page but wil need some help making it admin viewable only then I can release as a free mod (any takers on the helping me?)
-
First part sorted, thanks to the main man seanybob
-
I need help with two things. The first being car thefts. For some reason, no matter who commits a car theft you get the error "Its not allowed to use this function on staff members." I have looked intensively over the script and I'm sure it's pretty obvious but just can't get it. Second thing is creating a page that shows IP addresses for the users since the acp does not yet have that feature.