PHP - Extract Status
Okay I now have a working extract ZIP archive script.
What I am now looking to do is have a loop which checks the percentage complete the extraction is and at 100% (with no erros) carry out a PHP function. The code so far is (and includes comments on how the new function would be placed): $dir = opendir('temp'); while(false !==($file=readdir($dir))){ if(strpos($file, '.zip',1)){ extractupdate($file); } } function extractupdate($file){ $zip=new ZipArchive; if($zip->open('temp/'.$file) == TRUE){ $update=rtrim($file, ".zip"); $zip->extractTo($_SERVER['DOCUMENT_ROOT']."/update/temp/$update"); $zip->close(); echo "Extraction started."; // Place loop here to run untill 100% extraction completed and then run function "intsallupdate($update);" } else { echo "Failed to start extraction."; } } function installupdate($update){ // installupdate() will now shift the files around as necessary. // NB to PHPFREAKS, no assistance with code for installupdate() is required, only the loop. Cheers. } Many thanks in advance. Similar TutorialsThis topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321546.0 So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html?
here is the link with code&demo iamusing: http://www.sanwebe.c...-php-and-jquery
thanks in advance.
Hello, I have a webpage that runs some php code to control electrical devices. One part of it controls outside lights. Another part controls an electric door striker. I keep expanding the functionality of it and need to change one pin of the port without affecting the others. So far I use a different port for each function but I am out of ports so I need to use the different pins of the parallel port. I am using a linux ubuntu server. From my php webpage I issue this command: <?php exec("/home/setSerialSignal /dev/ttyS0 0 0"); ?> which controls the lights using the serial port. I can control 2 pins but I can't check the status of them so if I make a change to one pin it cancels the other. For another one I use the parallel port with this command: <?php exec("/home/parashell 0x378 1"); ?> which turns on pin #2 of the parallel port. Parashell has an executable called "pin". If you type the command "pin 0x378" it will return a value for the status of the parallel port. "1" for example which tells me that pin #2 is on. Is there a way to pass this value to a php variable? I am looking to be able to read the status of the port and make changes to just the pin I want. Lets say pin #2 is on and I want to turn pin #3 on. I would have to issue <?php exec("/home/parashell 0x378 2"); ?> to turn pin #3 on, but that would turn off pin #2. If I could pass the "1" from the "pin" command I could add it to the "2" and give it the command with a variable as "3". Thanks in advance for any help you can give. I hope I explained it ok and didn't confuse everyone. I want to know how can i check wether the user is online on my website or not.... I am wanting to echo one of these 4 statements depending on the 'status' value. Currently it is showing the status value on the 2nd line but not the statement below.. Code: [Select] <li> <strong>Status: </strong><?php more_fields('status') ?> <?php if (more_fields('status')=="Red") echo "Your account is currently undergoing judgement"; elseif (more_fields('status')=="Green") echo "Your account is currently Live"; elseif (more_fields('status')=="Yellow") echo "Your account is currently undergoing site visits"; elseif (more_fields('status')=="Blue") echo "Your account is currently undergoing insolvency/liquidation";?> </li> any help appreciated. Thanks, Jake Hi there, i have code that enables a user to login to my site. I have a player table that consists of: PlayerName, Password and Status. The playername and password is what logs the user in however i want to make it so that when a user logs in it automatically sets that users Status to 1. Can some one point me in the right direction please?? Thanks Code: [Select] <?php if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['textfield'])) { $loginUsername=$_POST['textfield']; $password=$_POST['textfield2']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "index.php"; $MM_redirectLoginFailed = "fail.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_swb, $swb); $LoginRS__query=sprintf("SELECT PlayerName, Password FROM player WHERE PlayerName=%s AND Password=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $swb) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> Thank you Hi, I need to know the delete status of an email. I can able to make the Read status, but whether there is any tricks that we can make in order to know the status of our email (deleted from our users) Any help !! Ty JO Problem: I'm trying to make it so the array responds to the integer of status in the database. So, to check if it's one, I try this: $get["status"]["1"] = "Message here..."; But, on my result, I'm just getting WWTT - And the value in the database for the ticket is 0. I'm not sure if I'm using the array correctly. My full code: <?php session_start(); include("../includes/mysql.php"); include("../includes/config.php"); ?> <!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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="../style.css" rel="stylesheet" type="text/css" /> <title><?php echo $title; ?></title> </head> <body> <div id="container"> <div id="content"> <div id="left"> <div class="menu"> <?php include("../includes/navigation.php"); ?> <div class="menufooter"></div> </div> <?php include("../includes/menu.php"); ?> </div> <div id="middle"> <?php $existing = $_POST['existing']; $query = mysql_query("SELECT COUNT(id),id,status,date,question,title FROM tickets WHERE id='$existing'"); $get = mysql_fetch_assoc($query); if(!$existing) { echo ' <div class="post"> <div class="postheader"><h1>Error</h1></div> <div class="postcontent"> <p>You have not enetered in a ticket ID. Please go back and do so.</p> </div> <div class="postfooter"></div> </div> '; } elseif($get['COUNT(id)'] < 1) { echo ' <div class="post"> <div class="postheader"><h1>Error</h1></div> <div class="postcontent"> <p>The ticket ID you are trying to use doesnt exist. Please go back or submit another ticket.</p> </div> <div class="postfooter"></div> </div> '; } else { $get["status"]["0"] = "Waiting for support..."; $get["status"]["1"] = "Waiting for user..."; $get["status"]["2"] = "Ticket Closed..."; $get["status"]["3"] = "Ticket Opened..."; echo ' <div class="post"> <div class="postheader"><h1>View Ticket Status - ID '. $get["id"] .'</h1></div> <div class="postcontent"> <p>Title: '. $get["title"] .' - Posted on: '. $get["date"] .'</p> <p>Ticket Status: '. $get["status"] .'</p> <p>Question: '. nl2br($get["question"]) .'</p> </div> <div class="postfooter"></div> </div> '; } ?> </div> </div> </div> </body> </html> Howdy I'm trying to figure out to get a file to call a page on another domain(diffrent server) and check if the activation code matches the one on the activation server. So on the user's server it has a cron job or on load will call my server and run the code in their update.php file against my activation.php file and see if it matches. If($usr == $actv){ //DO THIS }else{ //run disable script } hello when i try to get the checkbox status from my class i get only those who checked i send the &_POST to my class. how should i get also the values of checkboxes which not selected? Hello, I am trying to figure out how to grab the latest aim status update from "http://lifestream.aol.com/stream/iragedxt" But I can only see the Current Status if I am logged into my aim account on the website so is there a way I can log into my aim account on lifestream.aol.com and then I believe its to use curl to grab the text from the other website? if so could someone please help me with this? Thanks, John I am trying to make a Server Status checker that uses a image to tell if it is online or not. I also am trying to make it so you can the URL as a image code(EX: http://Http://domain.com/statuscheck.php?ip=google.com&port=80). What I'm trying to say it, that if you do like <img src="http://Http://domain.com/statuscheck.php?ip=google.com&port=80"> it would go to my site, use the php script, and then have the image Online or Offline, were the <img> code was posted. Here's my code Im trying to make it from. <?php $ip="{$_GET['ip']}"; $port="{$_GET['port']}"; if(!$sock=@fsockopen($ip,"$port", $num, $error, 5)) { Header('Content-type: image/png'); echo"<img src='images/offline.png'>"; } else { Header('Content-type: image/png'); echo"<img src='images/online.png'>"; } ?> Hello I recently got a "to many connection" error on my site, and want to know if anyone here knows a few codes that will show how many connection currently are in use (maybe even what files that creates them). I found I can use "Threads_connected" to show current open connections, but no info on how to write the code or where to pu the file. I hope you can show my what to do So i have a online status available and when the user logs in i insert a new row in a table so the user is online and when the user logs out i delete it so the users goes offline.. but when the user leaves the computer and has the website open he will get logged out after some time of inactivity and the row saying that the user is online will remain there and wont be deleted.. how can i remove the row by the time the session is removed due to inactivity? I dont have any code done till now because im still trying to find out how to do it.. thanks. Hi all, I have this script I used on a site hosted on my machine that checked if different servers and applications were running on my machine. Here's the code. Code: [Select] <html> <body> <style> fd{ color: #000000 font-size:100% } </style> <?php function check_port($port) { $conn = @fsockopen("212.233.xxx.xxx", $port, $errno, $errstr, 0.2); if ($conn) { fclose($conn); return true; } } function server_report() { $report = array(); $svcs = array('21'=>'FTP', '22'=>'SSH', '25'=>'SMTP', '80'=>'HTTP', '110'=>'POP3', '143'=>'IMAP', '3306'=>'MySQL', '8080'=>'HFS', '8081'=>'Webcam', '3784'=>'Ventrilo'); foreach ($svcs as $port=>$service) { $report[$service] = check_port($port); } return $report; } $report = server_report(); ?> <center> <table> <tr> <td><font face="Verdana" size="1" color="#000000">Apache:</td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['HTTP'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> <tr> <td><font face="Verdana" size="1" color="#000000">MySQL:</td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['MySQL'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> <tr> <td><font face="Verdana" size="1" color="#000000">HFS:</td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['HFS'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> <tr> <td><font face="Verdana" size="1" color="#000000">FTP:</font></td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['FTP'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> <tr> <td><font face="Verdana" size="1" color="#000000">Webcam:</font></td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['Webcam'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> <tr> <td><font face="Verdana" size="1" color="#000000">Ventrilo:</font></td> <td><font face="Verdana" size="1" color="#000000"> <?php echo $report['Ventrilo'] ? "<img src='main/images/on.png' width='16' height='15' border='0'>" : "<img src='main/images/off.png' width='16' height='15' border='0'>"; ?></font></td> </tr> </table> </center> </body> </html> I've added the HTML too. As you can see it checks if the ports are open. It worked perfectly and I didn't have any issues with it at all. Now, for a couple of days, I've been using an awardspace paid hosting, bought a domain name. I use wordpress now, and I pasted this code directly in a PHP/HTML code box (I use a plugin that enables use of PHP) and it shows the HTML formatting how it should be, but unfortunately doesn't work as intended. It shows everything to be down, while apache, mysql and my ftp server are still running on my computer (the IP it checks, 212.233.xxx.xxx). When I set the IP to be 127.0.0.1, the IP of the awardspace server as far as my script is concerned, it shows only that the IP is working. So, any suggestions? Any idea would be greatly appreciated I got this code off of this forum Code: [Select] <?php $ip="{$_GET['ip']}"; $port="{$_GET['port']}"; header('Content-type: image/png'); if(!$sock=@fsockopen($ip,"$port", $num, $error, 5)) { readfile('image/offline.png'); } else { readfile('image/online.png'); } ?>I'm able to check the status by going to Code: [Select] http://domain.com/statuscheck.php?ip=google.com&port=80 and it works fine. But I would like to show the status on my index.html page without having to click on a link. Is there anyway Please help. thank you in Advance. If i check more than one checkbox. I dont get any value from database.
HTML
<form method="post"> <input type="checkbox" name="receiver[]" value="cheater">CHEATER <input type="checkbox" name="receiver[]" value="un-verified">UN-VERIFIED <input type="checkbox" name="receiver[]" value="inactive">INACTIVE <input type="checkbox" name="receiver[]" value="active">ACTIVE <input type="submit" name="submit" value="ADD"> </form>PHP $errors = array(); $success = NULL; $error = NULL; $var['receiver'] = isset($_POST['receiver']) ? $_POST['receiver'] : NULL; ................. if(!empty($_POST['submit'])){ // FORM VALIDATION // } if(!empty($_POST['submit']) and empty($errors)){ $status = array_map('strval', $var['receiver']) + array(0); $statusSql = implode(',', $status); $query = 'SELECT email FROM users WHERE status IN("'.$statusSql.'")'; $select = $db->prepare($query); $select->execute(); $arrayData = array(); while($row = $select->fetch(PDO::FETCH_ASSOC)){ $arrayData[] = $row['email']; } $errors[] = implode(',', $arrayData); } require_once 'includes/antiCsrf/index.php'; $csrf = new antiCsrf(); $smarty->assign('success', $success); $smarty->assign('error', $error); $smarty->assign('errors', $errors); $smarty->assign('csrfKey', $csrf->csrfKey()); $smarty->assign('csrfToken', $csrf->csrfToken()); $smarty->assign('var', $var); ................. I bought a script not so long back and I am trying to install it on my Linux hosting cPanel with GoDaddy.
I have followed the installation instructions (below) provided by the script author but I am having no luck.
1. Modify server/server.php Line: 282
$master = new ChatBot(“(author's domain)”, 10000); Help me!!
Seem when i run the scripts, the output seems wrong
This is the output...
The 1st and 3rd entry is true, online
But the rest should be OFFLINE but the output shows all ONLINE
I think the problem is from foreach loop but I cannot figure out how to solve the problem
Please help me...
<?php include 'connector/connect.php'; ?> <meta http-equiv="refresh" content="6" > <style> tbody > tr:nth-child(2n+1) > td, tbody > tr:nth-child(2n+1) > th { background-color: #ededed; } table{ width: 70%; margin: auto; border-collapse: collapse; box-shadow: darkgrey 3px; } thead tr { background-color: #36c2ff; } </style> <h1 align="center">Server Availability</h1> <table border="1"> <thead> <tr> <th>Entry</th> <th>Host</th> <th>Name</th> <th>Location</th> <th>Description</th> <th>Availability</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM host_entry"; $no = 1; $dbhi = $dbh->query($sql); foreach ($dbhi->fetchAll(PDO::FETCH_BOTH) as $data) { ?> <tr> <td><?php echo $no++; ?></td> <td><?php echo $data['host_server']; ?></td> <td><?php echo $data['host_name']; ?></td> <td><?php echo $data['host_location']; ?></td> <td><?php echo $data['host_desc']; ?></td> <td> <?php $ip = $data["host_server"]; // Run the ping to the IP exec ("ping -n 1 -w 1 $ip", $ping_output); if(preg_match("/Reply/i", $ping_output[2])) { echo "<font color='green'><strong>Online!</strong></font>"; }else{ echo "<font color='red'><strong>Offline!</strong></font>"; } ?> </td> </tr> <?php } ?> </tbody> </table> I have an AJAX request but my problem is that is always returns a status code of 0. Below I have my JavaScript function. They send a request to a page called inc_submit.php which just echo's "hi" (as I'm just try to test it). Code: [Select] function submitForm(website_name, website_caption, website_contact, website_email, website_link) { var url4 = "includes/inc_submit.php?website_name=" + escape(website_name) + "&website_caption=" + escape(website_caption) + "&website_contact=" + escape(website_contact) + "&website_email=" + escape(website_email) + "&website_link=" + escape(website_link); alert (url4); request4.open("GET", url4, true); request4.onreadystatechange = confirmSubmit; request4.send(null); } function confirmSubmit() { if (request4.readyState == 4) { if (request4.status == 200) { var response4 = request4.responseText; document.getElementById("submit_status").innerHTML = response4; } else { alert("Error: status code is " + request4.status); } } } |