PHP - Php Progress Bar
Hey all,
Not sure if this is in the correct place (sorry if it is not) But i have been looking for hours now for a simple progress bar system when uploading bigger files. Im not even looking for good looking loading bar a simple percent would be good for me. But every site i have looked at to get any help or ideas from the comments are "Does not work", "Error" and that sort of thing. I have even tried many myself and can not get them to work. (at least 5-6) Some even requires the you to install add on programs to your sever - this i can not do as i don't own it. There must be a easy way to solve this problem? Please help Thank you. Eli Similar TutorialsI was wondering if there is a way to add an progress bar to this script that uploads files to a sql database
<!DOCTYPE html> <head> <title>MySQL file upload</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <form action="add_file.php" method="post" enctype="multipart/form-data"> <input type="file" name="uploaded_file"><br> <input type="submit" value="Upload file"> </form> <p> <a href="list_files.php">See all files</a> </p> <p> <a href="search.php">Search Database</a> </p> </body> </html>If so, how would i go about doing that? Hello, I've been trying to create a progress bar for the past 3 days, but I can't get it to work. I've got my own dedicated server with cPanel on it, using cPanel I installed the PECL extension. However, it doesn't respond to anything. The script I'm using is: HTML code: Code: [Select] <form id="uploadform" enctype="multipart/form-data" method="post"> <input id="UPLOAD_IDENTIFIER" name="UPLOAD_IDENTIFIER" type="hidden" value="12345" /> <input id="ulfile" name="ulfile" type="file" /> <input type="submit" value="Upload" /> </form>To request the information I made another page with: <?php print uploadprogress_get_info($_GET['id']); ?> Nothing is returned however, no error, nothing... I'm totally lost! Regards, Hi. how can I control a progress meter/bar to display errors when it failed to reach 100% or on getting to a point? thanks Hi there i'm using php&curl to fetch some data from another site, this sometimes takes up to 30 seconds but you don't actually see anything happen on the screen, i tried to implement the cURL progressbar but i didn't really get it to work, can someone help me out here ? This is my code: Code: [Select] <?php if(!empty($_SESSION[$session_prefix."user"])) { //Functions function middlestring($string,$start,$stop){ $pos = strpos($string,$start)+strlen($start); $retstr = substr($string,$pos); $pos = strpos($retstr,$stop); $retstr = substr($retstr,0,$pos); return $retstr; } function curl_get($url, $head, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, $head); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); return curl_exec($ch); } function curl_post($url, $datas, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $datas); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); return curl_exec($ch); } function getcookies($text, $startstr, $endstr){ $start = strpos($text, $startstr); $end = strpos($text, $endstr); $parts = split("Set-Cookie: ",substr($text, $start, $end-$start)); $cookies = ''; foreach ($parts as $co) { $cd = split(";",$co); if (!empty($cd[0])) { if(strpos($cd[0], "deleted")) {} else $cookies .= $cd[0].';'; } } return $cookies; } $mail = $ukuser; $pass = $ukpw; $code = $_REQUEST["code"]; $wert = $_REQUEST["guthaben"]; $captcha = $_REQUEST["captcha"]; if(empty($captcha)) { $text = curl_get('http://www.ukash.com/global/en/login.aspx', 1, 0, 1); $_SESSION["viewstate"] = urlencode(middlestring($text, '__VIEWSTATE" value="', '" />')); $text = curl_post('http://www.ukash.com/global/en/login.aspx', '__EVENTTARGET=ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24loginButton&__EVENTARGUMENT=&__VIEWSTATE='.$_SESSION["viewstate"].'&sIFR_replacement_0=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtEmail='.$mail.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtPassword='.$pass.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOByear=1980&%23=%2Fservices%2FlocaleRedirector.aspx%3FnodeId%3D156095%26languageCode%3Den&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOByear=1980&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24footerTellAFriend_23%24txtStFemail=&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0', 0, 1); $_SESSION["cookies"] = getcookies($text, 'Set-Cookie:', 'Cache-Control: '); $text = curl_get('http://www.ukash.com/global/en/my-ukash.aspx', 1, 1, 1); if(strpos($text, 'My Used Codes')) { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step1.aspx?email=&culture=de&country=de&lang=de', 1, 1, 0); $_SESSION["cookies"] .= 'ASP.NET_SessionId='.middlestring($text, 'Set-Cookie: ASP.NET_SessionId=', ' path=/; HttpOnly'); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $text = curl_get('https://direct.ukash.com/de/tools/combine/utils/PhishingImage.aspx', 0, 1, 0); echo '<form action="" method="post"> <table id="items"> <tr><td>'.$uka1lng.'</td><td><input type="text" name="code"></td></tr> <tr><td>'.$uka2lng.'</td><td><input type="text" name="guthaben" value="20" readonly="readonly"></td></tr> <tr><td><img src="data:image/jpg;base64,'.base64_encode($text).'"></td><td><input type="text" name="captcha"></td></tr> <tr><td></td><td><input type="submit" value="'.$uka3lng.'"></td></tr> </table> </form><br> <font color="red">'.$uka4lng.'</font>'.$uka5lng.'<br>'.$uka6lng; } else $ukerror = $uka7lng; } else { if($wert < 10) $ukerror = $uka8lng; else { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step1.aspx', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&tbxVoucherNo1='.$code.'&tbxVoucherVal1='.$wert.'&tbxVoucherNo2='.$code.'&tbxVoucherVal2=0&tbxVoucherNo3=&tbxVoucherVal3=&tbxVoucherNo4=&tbxVoucherVal4=&tbxVoucherNo5=&tbxVoucherVal5=&tbxVoucherNo6=&tbxVoucherVal6=&tbxVoucherNo7=&tbxVoucherVal7=&tbxVoucherNo8=&tbxVoucherVal8=&tbxVoucherNo9=&tbxVoucherVal9=&tbxVoucherNo10=&tbxVoucherVal10=&tbxBaseCurrency=EUR&tbxVerContent='.$captcha.'&chkTerms=on&btnConsolidate=', 1, 0); if(strpos($text, 'stimmt nicht mit dem Systemcode')) $ukerror = $uka9lng; else { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', 1, 1, 0); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); if(strpos($text, 'Ihre Ukash Referenznummer')) { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&btnProceed=', 1, 0); $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/Step4.aspx', 1, 1, 0); $newukash = middlestring($text, 'span id="lblVoucherDetailValue"', '</table>'); $newukash = middlestring($newukash, '<tr><td>', '</td></tr>'); $newukash = split('</td><td>', $newukash); $newcode = $newukash[0]; $ukguthaben = $newukash[2]; $user = mysql_fetch_array(mysql_query('SELECT * FROM users WHERE username="'.$_SESSION[$session_prefix."user"].'"')); $geld = floor($user["guthaben"] + $ukguthaben); mysql_query('UPDATE users SET guthaben="'.$geld.'" WHERE username="'.$_SESSION[$session_prefix."user"].'"'); mysql_query('INSERT into ukash (user, code1, code2, value) VALUES ("'.$_SESSION[$session_prefix."user"].'", '.$newcode.', 0, '.$ukguthaben.')'); echo floor($ukguthaben).' '.$guthaben.$uka10lng; } else $ukerror = $uka11lng; } } } echo $ukerror; } else echo'<font color="red">'.$uka12lng.'</font>'; ?> We are trying to get progress bar to place active class on the current page it one based on variable being set on page called "page", also the page is written into the <body class="page"> tag, once it is loading the page.
It is not working as we need can anyone, help us with script below to set progress bar to do prev and next?????
So variable is:
var page = "refundstep1";Body Class tage looks like: <body class="refunStep 1 main-layout">Progress bar is: <div class="tabContent progress-bar hidden-phone"> <div class="step active"> <h2>Step 1: Enter your Pin</h2> </div> <div class="step inactive"> <h2>Step 2: Tell us your address</h2> </div> <div class="step inactive"> <h2>Step 3: Confirm Your Details</h2> </div> </div>Code to actual set the other list next as class="inactive", list passed or compelted as class="active done", Current page as class="active" var progressClass = $('.progress-bar div.step'); $(progressClass).addClass(function(index, activeClass) { var activeClass = 'done'; var activePage = 'active'; alert(page); var currentPage = page; var pageClass = $('body').hasClass(page); console.log(pageClass); if(pageClass === true) { progressClass.addClass(activePage); progressClass.prevAll().addClass(activeClass); //To select all next elements of `.progressClass` element: progressClass.nextAll().addClass(nopageClass); } return nopageClass; }); I have a site where I have an admin panel set up to import an XML data feed into a database, but it's a large import and it takes a lot of time to update. I'm looking to upgrade the admin panel and offer the ability to be able to see the number of records as they're being imported instead of it hanging there until the query is completed. The tough part about a progress bar is obviously you have to know the # of items being imported beforehand, and that varies each time the feed is downloaded. So I'm just trying to get some suggestions from someone who may have written something similar. Thanks in advance! I'm trying to show the progress of executing a python script in PHP with a progress bar. I found a link (https://www.htmlgoodies.com/beyond/php/show-progress-report-for-long-running-php-scripts.html) that uses SSE to send progress updates to the client. In the original code, a loop is used to simulate a long script but in my case I'm trying to execute a python script that takes roughly 50 seconds. index.php
<!DOCTYPE html> process.php
<?php
function send_message($id, $message, $progress) {
echo "id: $id" . PHP_EOL;
ob_flush();
send_message('CLOSE', 'Process complete'); Problem: As you can see in process.php I commented the original code and placed a simple python execution in php. I just want to diplay the progress of the script but it is not doing so. What do I have to do to show the progress of the script? Note: I don't think is relavent but the python script just opens up a batch file. Are there other methods to display the progress bar of a script in php? hello guys, i need a help from u. from past 1 week , i am searching for it. may be it is simple query for you . in my project, i am uploading a file, for example 5mb of audio file, while uploading i need to display a progress bar along with percentage of how much it is uploaded to server ( as it works in google chrome browser). i tried several codes by searching in google . No code is working. i can able to display only loader.gif image not the status bar with percentage. so pls guys if you have these codes, pls share it . Hi,
I've seen this done, and I thought it would be simple now that I am starting to understand ajax but I can't figure it out.
I am using jQuery ajax via wordpress. I can click a button, call a php function and use the value returned from php to populate the textbox.
Ok, great!
but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting )
How can I accomplish this?
I've googled but I must not be using the correct words to search.
This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=316351.0 Hello people, I have created an application in Code Charge where my site users can login and play games online.The game code is run via flash and html. The Game has 5 stages and from a page in my application called transfertogame.php , i transfer them to the game page. Now i want to be able to track each players progress via database so that when they log back in and they get to the transfertogame.php page, it can check the page they were on before and immediately take them to the page without starting from page 1. Any help will be appreciated as i am very poor with php scripting This is the session ID i guess is being used from my application page //Initialize Method @4-537EA73F function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); } //End Initialize Method //Validate Method @4-7E1FC38C function Validate() { $Validation = true; $Where = ""; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method Hello All, I am in desperate help here since my site was DDoS attacked by some one in turkey (Ips originate mostly from turkey, Germany, and some other Europe countries). I have installed the ddos deflation and most of the IPs are now blocked. I have a php file in my server that I use to input data into my database and my streaming servers. This file is called connect.php and the hacker is basically created an automated script that repeatedly call the connect.php file from a botnet resulting in both apache and mysql dead. I use connect.php in the following way http.open('get', "ajax/createchannel_1.php?channel=" + channelname + "&sitename=" + sitename + "&privateurl=" + privateurl + "&privateurlcheck=" + privateurlcheck); How can i change the connect.php so that it only accept execution from my server/ Please your help is greatly appreciated. |