Jump to content
MakeWebGames

inferno564

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by inferno564

  1. Re: mccodes v2 help moved servers lol sorry forgot the SQL password was located in the config file
  2. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /var/www/class/class_db_mysql.php on line 46 FATAL ERROR: Could not connect to database on localhost (Access denied for user 'root'@'localhost' (using password: YES)) is there a way to fix this without a complete reinstall? note: i just moved servers
  3. upload pictures first i didn't make this i got it from http://us2.php.net/features.file-upload. second i edited to work with mccodes v2 by changing 2 or 3 lines of code. yes this is probably not secure (if you want to patch it up do so) third i know there's alot of these but this is the first one i found to work. so here is the code hope you like it. oh and this is for http://criminalexistence.com/ceforums/index.php?topic=18505.0 this pic mod <?php require "globals.php"; /*** this is a simple and complete function and the easyest way i have found to allow you to add an image to a form that the user can verify before submiting if the user do not want this image and change his mind he can reupload a new image and we will delete the last i have added the debug if !move_uploaded_file so you can verify the result with your directory and you can use this function to destroy the last upload without uploading again if you want too, just add a value... ***/ function upload_back() { global $globals; /*** 1rst set the images dir and declare a files array we will have to loop the images directory to write a new name for our picture ***/ $uploaddir = 'enter place you want to upload'; $dir = opendir($uploaddir); $files = array(); /*** if we are on a form who allow to reedit the posted vars we can save the image previously uploaded if the previous upload was successfull. so declare that value into a global var, we will rewrite that value in a hidden input later to post it again if we do not need to rewrite the image after the new upload and just... save the value... ***/ if ($ir['user_level'] <= 2) if(!empty($_POST['attachement_loos'])) { $globals['attachement'] = $_POST['attachement_loos']; } /*** now verify if the file exists, just verify if the 1rst array is not empty. else you can do what you want, that form allows to use a multipart form, for exemple for a topic on a forum, and then to post an attachement with all our other values ***/ if(isset($_FILES['attachement']) && !empty($_FILES['attachement']['name'])) { /*** now verify the mime, i did not find something more easy than verify the 'image/' ty^pe. if wrong tell it! ***/ if(!eregi('image/', $_FILES['attachement']['type'])) { echo 'The uploaded file is not an image please upload a valide file!'; } else { /*** else we must loop our upload folder to find the last entry the count will tell us and will be used to declare the new name of the new image. we do not want to rewrite a previously uploaded image ***/ while($file = readdir($dir)) { array_push($files,"$file"); echo $file; } closedir($dir); /*** now just rewrite the name of our uploaded file with the count and the extension, strrchr will return us the needle for the extension ***/ $_FILES['attachement']['name'] = ceil(count($files)+'1').''.strrchr($_FILES['attachement']['name'], '.'); $uploadfile = $uploaddir . basename($_FILES['attachement']['name']); /*** do same for the last uploaded file, just build it if we have a previously uploaded file ***/ $previousToDestroy = empty($globals['attachement']) && !empty($_FILES['attachement']['name']) ? '' : $uploaddir . $files[ceil(count($files)-'1')]; // now verify if file was successfully uploaded if(!move_uploaded_file($_FILES['attachement']['tmp_name'], $uploadfile)) { echo '<pre> Your file was not uploaded please try again here are your debug informations: '.print_r($_FILES) .' </pre>'; } else { echo 'image succesfully uploaded!'; } /*** and reset the globals vars if we maybe want to reedit the form: first the new image, second delete the previous.... ***/ $globals['attachement'] = $_FILES['attachement']['name']; if(!empty($previousToDestroy)) { unlink($previousToDestroy); } } } } upload_back(); /*** now the form if you need it (with the global...): just add the hidden input when you write your preview script and... in the original form but! if you have send a value to advert your script than we are remaking the form. for exemple with a hidden input with "reedit" as value or with a $_GET method who can verify that condition ***/ echo '<form action="" method="post" enctype="multipart/form-data"> <input type="file" name="attachement" name="attachement"></input> <input type="hidden" name="attachement_loos" name="attachement_loos" value="', $globals['attachement'] ,'"></input> <input type="submit" value="submit"></input> </form>'; ?>
  4. Re: [mccode v2] Simple Job Specials it says i have -1 job point and the crons dont change the job points it just says -1 job point always how do you fix this? :?
  5. Re: [mccode V2] Search Islands I edit the script a bit and added some code from the streets v2 tested some display errors but works fine   <?php /** * author thahacker07 * */ include "globals.php"; echo "<h3>The Islands</h3>"; if ($ir['islands'] == 0) { die("[b]You have already searched the islands as much as you can today.[/b]"); } echo "<table width='100%'><tr><td width='25%' align='left' valign='top'>"; for ($i = 1; $i <= 100; $i++) { echo sprintf("[b]%s)[/b]", $i); $randnum = rand(0, 1000); if ($randnum < 51) { echo "<font color='red'> You found nothing</font> "; } if ($randnum < 16) { echo "you fall over!lol"; } if ($randnum < 10) { echo "You see a guy getting mugged, but you decide to keep walking. You don't want to be in his shoes anytime soon.>"; } if ($randnum < 123) { $gain = rand(1, 3); echo "While searching the abandoned city you found [b]$gain[/b] crystals."; $db->query("UPDATE users SET crystals=crystals+$gain where userid=$userid", $c); } else { echo sprintf("<font color='green'> You found [b]$%d[/b]</font> ", number_format($randnum)); } $total += $randnum; if ($i == 25 or $i == 50 or $i == 75) { echo "</td><td width='25%' align='left' valign='top'>"; } } echo " "; echo sprintf("</td></tr></table> [b]You found a total of $%d searching The island![/b] ", $total); $newmoney = $ir['money'] + $total; $result = sprintf("UPDATE users SET money=%d WHERE userid=%u", $newmoney, $userid); $db->query($result); $h->endpage(); ?> not much of a change {i know} :-D
  6. Re: [mccode v2] Item Descryption. i found a cool thing that u could be yous :-D here is the link it uses dhtml http://www.php-development.ru/javascripts/popup-window.php
  7. Re: an idea for a template login,register.... ok thanks :-D
  8. i found a cool template that would be good for a login/register template ,but im not that great at php coding so here is the link to download it http://76.114.46.95/4945.zip and here is a screen shot if you get it working on mccode v2 let me know :-D
  9. Re: crimes help ***** I JUST DELETED MY ENTIRE DATA BASE **** I GUESS THATS WHY YOU DONT LET A NOOB HAVE ACCESS GAME DATA BASE I GUESS I WONT BE HAVING THAT ERROR ANY MORE LOL LUCK THE GAME IS A TEST
  10. Re: crimes help it would not let me upload the sql.zip or any compression into phpmyadmin so i copied and pasted the entire code to a a text file and i guess the crimes sql got messed up some how. there was no errors that i know of, but the reason i am posting is that each time my user do a crime there ex increases 50 % or more even when i have it set to 1 or .25 .
  11. i need the crimes sql table and its fields in a excusable code please. some how when i was moving to a new server my sql had a error when i reapplied it in the new severs data base and now the crimes do not work right. much appreciated.
  12. Re: crons not working properly never mined for some reason u have two gain xp before gaining energy :x
  13. Re: crons not working properly code remove: reason mccode v2 original source this is the code with the energy is there any thing wrong with it? and i am hosting my own sever on my computer linux
  14. Re: crons not working properly non are the same as my problem though
  15. i have just installed mccodes v2 and when my crons activate i only gain (will) and nothing else like (energy,and brave) what is the problem? please help!!!!!
×
×
  • Create New...