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

      Designing For TV: Principles, Patterns And Practical Guidance (Part 2)

      September 5, 2025

      Neo4j introduces new graph architecture that allows operational and analytics workloads to be run together

      September 5, 2025

      Beyond the benchmarks: Understanding the coding personalities of different LLMs

      September 5, 2025

      Top 10 Use Cases of Vibe Coding in Large-Scale Node.js Applications

      September 3, 2025

      Building smarter interactions with MCP elicitation: From clunky tool calls to seamless user experiences

      September 4, 2025

      From Zero to MCP: Simplifying AI Integrations with xmcp

      September 4, 2025

      Distribution Release: Linux Mint 22.2

      September 4, 2025

      Coded Smorgasbord: Basically, a Smorgasbord

      September 4, 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

      Drupal 11’s AI Features: What They Actually Mean for Your Team

      September 5, 2025
      Recent

      Drupal 11’s AI Features: What They Actually Mean for Your Team

      September 5, 2025

      Why Data Governance Matters More Than Ever in 2025?

      September 5, 2025

      Perficient Included in the IDC Market Glance for Digital Business Professional Services, 3Q25

      September 5, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      How DevOps Teams Are Redefining Reliability with NixOS and OSTree-Powered Linux

      September 5, 2025
      Recent

      How DevOps Teams Are Redefining Reliability with NixOS and OSTree-Powered Linux

      September 5, 2025

      Distribution Release: Linux Mint 22.2

      September 4, 2025

      ‘Cronos: The New Dawn’ was by far my favorite experience at Gamescom 2025 — Bloober might have cooked an Xbox / PC horror masterpiece

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

    CodeSOD: The Variable Toggle

    April 21, 2025

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

    <script>
        <span class="hljs-meta"><?php</span> <span class="hljs-keyword">if</span> (someVal) { <span class="hljs-meta">?></span>
            <span class="hljs-keyword">var</span> foo = <span class="hljs-meta"><?</span> <span class="hljs-keyword">echo</span> someOtherVal <span class="hljs-meta">?></span>;
        <span class="hljs-meta"><?php</span> } <span class="hljs-keyword">else</span> { <span class="hljs-meta">?></span>
            <span class="hljs-keyword">var</span> foo = <span class="hljs-number">5</span>;
        <span class="hljs-meta"><?php</span> } <span class="hljs-meta">?></span>
    </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>
        <span class="hljs-keyword">if</span>(linkfromwhere_srfid==<span class="hljs-string">'vff'</span>)
          {
        <span class="hljs-meta"><?php</span>
        <span class="hljs-variable">$vff</span> = <span class="hljs-number">1</span>;
        <span class="hljs-meta">?></span>
          }
    </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

    Building smarter interactions with MCP elicitation: From clunky tool calls to seamless user experiences

    September 4, 2025
    News & Updates

    From Zero to MCP: Simplifying AI Integrations with xmcp

    September 4, 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

    The most competent robot vacuum I tested last year just got a major upgrade

    News & Updates

    Uphold ethical standards in fashion using multimodal toxicity detection with Amazon Bedrock Guardrails

    Machine Learning

    Divine Comedy

    News & Updates

    African training program creates developers with cloud-native skills

    Tech & Work

    Highlights

    A Behind-the-Scenes Look at the New Jitter Website

    September 2, 2025

    How Jitter reimagined its website to highlight collaboration, creativity, and motion design at scale. Source:…

    Convert Eloquent Models to HLS Video

    July 15, 2025

    CVE-2025-47815 – GNU PSPP Heap-Based Buffer Overflow Vulnerability

    May 10, 2025

    Windows 11’s BSOD isn’t going anywhere. It’s now black, faster, and confusing

    July 4, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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