-
Who's Online 2 Members, 0 Anonymous, 437 Guests (See full list)
All Activity
- Today
-
Strange problem with main.js file and index.php .
gizmola replied to Ali_Hegazy's topic in Javascript Help
This is a problem you will encounter when you have code in production and need to update it. You'll need some way to "cache bust" files that users have already cached locally or they will continue to use the old version. For development, if you develop using Chrome, you can install an extension. I have used this one for a long time and it is safe and reliable: https://chromewebstore.google.com/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn Make sure you set it up to pin the button to the extension window, and then when you need to test, you can click it will clear cached items for the site you are working on. -
Paul-D: I've redacted a few things in your post as a courtesy but you can safely assume it's already out there on the internet. Be more careful in the future. Shame about the email addresses too.
-
I'd suggest changing your MySQL password now that you've posted it in a forum
-
Thanks. I need single quotes around ':ThisDate' working fine now. Thanks again.
-
6livevn1 joined the community
-
Named arguments need to be quoted. An example from: https://www.php.net/manual/en/pdostatement.execute.php $sth->execute( array( ':calories' => $calories, ':colour' => $colour ) ); "Unexpected" colons in the middle of PHP code gives it indigestion. Regards, Phill Ward.
-
Hi I have an error on a web page Parse error: syntax error, unexpected token ":", expecting "]" in /vhost/r/e/d/redacted/www/secure/SecurePDO.php on line 256 The Code page with all the relevant functions is this. This worked before I converted from my_sql to PDO. Have checked this over and it seems to comply. function StoreData($Page) at the very end of the file. Thanks for any help. x
-
CodeSkills joined the community
-
Strange problem with main.js file and index.php .
mac_gyver replied to Ali_Hegazy's topic in Javascript Help
browses cache content by default. on your development system, you must tell the browser to not cache the content of file types that you will be changing often during the development process. your web server likely/should already have a setting that outputs headers for .php files that tell the browser to not cache the content for the request. you need to add the .js and possibly .css/.html file extensions to this. for an apache web server, there would be an entry in the .htaccess file that looks like - <IfModule mod_headers.c> <FilesMatch "\.(php|js|css|html)$"> Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" Header set Pragma "no-cache" </FilesMatch> </IfModule> -
Strange problem with main.js file and index.php .
Ali_Hegazy replied to Ali_Hegazy's topic in Javascript Help
Updates: the same problem happens again when I suspend the device and I try to close LAMPP and start it again, and it works but the same question WHY this happened ? -
Hello developers, When I was working on password generator website using PHP, I connect the main.js file to the index file and everything is okay and it works, but when I close the device and reopen it and open the project any change in the javascript file does not affect on the index file and when I open the inspect and see the sources the main.js file is constant at the code before I turn off the device, then I change the name of js file and reconnect it to the index.php and it works, and the question here WHY this happened? I wish anyone help me because in real life I will not change the name of the files everyday. NOTE: my OS is Ubuntu. Thank you.
- Last week
-
You can specify either the width or the height for an image, and it will size to that. Generally speaking you want to pick one or the other, and allow the other dimension to be sized relative to the one you specify, otherwise the browser will attempt to fit the image which if the ratio of width/height doesn't match will cause the image to skew. What maxxd pointed out, is that the browser will download the full image either way, so if the image is much larger than the place where you are using it, clients will still have to pull down the full size image, which makes things slower and eats up more of your bandwidth. One very useful css property to be aware of is object-fit. I frequently use object-fit: cover in styles for images, although there are other options that might be better for your particular use cases. It's also very useful for backgrounds, as you can do things like this: .canvas__bg-img { height: 100%; width: 100%; object-fit: cover; opacity: 0.15; }
-
Okay. I can re size using the <img> tag but for video, found a solution <video width="640" height="480" controls> <source src="HosePipe.mp4" type="video/mp4"> Your browser does not support the video tag. </video>
-
If it's a very large image, you'll be better off resize it in an image editor and save the download time and bandwidth. Images should only be (about) as big (in pixel dimensions) as they're going to appear on the page at 100%, otherwise you're degrading the image integrity by resizing it in CSS. If it's just a little bit bigger than 100% (say, 10-20% maybe), you can give the image an id and use CSS to define the dimensions. Or, in a pinch, use the height and width attributes.
-
I know this is a simple one for you but I would like to display images on a web page but this is a large image. Can I put it in a container that fixes it's size. <body> <a href="BillBen.jpg">It's a plant.</a> </body> I might want to contain mp4 videos in this also. Thanks.
-
Not according to what you originally stated. You stated that for every request you wanted to "issue a reply quickly and start a timer." It was never clear if this was just a means to an end or not, because you didn't explain the problem you are trying to solve. What it does sound like at this point, is that you are trying to create your own home grown IDS or WAF, and you already got a suggestion from me, and a suggestion from requinix. For the most part people use fail2ban to drop annoying ssh bots and other similar port based traffic by bots and script kiddies trying brute force password attacks. It's written in Python, so it's not exactly light weight either, but it also has a simpler job in practice -- just count a small number of bad attempts and block the IP. That isn't going to work for something more sophisticated. This is why I suggested looking at OSSEC, and if it's more a WAF you want there are bunch of self hosted ones that also have FOSS versions like Safeline, Modsecurity and Bunkerweb.
-
You're right, it is a frequent requirement. It's so frequent that people don't implement these things themselves. If you want to monitor for "bad" activity and ban clients, that's literally what tools like fail2ban are made for.
-
Which is precisely why I'm trying to aggregate requests. I'd have thought that this would be such a frequent requirement that I'm surprised there isn't a ready-made solution.
-
It appears that writing PHP event handlers is simple and works well, and people have been using fullcalendar with PHP for some years now without issue. It's a fairly standard approach to wiring together js UI with PHP backend. Hopefully it's clear that you send and receive data in json format.
- 1 reply
-
- 1
-
-
But what is the 1st task, and how is it connected to this? My kneejerk reaction is that there are FOSS IDS tools like OSSEC you should look into. Even if you continue to go forward, an asynchronous approach is going to be better. When your site is inevitably accessed by bots/spiders, the overhead of spawnng a php process for every request is likely one that you will regret.
-
Hello, I have looked at codepen sites & have seen lots of people using this plugin, do you think that this is a Good thing to use ? I wood like to have a database filling calendar , which I can do. Thank-You. Sid
-
Since you ask, the second process is to analyse the page requests for malicious activity and, if necessary, blacklist and report the remote ip.
-
What is the application or problem you are trying to solve? This has all the hallmarks of an X/Y problem. What I can deduce: Some event occurs and some action is taken A 2nd action should be taken some time later (60 seconds in your case) However you don't want action 2 to occur in some circumstances for reasons undisclosed You've used the phrase: From your description, every request is immediately handled. Without knowing the purpose of this 2nd action, it's difficult to provide advice, but the obvious problem is that you want the 2nd action to be aware of the first action. Rather than a dumb process blocking for 60 seconds, it appears you want a process that will be created with a future event datetiime (1 minute in the future) If before it completes, a new event #1 comes in, you modify the expiration datetime and set it to 1 minute from the event Another possible low tech way of handling this would be to have process 2 implement a semaphore/lock file that is checked for when process 2 is run. Shared memory and IPC semaphores can be helpful for something like this. With that said, anytime you utilize a mechanism that relies on a single server architecture the scheme is inherently non scalable. This is where things like queues or databases typically come into play. Using some in memory server like redis is often a better platform.
-
I'm writing PHP in a web server environment behind nginx. When we receive a page request I want to issue a reply quickly and then start a timer. When the timer has expired I want to do some more work. Experiments with flush() were unfruitful so I split the work into two files and put this at the end of the first file: shell_exec("nohup php second.php $parameter 1> second.log 2> second.err"); The second file starts with a sleep() with the timeout set at around 60 seconds. It works but I really want to improve it by allowing the timer to be retriggered if another page request comes in so that second.php only runs once after all the page requests have been handled. Any ideas?
-
Validation works but no email sent, validation off email sent.
Doug replied to Doug's topic in PHP Coding Help
Thanks... it worked! One thing that needed to be changed was the, '$headers 'From:..... the 'From' was not, obviously, part of the email address. -
@gizmola Thanks. A few points that I hadn't considered in the 'bigger picture.' Also, the 'historic' aspect may be an interesting consideration.
-
There is something, not novel but persistent, that has led me to ponder: what future awaits the programming profession? Are we on the cusp of a new era for this vocation? In my observations, even students in elementary and middle school are no longer focusing on the fundamentals of programming when first introduced to coding. Instead, they immediately turn to artificial intelligence. While AI offers remarkable capabilities, it cannot replace core programming skills. Many children and adolescents today cannot write a single line of code. It is troubling that a twelve- or fifteen-year-old can become a “millionaire developer” by merely conceptualizing an app idea, feeding it into an AI tool, and accepting the finished product on the other side. The emerging generation, I believe, are not programmers; at best, they are idea generators. Educational institutions bear much of the responsibility for this shift. I do not wish to impede technological progress—it is the natural course of our times—but as schools, colleges, and universities increasingly rely on AI to handle coding assignments, the foundational discipline of programming risks disappearance. Is it appropriate for individuals to adopt the title “programmer” when they perform no programming whatsoever? If blame is to be assigned, it rests squarely with our educational system. By normalizing AI-generated code in their curricula, higher education institutions are eroding the very essence of programming. I have discussed this concern with two colleagues—both holding multiple master’s degrees in AI and IT. One specializes in artificial intelligence technology, and the other serves as a global lecturer and researcher in quantum computing and programming. They argue that this transformation is an inevitable and positive aspect of our field’s evolution. I respect their viewpoint and do not intend to obstruct global progress, but I maintain that we must preserve the critical thinking and technical rigor that define true programming expertise. My own experiments with AI-assisted development have revealed its current limitations. AI systems frequently introduce errors, exhibit limited contextual memory, and demand constant re-orientation. Far from accelerating projects wholesale, these tools can decelerate progress and introduce new challenges. While AI may soon mature enough to undertake substantial development tasks, it has not yet reached the point where it can reliably manage an entire project or even significant portions of one. Anyone who believes that mastering AI prompts alone constitutes programming proficiency has, in my view, misunderstood the discipline. I invite the community to weigh in: how do you perceive AI’s role in software development? Do you integrate AI into your workflows—partially or fully—and what have been your experiences and outcomes?