Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

execute code one time

Posted on 2013-06-28
3
Medium Priority
?
253 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
  • 2
3 Comments
 
LVL 60

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 60

Accepted Solution

by:
Julian Hansen earned 2000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

885 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