Jump to content

dank

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

About dank

  • Birthday 06/24/1991

Contact Methods

  • MSN
    a.danks@gmail.com
  • Website URL
    http://www.danks.ca
  • Yahoo
    andrew.danks

Profile Information

  • Gender
    Male
  • Location
    Canada

dank's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm not sure if PHP would be the necessary language for what you are trying to accomplish, that is, if you want the notification to be precisely 15 minutes before the given event time.
  2. Well that's the problem, when I saw "rand(round($atackStrength/2),$atackStrength)" I had no idea where $atackStrength was coming from or how it was being formed. So what that person said to you, was that you can change that rand() to whatever you want to. For example: <?php rand(1,10); ?> Produces a random value from 1 to 10. <?php rand(round($atackStrength/2),$atackStrength) ?> So if the person's strength value was 100, they're strength against their opponent would range from 50 to 100. That's all, that simple. The question still remains, however, where the value $atackStrength comes from. So what you're doing is like a puzzle. You have to scan through the code where $atackStrength is defined. Given the length of the code, that will be a very difficult thing to do. It is most likely due to some math flaws in vsys.php I know I'm not that much help. But I'll end by saying that the best lesson I've learned in programming is that it's always best to do everything yourself. If you use other people's scripts, you are trapped with the way that person wants it to work. But everyone has their own ideas of how something should work. Then making modifications is much more difficult since you have no idea what is going on in the code that the other person wrote. So it's really a nuisance. Making your own scripts is the best way to learn. And if you are having trouble, you download someone else's script and skim through it for reference to see how they did it. Then you write it your own way. It's like writing an essay, and looking at other ones for ideas, but you have to have it in your own words and in your own way. And if it's in your own words, it's much easier to understand what you're saying opposed to it being in someone else's words. Good luck with the script. It's definitely a challenge.
  3. To me, it is difficult to weed out a flaw in a code that is written by somebody else, especially one at that length. Now, you said the you've made changes to the original script. I assume that the script worked prior to your modifications, so I would suggest that you review the changes you've made. If you cannot figure out anything, I would suggest starting over and making changes one at a time. For example: make one change, make sure everything works fine, then make another change. Sorry I couldn't help you any further.
  4. <?php $atackStrength=getStrikeAction($atacker); $atackStrength=rand(round($atackStrength/2),$atackStrength); ?> Is this where it determines the attack strength? If so, I'd check the getStrikeAction function. In seems to be in the vsys.php file, I presume.
  5. lol @ All those "atacker" and "defender" and "spy" variables. What game is it? I noticed that you spell attack two different ways: "attack" and "atack" I'd be consistent with variable naming. Also, as rarebit asked, knowing the problem would be helpful for those who are trying to help you.
  6. Perhaps add a column to your MySQL table called 'email_sent' and then on the cron job script, have something like: $query = mysql_query("SELECT * FROM whatever WHERE email_sent='0' ORDER BY registration_time DESC LIMIT 100"); I just put the registration_time there as an idea where the first users get the newsletter first. It's not needed though, just a thought. Following that snippet, you could have something like: while($row = mysql_fetch_array($query)){ //do mailing thingy here mysql_query("UPDATE whatever SET email_sent='1' WHERE username='$row[username]'"); } Now, what I had in mind, you could have this script run every hour of the day for about 5 days, or whatever is necessary, at the beginning of the following month. Also, you would have to make another cron script to set all the email_sent values to 0 after that 5 day period. I don't know if this would work, but it's an idea you could work from. Hmm, it'd be faster to get a host that doesn't impose the 100 emails per hour limit, lol.
  7. Works for me. The stars look good, by the way. Nice design. Tips: - Add the rating system to more content on the site. - Particularize the site more. For example, I don't think the game cheats are necessary, there are already several other websites for that. - Perhaps add high scores for the Games section. I've heard of things you can download that include modified flash games to automatically send the results to a PHP script. It's quite neat. Good luck with the site, it has good potential.
  8. Hi, I put this together for you. first, create a folder called "ips". chmod it to 0777. Here is the code I re-did for you: [code] <?php $winner1 = 234; $winner2 = 630; $winner3 = 550; $check = file_get_contents("ips/".$_SERVER[REMOTE_ADDR].".txt"); if($check<30000){ srand ((double) microtime( )*1000000); $random_number = rand(0,10000); echo "Your Number: $random_number<br>"; if ( $random_number == "$winner1" ) {   echo "Congratulations, you're a winner!"; } elseif($random_number == $winner2){ echo "Congratulations, you're a winner!"; } elseif($random_number == $winner3){ echo "Congratulations, you're a winner!"; } else {   echo "Sorry ,you're not a winner!"; } $f0 = fopen("ips/".$_SERVER[REMOTE_ADDR].".txt","w+"); $f1 = fwrite($f0,$check+1); if(!is_writable('ips/'.$_SERVER[REMOTE_ADDR].'.txt')){ chmod("ips/".$_SERVER[REMOTE_ADDR], 777); } $f2 = file_get_contents('ips/all.txt'); if(!ereg($_SERVER['REMOTE_ADDR'],$f2) OR (!file_exists('ips/all.txt'))){ $f3 = fopen("ips/all.txt","w+"); $f4 = fwrite($f3,$f2."+".$_SERVER[REMOTE_ADDR]); if(!is_writable('ips/all.txt')){ chmod("ips/all.txt", 777); } } } else { echo "Sorry, you have used your 30000 chances."; } ?> <?php #cron.php $f0 = explode('+',substr(file_get_contents('all.txt'),'1')); for($i=0;$i<$f0;$i++){ unlink($f0[$i].'.txt'); } unlink('all.txt'); ?> [/code] Now, you are going to need to create a cron tab: 0 0 * * * php /path/to/ips/cron.php The cron tab will run every morning at 12am. Here is the code for cron.php: [code] <?php #cron.php $f0 = explode('+',substr(file_get_contents('all.txt'),'1')); for($i=0;$i<$f0;$i++){ unlink($f0[$i].'.txt'); } unlink('all.txt'); ?> [/code] Please note that I haven't tested it yet, but I am sure if there are any errors, you can work it out ;)
  9. Everyone is a newbie at some point, so there is nothing to be embarassed about. You can use the following instead of print: [code] Header("Location: success.php"); [/code]
×
×
  • 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.