Jump to content

How to have a php code check to see if html value has been modifed?


ghurty

Recommended Posts

I have the following html part of my code: <img src="images/top01.jpg" height="162" width="800">

 

 

I would like to write a little PHP code to place somewhere else in the script that if any of the info is changed in that line, it will display an error on the page and halt it from loading.

 

How would the code go.

 

Thanks

Link to comment
Share on other sites

$str = '<img src="images/top01.jpg" height="162" width="800">';

if ($str != '<img src="images/top01.jpg" height="162" width="800">') { 
   die ("HTML has changed");
}

 

But this question makes no sense. Client side JS is so easily evaded, serverside they would need to modify virtually nothing to change it.

Link to comment
Share on other sites

I am providing someone with some php code that I wrote, and I dont want them modifcations on it without having to come back to me.

 

They would want to modify the image variables.

 

So I want to use php (not js) code to make sure it stays the same, and I would obfuscate that code.

Thakns

 

Link to comment
Share on other sites

I am providing someone with some php code that I wrote, and I dont want them modifcations on it without having to come back to me.

 

They would want to modify the image variables.

 

So I want to use php (not js) code to make sure it stays the same, and I would obfuscate that code.

Thakns

 

You can obfuscate HTML as you would php, I'm sure there are free alternatives for you, but obfuscating code is never a foolproof method.

Link to comment
Share on other sites

I think he is asking, how to make certain parts of his php code non-editable and required.

and seriously there is no way to accomplish this, unless you encode some required functions.

but even than, if u give up the main code, there will be ways to bypass the system.

 

if I was you, i would use the separate code/display, so clients can edit the display but not the code, and encode the code.

 

Link to comment
Share on other sites

you can buffer output before display and than check the buffered output if it contains your html tag or not.

at begining of your code ob_start(); // your code comes under ob_start(); at the end : $Output = ob_get_flush(); Now you can check whether $Output has <img src="images/top01.jpg" height="162" width="800"> or not with :

echo (stristr($Output, '<img src="images/top01.jpg" height="162" width="800">') === false) ? 'Html error' : $Output;

Link to comment
Share on other sites

you can buffer output before display and than check the buffered output if it contains your html tag or not.

at begining of your code ob_start(); // your code comes under ob_start(); at the end : $Output = ob_get_flush(); Now you can check whether $Output has <img src="images/top01.jpg" height="162" width="800"> or not with :

echo (stristr($Output, '<img src="images/top01.jpg" height="162" width="800">') === false) ? 'Html error' : $Output;

 

Nice fresh obfuscation technique, That i'm sure a few more people will not get. Albeit I find it pointless to obfuscate anything, if you're releasing it, it should be paid for, copyrighted, or free.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.