-
Posts
912 -
Joined
-
Last visited
-
Days Won
7
Content Type
Profiles
Forums
Events
Everything posted by Coly010
-
I'm not using mccodes, i'll be making the game from scratch, thats why i'm trying to learn about the IPN and the code i'll need. But in my head i keep getting to a point: what if someone has donated, money takes a while to go through, but the script only runs once, sees money hasnt gone through, doesnt credit user, even though they have donated?
-
Thanks for the helps guys. Still a bit nervous, always will be when handling money, dont want angry players. But i'll look at the code samples and the IPN help :)
-
**** it sounds a bit complex, looks like I might have to do a bit of digging, and it'll definitely be paypal
-
I'm thinking of putting donator packs into my game, however, I don't know at the minute how I would go about doing this, especially as it would be much better for me to have a system that has them donate £x.xx amount, but then automatically gives them the pack once the money has gone through. Is there a way to do this, securely? Thanks, Colum
-
Honestly sniko, I was simply doubting the power of PHP for the task, but since I've never tried it I couldn't know for certain. I did say in my post that it could be done in PHP as I was aware of NWE and its modular structure. Ah well, I think there is enough here to get the OP thinking about his approach to this.
-
Yeah a design pattern is definitely essential. I think you might possibly be able to utilise a database for this. You'd also need a very could piece of code to search for modules, decompile them if they are in folders or packages and have them implement into your site seemlessly. With a database you could have a system to turn them on / off, have the url to the package etc. I don't know if PHP would be the best language for this tbh, it can be done, but how about looking into ASP.NET? You should have more functionality with that, it might make it a little bit easier, even if the only piece of ASP.NET code is to add / remove the modules, or process them.
-
Little bit off topic talking about his security problems? Its hard to understand what is actually wrong with the mod. Can you explain more about where your problem actually lies? The only thing I can pick from your code, without seeing the SQL is that maybe you shouldn't INSERT INTO, and rather create two columns for the forum_topics called `l_rating` and `d_rating` that way everytime someone likes it or dislikes it you simply have to have a bit of SQL: UPDATE forum_topics SET l_rating = (l_rating + 1) WHERE ft_id = '$ft_id' UPDATE forum_topics SET d_rating = (d_rating + 1) WHERE ft_id = '$ft_id' or something similar, then a bit of maths can get you the percentage rating: $likes = $db->query("SELECT l_rating FROM forum_topics WHERE ft_id = '$ft_id'"); $dislikes = $db->query("SELECT d_rating FROM forum_topics WHERE ft_id = '$ft_id'"); $total_votes = ($likes + $dislikes); $percentage = ($likes / total_votes ) * 100; echo $percentage; Untested but that should give you the like rating percentage of total votes. Misread your post, you have got the problem stated. ok. I dont know your SQL however i think something similar to this might be effective: table: forum_topic_votes ftv_id int(11) NOT_NULL A_I ft_id int(11) NOT_NULL userid int(11) NOT_NULL likes int(11) NOT_NULL dislike int(11) NOT_NULL then i dont know what your page before looks like but i'm assuming it'll have something like this in it: echo "<a href='forum_rate.php?action=like&ft_id=" . $ft_id . "'>Like</a><br /> <a href='forum_rate.php?action=dislike&ft_id=" . $ft_id . "'>Dislike</a><br /> then your forum_rate.php file: <?php include 'globals.php'; $ft_id = abs((int)$_GET['ft_id']) + 0; // People arguing about security, there's all of it together $action = $db->real_escape_string($_GET['action']); // <-- not 100% sure about that switch($action) { case like: like(); break; case dislike: dislike(); break; } function like() { global $userid, $h, $db, $ft_id; $sql = "SELECT * FROM forum_topic_votes WHERE userid = '$userid' AND ft_id = '$ft_id'"; $q = $db->num_rows($sql); if( $q != 0 ) { echo "You have already voted!"; exit; } else { // Stop users from rating more than once $insert = "INSERT INTO forum_topic_votes(ft_id, userid, likes) VALUES ('$ft_id', '$userid', '1')"; $db->query($insert); // Update the like ratings $db->query("UPDATE forum_topics SET l_rating = l_rating+1 WHERE ft_id = '$ft_id'"); echo " You have liked this topic!"; } } function dislike() { global $userid, $h, $db, $ft_id; $sql = "SELECT * FROM forum_topic_votes WHERE userid = '$userid' AND ft_id = '$ft_id'"; $q = $db->num_rows($sql); if( $q != 0 ) { echo "You have already voted!"; exit; } else { // Stop users from rating more than once $insert = "INSERT INTO forum_topic_votes(ft_id, userid, dislike) VALUES ('$ft_id', '$userid', '1')"; $db->query($insert); // Update the dislike ratings $db->query("UPDATE forum_topics SET d_rating = d_rating+1 WHERE ft_id = '$ft_id'"); echo " You have disliked this topic!"; } } ?> 100% untested, but it should work and if it doesn't, then the theory in it should be easily incorporated into code. For once, I think I was actually helpful :P
-
You could simply use a header, different functions for different parts of the file, then call the functions at the beginning if all your files. For the scrollbar all you need is a <div id="mainmenu"> </div> Then in css file #mainmenu { overflow-y: auto; } Simplez
-
Yeah that looks a hundred times better. No more floating scrollbars either :)
-
Here is how it looks on my screen. The red boxes are areas where i believe something needs done :/ [ATTACH=CONFIG]1216[/ATTACH]
-
On my laptop the header stuff also went into the content pane. Plus on mine there are a lot of scrollbars floating about and it separates the page in a really ugly way. i can understand the design you were going for with this, but what I think might look better would be if you were to make the whole page smaller, give it a fixed width. don't let it expand the full screen. There definitely needs to be more images, gradients, textures, effects and things added into it. I agree with Kyle its missing something
-
It would be too difficult to make a full first person experience in the web browser because of the fact that there isn't one suitable, completely cross-platform plugin that would allow something of that scale and diversity. Although, Java applets are supported by most browsers I believe, the only problem then is that creating a proper 3D game in Java is, if I'm not mistaken, pushing Java close to its limits as it is, with the added effort of networking, all the tasks, quests, keeping the game running smooth whilst providing good graphical feedback would be close to impossible through the web browser. It would be easier to do it as an actually application itself. No the isometric 3D rendering system you have is something that works great for the style of game you're doing, and it runs smoothly, giving the user the experience they like to have, without having to download any additional pieces of software, which is always a good thing. Too many people get put off when they see they need to install something.
-
As I said, slight limitations, camera movement isn't free, distant objects may appear to be the same size, instead of smaller, not being able to see the sky. Its a great way to go about doing it. I wasn't saying its bad, I was saying it was good, despite slight limitations, slight in the sense there isn't much
-
Things like this can't be rushed, not when they're that good aha
-
I like the idea behind the game, I also like the isometric 3D design, despite the slight limitations.
-
It looks nice for a business advertising products. The blue looks good.
-
I like the new design but it seems the boxes were inspired a bit from your futuristic template. But i like it, its simple and nice and to look at, although the light grey is very light, i'd darken it down a bit.
-
The design of the boxes fits the futuristic theme perfectly, its what you would expect to see. The colour contrast between the boxes and the background should definitely be worked on. Its too hard to see the edges of the boxes. A simple lighter grey outline might do the trick and still fit the theme if you gradient it a tad. @Peter, i think the over glow is used to try and create the futurist laser effect that you often see associated with those types of designs. Overall, if you finish it, it should look really well and might actually encourage more people to move away from the classic mafia style game and into a genre that I feel is some what lacking of text-based games.
-
Is there anywhere i can learn more about your game a_bertrand? :P
-
I'm a Crafter. i like to mine and make tools but that isn't in your options either
-
Can't at the moment, I'm in school aha
-
Ok so for me to do what I want to do, I can simply place a variable say: var add = 0; Then use the each() to dynamically update each class, for example: $(".classname").each(function() { add = add + $("#someDiv").outerWidth(); $(this).css({ left: add }); }); Would that work? Will the add variable change everytime it goes to the next element?
-
I know I can count how many elements there are containing the same class in jquery using: $(".classname").length however what i'd like to know is : is there a way for me to change each of the elements containing the class individually, all at once? For example: is there a way for me to create an array of all the elements that contain this specific class then iterate through this array so that i can dynamically change certain variables depending on a variable from the previous element that i changed it would be extremely helpful if someone could show me how to do this. Colum
-
With my old code, everything seems to work perfectly, until i open the chat box, then it slows down the site like completely. So here's the code for the chatbox and everything that affects it: part of the header file: echo '<script src="js/chat.js"> </script> <script src="js/chat_input.js"> </script> <script src="js/load_messages.js"> </script>'; echo "<div id='footer'> <div id='chat_box'> </div> <div id='active_chats'>"; include "active_chats.php"; echo " </div> <div id='pm_box'> </div> </div>" chat.php <?php include "mini_globals.php"; $fr_id = ""; $c_id = ""; if(isset($_POST['friend_id'])) { $fr_id = $_POST['friend_id']; } else { echo "FR_ID NOT SET<br />"; } if(isset($_POST['ch_id'])) { $c_id = $_POST['ch_id']; } else { echo "C_ID NOT SET<br />"; } $fr_id = abs((int)$fr_id); $c_id = abs((int)$c_id); $check_sql = $db->query("SELECT * FROM chats WHERE (c_id = '$c_id') AND (((user1_id = '$userid') AND (user2_id = '$fr_id')) OR ((user2_id = '$userid') AND (user1_id = '$fr_id')))"); $ch_nr = mysqli_num_rows($check_sql); if( $ch_nr != 1 ) { echo "Invalid Chat!"; } else { $fr_sql = $db->query("SELECT * FROM users WHERE userid = '$fr_id'"); $fr_ar = mysqli_fetch_array($fr_sql); $fdname = $fr_ar['display_name']; $fdpic = $fr_ar['display_pic']; echo "<div class='chat'> <table width='100%'><tr> <td width='90%' class='td_name'><center><b>" . $fdname . "</b></center></td><td width='10%'><img src='img/ex.png' class='hide_div' onClick='hideChat()' onMouseOver='HoverExOver()' onMouseOut='HoverExOut()' /></td> </tr></table> <div id='chat_messages' style='overflow-y:scroll;'> </div> <div id='is_writing'> </div> <div id='chat_input'> <input type='hidden' id='fr_id' value='" . $fr_id . "' /> <input type='hidden' id='chat_id' value='" . $c_id . "' /> <table width='100%'> <tr> <td width='100%'> <textarea id='imessage' cols='45'></textarea> </td> </tr> </table> </div> </div>"; } ?> load_messages.php <?php include "mini_globals.php"; $fr_id = $_GET['friend']; $c_id = $_GET['ch_id']; $fr_id = $db->real_escape_string($fr_id); $c_id = $db->real_escape_string($c_id); $limit = 20; $select_msgs = $db->query("SELECT * FROM i_messages WHERE c_id = '$c_id' ORDER BY im_id DESC LIMIT 20"); $imessage_array = array(); while( $imessages = mysqli_fetch_assoc($select_msgs) ) { $imessage_array[] = $imessages; } $imessages = array_reverse($imessage_array); echo "<table width='100%' class='msg_table'>"; foreach($imessages as $im_ar) { if( $im_ar['s_id'] == $userid ) { echo "<tr class='user_sent_msg'> <td>"; if( $im_ar['read_by_user'] == 1 ) { echo "<img src='img/read_icon.png' />"; } else if( $im_ar['read_by_user'] == 0 ) { if( $im_ar['received'] == 1) { echo "<img src='img/received_icon.png' />"; } else { if( $im_ar['sent'] == 1 ) { echo "<img src='img/sent_icon.png' />"; } } } echo "</td>"; $time = strtotime($im_ar['time']); echo "<td width='85%'>" . $im_ar['message'] . "</td><td class='time'>" . humanTiming($time) . " ago</td>"; } else if( $im_ar['s_id'] == $fr_id ) { $time = strtotime($im_ar['time']); echo "<tr class='friend_sent_msg'><td class='time'>" . humanTiming($time) . " ago</td><td width='85%' class='friend_sent_msg_msg'>" . $im_ar['message'] . "</td><td></td>"; if($im_ar['received'] == 0) { $im_id = $im_ar['im_id']; $db->query("UPDATE i_messages SET received = 1 WHERE im_id = '$im_id'"); } } echo "</tr>"; } echo "</table><span id='bottom_of_div'></span>"; ?> send_imessage.php <?php include "mini_globals.php"; $imessage = $_POST['i_message']; $fr_id = $_POST['friend_id']; $c_id = $_POST['ch_id']; $imessage = $db->real_escape_string($imessage); $fr_id = $db->real_escape_string($fr_id); $c_id = $db->real_escape_string($c_id); $iw_sql = $db->query("SELECT * FROM chats WHERE c_id = '$c_id'"); $iw_ar = $iw_sql->fetch_array(MYSQLI_BOTH); $user1 = $iw_ar['user1_id']; $user2 = $iw_ar['user2_id']; if($userid == $user1) { $db->query("UPDATE chat SET u1_writing = 0 WHERE c_id = '$c_id'"); } else if($userid == $user2) { $db->query("UPDATE chat SET u2_writing = 0 WHERE c_id = '$c_id'"); } if( $imessage == " ") { } else { if ( $imessage == "") { } else { $db->query("INSERT INTO i_messages(c_id, s_id, r_id, message, time, sent) VALUES('$c_id', '$userid', '$fr_id', '$imessage', NOW(), '1')"); } } $limit = 20; $select_msgs = $db->query("SELECT * FROM i_messages WHERE c_id = '$c_id' ORDER BY im_id DESC LIMIT 20"); $imessage_array = array(); while( $imessages = mysqli_fetch_assoc($select_msgs) ) { $imessage_array[] = $imessages; } $imessages = array_reverse($imessage_array); echo "<table width='100%' class='msg_table'>"; foreach($imessages as $im_ar) { $im_id = $im_ar['im_id']; if( $im_ar['s_id'] == $userid ) { echo "<tr class='user_sent_msg'> <td>"; if( $im_ar['read_by_user'] == 1 ) { echo "<img src='img/read_icon.png' />"; } else if( $im_ar['read_by_user'] == 0 ) { if( $im_ar['received'] == 1) { echo "<img src='img/received_icon.png' />"; } else { if( $im_ar['sent'] == 1 ) { echo "<img src='img/sent_icon.png' />"; } } } echo "</td>"; $time = strtotime($im_ar['time']); echo "<td width='85%'>" . $im_ar['message'] . "</td><td class='time'>" . humanTiming($time) . " ago</td>"; } else if( $im_ar['s_id'] == $fr_id ) { $db->query("UPDATE i_messages SET read_by_user=1 WHERE im_id = '$im_id'"); $time = strtotime($im_ar['time']); echo "<tr class='friend_sent_msg'><td class='time'>" . humanTiming($time) . " ago</td><td width='85%' class='friend_sent_msg_msg'>" . $im_ar['message'] . "</td><td></td>"; } echo "</tr>"; } echo "</table><span id='bottom_of_div'></span>"; ?> mini_globals.php <?php session_start(); if( $_SESSION['online'] != 1 ) { header("location:login.php"); exit; } $userid = $_SESSION['userid']; include "mysqli.php"; global $db; echo "<script src='js/chat_input.js'> </script> <script src='js/load_messages.js'> </script> <script src='js/friends.js'> </script> <script src='images.js'> </script>"; date_default_timezone_set('Europe/London'); $is = $db->query("SELECT * FROM users WHERE userid = '$userid'"); $ir = mysqli_fetch_array($is); include "global_func.php"; ?> chat.js function showChat(friendid, chat_id) { $('#chat_box').css({top:'50%',left:'50%',margin:'-'+($('#chat_box').height() / 2)+'px 0 0 -'+($('#chat_box').width() / 2)+'px'}); var fr_id = friendid; var c_id = chat_id; $.post("chat.php", { friend_id: fr_id, ch_id: chat_id }, function(data, status) { $("#chat_box").html(data); load_messages(fr_id, c_id); setInterval(function() { $("#is_writing").load("is_writing_div.php?ch_id=" + c_id + "&rnd=" + Math.random()) }, 3000); $("#chat_box").slideDown(); }); } function newChat(friendid) { $('#chat_box').css({top:'50%',left:'50%',margin:'-'+($('#chat_box').height() / 2)+'px 0 0 -'+($('#chat_box').width() / 2)+'px'}); var fr_id = friendid; $.post("newchat.php", { friend_id: fr_id }, function(data, status) { var chat_id = data; $.post("chat.php", { friend_id: fr_id, ch_id: chat_id }, function(data, status) { $("#chat_box").html(data); $("#chat_box").slideDown(); }); }); } function hideChat() { $("#chat_box").slideUp(); } function HoverExOver() { $(".hide_div").attr('src', 'img/ex_over.png'); } function HoverExOut() { $(".hide_div").attr('src', 'img/ex.png'); } load_messages.js function load_messages(friend, chat) { var refreshId = setInterval(function() { $("#chat_messages").load('load_messages.php?friend='+ friend +'&ch_id='+ chat +'&randval='+ Math.random()); }, 3000); $.ajaxSetup({ cache: false }); } function load_pmessages(friend, chat) { $("#private_messages").load('load_pmessages.php?friend='+ friend +'&ch_id='+ chat +'&randval='+ Math.random()); } chat_input.js $(document).ready(function() { $('#imessage').autogrow(); $("#imessage").keypress(function(event) { var friendid = $("#fr_id").val(); var chatid = $("#chat_id").val(); var holder = $("#imessage"); if (event.keyCode == 13) { event.preventDefault(); var msg = $(this).val(); post(msg, $(this), friendid, chatid); } }); $('#pmessage').autogrow(); $("#pmessage").keypress(function(event) { var friendid = $("#fr_id").val(); var chatid = $("#pmc_id").val(); var holder = $("#pmessage"); if (event.keyCode == 13) { event.preventDefault(); var msg = $(this).val(); postpm(msg, $(this), friendid, chatid); } }); }); function post(msg, selector, friendid, chatid) { var c_id = chatid; selector.val(""); $.post("send_imessage.php", { i_message: msg, friend_id: friendid, ch_id: chatid }, function(data, status) { $("#chat_messages").html(data); $("#chat_messages").animate({scrollTop: $("#bottom_of_div").offset().top}, 2000); var refreshId = setInterval(function() { $("#chat_messages").load('load_messages.php?friend='+ friendid +'&ch_id='+ chatid +'&randval='+ Math.random()); }, 3000); $.ajaxSetup({ cache: false }) }); } Right so thats a hell of a lot of stuff, please dont comment on security of what's going on. i just want to know if you can see anything that could be causing it to slow down when the chat opens. thanks :)
-
I never said PHP was essential, if there is a better language, then i'll do the research for that as well