Jump to content

tibberous

Members
  • Posts

    1,187
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by tibberous

  1. I hate vi. I hate the idiots that even put a 30 year old text editor in CentOS. But mostly I hate the fact that the damn crontab never saves, and that /etc/crontab isn't used, and that crontab -e opens a file in god-damn vi.

     

    Is there anyway to make it so that crontab -e brings up nano? Or a way to make it so that crontab isn't wiped when the server is reset?

  2. Instead of:

     

    $msg = "Database Successfully updated!!!";
      echo $msg;
    

     

    Put:

     

    echo mysql_affected_rows() ? "Database Successfully updated!!!" : "Error updating database";
    

     

    Btw, your doing some really weird stuff. Like:

     

    $rs = mysql_query($sql,$conn) can just be $rs = mysql_query($sql); unless your actually connecting to more than one database

    Saving the result in $rs is weird, since your doing an update, not a query

    Saying "if($rs)" is weird. Why? Because $rs will be false if there is an sql error (technically this never occurs because you die() if there is one), but also if no variable was sent.

    mysql_close is unnecessary

     

     

  3. and as such will be removed some time in the future

     

    2042 maybe. Removing mysql_* would probably break +90% of the production code in existence.

     

    And, OP, how can you possible not understand strlen? It returns the number of letters in a word.

     

    hello has 5 letters, so strlen("hello"); would be 5.

     

    The PHP docs have really good example code generally.

  4. That's a rather unprofessional way to phrase things especially for a job posting, and I would be wary of any company that would use language like that in a job posting.

     

    This. Best case, you'll work for a pretentious asshole; worst case the 'job' will be for a 'startup' that will want to pay you in 'shares'.

  5. I am trying to get the 26 letters of the alphabet as an array in random order.

     

    Sounds easy right?

     

    I've been at it 45 minutes - still doesn't work:

     

    function random_letters(){
    	$letters = array();
    
    	for($i=0;$i<26;$i++){
    		$letters[$i] = chr($i+97);
    	}
    
    
    	$retval = array();
    
    	for($i=0;$i<26;$i++){
    		$indexes = array_keys($letters);
    		$index = array_slice($indexes, $index = floor(rand(0,count($indexes))), 1);
    		$index = $index[0];
    
    		$retval[$i] = $letters[$index];
    		$retval[$i] = $retval[$i][0];
    		unset($letters[$index]);
    	}
    
    
    
    	return $retval;
    }
    

     

    I've decided to say hell with it and just make a database with the 26 letters, then use "select * from letters order by rand()"

     

    But I'd like to see it done with php.

     

    Only rule is you can't use usort.

     

     

  6. No.

     

    An external website is going to call your script as a url, the same as a browser would (ie: http://www.whatever.com/index.php)

     

    If you don't put it in the web directory, then your safe. If you want to protect your script from bots, you can try using USER_AGENT, or some tricks like ajax and header redirects, but ultimately it's impossible to make something that will work in a browser but is safe from a bot.

     

    What are you trying to prevent exactly? Hack attempt, DoS, data mining?

  7. Part of the problem is that I want to sell the game - I could make it playable as a webpage, but I'm not sure how I'd sell that on the app store.

     

    Not loving the very alpha look of Qt.

     

    I haven't looked at objective-c -- I thought it was just regular c they used, could make it a lot easier. I think I might just focus on the Flash version, and maybe just pay a US developer to make the mobile versions for a few grand. I wouldn't hate to have the iPhone experience, just trying to focus on stuff that doesn't involve me sitting at a computer all day.

  8. I'm making a basic, turn based game. I'm writing the core in PHP, with a Flash based client (and maybe an ajax client, since I'm using that to test and it's already half-done)

     

    I want to release it for Android, so I'll write it in Java, which shouldn't be too much different from Flash (been years but I've wrote graphic apps in java)

     

    What has me worried is the iPhone part, since that has to be done in C / C++. I haven't used either in YEARS, and only did graphics stuff in DirectX, which I'm guessing Microsoft hasn't released for the iPhone.

     

    Just wondering if anyone has experience using any kind of iPhone platform / engine? I know there are people slamming out iphone apps, but it's a little daunting to write something in a language that you were only 'decent' in 10 years ago.

  9. You pretty much need to know html and css before PHP, unless you just want to write command line scripts.

     

    But to answer your question:

     

    echo "<CENTER><B><FONT SIZE=9 FACE=TAHOMA>Your Email Change was sent successfully";

     

    Will work.

  10. Get the Firebug extension if you don't already have it - it can be a huge help in reverse-engineering certain things. It has a feature called "Inspect Element" that you can use on images and buttons to try to get the javascript they call.

     

    And yeah, I can see how a bot that mimics a player could be needed. People want to be attacked by a player with an army and different units -- not the same as just changing the amount of shit they have with no reason why.

  11. Don't think your thinking of this exactly right.

     

    First, are you running this from your computer or a webserver? Because it shouldn't like you could run it on a windows PC and either use task scheduler or just a while(true) { sleep($x) } loop.

     

    Second, your going to open a new session with your PHP script -- you won't check to see if your logged in, you'll just log in.

     

    Essentially what you are doing is just automating the same get / post requests a browser would send. How complex that is depends on the game -- for example, are the units and terrain one image, or is the background an image and the units overlayed on top? Makes a big difference -- the first way you have to figure out pixel colors, the second you have to parse though some source.

     

    Regardless of the game, I'd consider this ambitious.

  12. I HATE PLESK!

     

    All I want to do is change the directory for the default web directory (ie: the one it goes to if you go to the ip, or a domain that doesn't have a specific vhost)

     

    And change the default directory for ONE site.

     

    Without plesk this would take 20 seconds - I've spent an hour trying to get it to work! What really sucks is that I had the first part work, and Plesk decided to rewrite the file.

     

    I got this server a while ago, hate to get a new one and transfer everything, but Plesk is such garbage I'm about ready to. Why would they make default folder /var/www/vhosts/site.com/httpdocs and make it so dam hard to change??

  13. Yeah, I think you are a little ahead of yourself. You might as well say you want to build a two-story cape cod style house - no one is going to be able to tell you how in one post and even if they could you probably wouldn't know enough to understand what they are tell you.

     

    You could break the project into tons of small steps, and ask how to do each step, but if you find yourself stuck on too many of the steps, you might just want to go through a couple more books / tutorials.

  14. It would be quite easy to build yourself given the spec and GD Library/ImageMagick as well.

     

    It would be possible, but I doubt it would be 'quite easy'.

    Which is probably why people want compensation for taking to build something that is not easy. Just saying

     

    If this was something I was making money on, I'd just tell the client to pay for the library. Problem is, this is a personal type project -- doesn't make sense to spend money to do something I can do with a desktop app for free. I've released a bunch of stuff for free over the years, and generally when I need something free, it's pretty easy to find - I'm just disappointed that either no one has written it or that the search engines are so flooded with spammers I can't find it.

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