Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 6, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 6, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 6, 2025

      AI is currently in its teenage years, battling raging hormones

      June 6, 2025

      4 ways your organization can adapt and thrive in the age of AI

      June 6, 2025

      Google’s new Search tool turns financial info into interactive charts – how to try it

      June 6, 2025

      This rugged Android phone has something I’ve never seen on competing models

      June 6, 2025

      Anthropic’s new AI models for classified info are already in use by US gov

      June 6, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Handling PostgreSQL Migrations in Node.js

      June 6, 2025
      Recent

      Handling PostgreSQL Migrations in Node.js

      June 6, 2025

      How to Add Product Badges in Optimizely Configured Commerce Spire

      June 6, 2025

      Salesforce Health Check Assessment Unlocks ROI

      June 6, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft: Run PS script now if you deleted “inetpub” on Windows 11, Windows 10

      June 6, 2025
      Recent

      Microsoft: Run PS script now if you deleted “inetpub” on Windows 11, Windows 10

      June 6, 2025

      Spf Permerror Troubleshooting Guide For Better Email Deliverability Today

      June 6, 2025

      Amap – Gather Info in Easy Way

      June 6, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: The Variable Toggle

    CodeSOD: The Variable Toggle

    April 21, 2025
    CodeSOD: The Variable Toggle

    A common class of bad code is the code which mixes server side code with client side code. This kind of thing:

    <script>
        <?php if (someVal) { ?>
            var foo = <? echo someOtherVal ?>;
        <?php } else { ?>
            var foo = 5;
        <?php } ?>
    </script>
    

    We’ve seen it, we hate it, and is there really anything new to say about it?

    Well, today’s anonymous submitter found an “interesting” take on the pattern.

    <script>
        if(linkfromwhere_srfid=='vff')
          {
        <?php
        $vff = 1;
        ?>
          }
    </script>
    

    Here, they have a client-side conditional, and based on that conditional, they attempt to set a variable on the server side. This does not work. This cannot work: the PHP code executes on the server, the client code executes on the client, and you need to be a lot more thoughtful about how they interact than this.

    And yet, the developer responsible has done this all over the code base, pushed the non-working code out to production, and when it doesn’t work, just adds bug tickets to the backlog to eventually figure out why- tickets that never get picked up, because there’s always something with a higher priority out there.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleZentyal Server is a unified network server Linux distribution
    Next Article CVE-2025-0632 – Formulatrix Rock Maker Web Local File Inclusion Vulnerability

    Related Posts

    News & Updates

    4 ways your organization can adapt and thrive in the age of AI

    June 6, 2025
    News & Updates

    Google’s new Search tool turns financial info into interactive charts – how to try it

    June 6, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Clair Obscur: Expedition 33 delights with an Xbox Developer_Direct 2025 deep dive — oh, and a spring release date, too

    News & Updates

    This new Philips smart lock combines palm recognition with a built-in camera for ultimate security

    News & Updates

    No DisplayLink Enabled Display Detected [6 Quick Fixes]

    Operating Systems

    Google Cloud: Driving digital transformation

    Artificial Intelligence

    Highlights

    News & Updates

    CodeSOD: Anything and Everything

    June 4, 2025

    Today’s short function comes from Janusz, and it’s anything you want it to be: public…

    How to Check the Number of Dynamic Dashboards in Salesforce?

    March 28, 2025

    Co-op CEO to Members: We’re Fighting to Protect Your Data

    May 15, 2025

    Hiring Kit: Platform Developer

    January 16, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.