Jump to content

xoligy

Members
  • Posts

    232
  • Joined

  • Last visited

    Never

Everything posted by xoligy

  1. If its a homeserver its normally something like this: $con = mysql_connect("localhost","username","password");
  2. Thanks for the reply, like i said im still noobish and learning as i code. Functions, sessions are very new to me and so i passing info from one page to the next! Anwyay tried your solution after fixing the spelling mistakes and added $mobsters and no joy! I goto the the page im linking from and have three delete buttons as it should show three accounts but the names are not there. Refresh the screen and then there are seix accounts again 9 :/ $mobcount = mysql_fetch_row(mysql_query("select count(username) from mobster where username='$uname'")); function listmob(){ $uname = $_SESSION['username']; $mobsters = mysql_query("select * from mobster where username='".$uname."'"); while(mysql_fetch_assoc($mobsters)){ //added $mobsters, fixed spelling $_SESSION['mobs'][] = array('name'=>$row['name'], 'id'=>$row['id']);} foreach($_SESSION['mobs'] as $mob) //spelling fix { echo "<tr><td><a href='mobster.php?id=".$mob['id']."'>".$mob['name']."</a></td><td><a href='account.php'>delete</a></td></tr>"; } }
  3. Ok ehre is whats going on you sign up (when ive made that lol) and you have ur username, from there im going to make it so you can add accounts for game data. So say admin had 3 accounts i want it so i can click the link and goto the right profile id 1 name admin id 2 name admin2 etc etc But all its doing is going straight to the last name as u can see im playing with sessions with no joy im a noob process.php $mobcount = mysql_fetch_row(mysql_query("select count(username) from mobster where username='$uname'")); function listmob(){ $uname = $_SESSION['username']; $mobsters = mysql_query("select * from mobster where username='".$uname."'"); while($row = mysql_fetch_array( $mobsters )) { echo "<tr><td><a href='mobster.php?id=".$row[id]."'>".$row[name]."</a></td><td><a href='account.php?del'>delete</a></td></tr>"; $_SESSION['mname'] = $row[name]; $_SESSION['id'] = $row[id]; } } profile $mob = $_SESSION['username']; //echo $_SESSION['username']; $_SESSION['mname']; echo $_SESSION['mname']; $_SESSION['id']; echo "<br> ID - ".$_SESSION['id']; $mob1 = mysql_fetch_array(mysql_query("select id, username, name, mob, hired from mobster where username='".$_SESSION['username']."' AND id='".$_SESSION['id']."'")); ?>
  4. Hey all long time since ive been here as i quit coding but now im back lol. Anyway im trying to make a page where im able to add new items to a game db (im creating it all dont ask why) and im running into issues already. Anyway the code is below and here are my issues: 1. When i post the form only numerical data can be entered into the name field, yet in the db its varchar. I dunno whats up there 2. When i added $limited to the equasion nothing would get entered into the database, as you can see its working on a dropdown box (its 1,2 at the moment but should be blackmarket, favor 3. I will be adding cost soon as the above are figured out lol infact there will be two costs (game payments and favor point payments) 4. Yes i suck! Db info: $type > item varchar(30) utf8_general_ci Thanks in advance for any help Ps. Please feel free to say if things could be improved, or of any good tutorials i lost all my decent ones <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); } include('db.php'); include('proc.php'); if (!function_exists("cln")) { function cln( $value ){ if( get_magic_quotes_gpc() ){ $value = stripslashes( $value ); } //check if this function exists if( function_exists( "mysql_real_escape_string" ) ) { $value = mysql_real_escape_string(trim(strip_tags(htmlspecialchars(( $value ))))); } //for PHP version < 4.3.0 use addslashes else { $value = addslashes( $value ); } return $value; } } if($addweapon){ $name = cln($name); $att = cln($att); $def = cln($def); $type = cln($type); $limited = cln($limited); $cost = cln($cost); $result = mysql_query("insert into $type (item, att, def, limited) values ($name, $att, $def, $limited)"); echo $result; echo $limited; $melcount = mysql_fetch_row(mysql_query("select count(*) from melee")); $expcount = mysql_fetch_row(mysql_query("select count(*) from explosives")); $guncount = mysql_fetch_row(mysql_query("select count(*) from guns")); $armcount = mysql_fetch_row(mysql_query("select count(*) from armour")); $vehcount = mysql_fetch_row(mysql_query("select count(*) from vehicles")); $hencount = mysql_fetch_row(mysql_query("select count(*) from henchmen")); $favcount = mysql_fetch_row(mysql_query("select count(*) from favor")); //$blkcount = mysql_fetch_row(mysql_query("select count(*) from melee where limited>0")); } ?> <table> <tr> <td colspan='2'>Add new items m2 items here:<td> </tr> <tr> <form name="form" method="post" action="<?=$_SERVER[php_SELF]?>"> <td>Item name:</td><td><input type="text" name="name" size="15"></td> </tr> <tr> <td>Attack:</td><td><input type="text" name="att" size="5"></td> </tr> <tr> <td>Defence:</td><td><input type="text" name="def" size="5"></td> </tr> <tr> <td>Item type:</td> <td> <select name="type"> <option value="melee">Melee</option> <option value="explosives">Explosives</option> <option value="guns">Guns</option> <option value="armour">Armour</option> <option value="vehicles">Vehicles</option> <option value="henchmen">Henchmen</option> </select> </td> </tr> <tr> <td>Limited item:</td> <td> <select name="limited"> <option value="">None</option> <option value="1">Favor</option> <option value="2">Blackmarket</option> </select> </td> </tr> <tr> <td>Cost:</td><td><input type="text" name="cost" size="5"></td> </tr> <tr> <td><input type="submit" name="addweapon" value="Submit"></td> </form> </tr> <tr> <td>Total Melee:</td><td><?=$melcount[0]?></td> </tr> <tr> <td>Total Explosives:</td><td><?=$expcount[0]?></td> </tr> <tr> <td>Total Guns:</td><td><?=$guncount[0]?></td> </tr> <tr> <td>Total Armour:</td><td><?=$armcount[0]?></td> </tr> <tr> <td>Total Vehicles:</td><td><?=$vehcount[0]?></td> </tr> <tr> <td>Total Henchmen:</td><td><?=$hencount[0]?></td> </tr> <tr> <td>Total FP Items:</td><td><?=$favcount[0]?></td> </tr> <tr> <td>Total Blackmarket:</td><td><?=$blkcount[0]?></td> </tr> </table> <?include 'left.php';?>
  5. Thanks hotdawg as i said its for a pm system not for email, i will have a play with the code you gave tho and see if i can make something work. as for my code this is what i have: <?php if($send) { if($src) { if ($msg == ""){ } else { mysql_query("UPDATE $tab[pimp] SET msg=msg+1, msgsent=msgsent+1 WHERE pimp='$pid'"); mysql_query("UPDATE $tab[pimp] SET online='$time' WHERE id='$id'"); $msg=filter($msg); mysql_query("INSERT INTO $tab[mail] (src,dest,msg,time,inbox,del,crew) VALUES ('$id','$src[1]','$msg','$time','inbox','no','$crw[0]');"); $success=yes; } } ?> As for why i asked for two in the same post it just makes sense to me tho i suppose it can be complicated if there are more so sorry Gonna see if i can get your code to work some how thanks
  6. Ok been trying to get the quote feature to work but seems im doing it completely wrong maybe someone can give me some guidence? On the mail page i have "quote" as a link that is linked to the id of the message so the link is as follows: <a href="out.php?pid=test2&tru=4&reply=103">quote</a> pid is the user, tru is the current round, reply is the message id. I thought it would be as simple as adding $_GET['id']; but seems im doing it wrong and nothing is getting displayed when i echo the variable. So im guessing the info isnt getting passed along altho the address is as it shold be. Can someone please help out and give some guidence or like i asked before point me to tutorials that have the features im after? Ive looked but found nothing to help me
  7. Ok i have a simple private message system where you just type in the messaged and press send and the message is sent, now i want to add "Cc" to the send page and also the ability to quote a message from one page to the next. With the Cc i would like them to be able to add a "," to seperate the contacts so user1,user2 etc etc. I have looked about but all the ones i have found have been for email, and none have said how to seperate with a commer thta i have seen :/ I take it nothing would have to be added to the db to add these features? Anyway hope someone can help out
  8. Guess i'll spend another few hrs at this and then just set up seperate pages which isnt what i really want :/
  9. Ok ive been trying to add multiple submit buttons to a page that basically update something in the db (simple eh!) problem im having is i carn't find the right info i require well i dont think i can anyway i look at the code ty and no luck Here is the code i was using that works on one submit button its not the best coding i know and thats why i need a push in the right direction: <? if($_POST[medals]){ mysql_query("UPDATE $tab[pimp] SET medals='off' WHERE id=$pimp[id]"); } // can use }else{ here i know if($_POST[medals]){ mysql_query("UPDATE $tab[pimp] SET medals='on' WHERE id=$pimp[id]"); } $tog = mysql_fetch_array(mysql_query("SELECT medals FROM $tab[pimp] WHERE id=$pimp[id]")); if($tog[0] == "on"){$toggle="on";} // can be removed i know else{$toggle="off";} // can be removed i know ?> <td><form method="post" action=""><input type="submit" name="<?=$toggle?>" value="<?=$toggle?>"></td> Now if i added a new button and with a new function it looks like it works but then it fails because you click "on" on one and it switches the other off lol Can someone point me in the right direction of a good tutorial or have patience and help me out?
  10. Your a genius! I dont care what other people say lol From what ive seen it works Thanks very mutch Keith its much appreciated!
  11. God damn it! lol Its close Keith, its still shows all the records it seems, but only a few have the name of the attacker which are the latest ones here is a dump of that info: attacked by 3 revenge expires in "23 hours, 58 minutes, 46 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by 3 revenge expires in "23 hours, 58 minutes, 46 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by revenge expires in "-14432 days, -12 hours, -43 minutes, -8 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by revenge expires in "-14432 days, -12 hours, -43 minutes, -8 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by revenge expires in "-14432 days, -12 hours, -43 minutes, -8 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by revenge expires in "-14432 days, -12 hours, -43 minutes, -8 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by revenge expires in "-14432 days, -12 hours, -43 minutes, -8 seconds" attack back 3 took a short cut through your street in 1 lolos. 3 of your boys became speedbumps. 5 of 3's guys were also killed. attacked by 2 revenge expires in "3 hours, 29 minutes, 31 seconds" attack back 2 took a short cut through your street in 1 lolos. 1 of your boys became speedbumps. 1 of 2's guys were also killed. I know two 3's appeared but that shouldnt happen when its life *fingers crossed* plus i have a session to add to it when i read up about them.
  12. Here is an sql dump: - phpMyAdmin SQL Dump -- version 2.10.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jul 08, 2009 at 01:20 PM -- Server version: 5.0.45 -- PHP Version: 5.2.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `mob2` -- -- -------------------------------------------------------- -- -- Table structure for table `r37_mailbox` -- CREATE TABLE `r37_mailbox` ( `id` bigint(20) unsigned NOT NULL auto_increment, `src` int(11) NOT NULL default '0', `dest` int(11) NOT NULL default '0', `msg` text NOT NULL, `time` int(12) NOT NULL default '0', `inbox` varchar(32) NOT NULL default '', `del` char(3) NOT NULL default 'no', `crew` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=52 ; -- -- Dumping data for table `r37_mailbox` --
  13. Thanks again Keith, still no joy unfortunatly. What you wrote to me looks like jibberish lol but no doubt makes sense to you :-/ Anyway here is what i got: Invalid query: Unknown column 'a.id' in 'field list'
  14. I asked someone else about it and they said to try a loop so gonna read up about loops and see how horribly wrong i go there lol unless someone says that wount work?
  15. Sorry taken a while to get back been busy with things, any way seem to be getting this: Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT `src`, MAX(`time`) as LatestTime FROM `r38_mailbox` WHERE dest='1' AND i' at line 3 im lost lol
  16. id is now ambigious.. (uses google lol) id = is just your normal 1,2,3 for each insert src = person from dest = person to msg = message time = time sent del = deleted or not crew = crew message I'll read up on grouping and joining when im more awake, see if i can make head or tails of it. Im trying to do too much going from if, elseif statments to mysql querys before i know everything lol think this is the hardest job for me till i learn about sessions. Thanks for the replys btw
  17. Unfortunatly it didnt work, neither did my idea but i guessed my way wouldnt lol here is what i got: Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY `id`) b ON `a.id` = `b.id` WHERE dest='4' AND inbox='attacks' AND d' at line 3
  18. No-one able to help out im starting to think maye i need a second query for the time and add that into the equasion? So a query for the $time and then do the query shown above will hopefully order how i want. But i would of thought that it could of all been done in one query :/
  19. Ok here is the code im working with and im having problems because im dumb and been out the loop for a while, i did post this on another forum but no response after a few days or anything! Anyway here is what im trying to do, i need to get the information from the db and if there is more than 1 record for the same person display the "latest" record and then sort in time desending. Below is how it started out and then the next bit of code is what i then tried but becasue i "moved" time im no longer able to use the code i had to get the time out the db! The only other thing i can come up with is maybe a second query but surely it can all be done in one? Anyway any help is appreciated! Btw i only re-wrote the top half so i could be speaking jibberish after this text lol mysql_query("SELECT `id`,`src`,`dest`,`msg`,`time`,`del`,`crew` FROM `$tab[mail]` WHERE dest='$id' AND inbox='attacks' AND del='no' and time >= '$before' ORDER BY `time` DESC")or die("Invalid query: " . mysql_error()); Now whats happening is its showing all records by the same id whre i just want the latest record by time (if that makes sense) There will be other results shown by other people too but as i said i want it all done by last inputted time. Someone did suggest SELECT DISTINCT and it seemed to fail when i tried adding it to the begginging of the query so i changed it to: mysql_query("SELECT DISTINCT `time` AND `id`,`src`,`dest`,`msg`,`del`,`crew` FROM `$tab[mail]` WHERE dest='$id' AND inbox='attacks' AND del='no' and time >= '$before' ORDER BY `time` DESC")or die("Invalid query: " . mysql_error()); Which did the job i want i believe but messed up the time because there is no time being pulled. what i mean: user 1 time user 2 time user 2 time user 2 time Above wrong Below wight user 1 time user 2 time Hope it makes sense :/ also all the other querys are needed!
  20. same as me then dark >.< but one question, why would people use your site rather than going to googlemaps or another site thats better laid out?
  21. Sorry but as projectfear said, im not registering! 1. as fear said the "how do i play" button is kinda hidden in the top corner, plus why whould i have to watch a video carnt you write a few instrutions saying how to play? (i know most just mess about then learn) 2. copyright is in the wrong place should always be at the bottom of the page 3. why do i have "half price credit week blah blah" over forgot password? 4. images, text, and colour aint fantastic! Without a demo account canna give more info sorry!
  22. As said very plain and boring, plus when the footer ends there is just a white space so maybe you could add an ending across the bottom "_____________" plus a little too much info in the footer is it really needed in such a small space
  23. Personally there are many games like this out there already but here is what i think: 1. Links on the left are hard to notice i didnt realise they were links till i clicked them (maybe im being dumb) 2. The closing of the menu is stupid i was just looking at what was there then whoop its gone! 3. Shoutout shouldn't that be in communictaion? 4. Watch you should say if thats server time or the users computer that helps in these kinda games, also why isnt it just automatically visable? Think about it why click a link if i can look where my task bar is??? 5. As mentioned the banner, i can tell its been squashed 6. The location of some items are in the wrong place example. help us, jail, help desk (thats just three i noticed) 7. Invite friends shouldnt be an email but a referal system I only loaded the main page and had a quick gander but thats what i noticed if you want a more detailed revied let me know and i'll do it either sunday or monday night
  24. thanks for that thebadbad seems to work a treat
  25. For the way i have to do it, it be something like rand factor for something to actually happen so lets say there is a 50% chance of that then i would need a random choice of what "could" happen, i really need to try and write something and see how far off i am with this but at the moment my head isn't working :-/
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.