Jump to content

matthew9090

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Posts posted by matthew9090

  1. ive made a forum http://coolcodeforum.co.cc. I would like to install a syntax highlighter. so i found this.

     

    i have followed the intall instructions just as they say but when i open includes/functions.php

     

    #-----[ OPEN ]------------------------------------------

    #

    includes/functions.php

    #

    #-----[ FIND ]------------------------------------------

    #

    $match = array('<br />', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid");

    $replace = array("\n", '', '', '', '');

    #

    #-----[ REPLACE WITH ]------------------------------------------

    #

    $match = array('</li></ol>', '</li>', '<br />', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid");

    $replace = array("", "\n", "\n", '', '', '', '');

    #

     

    as it says above, i tryed find the '$match = array' line but it does not exist! this is MOD version 0.7.5 and my forum phpbb forum version is 3.0.8

  2. i currently have a .co.cc domain name but thinking of changing it to a .com

     

    but i have already submited the .co.cc one to some search engines like google. also my hosting account main domain is the co.cc one. Has anyone got any advice? should i just make a new account and submit it all over again?

  3. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files\EasyPHP-5.3.3\www\Project\search.php on line 44

    No results found.

     

    that means it is not connecting to the database propibly and like xyph said to use the error thing to check.

     

    try this

    //explode search term
    			$search_exploded = explode(" ",$search);
    			$x = 0;
    			foreach($search_exploded as $search_each)
    			{
    			//construct query
    			$x++;
    			if ($x==1)
    			$construct = "sname,fname,sno LIKE '%{$search_each}%'";
    			else
    			$construct .= " OR sname,fname,sno LIKE '%{$search_each}%'";
    
    			}
    
    

     

  4. ive found a cool script now but it doesn't use the database. i need the database so it can get what player is on what square.

     

    <?php
    //game map test
    
    //set the grid size
    $grid_y = (int)30;
    $grid_x = (int)30;
    
    //x and y rows to display at once
    $display_rows = (int)15;
    
    //default display cordinate
    $x = (int)1;
    $y = (int)1;
    
    $param_x = $_REQUEST["xcord"];
    $param_y = $_REQUEST["ycord"];
    
    if (isset($param_x) && isset($param_y)) {
        //validate that the parameter is a legit point
        if (($param_x <= $grid_x) && ($param_x >= 1) && ($param_y <= $grid_y) &&($param_y >= 1)) {
            $x = (int)$param_x;
            $y = (int)$param_y;
        }
    }
    
    //the grid position desired will be set to display in the center of the viewable grid
    $display_half = round($display_rows / 2);
    $other_half = $display_rows - $display_half;
    
    //to display the target in the middle, you have to get the number of rows to display before and after it.
    //some simple math to take care of that.
    $start_x = ($x - $display_half) +1;
    $end_x = $x + $other_half;
    
    //if the $start_x variable is less than 1 the grid would be in the negatives. so set it to 1
    if ($start_x < 1) {
        $start_x = 1;
        $end_x = $display_rows;
    } else
    //if $end_x is off the grid we have to compensate and add the remaining rows to the start.
    if ($end_x > $grid_x) {
        $extra = $end_x - $grid_x;
        $end_x = $grid_x;
        
        $start_x = $start_x - $extra;
    }
    
    //same applies for the y axis
    $start_y = ($y - $display_half) +1;
    $end_y = $y + $other_half;
    
    if ($start_y < 1) {
        $start_y = 1;
        $end_y = $display_rows;
    } else
    if ($end_y > $grid_y) {
        $extra = $end_y - $grid_y;
        $end_y = $grid_y;
        
        $start_y = $start_y - $extra;
    }
    
    //showing the current parameters
    echo "X $x - Y $y<br>";
    ?>
    
    <!--grid table-->
    <table width="750" cellspacing="0" cellpadding="2" border="1">
    <?php
    //these 2 for loops represent the y and x axis
    //using the data collected above the loops will properly display the grid
    for ($Ty = $start_y; $Ty <= $end_y; $Ty++) {
        //start new row
        echo '<tr>';
        for ($Tx = $start_x; $Tx <= $end_x; $Tx++) {
            //show grid
            DisplayGrid($Tx,$Ty);
        }
        echo '</tr>';
    }
    ?>
    </table>
    
    
    <?php
    
    function DisplayGrid($gridx,$gridy) {
        global $x, $y;
        
        $bgcolor = null;
        //highlight current select grid coordinate
        if ($gridx == $x && $gridy == $y) {
            $bgcolor = 'bgcolor="#c00000"';
        }
        
        echo "<td width=\"50\" height=\"50\" $bgcolor align=center valign=center><a href=\"map.php?xcord=$gridx&ycord=$gridy\">[X]</a><br><font size=1>($gridx,$gridy)</font></td>";
    }
    
    ?>
    

     

    so would i change the first 2 variables to a select?

     

  5. how would you code a map for a browser game like travian? i know how it works but i cant code that sort of stuff.

    ive got my database set up like this

     

    x  y  player

    1  1

    1  2

    etc....

     

    so i when you click an arrow it will got to the next square along.

  6. what do the big browser games like travian and tribal wars use to make there graphics. Because they look quite realistic and it seems impossible to draw them on photoshop.

  7. ive looked at loads of codes but none work. i am trying to refresh the resource count (for a browser game). my overview page includes all the files so it looks like this:

    <?php
    
    include 'global.php';
    if (isset($_SESSION['user']))
    {
    $username = $_SESSION['user'];
       include('inc/calculateres.php');
    include('inc/showname.php');
    echo "<hr><div id='refresh'>";
    include('inc/showres.php');//need to refresh this line<<<<<<<
    echo "</div><p>";
    include('inc/resph.php');
       echo "<p>";
       include('inc/showbuildings.php');
    }
    else
    {
    header("location: login.php");
    }
    
    ?>
    

    i need to refresh the div and the showres.php include every 2 seconds so you dont have to refresh the page manually.

     

    please help me!

  8. im trying to calculate the new value from a timestamp. there is the

     

    current production per hour

    the current value

    the time difference from now to the last updated timestamp

     

    so depending on the production per hour the number will go up every so often

  9. this one

     

     formula = $production_per_hour / $difference + $current_number; 

     

    it needs to calculate the new value from a timestamp using the difference

     

    $difference = strtotime($time_current) - strtotime($time_old);

     

    the production per hour and the current value

     

     

  10. ive got this so far

     

    $difference = strtotime($time_current) - strtotime($time_old);
    $formula = $production_per_hour / $difference + $current_number;
    $round = round($formula, 0);
    

     

    so i need to calculate from a timestamp in the database what the new number will be. i just don't know what to divide, times, plus or minus. ive fiddled around with it to see if i could get it right.

  11. i hav almost got it working. i just need the right formula.

     

    $calculate = $difference / 60 + $production + $current_resources;

    $round = round($calculate, 0);

     

    that is what i made up but i think it is wrong

  12. i have searched everywhere and no code seems to work. i have time1 and time 2 in the format Y-m-d H:i:s. i just don't know how to find the difference.

     

    old time: 2011-04-11 20:15:46

     

    new time: 2011-04-11 21:00:11

     

    after i have the difference, i need to get a resource production per hour which is stored in the database and calculate the new value of the resource.

     

    $production_per_hour = 100;
    $time_old = "2011-04-11 20:15:46";
    $time_new = "2011-04-11 21:00:11";
    $current_resources = "500";
    

     

  13. ive got this code:

    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    	$(document).ready(function() {
    	  var number = 5;
    	  function countdown() {
    				setTimeout(countdown, 1000);
    				$('#box').html("Selecting person in " + number + " seconds");
    				number --;
    
    				if (number<0) {
    				keywords = 
    				[
    				"name1", 
    				"name2",
    				"name3",
    				"name4",
    				"name5"
    				]
    					var keyword = keywords[Math.floor(Math.random()*keywords.length)]
    					document.write(keyword);
    					number = 0;
    				}
    	  }
    	  countdown();
    	});
    </script>
    <center>
    <div id="box">
    </div>
    </center>
    

     

    it counts down from 5 then chooses a random name but then keeps doing it every second and there is a huge line of names. how can i stop this?

     

×
×
  • 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.