Problem highlighting a line on an html form [duplicate] - php

Is there a standard for what actions F5 and Ctrl+F5 trigger in web browsers?
I once did experiment in IE6 and Firefox 2.x. The F5 refresh would trigger a HTTP request sent to the server with an If-Modified-Since header, while Ctrl+F5 would not have such a header. In my understanding, F5 will try to utilize cached content as much as possible, while Ctrl+F5 is intended to abandon all cached content and just retrieve all content from the servers again.
But today, I noticed that in some of the latest browsers (Chrome, IE8) it doesn't work in this way anymore. Both F5 and Ctrl+F5 send the If-Modified-Since header.
So how is this supposed to work, or (if there is no standard) how do the major browsers differ in how they implement these refresh features?

It is up to the browser, but they behave in similar ways.
F5 usually updates the page only if it is modified. Modern browsers send Cache-Control: max-age=0 to tell any cache the maximum amount of time a resource is considered fresh, relative to the time of the request.
CTRL-F5 is used to force an update, disregarding any cache. Modern browsers send Cache-Control: no-cache and Pragma: No-cache
If I remember correctly, it was Netscape that was the first browser to add support for cache-control by adding Pragma: No-cache when you pressed CTRL-F5.
┌───────────┬──────────────┬─────┬─────────────────┬──────────────────────────────┐
│ Version 4 │ F5 │ R │ CLICK │ Legend: │
│2021 MAY 19├──┬──┬──┬──┬──┼──┬──┼──┬──┬──┬──┬──┬──┤ C = Cache-Control: no-cache │
│ │ │S │C │A │A │C │C │ │S │C │A │A │C │ I = If-Modified-Since │
│ │ │H │T │L │L │T │T │ │H │T │L │L │T │ M = Cache-Control: max-age=0 │
│ │ │I │R │T │T │R │R │ │I │R │T │T │R │ N = Not tested │
│ │ │F │L │ │G │L │L │ │F │L │ │G │L │ P = Pragma: No-cache │
│ │ │T │ │ │R │ │+ │ │T │ │ │R │+ │ - = ignored │
│ │ │ │ │ │ │ │S │ │ │ │ │ │S │ │
│ │ │ │ │ │ │ │H │ │ │ │ │ │H │ With 'CLICK' I refer to a │
│ │ │ │ │ │ │ │I │ │ │ │ │ │I │ mouse click on the browsers │
│ │ │ │ │ │ │ │F │ │ │ │ │ │F │ refresh-icon. │
│ │ │ │ │ │ │ │T │ │ │ │ │ │T │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ 1: Version 3.0.6 sends I │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ and C, but 3.1.6 opens │
│Brave 1.24 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ the page in a new tab, │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ making a normal request │
│Chrome 1 │MI│MI│MI│- │- │MI│- │MI│MI│MI│MI│MI│N │ with only I. │
│Chrome 6 │MI│CP│CP│- │- │MI│CP│MI│CP│CP│MI│- │N │ 2: Version 10.62 does │
│Chrome 90 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ nothing. 9.61 might do C │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ unless it was a typo in │
│Edge 90 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ my old table. │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ 3: Opens the currernt tab in │
│Firefox 3.x│MI│- │CP│- │- │MI│CP│MI│CP│1 │M │MI│N │ a new tab, but does not │
│Firefox 89 │M │- │CP│- │M │M │CP│M │CP│3 │M │M │3 │ refresh the page if it is │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ cached in the browser. │
│MSIE 8, 7 │I │- │C │- │I │I │ │I │I │C │I │I │N │ │
├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ │
│Opera 10, 9│C │- │- │2 │- │C │- │C │C │C │C │- │N │ │
│Opera 76 │M │CP│CP│- │- │M │- │M │CP│CP│M │CP│CP│ │
├───────────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──────────────────────────────┤
│ https://stackoverflow.com/a/385491/36866 │
└─────────────────────────────────────────────────────────────────────────────────┘
Note about Chrome 6.0.472: If you do a forced reload (like CTRL-F5) it behaves like the url is internally marked to always do a forced reload. The flag is cleared if you go to the address bar and press enter.

Generally speaking:
F5 may give you the same page even if the content is changed, because it may load the page from cache. But Ctrl+F5 forces a cache refresh, and will guarantee that if the content is changed, you will get the new content.

I've implemented cross-browser compatible page to test browser's refresh behavior (here is the source code) and get results similar to #some, but for modern browsers:

At least in Firefox (v3.5), cache seems to be disabled rather than simply cleared. If there are multiple instances of the same image on a page, it will be transferred multiple times. That is also the case for img tags that are added subsequently via Ajax/JavaScript.
So in case you're wondering why the browser keeps downloading the same little icon a few hundred times on your auto-refresh Ajax site, it's because you initially loaded the page using CTRL-F5.

IE7/8/9 seem to behave differently depending on whether the page has focus or not.
If you click on the page and CTRL+F5 then "Cache-Control: no-cache" is included in the request headers. If you click in the Location/Address bar then press CTRL+F5 it isn't.

When user press F5 although new request goes to web server and get a responce for the request as well. But when the responce header is Parsed it check the required information in browser cache. If the required information in cache has not expired then that information is restored from in cache itself.
When user click on CTRL-F5 even then new request goes to web server and get a responce. But this time when the responce header is Parsed it do not check any required information in cache, and bring all updated information form server only.

Related

Static website 404 error page for Google App Engine

I have a completely static website that'd I've deployed to Google App Engine, but I cannot get it to return my custom 404 page, just the generic one like this.
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Not Found</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Not Found</h1>
<h2>The requested URL <code>/foo</code> was not found on this server.</h2>
<h2></h2>
</body></html>
I've tried all the solutions I can find but still cannot get it to work. I tried adding require_matching_file: true as recommended in this answer but to no avail. I've also tried to "Edit website configuration" under the bucket storage options.
This is my app.yaml file.
runtime: php55
api_version: 1
threadsafe: true
# Handle the main page by serving the index page.
handlers:
- url: /$
static_files: build/index.html
upload: build/index.html
# Handle folder urls by serving the index.html page inside.
- url: /(.*)/$
static_files: build/\1/index.html
upload: build/.*/index.html
# Handle nearly every other file by just serving it.
- url: /(.+)
static_files: build/\1
upload: build/(.*)
# all other pages are a 404
- url: /.*
static_files: build/404.html
upload: build/404.html
# This doesn't work either
error_handlers:
- file: build/404.html
This is my website's directory structure.
build
│
│ index.html
│ 404.html
│
└───blog
│ │ index.html
│ │
│ └───post-1
│ │ index.html
│ post-2
│ │ index.html
│ | ...
│
└───data
│ │ blog-posts.json
│ │ projects.json
│
└───img
│ │ image-1.jpg
│ │ image-2.jpg
│ | ...
│
└───projects
│ │ index.html
│ │
│ └───project-1
│ │ index.html
│ project-2
│ │ index.html
│ | ...
│
└───static
│ │
│ └───css
│ │ styles.css
│ js
│ │ scripts.js
│
Ultimately I'd like to use a PHP 404 page to send the proper 404 header, but right now I'd settle for a plain HTML page.
This the app.yaml file that worked for me.
runtime: php55
api_version: 1
threadsafe: true
# Handle the main page by serving the index page.
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
# Handle folder urls by serving the index.html page inside
- url: /(.*)/$
static_files: build/\1/index.html
upload: build/.*/index.html
# Handle other file types by just serving them
- url: /(.*\.(css|js|json|gif|eot|png|jpg|jpeg|ico|svg|xml|woff|woff2))$
static_files: build/\1
upload: build/.*\.(css|js|json|gif|eot|png|jpg|jpeg|ico|svg|xml|woff|woff2)$
# all other pages are a 404
- url: /.*
script: build/404.php
The structure is the same as posted in the question, I just changed 404.html to 404.php.

xampp object not found error after clicking on activation link

I am following one tutorial for signup and sign in using email verification.
It works fine and it sends a confirmation link on provided email id.
It shows:
I have tried adding alies as well but didn't work
I don't know how do i solve it. Please guide me.
File Structure:
C:.
│
│
│
└───signup-email-verification
│ class.user.php
│ dbconfig.php
│ fpass.php
│ home.php
│ index.php
│ logout.php
│ resetpass.php
│ signup.php
│ store-signup.php
│ tbl_users.sql
│ verify.php
│
├───bootstrap
│ ├───css
│ │ bootstrap-responsive.css
│ │ bootstrap-responsive.min.css
│ │ bootstrap.css
│ │ bootstrap.min.css
│ │
│ ├───img
│ │ glyphicons-halflings-white.png
│ │ glyphicons-halflings.png
│ │
│ └───js
│ bootstrap.js
│ bootstrap.min.js
│ jquery-1.9.1.min.js
│
└───mailer
class.phpmailer.php
class.pop3.php
class.smtp.php
I was trying to access below link
localhost/drop2/signup-email-verification/store-signup.php
As you mentioned in your comment, you are trying to access store-signup.php using below URL.
localhost/drop2/signup-email-verification/store-signup.php
Now, as per above URL, your application should be drop2 and store-signup.php resides under signup-email-verification folder. That means, you folder structure should be
drop2
|
|--- signup-email-verification
|
|---store-signup.php
As per your posted folder structure, you don't have drop2 folder itself.
Also, you are suppose to place your project folder under your server root folder not in C: drive.

Empty libs.css and libs.js files

I compiled my styles and scripts using webpack, but I noticed that the libs.css and libs.js files are empty rather I have entries in the app.cs and app.js files. Here are my npm settings:
:- webpack.mix.js:
const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js/')
.sass('resources/assets/sass/app.scss', 'public/css/');
mix.styles([
'libs/animate.css',
'libs/animations.css',
'libs/app.css',
'libs/bootstrap-theme.css',
'libs/bootstrap.css',
'libs/custom.css',
'libs/font-awesome.min.css',
'libs/head-custom.css',
'libs/sb-admin-2.css',
'libs/sticky.css',
'libs/style.css',
], './public/css/libs.css');
mix.scripts([
'libs/app.js',
'libs/bootstrap.js',
'libs/custom.js',
'libs/gmap.js',
'libs/ipad.js',
'libs/jquery.form.min.js',
'libs/jquery.min.js',
'libs/jquery.pjax.js',
'libs/jquery.slim.min.js',
'libs/myform.js',
'libs/sb-admin-2.js',
'libs/sb-admin-2.min.js',
'libs/sticky.js',
'libs/template.js',
], './public/js/libs.js');
mix.scripts([
'/plugins/jquery.appear.js',
'/plugins/jquery.backstretch.min.js',
'/plugins/modernizr.js',
'/plugins/libs3/jquery.js',
], './public/js/plugins/plugins.js');
mix.scripts([
'/libs/isotope.pkgd.js',
], './public/js/plugins/isotope/isotope.js');
:- mix-manifest.json:
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css",
"./public/css/libs.css": "./public/css/libs.css",
"./public/js/libs.js": "./public/js/libs.js",
"./public/js/plugins/plugins.js": "./public/js/plugins/plugins.js",
"./public/js/plugins/isotope/isotope.js": "./public/js/plugins/isotope/isotope.js"
}
:- Directory structure of resource folder:
resources/
├── assets
│ ├── css
│ │ └── libs
│ │ ├── animate.css
│ │ ├── animations.css
│ │ ├── app.css
│ │ ├── bootstrap.css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap-theme.min.css
│ │ ├── custom.css
│ │ ├── font-awesome.min.css
│ │ ├── head-custom.css
│ │ ├── sb-admin-2.css
│ │ ├── sb-admin-2.min.css
│ │ ├── sticky.css
│ │ └── style.css
│ ├── js
│ │ ├── app.js
│ │ ├── bootstrap.js
│ │ ├── components
│ │ │ └── Example.vue
│ │ ├── libs
│ │ │ ├── app.js
│ │ │ ├── bootstrap.js
│ │ │ ├── custom.js
│ │ │ ├── gmap.js
│ │ │ ├── ipad.js
│ │ │ ├── isotope.pkgd.js
│ │ │ ├── jquery.form.min.js
│ │ │ ├── jquery.min.js
│ │ │ ├── jquery.pjax.js
│ │ │ ├── jquery.slim.min.js
│ │ │ ├── myform.js
│ │ │ ├── sb-admin-2.js
│ │ │ ├── sb-admin-2.min.js
│ │ │ ├── sticky.js
│ │ │ └── template.js
│ │ └── plugins
│ │ ├── jquery.appear.js
│ │ ├── jquery.backstretch.min.js
│ │ ├── libs3
│ │ │ └── jquery.js
│ │ └── modernizr.js
│ └── sass
│ ├── app.scss
│ └── _variables.scss
Try this code below...
mix.styles(['resources/assets/css/libs/animate.css', 'resources/assets/css/libs/animations.css', 'resources/assets/css/libs/app.css', 'resources/assets/css/libs/bootstrap-theme.css', 'resources/assets/css/libs/bootstrap.css', 'resources/assets/css/libs/custom.css', 'resources/assets/css/libs/font-awesome.min.css', 'resources/assets/css/libs/head-custom.css', 'resources/assets/css/libs/sb-admin-2.css', 'resources/assets/css/libs/sticky.css', 'resources/assets/css/libs/style.css' ], 'public/css/libs.css', './');
mix.scripts(['resources/assets/js/libs/app.js', 'resources/assets/js/libs/bootstrap.js', 'resources/assets/js/libs/custom.js', 'resources/assets/js/libs/gmap.js', 'resources/assets/js/libs/ipad.js', 'resources/assets/js/libs/jquery.form.min.js', 'resources/assets/js/libs/jquery.min.js', 'resources/assets/js/libs/jquery.pjax.js', 'resources/assets/js/libs/jquery.slim.min.js', 'resources/assets/js/libs/myform.js', 'resources/assets/js/libs/sb-admin-2.js', 'resources/assets/js/libs/sb-admin-2.min.js', 'resources/assets/js/libs/sticky.js', 'resources/assets/js/libs/template.js' ], 'public/js/libs.js', './');
I think all paths should be relative to the root of the project (where webpack.mix.js is). Try
mix.styles([
'resources/assets/css/libs/animate.css',
//...
], 'public/css/libs.css')
mix.scripts([
'resources/assets/js/libs/app.js',
//...
], 'public/js/libs.js')
After much research I was able to use a laravel project to determine the reason for the empty files. The right syntax should have bee some like this:
mix.js('resources/assets/js/app.js', 'public/js/libs.js')
.sass('resources/assets/sass/app.scss', 'public/css/libs.css');
I should have specified destination file, so the right syntax would be some thing similar to:
```
const { mix } = require('laravel-mix');
mix
.js('resources/assets/js/app.js', 'public/js/app.js')
.js('resources/assets/js/bootstrap.js', 'public/js/app.js')
.js('resources/assets/js/plugins/jquery.appear.js', 'public/js/plugins/jquery.appear.js')
.js('resources/assets/js/plugins/jquery.backstretch.min.js', 'public/js/plugins/jquery.backstretch.min.js')
.js('resources/assets/js/plugins/modernizr.js', 'public/js/plugins/modernizr.js')
.combine([
'resources/assets/js/libs/app.js',
'resources/assets/js/libs/bootstrap.js',
'resources/assets/js/libs/custom.js',
'resources/assets/js/libs/gmap.js',
'resources/assets/js/libs/ipad.js',
'resources/assets/js/libs/jquery.form.min.js',
'resources/assets/js/libs/jquery.min.js',
'resources/assets/js/libs/jquery.pjax.js',
'resources/assets/js/libs/jquery.slim.min.js',
'resources/assets/js/libs/myform.js',
'resources/assets/js/libs/sb-admin-2.js',
'resources/assets/js/libs/sb-admin-2.min.js',
'resources/assets/js/libs/sticky.js',
'resources/assets/js/libs/template.js',], 'public/js/libs/libs.js')
.js('resources/assets/js/isotope/isotope.pkgd.min.js', 'public/js/plugins/isotope/isotope.pkgd.min.js')
.sass('resources/assets/sass/app.scss', 'public/css/lib.css')
.version();
```
The combine syntax should have been used to combine my javascript files.
Help source:
https://github.com/udoyen/blender

PHP - Silex: Fatal error: Class not found

I've made a PHP application with Silex. I'm using a WAMP solution on my laptop to develop, in combination with Composer.
Now, when I upload the application (maps 'app', 'src' and 'web') and upload the database, change the config.php to the correct database credentials I issue the composer command (composer.phar -o install) to install the vendor dependencies.
Until this point everything works, Composer makes the 'vendor' map and installs the dependencies without errors. But when I visit the website it shows me the error:
Fatal error: Class 'WanaKo\Provider\Controller\HomeController' not found in /home/wanako/domains/wanako.net/app/app.php on line 37
What can I do to fix that error? I must add that the server is running DirectAdmin with PHP 5.5.16 and that I've made a symlink from 'public_html/' to 'web/'
The directory structure is:
/home/wanako/domains/wanako.net/
├── app
├── logs
├── public_ftp
│ └── incoming
├── public_html -> web/
├── src
│ ├── wanako
│ │ ├── provider
│ │ │ └── controller
│ │ └── repository
│ └── views
│ ├── errors
│ └── home
├── vendor
│ ├── composer
│ ├── doctrine
│ │ ├── common
│ │ └── dbal
│ ├── igorw
│ │ └── config-service-provider
│ ├── imagine
│ │ └── imagine
│ ├── ircmaxell
│ │ └── password-compat
│ ├── knplabs
│ │ └── repository-service-provider
│ ├── monolog
│ │ └── monolog
│ ├── neutron
│ │ └── silex-imagine-provider
│ ├── pimple
│ │ └── pimple
│ ├── psr
│ │ └── log
│ ├── silex
│ │ └── silex
│ ├── swiftmailer
│ │ └── swiftmailer
│ ├── symfony
│ │ ├── config
│ │ ├── debug
│ │ ├── event-dispatcher
│ │ ├── filesystem
│ │ ├── form
│ │ ├── http-foundation
│ │ ├── http-kernel
│ │ ├── icu
│ │ ├── intl
│ │ ├── locale
│ │ ├── options-resolver
│ │ ├── property-access
│ │ ├── routing
│ │ ├── security-core
│ │ ├── security-csrf
│ │ ├── translation
│ │ ├── twig-bridge
│ │ └── validator
│ └── twig
│ └── twig
└── web
├── css
├── font
├── images
└── js
composer.json
{
"name": "Wanako/Wakano.net",
"require": {
"silex/silex": "1.0.*#dev",
"twig/twig": ">=1.8,<2.0-dev",
"doctrine/dbal": "2.*",
"knplabs/repository-service-provider": "dev-master",
"symfony/twig-bridge": "~2.1",
"symfony/form": "~2.1",
"symfony/validator": "~2.1",
"symfony/config": "~2.1",
"symfony/translation": "~2.1",
"symfony/locale": "~2.1",
"monolog/monolog": ">=1.0.0",
"igorw/config-service-provider": "~1.1",
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
"ircmaxell/password-compat": "dev-master",
"neutron/silex-imagine-provider": "~0.1"
},
"autoload": {
"psr-0": {
"WanaKo": "./src/"
}
}
}
At line 37 of app/app.php I've got:
$app->mount('/', new WanaKo\Provider\Controller\HomeController());
homecontroller.php (in the folder src/wanako/provider/controller/)
<?php
namespace WanaKo\Provider\Controller;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\Validator\Constraints as Assert;
class HomeController implements ControllerProviderInterface {
$controllers = $app['controllers_factory'];
// Bind sub-routes
$controllers->get('/', array($this, 'home'))->method('GET')->bind('home.news');
return $controllers;
}
public function home(Application $app) {
// STUFF
}
I've got no clue on this one. Is there something I did wrong? Wrong folder structure? Something I forgot? If anyone needs more info, just ask. Thanks for helping out!
I believe you have to name your folder structure and files in the correct case for psr0 to work correctly, like this:
src/WanaKo/Provider/Controller/HomeController.php

cakephp: running diffrent cakephp verison on same domain

I have already installed cakephp verion 1.3 on root of domain for Application1.
Now i want to develop another music application, that i want to store in a sub-directory. Now i want to use latest cakephp version for this application.
I am new to cakephp, and donot want to use same cakephp core for both application. First root application was not developed by me.
Directory structure is a s follow.
ROOT
├── .htaccess
├── cake
│ ├── config
│ ├── console
│ ├── libs
│ ├── tests
├── app
│ │ ├── .htaccess
│ │ ├── libs
│ │ ├── vendors
│ │ ├── config
│ │ ├── plugins
│ │ ├── views
│ │ ├── models
│ │ ├── controllers
│ │ ├── temp
│ │ ├── WEBROOT
│ │ │ ├── .htaccess
├──music (this one i want to use for latest version cakephp installation).
I installed cakephp 2.5.2 in music directory, but unable to access this by www.example.com/music/
It redirect to first root application i.e. example.com/member/index.
In
├── app
│ │ ├── config
│ │ ├ ├──routes.php
I have this:
Router::connect('/', array('controller' => 'members', 'action' => 'index'));
If unable to understand what i want:
My Question:
How can i run two different cakephp version, one on root of the domain
and second in subdirectory (music).
If not possible i will use same version, but one application will be in music sub directory.
Both the versions should work fine, just make sure you have not written a htaaccess rule to redirect all incoming request to the first cakephp folder.

Categories