Solved

execute code one time

Posted on 2013-06-28
3
245 Views
Last Modified: 2013-06-28
hello there,
I have this code that its supposed to output just one hello but this is what im getting
"hello worldhello world"

preg_replace("/.*/e","eval(gzinflate(base64_decode('S03OyFdQykjNyclXKM8vyklRsgYA')));",".");

Open in new window


how can I fix it?
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 56

Expert Comment

by:Julian Hansen
ID: 39283729
The inflated string is echo "Hullo World" with an eval in front of it - is going to output Hullo World ....
0
 
LVL 1

Author Comment

by:XK8ER
ID: 39283742
yes but what can I do so it only display one "hello world"
0
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39283839
Don't eval the string - just deflate it.

By eval'ing it you are asking php to execute what is in the string. As it includes an echo - it is going to output the echo.

Also the way you are using your preg_replace is confusing.

You say you want to output hello - but you don't have any echo statements in your code sample - you also have the input string as the second parameter - which is the replace ment parameter.
It should be

preg_replace(pattern, replacement, subject)

What are you wanting out of the preg_replace?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question