Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:22:54+00:00 2026-06-14T09:22:54+00:00

Good evening fellow overflowers, I’ve got a little problem that I’m attempting to solve

  • 0

Good evening fellow overflowers, I’ve got a little problem that I’m attempting to solve but just cant and I’m hoping you can help.

I have a script that sends strings via cURL to a website. That behaves exactly as expected, and the webpage responds okay. My problem is that there’s a set of defines on the website that I want to tap into (for illustration purposes, example below:). I’ve already added a reference to the file where the defines are stored and this works like a charm.

define(‘TABLE_COUNTER’, ‘counter’);

Let’s say (all security and mumbo-jumbo aside) my script on the website I’m sending to has a simple:

mysql_query($_POST[‘aaa’]);

Where $_POST[‘aaa’] would be a valid query. If, on the website in question I were to do the following, the result would execute:

mysql_query("SELECT * FROM " . TABLE_COUNTER);

Which translates into:

mysql_query("SELECT * FROM counter");

However I cannot seem to get the script at the website end to execute any sqlquery with a constant defined. Any help would be greatly appreciated (I’m losing a lot of hair here!).

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:22:55+00:00Added an answer on June 14, 2026 at 9:22 am

    The way to do this is with eval:

    $myquery_string = 'mysql_query('.$_POST['aaa'].');';
    eval($myquery_string);
    

    However, I don’t really recommend doing this, as it means that the form input can contain almost valid PHP code, and it will be executed by your script. This is worse than the typical SQL or XSS injection.

    Also, when filling in the form, the user will have to include all the necessary quotes around the literal parts of the query.

    A better solution would be to define a template language for your input, and have the PHP script replace template placeholders with the appropriate constants. But I’m not going to write this for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening, people! I'm trying to solve a rather simple problem, but.. well, it
Good evening I've got a little problem with my DataGridView in a .NET Windows
Good evening! Been searching all over, and I'm afraid I've just got something completely
Good evening. I'm developing an android application that uses Facebook SDK. I've no problem
good evening fellow code bashers: i know it should be simple, but i'm tired
Good Evening, The problem is that i have both xcode 3.2 and xcode 4
Good evening everyone, I was hoping you could help with an Objective-C question I
Good evening, In my app that I'm currently developing, I have a class that
Good evening all, I've been working on an MD5 tool in C# that takes
Good evening everyone. I am puzzling over the oddity that the jQuery Marquee plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.