function pool() { global $poolnum; for ($i = 0; $i < $poolnum; $i++) { $pid = pcntl_fork(); if ($pid < 0) { tlog("fork error"); } else { if ($pid == 0) { tlog("child "); break; } else { tlog("father "); } } } work(); }
$image = $_FILES['image']['name']; $file_name = $image; $ext = pathinfo($image, PATHINFO_EXTENSION); $allowed = array('jpeg', 'jpg', 'png'); if (in_array($ext, $allowed)) { $file_name_md5 = md5($file_name . date("Y-m-d , h:i:s")); $target_file = "image/" . $file_name_md5 . "." . $ext; move_uploaded_file($_FILES['image']['tmp_name'], $target_file); $file_name = $domain . "pages/" . $target_file; //echo $file_name; work($file_name, $DB); } else { echo json_encode(array('result' => "failure", 'response' => "Some details missing")); } } else { work("", $DB); } } else { echo json_encode(array('result' => "failure", 'response' => "Some details missing")); } // Doing all the work function work($file_name, $connect) { $topic = "myschool"; $reg_ids = ""; $title = $_POST['title']; $name = $_POST['name']; $description = $_POST['message']; $url = ""; if (isset($_POST['url'])) { $url = $_POST['url'];
$MailArchiverToMySQL = 1; } if (!is_numeric($MailArchiverToSMTP)) { $MailArchiverToSMTP = 0; } if (!is_numeric($MailArchiverSMTPINcoming)) { $MailArchiverSMTPINcoming = 1; } $GLOBALS["MailArchiverEnabled"] = $MailArchiverEnabled; $GLOBALS["MailArchiverToMySQL"] = $MailArchiverToMySQL; $GLOBALS["MailArchiverToMailBox"] = $MailArchiverToMailBox; $GLOBALS["MailArchiverMailBox"] = $MailArchiverMailBox; $GLOBALS["MailArchiverToSMTP"] = $MailArchiverToSMTP; $GLOBALS["MailArchiverSMTP"] = $MailArchiverSMTP; $GLOBALS["MailArchiverSMTPINcoming"] = $MailArchiverSMTPINcoming; work(); function work() { //return; $unix = new unix(); $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid"; $pidTime = "/etc/artica-postfix/" . basename(__FILE__) . ".time"; if ($GLOBALS["VERBOSE"]) { echo "PidFile = {$pidfile}\n"; } $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $timepid = $unix->PROCCESS_TIME_MIN($pid); system_admin_events("Other pid {$pid} running since {$timepid}mn", __FUNCTION__, __FILE__, __LINE__, "archive"); die; }
<input type="submit" value="Submit"> </form> <?php require "databaseAndFunctions.php"; date_default_timezone_set("Asia/Kolkata"); if (isset($_FILES['image']) && isset($_POST['title']) && $_FILES['image']['name'] != "") { $image = $_FILES['image']['name']; $file_name = $image; $ext = pathinfo($image, PATHINFO_EXTENSION); $allowed = array('jpeg', 'jpg', 'png'); if (in_array($ext, $allowed)) { $file_name_md5 = md5($file_name . date("Y-m-d , h:i:s")); $target_file = "image/" . $file_name_md5 . "." . $ext; move_uploaded_file($_FILES['image']['tmp_name'], $target_file); $file_name = $domain . $target_file; work($file_name, $DB); } else { echo "File type not allowed"; } } else { echo "Some Details are missing"; } // Doing all the work function work($file_name, $connect) { $topic = "myschool"; $reg_ids = ""; $title = $_POST['title']; $time = date("Y-m-d , H:i:s"); $query = "INSERT INTO `images`(`title`, `image`, `time`) VALUES ('{$title}', '{$file_name}', '{$time}')"; $result = mysqli_query($connect, $query);
<?php require_once "includes/session.php"; //For creating a session, we don't use cookies "for better security" require_once "includes/functions.php"; //Functions files require_once "includes/db_connection.php"; //Including the database connection file confirm_logged_in(); $about = about_page(); $education = education(); $work = work(); $teaching = teaching(); if (isset($_POST['aboutSubmit'])) { // Process the form $about = $_POST["about"]; $query = "UPDATE about SET "; $query .= "about = '{$about}' "; $query .= "WHERE id = 1 "; $query .= "LIMIT 1"; $result = mysqli_query($connection, $query); if ($result && mysqli_affected_rows($connection) == 1) { // Success $_SESSION["message"] = "The about has been updated."; redirect_to("about.php?id=1"); } else { // Failure $_SESSION["message"] = "The about update failed."; } } if (isset($_POST['workSubmit'])) {
<?php if (!empty($_GET)) { require_once 'constants.php'; require_once 'db.php'; $res = work(); // If it didn't parse properly, spit out the errors if ($res['status'] == false) { echo "Errors:\n"; foreach ($res['errors'] as $error) { echo ' ' . $error; } die; } else { // Success! Tell the user where to get to the results echo "Success! " . $res['url'] . "\n"; // We want to die here as well so the HTML below is only shown // if there's no $_POST die; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Query</title> </head> <body> <strong>Error:</strong> This page shouldn't be visited manually.
echo " -d Outputs the commands instead of running them (optional)\n"; echo " -h This help text\n"; exit(1); } // Handle arguments $opts = getopt('s:u:r:m:dh'); if (empty($opts) || isset($opts['h'])) { show_usage(); } $scope = get_arg($opts, 's', ''); $username = get_arg($opts, 'u', 'phpbb'); $repository = get_arg($opts, 'r', 'phpbb3'); $developer = get_arg($opts, 'm', ''); $dry_run = !get_arg($opts, 'd', true); run(null, $dry_run); exit(work($scope, $username, $repository, $developer)); function work($scope, $username, $repository, $developer) { // Get some basic data $forks = get_forks($username, $repository); $collaborators = get_collaborators($username, $repository); if ($forks === false || $collaborators === false) { echo "Error: failed to retrieve forks or collaborators\n"; return 1; } switch ($scope) { case 'collaborators': $remotes = array_intersect_key($forks, $collaborators); break; case 'organisation': $remotes = array_intersect_key($forks, get_organisation_members($username));
echo " -p pull_request_id The pull request id to be merged (mandatory)\n"; echo " -r remote Remote of upstream, defaults to 'upstream' (optional)\n"; echo " -d Outputs the commands instead of running them (optional)\n"; echo " -h This help text\n"; exit(2); } // Handle arguments $opts = getopt('p:r:dh'); if (empty($opts) || isset($opts['h'])) { show_usage(); } $pull_id = get_arg($opts, 'p', ''); $remote = get_arg($opts, 'r', 'upstream'); $dry_run = !get_arg($opts, 'd', true); try { exit(work($pull_id, $remote)); } catch (RuntimeException $e) { echo $e->getMessage(); exit($e->getCode()); } function work($pull_id, $remote) { // Get some basic data $pull = get_pull('phpbb', 'phpbb3', $pull_id); if (!$pull_id) { show_usage(); } if ($pull['state'] != 'open') { throw new RuntimeException(sprintf("Error: pull request is closed\n", $target_branch), 5); } $pull_user = $pull['head'][0];
if (isset($_FILES['image']) && $_FILES['image']['name'] != "") { $image = $_FILES['image']['name']; $file_name = $image; $ext = pathinfo($image, PATHINFO_EXTENSION); $allowed = array('jpeg', 'jpg', 'png'); if (in_array($ext, $allowed)) { $file_name_md5 = md5($file_name . date("Y-m-d , h:i:s")); $target_file = "image/" . $file_name_md5 . "." . $ext; move_uploaded_file($_FILES['image']['tmp_name'], $target_file); $file_name = $domain . $target_file; work($file_name, $connect); } else { echo "File type not allowed"; } } else { work("", $connect); } } else { echo "Some Details are missing"; } // Doing all the work function work($file_name, $connect) { $name = $_POST['name']; $fb_url = ""; $tweet_url = ""; if (isset($_POST['url_fb'])) { $fb_url = $_POST['url_fb']; } if (isset($_POST['url_tweet'])) { $tweet_url = $_POST['url_tweet'];
$title = $_POST['title']; } else { $title = ""; } if (isset($_FILES['image']) && $_FILES['image']['name'] != "") { $image = $_FILES['image']['name']; $file_name = $image; $ext = pathinfo($image, PATHINFO_EXTENSION); $allowed = array('jpeg', 'jpg', 'png'); if (in_array($ext, $allowed)) { $file_name_md5 = md5($file_name . date("Y-m-d , h:i:s")); $target_file = "image/" . $file_name_md5 . "." . $ext; move_uploaded_file($_FILES['image']['tmp_name'], $target_file); $file_name = $domain . "pages/" . $target_file; echo $file_name; work($file_name, $DB, $topic); } else { echo "File type not allowed"; } } } // Doing all the work function work($file_name, $connect, $topic) { $reg_ids = ""; $title = $_POST['title']; $time = date("Y-m-d , H:i:s"); $query = "INSERT INTO `images`(`title`, `image`, `time`) VALUES ('{$title}','{$file_name}','{$time}')"; $result = mysqli_query($connect, $query); if ($result) { $pid = mysqli_insert_id($connect);