PHP - Making A Bat File For Window Task Scheduler
Can someone help me out with making a bat file. I cant find a good set of directions on google.
I have window scheduler all working in running but it runs my script in note pad and not IE like I need it too. I also read something about php cgi file for doing this same thing but cant make heads of tails out of it from reading about it in the manual. Trying to run this http://localhost/gate/users/update.php Similar TutorialsI have a PHP file that does some data processing work in the database and I run in from a web browser each weekend. The PHP file usually completes the job in 4 hours, but past 2 weekends, it failed to complete. Then, i need to reexecute the file. Why? And how to fix this? Need help the page doesnt do anything, if anyone could guide me in helping me make this work and more efficient I am making a weekley scheduler if the team have either played this week dont schedule or if the two teams have played each other in previous weeks dont schedule them together here is my scheduler class <?php class scheduler { var $week; var $max_teams; function scheduler() { global $Settings; $get_all = mysql_query("SELECT * FROM teams"); $this->max_teams = mysql_num_rows($get_all); if ($Settings->week == 'Not Started') { $this->week = 1; } else { $this->week = $Settings->week; } } function CheckTeams($team1,$team2) { //check if the two teams have played at all //this season if ($this->checkPlay($team1,$team2)) { return true; } else { return false; } } function checkPlay ($team1,$team2) { $week = $this->week; $check = mysql_query("SELECT * FROM matches WHERE team1 = '".$team1."' AND team2 = '".$team2."' OR team1 = '".$team2."' AND team2 = '".$team1."'"); $num = mysql_num_rows($check); if ($num > 0) { return false; } else { $check = mysql_query("SELECT * FROM matches WHERE `team1` = '".$team1."' OR `team2` = '".$team1."' AND `week` = '".$week."' "); $nums = mysql_num_rows($check); if ($nums > 0) { return false; } else { $check = mysql_query("SELECT * FROM matches WHERE `team1` = '".$team2."' OR `team2` = '".$team2."' AND `week` = '".$week."' "); $nums = mysql_num_rows($check); if ($nums > 0) { return false; } else { return true; } } } } function createMatch ($team1,$team2) { $create = mysql_query("INSERT INTO matches (`team1`, `team2`) VALUES ('$team1','$team2')"); if ($create) { return true; } else { return false; } } } ?> here is my other script <?php //get all teams first and set them in available array $get_all = mysql_query("SELECT * FROM teams"); $max_teams = mysql_num_rows($get_all); $i = 1; $rand_team = rand(1,$max_teams); while($team = mysql_fetch_assoc($get_all)) { $available[$i] = $team['teamname']; $i++; } // end getting all teams for ($i = 1; $i < $Scheduler->max_teams; $i++) { //get the two teams $get_team1 = rand(1,$Scheduler->max_teams); $get_team2 = rand(1,$Scheduler->max_teams); $team1 = $available[$get_team1]; $team2 = $available[$get_team2]; if ($Scheduler->CheckTeams($team1,$team2)) { if ($Scheduler->createMatch($team1,$team2)) { echo 'Scheduled '.$team1.' to play '.$team2.' in week '.$Scheduler->week.'<br />'; } }else { $i--; } } ?> I am working on my admin panel for a client and i am having a problem with creating an automatic scheduler. The problem I am having is that if the teams already played its not redoing the for loop how can i make it do the for loop again? Code: [Select] <?php //Automatic Scheduler for leagues and such //Load custom mysql class for this project include("class.mysql.php"); //start MySql instance $my = new MySql; //get the number of teams $num = $my->getNum("SELECT id FROM teams"); //if number of teams are odd add a dummy team for a BYE week if ($num%2 != 0) { //create dummy team called BYE $my->insert('Teams',array("Name" => "BYE")); } //do the necessary calculations $number_of_teams = $num; $number_of_weeks = $number_of_teams * 2 - 2; $number_of_matches_per_week = $number_of_teams/2; $total_number_of_matches = $number_of_weeks * $number_of_matches_per_week; //start the week for statment for ($i = 1; $i <= $number_of_weeks; $i++) { //get all the teams in an array $teams = $my->getArray("SELECT id,name FROM teams"); shuffle($teams); for ($b = 1; $b <= $number_of_matches_per_week; $b++) { //get random teams $aid = array_rand($teams); $hid = array_rand($teams); //check to see if the teams have played each other if they have it will return FALSE if ($my->checkTeams($aid,$hid)) { //create match $my->createMatch($aid,$hid,$i); } else { //do it again $b--; } } } ?> Hello, I am fairly new at php (have been using HTML/CSS for a while but recently learned the php basics). I am building a website to allow clients to schedule through multiple massage therapists and I am struggling with the basic beginings of a scheduler scripts. If someone can point me towards a tutorial or script that would be great, or answer any of the following questions: 1. What would be the best way to store each therapists weekly schedule (based on monday-sunday with start and end times) and propagate that info. to every day that a client might schedule on? 2. How do i get the day of the week based on the date? 3. How do i display a calendar that lets them choose the date? This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=333559.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317921.0 I am trying to make PHP output a file in html and using the following code. Code: [Select] <?php readfile("./1/index.html"); ?> ... but it isn't working. How would I get PHP to output a file as HTML? I have been spending the majority of this week figuring out why my files are not showing up at my upload location that I set up in my newly created simple upload form. It just seems like php doesn't like me at all. Here is what my code looks like below. Code: [Select] <?php if (move_uploaded_file($_FILES['thefile']['name'], $upload_file)) $destination = "/www/zymichost.com/m/t/l/mtlproductions/htdocs/"; $upload_file = $destination . basename($_FILES['thefile']['name']);{ echo "Your file has been uploaded successfully!"; }/* else { echo "Your file did not upload successfully. Check to make sure your file meets the requirements and then try again."; print_r($_FILES);}*/?> I have the orange marked areas commented out due to the unexpected T_ELSE error thing. What do I do to get my files to show up at my upload location when I use my upload form? Thanks! Hello: I have a question. I use to - when I was doing Classic ASP - make a single navigation file to include all aspects of site navigation. I'm trying to do that now in PHP, but keep getting errors. Can some set me straight (I am assuming what I want to do can be done in PHP). I have my myNav.php file (in an "include" subfolder): Code: [Select] <?php function showLinks() <script type="text/javascript" src="include/spNewWindow.js"></script> <script type="text/javascript" src="include/openSesame.js"></script> <link rel="stylesheet" type="text/css" href="include/StyleSheet.css" /> ?> <?php function showTopMenu() <a href="#">Link 1</a><br /> <a href="#">Link 2</a><br /> <a href="#">Link 3</a><br /> ?> This is the myPage.php I am trying to pull it in to: Code: [Select] <?php include('include/myNav.php'); ?> <html> <head> <title></title> <?php echo $showLinks; ?> </head> <body> <div id="myMenu"> <?php echo $showTopMenu; ?> </div> ... REST OF SITE, ETC ... </body> </html> However, this is not working at all. I have figured out how to make files for each individual aspect - Menu, Footer, META tags, etc - but I would like to do this with one file as shown above. Is this possible? Thanks! $connet = mysql_connect("host", "db_username", "pass") or die(mysql_error()); $user = $_SESSION['SESS_FIRST_NAME']; mysql_select_db('db_name, $connet) or die(mysql_error()); mysql_query("SELECT members Get $earn='earned' WHERE $user='username' LIMIT 1;"); $earn = $total_earn; ?> <a>$<?php echo "$total_earn";?></a> wanting to take a variable and use that variable to search my sql table for another variable
example : (from outside prog XXX is sent in as 'killacct')
$killacct = $_GET['killacct'];
now take 'killacct' and search table 'blahblah' for the row 'variable'
so if the table was
killacct = XXX | blahblah = YYY
so then i can pull a second variable from my first one
XXX is associated with YYY
sorry this was probably really hard to understand im very exhaused lol
hi. i want to send an email with php, but i need this email should be a task invitation in outlook. i searched at google, but i couldn't find anything that solves my problem. any ideas? thanks in advance.... EDIT: It would seem i placed this in the wrong section. Can we have a mod move this? I'm gonna go ahead and admit that this is a task that my school left me for my course in PHP and mySQL but i won't just ask for someone to construct the code for me but just to give me advice and assistance in my code. What i'm trying to do is request a number from a user and generate random integers between 1 to 100 as many as the user specified. The task told me to place all the numbers in an array and that i can use a foreach loop to go through and indicate what numbers are lower than 50 and what is higher than 50. The output should be similar to this: All your numbers: 45 23 14 79 99 22 56 Numbers lower than 50: 45 23 14 22 Numbers higher than 50: 79 99 56 This is my code: Code: [Select] <!DOCTYPE html PUBLIC "-//w3c//DTD XHTMLm 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmnlns="http://www.w3.org/1999/xhtml" xml:lang="sv" lang="sv"> <head> <meta http-equiv="Content-Type" content="text/html; charset="utf-8" /> <title>Task</title> </head> <body> <?php $Nummer=$_REQUEST['nummer']; for ($count=1;$count <= $Nummer; $count++){ $testSlump = rand(1, 100); echo $testSlump . "</br>"; } $testArray = array($testSlump); foreach ($testArray as $n) { if ($testArray > 50){ echo $testArray . echo 'this number is lesser than 50'; } } ?> </body> </html> I've googled, read through the litterature but none seem to help me. I thought to myself that one solution might be placing all values generated in a for loop in an array and then using the foreach loop to confirm what is what. Class notes and our schools PHP help site doesnt have anything that would help me finish this task. How do you place for loop values in an array? (if i'm on the right track) Any help etc is greatly appreciated.
Hi my name is Alexander and i am new to coding. i am in need for tommorow for this task , but i cant figure out how to make it. Can anyone explain where is my mistake and how the code should look? I have some code but its full with errors....
I have a client that has a youtube video on his page that he changes everyday. I have been wrestling with being able to allow him to login to an admin page, that returns a simple form for him to input the new video id from his youtube link which then posts to a txt file. This text file is then included in the html for to supply the correct youtube video. Basically the way it is now the html page has Code: [Select] <iframe class="youtube-player" type="text/html" width="566" height="266" src="http://www.youtube.com/embed/Video Id Here" frameborder="0"> </iframe> Now I have been completely unsuccessful just creating a form that will let him change just the "Video Id" so we have been working on copying and pasting the entire iframe code in the form. My first attempt created backslashes in the txt file where quotes are, I then added stripslashes to fwrite and that posted nothing to my txt file. So I'm not sure if the code I have is worth a spit or if I should restart with some assistance. My main goal (if achievable) is to remove the iframe code from the html page and use a php include to include the text file that has the iframe in it. Then create a page for my client to login to to paste either the video url or just the video id and have this change on the fly. Any help would greatly be appreciated! Hello, I have come to a dead end. What I'm trying to do is simple: have a dynamic title for my php page (something that would be executed by, for example, Code: [Select] <title><?php echo $title; ?></title>). I'm not an experienced coder. I've tried about 15 different variations to try to achieve the result I want, and none of them have worked. I'm using a dynamic web template (DWT), which has editable regions for the Code: [Select] <title> section and for the main body of the webpage. I'm also using a Smarty template, called display_post.tpl, which, along the php file that is attached to the DWT, called display_post.php, are provided below as originally written: Smarty template: Code: [Select] <table cellpadding="8"> <tr> <td valign="top"> {section name=mysec loop=$posts} <h2>{$posts[mysec].title}</h2><br> {$posts[mysec].body|nl2br} <br> {/section} </td> </tr> </table> display_post.php: Code: [Select] <?php require_once('db_login.php'); require_once('config.php'); $conn = mysqli_connect($db_host, $db_username, $db_password, $db_database) or die ('Error connecting to MySQL'); $post_id = $_GET['post_id']; $query = "SELECT * FROM posts WHERE post_id=$post_id"; $result = mysqli_query($conn, $query); while($row = $result->fetch_array()){ $test[] = $row; } $smarty->assign('posts', $test); $smarty->display('display_post.tpl'); mysqli_close($conn); ?> Everything works as is. Part of the problem is that I don't know whether to do this through the DWT/php file or through Smarty. I've tried variations on both approaches, which I can provide for food-for-thought if need be. For now, I would love to read any possible solutions that you can come up with. Thanks bunches! Maat if($_GET['task']=='del') { $id=$_GET['id']; $name=$_GET['new_image']; mysql_query('delete from tbl_gallery where id="'.$id.'"' ); unlink ($name); } Hi, I made a small php configuration that runs a cmd command that is designed to create a Scheduled Task on Windows. Code snippet $createTaskCmd = "schtasks.exe /CREATE /SC MONTHLY /D 15 /TN mytask /TR C:\Windows\System32\notepad.exe /ST 00:00:10 /f /RU System"; shell_exec($createTaskCmd); keep in mind I also tried using, 'exec' and I also tried out this solution. I'm trying to create a temporary task and have it be destroyed much later. Hi there, I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy. Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates). How can I schedule this task automatically and make php access the updated xml file once a day. All comments and feedbacks are always welcomed Thank you! Hey Ok i'd say i'm pretty average with HTML, CSS and PHP I have my own website - www.leedsmethockey.co.uk and i want to develop a new section... i'll try and explain as best i can i have a database with all the players and their email address... When someone is selected for a match i wish the website to email their email address to let them know... please could someone advice me where i need to start and what sort of code i need to be looking into? Many Thanks |