PHP - Php 7.4 Loading Gif Issue
Hi! This code, which is basically HTML and Javascript, echoed in PHP (as you can see in the attached image), has functioned well for a long time. It still does, if put in a page by itself. The problem now is when it is integrated in other PHP scripts. It does not work this way on either the live server or on WAMP anymore. This script is normally setup to be execute about half way through the complete script of the page and has functioned well, showing approx. the top half of the page, as well as a loading gif. When the PHP workload is complete, the loading gif is removed and the rest of the page is displayed. Now with the later versions of PHP, all I see is a blank page until all the script is executed, which can take about 15 seconds or more. PHP does not release the information to Apache, or if it does, Apache does not do anything with it. I have tried different approaches, using ob_flush() and so on, but it just will not function. I would like to know if someone else has had this issue, or knows about it and if there is any current solution. I have not managed to find any working solution that will work with PHP 7.4 and in the future, on the net. I know one cannot predict all the changes that will occur with PHP in the future, but I would like the solution to function for at least 3-5 future versions. I am now going to try something completely different outside the box and create a start page instead. If it does work, it will just be a temporary solution though. Thanks for any assistance beforehand. Mac Edited October 24, 2020 by MacDknife spelling error Similar TutorialsHello,
I've got an overlay on my website which loads up when a button is clicked. Once the button it clicked, it parses a PHP file into a div which generates the content to be shown in the div. However, I can't seem to get the jQuery to work on buttons which are imported unless I call another Javascript file while populating the div. Does anyone know how I can get this so that it will work weather the buttons are there as the page is loaded or after extra content is brought in?
I'm presuming it's due to the
$(document).ready(function(){ });Current jQuery $(document).ready(function() { $('.CloseOverlay').click(function() { $('.OverlayContainer').hide(); }); $('.Approve').click(function() { var UserID = $(this).val(); var Status = "GetData"; $.post('/Admin/Users/Verified/approveUser.php', { UserID: UserID, Status: Status }, function(data) { $('.OverlayWrapper').html(data); }); $('.OverlayContainer').show(); }); });P.S - I'm pretty shocking at jQuery/Javascript! Thanks in advance, Andy Edited by Andy11548, 25 August 2014 - 08:31 AM. I have some issue with the website just created specifically http://ecolandscaping.co/index.php?m=3 and hosted on the 000webhosting.com. It loads the page slowly. Things what i have consideredto trie to improve better performance: * optimized CSS files * optimized MySQL queries with specifying the rows wanted (SELECT ID, IMAGE.....) * avoid to select an image saved as blob if not necessary etc. * made different image retrieving php files P.S. the website is small of size approx 700KB for loading. Problem is that not all the images (saved in MYSQL BLOB) are loaded successfully. Could anyone have a look and advice what else could cause the performance issue. P.S.S. I do take in account that this isthe free hosting and may cause some problems I have a php tutorial that I followed for creating, inserting, selecting and updating a MySQL database with php. Everything works fine so I wanted to put it into Wordpress. I took the code and placed it into the wordpress page and everything worked just fine except the update function. Here is the tutorial I used. http://www.phpsimple.net/mysql_insert_record.html It is also the part I am having trouble with. I am able to create a record and I am also able to select a record but when I choose "update" the form doesn't load the data. It will outside the website but not inside wordpress. I am hoping this is not vague but because of my inexperience I am not sure what else to say. I will be more than happy to provide any other information you need. I seem to have a problem with a PHP page I made. When executed on the server, it loads with a filesize 0 and for some browsers, says it does not exist. I believe that the cause is because it is not parsing due to a syntax error. I've busted my @$$ over this code, trying to find the issue, but cannot find it. Here is the whole page's code on pastie: http://pastie.org/1064160 (I looked at the appropriate forums to put this in, but it seems I couldn't find a forum section specifically for this problem) Yesterday PHP on WAMP was working perfectly. So I shutdown the computer, go to sleep, and wake up and turn WAMP on. But for some odd reason, when none of my PHP files are loading properly. It just shows all the code as if it were a .txt file. Any reasons for this? Hi I have website where users can upload pictures on server. Sometimes it take 4-5 seconds until the upload it's finish. What can I do that when I click on upload button an icon appear in middle of the screen and disappear then the pictures was finish uploading. Thanks Hey guys, Problem: php script keeps loading and i dont know why. What I've done so far is commenting out line-by-line so I found out that the problem is somewhere he Code: [Select] <div id="wrapper"> <div id="inner"> <div id="top"> <?php require 'basic/logo.php';?> <?php require 'basic/header.php';?> </div> its not working - keeps loading. Commenting out the 'required' stuff it works... error_reporting(E_ALL); is on... what the hell is the problem?! the files are there in /basic. Just dont know any further! Hello everyone, I have a PHP shopping cart I am working on. I have all my pictures stored in a folder url directory of my project. In my SQL database I have an image table that holds all of the image names. When I load the picture names with my php It somehow adds some extra random characters to the directory path: /img/%7B$row_product_image[name]%7D 404 (Not Found) If I hardcode the image directory img/picturename.jpg It works. Here is what I have. <?php include_once "objects/database.php"; include_once "objects/product.php"; include_once "objects/product_images.php"; // object instances $database = new Database(); $db = $database->getConnection(); $product = new Product($db); $product_image = new ProductImage($db); $recordsPerPage = 1; while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { extract($row); echo '<div class="col-md-4 mb-2">'; echo '<div class="product-id d-none">{$id}</div>'; echo '<a href="product.php?id={$id}" class="product-link">'; $product_image->product_id = $pid; $stmt_product_image = $product_image->readFirst(); while($row_product_image = $stmt_product_image->fetch(PDO::FETCH_ASSOC)) { echo '<div class="mb-1">'; echo '<img src="img/{$row_product_image[name]}" class="w-100" />'; echo '</div>'; } echo '<div class="product-name mb-1">{$name}</div>'; echo '</a>'; echo '</div>'; } class ProductImage { private $pdoConn; private $table_name = "product_images"; public $id; public $product_id; public $name; public $timestamp; public function __construct($dbconn) { $this->pdoConn = $dbconn; } function readFirst() { // SELECT query $query = "SELECT id, pid, name " . "FROM " . $this->table_name . " " . "WHERE pid = ? " . "ORDER BY name DESC " . "LIMIT 0, 1"; // prepare query statement $stmt = $this->pdoConn->prepare($query); // sanitize $this->product_id=htmlspecialchars(strip_tags($this->product_id)); // bind variable as parameter $stmt->bindParam(1, $this->product_id); // execute query $stmt->execute(); // return values return $stmt; } } ?>
I got problem with one of my php page. Mozilla browser keeps on loading although it shows the page, i am not really sure which part is wrong. But i don't find any problem with other browsers lol. Can anyone help me please thanks in advance Lets say that I have an array that I want to convert to a value object My value object class is as follows: /* file UserVO.php*/ class UserVO { public $id; public $email; public function __construct($data) { $this->id = (int)$data['id']; $this->email = $data['email']; } } And I create my array of value objects as follows: /* file UserService.php*/ $array = array( array(...), array(...)); $count = count($array); for ($i = 0; $i < $count; $i++) { $result[] = new UserVO($array[$i]); } return $result; OK, so this all works fine. However, I'd like to specificy the VO that is to be created dynamically, so that I can have a single dynamic function to create my VO's. Something like: $ret = create_vo($array, 'UserVO'); function create_vo($data, $vo) { $count = count($data); for ($i = 0; $i < $count; $i++) { $result[] = new $vo($array[$i]); //this obviously wont work...Class name must be a valid object or a string } return $result; } I realise that I could do this with a switch statement (iterating through all my VO's)...but there is no doubt a much much more elegant solution. It would also be supercool if I could lazy load the VO's as needed, instead of having multiple 'includes' Any help much appreciated. My website www.staceyxsolomon.com is only loading the header of my index.PHP page The full page is there i had double checke in the FTP It happened after my host put me onto another server, all settings carried over, please can somebody advise help if this is PHP related? Hi, not sure if this is the correct forum, so apologies, i assumed it was a php problem. Anyway, all of the pages on my site are permanently loading. http://dev.subverb.net contains a few external scripts from twitter and facebook, so I assumed it could be that, but even ones like http://dev.subverb.net/mix.php always are loading. I can't figure out on firebug how to find what is loading, because it doesnt seem to tell me in the net profile, just what has already been loaded. Any help? Okay the reason I'm doing it this way is because I work locally and then transfer them to the production site. For some reason, this isn't working even though when I view the page source, it has the right URL, but when it's clicked it goes to a blank page, but when I copy and paste, it goes to the right page. Anywho, this is what I'm trying: Code: [Select] <?php $homeURL = 'localhost:90/Elvonica'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Elvonica</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="stylesheet" type="text/css" href="<?php echo $homeURL; ?>/template/css/skySpirit.css" /> I didn't plug in the rest to ignore it since it's not part of the problem. It's printing: localhost:90/Elvonica/template/css/skySpirit.css, but when it's clicked, goes to blank page. When it is copied and pasted, it goes to the right page. I have a feeling you can't include PHP inside a link rel or any sort of that header information. If anyone could please help me how to do this, I would appreciate it. FYI: I did have just template/css/skySpirit.css and it worked until I go into a another directory like forums/index.php. Then it tries to go localhost:90/Elvonica/forums/template/css/skySpirit.css and it's not in there obviously. Thank you for anything that you can offer! I know how to do the includes with the dirname(__FILE__). i'm having issue related getting URL content properly FB:LIKE first link work properly but other links wouldn't work properly mypage.php code is simple mysql connectivity Code: [Select] $httplink = "localhost/mypage.php?mypage=" ; while($row = mysql_fetch_assoc($rs)) { echo "<tr>"; echo "<td> {$row['id']}</td>"; echo "<td><fb:like href=\"{$httplink}{$row['id']}\" layout=\"button_count\" show_faces=\"false\" width=\"100\" font=\"tahoma\" colorscheme=\"dark\"></fb:like></td>"; echo "<td> {$row['title']} </td>" ; echo "<td> <a href =\"{$row['http']}{$row['link']}\" target = \"_blank\" >{$row['http']}{$row['link'] }</a> </td>" ; echo "</tr>"; } mypage.php : <?php $link = mysql_connect('localhost', 'root', '1234'); if (!$link) die('Could not connect: ' . mysql_error()); $status = mysql_select_db('fblike', $link ); if(!$status) die("Failed to select database!"); if (!empty($_GET['mypage'])) { $result = mysql_query("SELECT * FROM mytable WHERE id={$_GET[mypage']} "); if (!$result) die('Invalid query: ' . mysql_error()); $rows = mysql_fetch_row($result); echo "<html>"; echo "<head>"; echo "<title>{$rows[1]} </title>"; echo "</head>"; echo "<body>"; echo "{$rows[1]} "; echo "</body>"; echo "</html>"; } mysql_close($link); ?> I have a PHP Page. It is doing a lot of site crawling, throughout a lot of loops. Basically it's getting a massive array together and it's huge. However, it's so big that PHP times out beyond belief. I mean there is no error or nothing. Google throws a major error about page not found, IE shows an internet connection error. It really times out big time. Even though it's not really "A LOT". Any advice on what to do in that situation. I can't show the site/code because of NDA, but was curious if someone had ever done that much work on a PHP page before to have it do that? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=314117.0 Hi All I have a site which is built from 3 folders: folder1 frolder2 frolder3 folder1 is the "master" folder. Means, In it I have the login page, connecxtion to DB elements, and header, footer and bootstrap treeview sidebar which I want to use in all the pages of the site. folders 2 and 3 each store all pages concern a specific vertical. The sidebar, which is located at folde1 retrive the content from database using AJAX, and Ive overloaded some of the original css by using custom css. here is psrt of the sidebar code: <link href="custom.css" type="text/css" rel="stylesheet" madia="all"/> <script type="text/javascript"> $(document).ready(function() { var treeData; $.ajax ({ type: "GET", url: "fill_sidebar.php", dataType: "json",
When I load this sidebar to pages inside folder1 all works great The loading is done by this code: <script> $(document).ready(function () { $('#sidebar').load('sidebar.php'); }); </script> The loading for folder 2 is done by this code: <script> $(document).ready(function () { $('#sidebar').load('../folder2/sidebar.php'); }); </script>>
When I try to load it to pages from other folder2 or 3 I get erroe message (in developer tools):
folder2/custom.css net::ERR_ABORTED 404 (Not Found) Of course, I i copy these files to folder2 all works fine, but I dont want to do that. I want to maintain only one file. My question is how to make these loads relative to the page I load? I am running php on one computer at work and want other users on other computers to access the index page by sharing it.after mapping the page, I see no data on the other machine. Does php, as pache need to beer installed on other computers footer it too work properly i'm new to php and don't really know where to start here... i'm automating a system that scrapes a site for a particular pdf download link (got this far), downloads it, parses the pdf, etc... problem is that you must be logged in (while viewing in the browser) in order to access the pdf... if you're not logged in, you are redirected and the download fails... i do have a proper login... how would i go about utilizing my login in order automate the pdf download? is there a way to send the login with the url request? or open a stream, login, and retry the download? thanks I have a script which registers people to a database, however it doing something very strange. Whenever I place it into even a single CSS div it adds the registration to the dabase but stops loading the next page (index.php) I find this totally bizarre as I haven't seen anything like this behave before. With CSS affecting how PHP works. Especially when the CSS is not inside the <php> of <form> tags. Code: [Select] <?php include("connect.php"); if($_POST['submit']) { $username = mysql_real_escape_string(trim($_POST['username'])); $password = trim($_POST['password']); $password2 = trim($_POST['password2']); $email = mysql_real_escape_string(trim($_POST['email'])); $error = false; if(!isset($username) || empty($username)) { $error = "You need to enter a username."; } $query = mysql_query("SELECT id FROM users WHERE username = '".$username."' LIMIT 1"); if(mysql_num_rows($query) > 0 && !$error) { $error = "Sorry, that username is already taken!"; } if((!isset($password) || empty($password)) && !$error) { $error = "You need to enter a password."; } if((!isset($password2) || empty($password2)) && !$error) { $error = "You need to enter your password twice."; } if($password != $password2 && !$error) { $error = "The passwords you entered did not match."; } if((!isset($email) || empty($email)) && !$error) { $error = "You need to enter an email."; } if(preg_match("/[a-zA-Z0-9-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) == 0 && !$error) { $error = "The email you entered is not valid."; } $query = mysql_query("SELECT id FROM users WHERE email = '".$email."' LIMIT 1"); if(mysql_num_rows($query) > 0 && !$error) { $error = "Sorry, that email is already in use!"; } if(!$error) { $query = mysql_query("INSERT INTO users (username, password, email) VALUES ('".$username."', '".mysql_real_escape_string(md5($password))."', '".$email."')"); if($query) { $message = "Hello ".$_POST['username'].",\r\n\r\nThanks for registering! We hope you enjoy your stay.\r\n\r\nThanks,\r\nJohn Doe"; $headers = "From: ".$website['name']." <".$website['email'].">\r\n"; mail($_POST['email'], "Welcome", $message, $headers); setcookie("user", mysql_insert_id(), $time); setcookie("pass", mysql_real_escape_string(md5($password)), $time); header("Location: index.php"); } else { $error = "There was a problem with the registration. Please try again."; } } } ?><html> <head> <title>Register</title> </head> <body> <form action="" method="post"> <?php if($error) echo "<span style=\"color:#ff0000;\">".$error."</span><br /><br />"; ?> <label for="username">Username: </label> <input type="text" name="username" value="<?php if($_POST['username']) echo $_POST['username']; ?>" /><br /> <label for="password">Password: </label> <input type="password" name="password" value="<?php if($_POST['password']) echo $_POST['password']; ?>" /><br /> <label for="password2">Retype Password: </label> <input type="password" name="password2" value="<?php if($_POST['password2']) echo $_POST['password2']; ?>" /><br /> <label for="email">Email: </label> <input type="text" name="email" value="<?php if($_POST['email']) echo $_POST['email']; ?>" /><br /><br /> <input type="submit" name="submit" value="Register" /> </form> </body> |