Jump to content

NArc0t1c

Members
  • Posts

    299
  • Joined

  • Last visited

    Never

Posts posted by NArc0t1c

  1. Try:

    <?php
    //headers
    $messageheader = 'From: '.$_POST['name']."\n";
    //To
    $to = "abc@xyz.in"; //correct email id given
    //Message
    $message = "First Name: " . $_GET['name'] . "\n";
    $message .= "Address: " . $_GET['address'] . "\n";
    $message .= "Email: " . $_GET['email'] . "\n";
    $message .= "Query: " . $_GET['query'] . "\n";
    $message .= "Joined the blah blah.....\n";
    $message .= "send membership information asap";
    $message .= 'Comments: '.$_POST['message'];
    //Subject
    $subject = 'Feedback from blah blah';
    // send the email
    $send_mail = mail($to, $subject, $message, $messageheader);
    //Verify that mail has been sent.
    if (!$send_mail){
    echo 'There was an error while sending your email.';
    } else {
    echo 'Your email was sent successfully.';
    }
    ?>

  2. Just a correction to you're script ben:

    <html>
    <head>
    <script type="text/javascript">
    function check()
    {
    if(document.flight_ticket.yn.checked == false) 
    {
       alert ("Please check YES or NO to confirm flight");
       return false;
    }else{ 
    return true;
    }
    }
    </script>
    </head>
    <body>
    <form name="flight_ticket" onsubmit="check()">
    <input type="checkbox" name="yn" /><br />
    <input type="submit" name="submit"  />
    </form>
    </body>
    </html>

     

  3. Why do you want to count the total to the average?

    That just seems weird.

    For statistic's logging you would get total(then display), average(display), single's(display).

    Three separate queries.

     

    Please explain for what you are using it for.

  4. I'm not looking for an argument.

     

    The full script is:

    <?php
    
      $time = time();
      $cron_minute_run = 60;
      $cron_fminute_run = 60 * 5;
      $cron_hour_run = 60 * 60;
      $cron_day_run = 60 * 60 * 24;
      
      $last_minute_run = file("crons/cron_minute.txt");
      $last_fminute_run = file("crons/cron_fiveminute.txt");
      $last_hour_run = file("crons/cron_hour.txt");
      $last_day_run = file("crons/cron_day.txt");
      if ($time - $last_minute_run >= $cron_minute) {
          $start_min_timer = microtime();
          if (($time - $last_minute_run) / 60 > 1) {
              $minute_run_no = $time - $last_minute_run / 60;
          } else {
              $minute_run_no = 1;
          }
          for ($i = 0; $i < $minute_run_no; $i++) {
              $do = mysql_query("UPDATE users SET hospital=hospital-1 WERE hospital > 0", $c);
              $do = mysql_query("UPDATE users SET jail=jail-1 WHERE jail > 0", $c);
              
              mysql_query("UPDATE `auctions` SET time=`time`-1");
              $qqq = mysql_query("SELECT * FROM `auctions` WHERE time=0", $c);
              while ($win = mysql_fetch_array($qqq)) {
                  $time = $win['time'];
                  $item = $win['itemname'];
                  $winner = $win['bidder'];
                  $owner = $win['owner'];
                  
                  $iname = mysql_query("SELECT `itmname` FROM `items` WHERE itmid={$item}");
                  if ($win['bids'] > 0) {
                      mysql_query("insert into `inventory` VALUES('',$item,$winner,1)", $c) or die(mysql_error());
                      event_add($winner, "You won the auction of the {$iname} for \${$win['current']}", $c);
                      event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}", $c);
                      mysql_query("update users set money=money+{$win['current']},auctionquota=auctionquota-1 where userid=$owner", $c);
                  }
                  if ($win['bids'] == 0) {
                      event_add($win['owner'], "Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.", $c);
                      
                      $winner = $win['owner'];
                      
                      mysql_query("insert into `inventory` VALUES('',$item,$winner,1)", $c) or die(mysql_error());
                  }
              }
              mysql_query("delete from `auctions` where time=0", $c);
              
              
              
              if (empty($do)) {
                  mail("me@domain.suffix", "Minute Cron not run.", "The minute cron could not run because of a mysql error.", "From: ferdi@narc0t1c.net");
              } else {
                  $open = fopen("crons/cron_minute.txt", "w");
                  fputs($open, time());
                  fclose($open);
                  $end_min_timer = microtime();
                  $total_min_timer = $start_min_timer - $end_min_timer;
                  mail("me@domain.suffix", "Minute Cron was run.", "The minute cron was run succesfully.\r\n" . "Time: $time\r\n" . "Time Took: $start_min_timer - $end_min_timer\r\n" . "Total: $total_min_timer.", "From: ferdi@narc0t1c.net");
              }
          }
      }
      
      if ($time - $last_fminute_run >= $cron_fminute_run) {
          $start_fmin_timer = microtime();
          if ($time - $last_fminute_run / 60 > 1) {
              $fminute_run_no = $time - $last_fminute_run / 60;
          } else {
              $fminute_run_no = 1;
          }
          for ($i = 0; $i < $fminute_run_no; $i++) {
              $q1 = mysql_query("SELECT COUNT(*) as users FROM users", $c);
              $r = mysql_fetch_array($q1);
              $rows = $r['users'];
              $i = 1;
              $next = $rows;
              $query = "UPDATE users SET brave=brave+((maxbrave/10)+0.5) WHERE brave<maxbrave ";
              $query2 = "UPDATE users SET brave=maxbrave WHERE brave>maxbrave";
              $query3 = "UPDATE users SET hp=hp+(maxhp/3) WHERE hp<maxhp";
              $query4 = "UPDATE users SET hp=maxhp WHERE hp>maxhp";
             $do =  mysql_query($query, $c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query2, $c) or die("\nError Executing Query 2 for updating users $i to $next\n$query2\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query3, $c) or die("\nError Executing Query 3 for updating users $i to $next\n$query3\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query4, $c) or die("\nError Executing Query 4 for updating users $i to $next\n$query4\n" . mysql_error() . "\nError Code:" . mysql_errno());
              
              $q1 = mysql_query("SELECT COUNT(*) as users FROM users", $c);
              $r = mysql_fetch_array($q1);
              $rows = $r['users'];
              $i = 1;
              $next = $rows;
              $query = "UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy AND donatordays=0";
              $query5 = "UPDATE users SET energy=energy+(maxenergy/(6)) WHERE energy<maxenergy AND donatordays>0";
              $query2 = "UPDATE users SET energy=maxenergy WHERE energy>maxenergy";
              $query3 = "UPDATE users SET will=will+10 WHERE will<maxwill";
              $query4 = "UPDATE users SET will=maxwill WHERE will>maxwill";
              mysql_query($query, $c) or die("\nError Executing Query 1 for updating users $i to $next\n$query\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query5, $c) or die("\nError Executing Query 5 for updating users $i to $next\n$query5\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query2, $c) or die("\nError Executing Query 2 for updating users $i to $next\n$query2\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query3, $c) or die("\nError Executing Query 3 for updating users $i to $next\n$query3\n" . mysql_error() . "\nError Code:" . mysql_errno());
              mysql_query($query4, $c) or die("\nError Executing Query 4 for updating users $i to $next\n$query4\n" . mysql_error() . "\nError Code:" . mysql_errno());
              
              if (empty($do)) {
                  mail("me@domain.suffix", "Five Minute Cron not run.", "The five minute cron could not run because of a mysql error.", "From: ferdi@narc0t1c.net");
              } else {
                  $open = fopen("crons/cron_fiveminute.txt", "w");
                  fputs($open, time());
                  fclose($open);
                  $end_fmin_timer = microtime();
                  $total_fmin_timer = $start_min_timer - $end_min_timer;
                  mail("me@domain.suffix", "Five Minute Cron was run.", "The five minute cron was run succesfully.\r\n" . "Time: $time\r\n" . "Time Took: $start_fmin_timer - $end_fmin_timer\r\n" . "Total: $total_fmin_timer.", "From: ferdi@narc0t1c.net");
              }
          }
      }
      
      if ($time - $last_hour_run >= $cron_hor_run) {
          $start_hour_timer = microtime();
          if ($time - $last_hour_run / 60 > 1) {
              $hour_run_no = $time - $last_hour_run / 60;
          } else {
              $hour_run_no = 1;
          }
          for ($i = 0; $i < $hour_run_no; $i++) {
              mysql_query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME>0", $c);
              $q = mysql_query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0", $c);
              while ($r = mysql_fetch_array($q)) {
                  $suc = rand(0, 1);
                  if ($suc) {
                      $log = $r['ocSTARTTEXT'] . $r['ocSUCCTEXT'];
                      $muny = (int)(rand($r['ocMINMONEY'], $r['ocMAXMONEY']));
                      $log = str_replace(array("{muny}", "'"), array($muny, "''"), $log);
                    $do = mysql_query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangCRIME=0 WHERE gangID={$r['gangID']}", $c);
                      mysql_query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())", $c);
                      $i = mysql_insert_id($c);
                      $qm = mysql_query("SELECT * FROM users WHERE gang={$r['gangID']}", $c);
                      while ($rm = mysql_fetch_array($qm)) {
                          event_add($rm['userid'], "Your Gang's Organised Crime Succeeded. Go <a href='oclog.php?ID=$i'>here</a> to view the details.", $c);
                      }
                  } else {
                      $log = $r['ocSTARTTEXT'] . $r['ocFAILTEXT'];
                      $muny = 0;
                      $log = str_replace(array("{muny}", "'"), array($muny, "''"), $log);
                      mysql_query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}", $c);
                      mysql_query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())", $c);
                      $i = mysql_insert_id($c);
                      $qm = mysql_query("SELECT * FROM users WHERE gang={$r['gangID']}", $c);
                      while ($rm = mysql_fetch_array($qm)) {
                          event_add($rm['userid'], "Your Gang's Organised Crime Failed. Go <a href='oclog.php?ID=$i'>here</a> to view the details.", $c);
                      }
                  }
              }
              
              if (empty($do)) {
                  mail("me@domain.suffix", "Hour Cron not run.", "The hour cron could not run because of a mysql error.", "From: ferdi@narc0t1c.net");
              } else {
                  $open = fopen("crons/cron_fiveminute.txt", "w");
                  fputs($open, time());
                  fclose($open);
                  $end_hour_timer = microtime();
                  $total_hour_timer = $start_min_timer - $end_min_timer;
                  mail("me@domain.suffix", "Hour Cron was run.", "The hour cron was run succesfully.\r\n" . "Time: $time\r\n" . "Time Took: $start_hour_timer - $end_hour_timer\r\n" . "Total: $total_hour_timer.", "From: ferdi@narc0t1c.net");
              }
          }
      }
      
      if ($time - $last_day_run >= $cron_day_run) {
          $start_day_timer = microtime();
          if ($time - $last_day_run / 60 > 1) {
              $day_run_no = $time - $last_day_run / 60;
          } else {
              $day_run_no = 1;
          }
          for ($i = 0; $i < $day_run_no; $i++) {
              mysql_query("UPDATE users SET shots=6");
              mysql_query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 0", $c);
           $do = mysql_query("UPDATE users SET daysold=daysold+1", $c);
              mysql_query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0", $c);
              mysql_query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0", $c);
              mysql_query("UPDATE users SET cdays=cdays-1 WHERE course > 0", $c);
              mysql_query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0", $c);
              mysql_query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0", $c);
              $q = mysql_query("SELECT * FROM users WHERE cdays=0 AND course > 0", $c);
              while ($r = mysql_fetch_array($q)) {
                  $cd = mysql_query("SELECT * FROM courses WHERE crID={$r['course']}", $c);
                  $coud = mysql_fetch_array($cd);
                  $userid = $r['userid'];
                  mysql_query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})", $c);
                  $upd = "";
                  $ev = "";
                  if ($coud['crSTR'] > 0) {
                      $upd .= ",us.strength=us.strength+{$coud['crSTR']}";
                      $ev .= ", {$coud['crSTR']} strength";
                  }
                  if ($coud['crGUARD'] > 0) {
                      $upd .= ",us.guard=us.guard+{$coud['crGUARD']}";
                      $ev .= ", {$coud['crGUARD']} guard";
                  }
                  if ($coud['crLABOUR'] > 0) {
                      $upd .= ",us.labour=us.labour+{$coud['crLABOUR']}";
                      $ev .= ", {$coud['crLABOUR']} labour";
                  }
                  if ($coud['crAGIL'] > 0) {
                      $upd .= ",us.agility=us.agility+{$coud['crAGIL']}";
                      $ev .= ", {$coud['crAGIL']} agility";
                  }
                  if ($coud['crIQ'] > 0) {
                      $upd .= ",us.IQ=us.IQ+{$coud['crIQ']}";
                      $ev .= ", {$coud['crIQ']} IQ";
                  }
                  $ev = substr($ev, 1);
                  if ($upd) {
                      mysql_query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid", $c) or die(mysql_error() . "<br />" . "UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid");
                  }
                  mysql_query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')", $c);
              }
              mysql_query("UPDATE users SET course=0 WHERE cdays=0", $c);
              mysql_query("TRUNCATE TABLE votes;", $c);
              mysql_query("UPDATE fedjail set fed_days=fed_days-1", $c);
              mysql_query("UPDATE users u LEFT JOIN fedjail f ON u.fedjail=f.fed_id SET u.fedjail=0 WHERE f.fed_days=0", $c);
              mysql_query("DELETE FROM fedjail WHERE fed_days=0", $c);
              mysql_query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY,us.strength=us.strength+jr.jrSTRG,us.labour=us.labour+jr.jrLABOURG,us.IQ=us.IQ+jr.jrIQG,u.exp=u.exp+(jr.jrPAY/20) WHERE u.job > 0 AND u.jobrank > 0", $c) or die("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY,us.strength=us.strength+jr.jrSTRG,us.labour=us.labour+jr.jrLABOURG,us.IQ=us.IQ+jr.jrIQG WHERE u.job > 0 AND u.jobrank > 0<br />" . mysql_error());
              mysql_query("update users set turns=200 WHERE donatordays>=1", $c) or die(mysql_error());
              mysql_query("update users set turns=100 WHERE donatordays<=0", $c) or die(mysql_error());
              
              if (empty($do)) {
                  mail("me@domain.suffix", "Day Cron not run.", "The hour cron could not run because of a mysql error.", "From: ferdi@narc0t1c.net");
              } else {
                  $open = fopen("crons/cron_fiveminute.txt", "w");
                  fputs($open, time());
                  fclose($open);
                  $end_day_timer = microtime();
                  $total_day_timer = $start_min_timer - $end_min_timer;
                  mail("me@domain.suffix", "Day Cron was run.", "The day cron was run succesfully.\r\n" . "Time: $time\r\n" . "Time Took: $start_day_timer - $end_day_timer\r\n" . "Total: $total_day_timer.", "From: ferdi@narc0t1c.net");
              }
          }
      }
      
      exit;
    ?>

  5. Error on line 14:

    The if statement.

    Original error:

    Fatal error: Unsupported operand types in /hsphere/local/home/user/parth/script.php on line 13

     

     

    ToonMariner, the queries were just examples, there are about 30 queries and some file I\O.

    I have tried it that way, in brackets, still doesn't work.

    Thanks though.

     

  6. Hello.

     

    I have a problem with a script I am trying to make.

    I know it's correct, but it giving me an Unsupported operand types error.

     

    What causes this?

    It's an if statement, with a calculation; surely it cannot be that!

     

    Here is a part of the script:

    <?php
    
      $time = time(); // Generate time.
      $cron_minute_run = 60; // Seconds in a minute.
      $last_minute_run = file("crons/cron_minute.txt"); // Get previous time.
    
      if ($time - $last_minute_run >= $cron_minute_run) {
          $start_min_timer = microtime(); // Start timer.
          if ($time - $last_minute_run / 60 > 1) { 
              $minute_run_no = $time - $last_minute_run / 60; // Calculate how many times to run.
          } else {
              $minute_run_no = 1; // Only run once.
          }
    
          for ($i = 0; $i < $minute_run_no; $i++) { // Run x times.
              $do = mysql_query("UPDATE table SET col_2=col_2-1 WERE other > 0", $c);
              $do = mysql_query("UPDATE table SET col=col-1 WHERE other > 0", $c);
              if (empty($do)) {
                  mail("me@domain.suffix", "Minute Cron not run.", "The minute cron could not run because of a mysql error.", "From: me@domain.suffix"); // Send mail stating there is an error.
              } else {
                  $open = fopen("crons/cron_minute.txt", "w"); //Write time to file for next use.
                  fputs($open, time());
                  fclose($open);
                  $end_min_timer = microtime(); // End timer.
                  $total_min_timer = $start_min_timer - $end_min_timer; // Calculate timer.
                  mail("me@domain.suffix", "Minute Cron was run.", "The minute cron was run succesfully.\r\n" . "Time: $time\r\n" . "Time Took: $start_min_timer - $end_min_timer\r\n" . "Total: $total_min_timer.", "From: me@domain.suffix"); // Send a mail for statistics.
              }
          }
      }
    exit; //No need to continue.
    
    ?>

     

    Thanks..

     

  7. Two tricks first.

    1) When using double quotes in forms and things like that, use echo with a single quote, then you don't need \.

    2) Use [ code ][ /code] its, not php, the bccode has to get phrased trough the system, then it's converted to html.

     

     

    Now I'll help you..

    Problems:

    echo "<form action=\"optiontable.php?\" name=optionform>";

    Why is the ? there, and why doesn't name have quotes but action does?

    You also did not specify a method, so it will take default settings and make it get.

     

    echo "<p>Table<input type=\"radio\" name=\"name\" value=\"table\">";
    echo "</p>";
      echo "<p>Tree  <input type=\"radio\" name=\"name\" value=\"tree\">";
      echo "</p>";
    echo "<input type=submit value=\"Submit\">";

    Again with the name not quoted, and the type.

     

    Now for the actual piece for scripting you want.

    You basically want to let the client be able to select one element.

    And then they submit the entry and then they will get shown the entry they chose.

     

    <?php
      if (isset($_POST['Submit'])) {
          // The form has been subitted.
          if (empty($_POST['name'])) {
              // They did not select anything.
              echo 'You did not select anything.';
          } else {
              if ($_POST['name'] == 'tree') {
                  // They selected tree..
                  echo 'You selected tree.';
              } else {
                  // They selected something else.
                  echo 'You selected table.';
              }
          }
      }
      
      /*    The Form       */
      
      echo '
    <div style="position:absolute; left:45px; top:80px;">
    <form action="optiontable.php" name"=optionform" method="post">
    <font size="4">View options</font>
    <p>Table<input type="radio" name="name" value="table"></p>
    <p>Tree  <input type="radio" name="name" value="tree"></p>
    <input type="submit" value="Submit">
    </div>
    ';
    ?>

     

    Hope that helps.

     

     

  8. Hello.

     

    I have seen many scripts using curl to make thousands of accounts and do other stuff.

    But how can I present it?

     

    Sending hidden headers: Can be seen by a Firefox extensions.

    Hidden fields: View->Source

    Checking referrer: Can be fooled.

     

    What else is there?

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