Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

newuserphp

Members
  • Joined

  • Last visited

  1. This is on the parent-page : i f(isset($_POST['submit']) { $_SESSION['response'] = $_POST['selection']; And this is my code on the child-window : if (!(isset($_SESSION['login']) && $_SESSION['login'] != '') || (!isset($_SESSION['response']))) { header ("Location: www.example.com/access_denied.php"); exit() ; } Still not working The child-window is still accessible directly The "radio selection" is being made on the parent-page. But, the check needs to be performed on the child-window, doesnt it? Otherwise, the child-window will be accessible each time
  2. "....................does it post to itself to set $_SESSION['response']? Child Page - This will display information based on the selection from the first page?.............." Yes, this is the case. The parent-page posts to itself. When the SUBMIT button is clicked, then the child_window (new window) opens. Which is why I need a code which prevents access to this child_window directly
  3. Hello. I'm trying to include a small PHP code at the beginning of a certain file (which is a "new window"), which would prevent the user from directly accessing the file, if he inputs the URL directly into his browser. In other words : my website functions in such a way that, first the user has to make a radio-selection on the parent window, and click "submit", which opens a new "child" window. But, first the user has to be logged in! In order to prevent the window from opening, I wrote this code at the very beginning of the PHP file (for both parent and child windows) : <?php session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) { header ("Location: www.example.com/access_denied.php"); exit() ; If the user is not logged in, and he tries to go directly to a particular URL, he is re-directed to a file which displays an "ACCESS DENIED" text. However, for this particular situation (as explained above), the user first needs to make a selection on a parent page. If he does not choose anything on the parent-page, and simply enters the URL for the "child window" in his browser, he is still able to access the php file directly (which I do not want) The radio selection on the parent-page is as follows : if(isset($_POST['submit']) { $_SESSION['response'] = $_POST['selection']; On the child_window, I added the following code : if (!(isset($_SESSION['login']) && $_SESSION['login'] != '') || (isset($_SESSION['login']) && (!(isset($_POST['selection')))) { header ("Location: www.example.com/access_denied.php"); Meaning : even if the user is logged in..........unless he has made a selection on the parent-page, he cannot access the child-window. But, this code is not working. I even tried to create a random "$_SESSION" variable on the parent-page, which is activated once a radio-selection has been made.............and, on the child-window, I wrote a code, saying : if this random $_SESSION has not been set, the child-window would give an "access-denied" message. Still, this does not work. The user is still able to view and access the child-window by typing in the direct URL. Any help would be appreciated. Thanks
  4. Perhaps, it's my fault for not having stated my entire file-structure from the start I simply didn't think it was necessary, because, as I mentioned earlier : the second rule works perfectly. So, I assumed that the same format would work with the third rule. My file structure is as follows (from ROOT folder to file_name) : www.example.com/Principal/Rolan/file_name For the second rule, the file-structure is exactly the same. www.example.com/Principal/Project/file_name When I created the second rule (to hide the Project folder), I changed all my URLs in my php-code, to the following : /Principal/file_name And, it works. the "Project" folder is hidden from view So, naturally, when I wanted to do the same for "Rolan", I thought the same principle applies. But, I guess I was wrong. So............using the new HTACCESS code you just gave me : RewriteRule ^gagoo/([^/]+)/([^/]+)/?$ $1/$2.php [NC,L] I guess that : I should replace "gagoo" with "Rolan"..............and then change all my URL (in the php files) to : /Principal/file_name Am I on the right track ?
  5. I am still getting the 404 error Should I write the URL with our without "Rolan" ? /gagoo/file_name or /gagoo/Rolan/file_name ? I tried both; neither are working;
  6. Thanks, Nock. But, I'm still getting the error "404 : File not found" Am I using the correct URL in my code : /gagoo/Rolan/file_name ? (I also tried removing the "Rolan" from the URL : /gagoo/file_name. But it still does not work) I assume the "Rolan" should NOT be there (since, the purpose of the Rule is to hide the "Rolan" from the URL in the browser, the same way the first Rule hides the "PHP" folder from view)
  7. I created a Rule in my HTACCESS file, to hide a sub-folder. RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [NC] RewriteRule ^ /%1/%3 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/?$ $1/Project/$2.php [NC,L] The first rule removes all file-extensions : php The second rule will hide the folder "Project" from the URL Both these rules are working perfectly. However, when I tried to add a third rule, to hide another folder, it failed. This second folder (Rolan) is in the same location as the "Project" folder, so I assumed that it should work simply by copy-pasting the second rule, and then adding a PREFIX to the beginning of the third rule : RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [NC] RewriteRule ^ /%1/%3 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/?$ $1/Project/$2.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^gagoo/([^/]+)/([^/]+)/?$ $1/Rolan/$2.php [NC,L] I added the prefix "gagoo" to the third rule. Also, I removed the [NC,L] from the end of the second rule, and placed it at the end of the third rule. Then, in my PHP code, I wrote the URL as follows : www.example.com/gagoo/Rolan/file_name Both the first and second rules are still working. But, for the third rule, I am getting a "FILE NOT FOUND : 404" error. The thing is : I wrote a JavaScript code, which opens "file_name" in a "New Window". (Still, I doubt that this could be the reason for the problem)
  8. I created a Rule in my HTACCESS file, to hide a sub-folder. RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [NC] RewriteRule ^ /%1/%3 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/?$ $1/Project/$2.php [NC,L] The first rule removes all file-extensions : php The second rule will hide the folder "Project" from the URL Both these rules are working perfectly. However, when I tried to add a third rule, to hide another folder, it failed. This second folder (Rolan) is in the same location as the "Project" folder, so I assumed that it should work simply by copy-pasting the second rule, and then adding a PREFIX to the beginning of the third rule : RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [NC] RewriteRule ^ /%1/%3 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/?$ $1/Project/$2.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^gagoo/([^/]+)/([^/]+)/?$ $1/Rolan/$2.php [NC,L] I added the prefix "gagoo" to the third rule. Also, I removed the [NC,L] from the end of the second rule, and placed it at the end of the third rule. Then, in my PHP code, I wrote the URL as follows : www.example.com/gagoo/Rolan/file_name Both the first and second rules are still working. But, for the third rule, I am getting a "FILE NOT FOUND : 404" error The thing is : I wrote a JavaScript code, which opens "file_name" in a "New Window". (Still, I doubt that this could be the reason for the problem)
  9. This is 2015 ???????????? REALLY ????? Damn, time sure flies when you got work to do
  10. Quick question : if I had a file-path that looked like this : www.example.com/CODE/myfile.php www.example.com/CODE/HTML/myfile.html Basically, I want to hide everything that comes AFTER "Code". Like so : www.example.com/CODE/..................... How can I add it to my HTACCESS file ? My file already looks like this : Options -Indexes Options -MultiViews Options +FollowSymlinks <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> From the links you gave me, I'm guessing I need to add something like this : RewriteEngine On RewriteRule ^/pages/(.+)\.php $1\.php [NC, L]
  11.    newuserphp reacted to a post in a topic: iFrame tag not displaying properly
  12. Now, THAT'S more like it It shows the whole window now But, with a scroll bar..............maybe, I should set the "scrolling" back to "no"
  13. Still, this does not solve my issue Removing the Height and Width parameters only made it worse : the window shrank even further, to the size of a cell phone And, styling the width and height in CSS did not change anything : <!doctype html> <html> <head> <title>MY IFRAME TEST</title> <style type="text/css"> body { margin: 0; } iframe { width:100%; height:100%; } </style> </head> <body> <iframe src="mytest.html"> </iframe> </body> </html>
  14. Thanks for the response, Nillerversion. Regarding the closing tag..........that was just a typo on my part. It was not part of my code. (My original code is exactly as you wrote it). As regards the bad effects of iFrame..........yes, I'm aware of them. Aside from the one you mentioned, regarding SEO, iFrames also : (a) prevent users from Bookmarking specific pages on one's website; ( b ) cause difficulties with Debugging, Of course, I would much rather have used the HTACCESS file. But, the "Rewrite" command in htaccess does not hide folders or filenames. It simply re-directs from one page to another. Meaning : the "target" page has to exist anyway.
  15. There is nothing missing
  16. I am trying to use the iFrame tag to hide my folder and file-names in my URL. I've found the correct syntax from online tutorials. However, when I execute it, for some reason, the window which is displayed is severely "restricted" The Height and Width are restricted to only about a fifth of the entire screen. Here is the code for my INDEX.HTML file : <!DOCTYPE HTML> <html> <head> <title>My Title</title> </head> <body> <iframe src="mytest.html" height="100%" width="100%" name="Your Title" /> </iframe> </body> </html> Index.html is, of course, the default webpage for my website. So, when it's executed, the browser goes to : MYTEST.HTML I thought that setting the HEIGHT and WIDTH to 100% was supposed to take care of this issue. But, it didn't. So, I decided to add some CSS styling, as follows : <!DOCTYPE HTML> <html> <head> <title>Your Title</title> <style type="text/css"> <!-- Full Screen Page Fix --> body { margin: 0; } </style> </head> <body> <iframe src="mytest.html" height="100%" width="100%" name="Your Title" /> </iframe> </body> </html> I also added the attributes : frameborder="0" scrolling="no" And, then, I changed to : frameborder="0" scrolling="yes" But, this still did not resolve the issue. Is the problem with my browser itself? Although, I doubt it.........seeing as I've tested this with Chrome, Mozilla, and IE

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.