Solved

execute code one time

Posted on 2013-06-28
3
240 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 51

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 51

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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 look for a specific file type in a local or remote server directory using PHP.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now