Format Result Text Using Passthru Of System
I tried to use the Passthru and System function to resolve some whois
information.
echo passthru('whois 62.69.168.12') .'<br>'
-or-
$whois = system('whois 62.69.168.12', $retval);
It works fine, but all the result text is at one line. How can i format this
output correctly ?
View Complete Forum Thread with Replies
Related Forum Messages:
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't finish loading ( Waiting... Opening... :-( ) <?php echo system("dir"); ?> The same for <?php echo exec("dir"); ?> or <?php echo shell_exec("dir"); ?>, etc... I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on windows XP SP2.
View Replies !
Format Table With PHP Result
I have to create some kind of dynamic page, logic is next: i have integer in variable and i need to create certain number of fields based on that int. example $variable = 6 and I need to have table with 6 fields, 4 in one row and 2 in second....my problem is how to do that, how to get new <tr> when number in bigger than 4.
View Replies !
Changing Array Format From Result Of MySQL
here is what MySQL returns in a visual way.. game_id | team_id | stat_id 1 | 1 | 1 1 | 2 | 3 1 | 3 | 7 1 | 3 | 6 2 | 1 | 1 2 | 4 | 3 in records with the same game_id, there will be no repeating team_id in records with the same team_id, there will be no repeating stat_id so, after I got the query, I made them into this format PHP Code:
View Replies !
Format Text
I want PHP to put spaces after a certain amount of characters, for example if I have a text string like ********xxxxxxxxxxxxxxxx and I want it to be xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx, how would I do that?
View Replies !
Format Number And Text
I want to format my id's in a sertan way however i am not sure how t approatch this problem. i want to write a function that formats a 0 to D000000. However i alsow wat to be eable to convert them back from D000000 to 0 to make calculations with it. For exaple adding 1 to create D100000.
View Replies !
Allow A User To Format Text...
I want to allow a page on me website to send an email to someone, but allow them the freedom to add images/format text etc. Is there a way this can be done using php, or is there an already existing php extension that will let me do this?
View Replies !
Delimited Text Format
I am trying to export data from a DB in a "delimited text format" with PHP and a MySQL DB. I am able to create CSV file and a tab delimted file by printing "/t" after each item. however this apparantly isn't a "delimited text format". tell me how I can do this?
View Replies !
Script Text Format
How can I disply the following code's message (You entered an invalid username or password! Try again) in red color? what will be the code? { $_SESSION['login']= '' $strMessage = "You entered an invalid username or password! Try again"; }
View Replies !
Format Text File After Fopen
I use “fopen” to access the text file (this is working fine). Then I want to format the results. I tried “fgets” but there is a “return” after each entry in the text file. "fgets" thinks this is a new record and puts the data on the next line. How can I bypass the "returns" and use the file as is. Example of the text file: Sold_To_Name............: XXXX XXXX Ship_To_Name............: ZZZZZZZZZ Sold_To_Address.........: XXXX XXXX Ship_To_Address.........: ZZZZZZZZZ Sold_To_City............: XXXXX Ship_To_City............: ZZZZZZZ Sold_To_State...........: XX Sold_To_Zip.............: XXXXX Ship_To_State...........: ZZ Ship_To_Zip.............: ZZZZZ Sold_To_Phone_Number....: XXXXXXXXXX Ship_To_Phone_Number....: ZZZZZZZZZZ This is how I would like to format text: Sold to XXXX XXXX XXXX XXXX XXXXX XX XXXXX XXX-XXX-XXXX Ship to ZZZZZZZZZ ZZZZZZZZZ ZZZZZZZ ZZ ZZZZZ ZZZ-ZZZ-ZZZZ This my current programing:
View Replies !
Function To Format Text As Html?
Is there a function in PHP that will format text in basic HTML automatically for you? I'm pulling an article piece of text from MySQL and on display, it doesn't break at paragraphs. I know the returns are there, because when I browse the data in PHPMyAdmin, the text is broken into paraphraphs. I'd rather not insert html into the text in MySQL as I may use this text for other purposes like print. Is there and html tag that I'm missing that would do this besides <pre>?
View Replies !
Mail() Plain Text Vs. Html Format
I have been testing the mail() code below using MS Outlook and Outlook Express and a hotmail account and the details sent are always in "plain text" format, which results in the information being nicely aligned (incidentally the e-mail contains order confirmation with lots of columns). However, my customer came back to me this morning to tell me that all is not well ! And rightly enough, when I looked at the snapshot he sent me he is receiving it in "html" format. What am I doing wrong ? Keeping in mind that I am a PHP greenhorn ... Can anyone help. Thanks in advance ! $headers = "From: info@somecompany.com "; $headers.= "X-Sender: <info@somecompany.com> "; $headers.= "X-Mailer: PHP "; $headers.= "X-Priority: 1 "; $headers.= "Return-Path: "."<info@somecompany.com> "; $headers.= "cc: info@anothercompany.com "; $headers.= "bcc: me@mycompany.com "; $headers.= "MIME-Version: 1.0 "; $headers.= "Content-type: text/plain; charset=iso-8859-1 "; if(@mail($to,$re,$msg,$headers)) { // tell them all was sent fine } else { // give an error message }
View Replies !
Get The Text To Format Correctly When The User Posts It?
I have a forum on my site for people to post messages. Is there a way to get the text to format correctly when the user posts it? At the moment if a user types the following: ---- Hello everyone here is my shopping list: -egg -cheese -milk -bread ---- The results will look like: "Hello everyone here is my shopping list: -egg -cheese -milk -bread" All on the same line! How do I get it to recognize that there has been a new line created or any other html formatting for example and transfer it to the database so its displays correctly when it is recalled?
View Replies !
Text Dates To Unix Time Format
On one of my community sites, I recently switched from PHP Nuke to PostNuke. During the conversion, I noticed that PHP Nuke had a registration date format of "Mar 1, 2001" and the PostNuke has a registration date format of "983620800", so I wiped all of the users' registration dates, and they inherited the date of the new system start. I still have the old database with all the old date formats in it. Is there a way to convert "Mar, 1, 2001" into "983620800"?
View Replies !
Sending Multiline Mail In Text Format
I'm using PHPMailer class to send mails and it works fine for HTML ones. But I can't manage to send correctly a text formatted mail... I tried this : - $message = "first line* *second line"; - $message = "first line* *second line"; - $message = "first line*".chr(13).chr(10)*second line"; - $message = "first line* *second line"; Result is always the same (I tried many mail readers like Outlook express, Yahoo, ...) : the body appears on only one line, with a space between the 2 *, instead of a carriage return...first line* *second line.
View Replies !
Sort By Time (hh:mm:am/pm - Format) In Text String
I have a group of records that I need to sort by time field. The time field is a text string (should've been a date/time - I know -doh!) I was wondering if anyone knew how to write a query to sort in Ascending order with the earliest appearing first. The times are stored as follows: 10:30pm 11:30pm etc.
View Replies !
Strip Tags Functions To Format The Text From The Database
I am here trying loads of different strip tags functions to format the text from the database the way I want, but it doesnt seem to be working. If you look at the below example. The bottom images shows how the text is currently been pulled and displayed from the database. I am looking to just format it as normal text when its been displayed in the result.
View Replies !
Select Specific Snippet Of Text, Replace With A Database Result
I'm having some problems trying to do something; I just can't think of a way to do it. Basically, I want to search for a specific snippet of text in a body of text, then replace it with the requested database result with some thrown in HTML. Users will be able to type the following (or something along these lines, depending on what works best): [image=12345]Insert caption here[/image] Then I need it to search for the requested image in the appropriate table and return the image's url (for an example, let's say the table is called "images", and the columns required are "imageid" and "imageurl". Code:
View Replies !
Suggestion Needed On Data Storage Format In Text File
The project I am developing doesn't involves database. I want to parse the mailbox file (.mbx) and store the summary in the text file for fast retrieval and display of information in the Inbox page. The sugegsted format are as: #1 ID [4 bytes]: Subject [100 bytes]: To Address[100 bytes]: From Address[100 bytes]...etc... #2 Instead of preassining fixed size to variable (as actual data may be much less or can grew to more), we can store the values continuously, seperated by some unique seperator (#|#, *#*, ...) 1324#|#Hi, How are you#|#me@google.com#|#you@google.com#|# ... and so on Which of these will be the efficeint one (as there will be frequent insert/delete/update of the individual information, eg. set message as read ..., delete message ..., new message ...) Also please suggest on how to determine the variable size (100 bytes as in #1), and assign the size to the variable accordingly and read it (differentiate multiple variables) when required.
View Replies !
Temperature Sensor With Internal Web Server That Provide The Data In A Text Format.
I have a Temperature sensor with internal web server that provide the data in a text format. When quering the ip(ttp://192.168.10.220/temp) of the sensor i get that kind of reply: Probe 1|82.2|Probe 2|80.8|Probe 3|-99.9|Probe 4|-99.9 I woud like to import the result into my mysql database. What is the best way to do this? Should i use a fopen() ? I have try with this but i don't know how get just the value data...
View Replies !
Voting System(i Am Using Two Tables One For Result And One For Voting
I want to create voting system on my website. how can i implement it. the logic is if i create some voting system in mysql table and save result in mysql. how can i show that result in graph shape in such a way like e.g voting are on five things, animal 5 bird 30 fish 30 cars 15 and homes 25 votes total vote cast 105 how can i show this in graph. I want to show like: for animal it shows green bar bird shows red bar etc. hope you will understand the question. any query please feel free to email me. any idea how can i get this my object.
View Replies !
Validate A Text Area In My Template System
I want to validate a text area in my template system. To define a value, I just have to insert: $template->append("NAME", "VALUE"); I am trying to easily provide text-area status after form submission. So say it is a select for male or female. I would define the dependency which would tell the system whether or not to return a value, so that's $error[gender]. Then current is what the value submitted is equal to, so male for example. $options is a comma separated list of possible options (male, female). Status is another variable I use, and isn't important. Code:
View Replies !
Passthru()
Anyone know why i'm getting an "unable to fork [datafile] " error using the passthru function. Tried it on txt files and grafix, and both types give error.
View Replies !
Passthru
Warning: passthru() has been disabled for security reasons in ... how can I change my php.ini file (php4/apache/winxp server) to enable this function? How can I best work around if I can't use this function?
View Replies !
Help With Passthru And Wmic...
I'm trying to get this to work. <?php echo passthru('wmic cpu get loadpercentage'); ?> and just output to the browser... It looks like cmd.exe hangs when it tries to execute the command. The IUSR_ account has access to both the cmd.exe and wmic files. I have also tried copying the wmic files to the C:php dir, and to the directory the web app is running from.
View Replies !
Passthru & Exec
I have a script which uses passthru to execute a shell script. This shell script then (at some point in its running) executes a php script. When executing the shell script from the command line everything works fine. When using passthru, however, I get the following error when it gets to the point where it tries to execute the 2nd php script: Code: Status: 404 X-Powered-By: PHP/4.4.2 Content-type: text/html No input file specified. 255 I'm hosted on Dreamhost with php 4.4.2.
View Replies !
Variables In Passthru
I am trying to print the website statistics for certain websites to a PDF file using htmldoc. $pdf = passthru("/usr/bin/htmldoc -t pdf --quiet --jpeg --webpage http://$username:$pass@$domain:2082/awstats.pl?year=$year&output=main&config=$domain&lang=en&month=$month"); The issue is that none of the variables after $year work the $domain and $month variable.
View Replies !
Passthru Output
I need to run a linux command via php and display the output in a browser. <? passthru('/home/user/qmHandle -R > output'); header("location:./output"); ?> The above code is supposed to run qmHandle and write the output to a file "output". It works fine, but it only writes the last line to "output". However, when I run qmHandle directly at a terminal, it outputs several hundred lines to screen.
View Replies !
Passthru() Or Exec()
I am trying to make a website where I can restart an application. I can make it terminate the app but it hangs when trying to restart it. the website calls the function this way: ##################### PHP ##################### <?php if (isset($_POST["kill_server"])){   kill_server();   echo "<img src=./images/ok.gif> El server esta siendo apagado. Por favor espere 1 minuto!"; } elseif (isset($_POST["init_server"])){   init_server();   echo "<img src=./images/ok.gif> El server esta siendo iniciado. Por favor espere 3 minutos!"; } ?>.
View Replies !
Safe Mode And Passthru
I seem to be getting some inconsistent results when using passthru() in safe mode. They appear to be related to the fact that passthru should treat all command arguments as one single argument when safe mode is on. Everything works just fine on my MacOS X webserver ( Apache 1.3.29 with PHP 4.3.6 ). But on my Linux Enterprise 3.0 production server (running Apache 2.0.46 with PHP 4.3.2) things are different. Here are the argument(s) that passthru hands to my command when safe mode is off: rrdtool args: graph - --start -3600 --end N --width 300 --height 75 --lower-limit 0 --rigid --title BaBarCM2 Grid Load last hour --vertical-label Load/Procs DEF:load_one=/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/load_one.rrd:sum:AVERAGE DEF:proc_run=/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/proc_run.rrd:sum:AVERAGE DEF:cpu_num=/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/cpu_num.rrd:sum:AVERAGE DEF:num_nodes=/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/cpu_num.rrd:num:AVERAGE AREA:load_one#CCCCCC:1-min Load LINE2:num_nodes#00FF00:Nodes LINE2:cpu_num#FF0000:CPUs LINE2:proc_run#0000FF:Running Processes And this is what passthru hands to my command when safe mode is on: rrdtool args: graph - --start -3600 --end N --width 300 --height 75 --lower-limit 0 --rigid --title 'BaBarCM2 Grid Load last hour' --vertical-label 'Load/Procs' DEF:'load_one'='/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/load_one.rrd':'sum':AVERAGE DEF:'proc_run'='/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/proc_run.rrd':'sum':AVERAGE DEF:'cpu_num'='/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/cpu_num.rrd':'sum':AVERAGE DEF:'num_nodes'='/u2/ganglia/rrds/BaBarCM2/__SummaryInfo__/cpu_num.rrd':'num':AVERAGE AREA:'load_one'#CCCCCC:Ƈ-min Load' LINE2:'num_nodes'#00FF00:'Nodes' LINE2:'cpu_num'#FF0000:'CPUs' LINE2:'proc_run'#0000FF:'Running Processes' The quotes are still there. Why am I not getting consistent behaviour on both platforms? Is this a bug in php 4.3.2 or 4.3.6?
View Replies !
Passthru(ls -alr) And Opendir - At The Same Time
I'm able to print a directory with opendir, but currently the files are in random order. My goal is to determine a way to use passthru (or some similar function... exex or system maybe) to sort the directory prior to listing it on the screen. I want to use open dir so I can make a link to the files (otherwise a simple <pre></pre> output would do nicely).
View Replies !
Cannot Get Exec() Or Passthru() To Work?
I cannnot seem to get exec() or passthru() to execute a perl script; here's the code snippet: if ($debug) { echo "username1 = ".$username1."<br>"; echo "dbname = ".$dbname."<br>"; echo "SESSION[dbname] = ".$_SESSION['dbname']."<br>"; echo "Output file = ".$outputfile."<br>"; echo "Project name = ".$projectname."<br>"; echo "Study name = ".$studyname."<br>"; echo "The command to be run is: ".$cmd."<br>"; } // Run the command! exec($cmd,$myoutput,$rtnvar); echo "rtnvar = ".$rtnvar."<br>"; foreach ($myoutput as $line) { echo $line."<br>"; } Which produces the results: username1 = rick dbname = cgb_lab_data SESSION[dbname] = cgb_lab_data Output file = myoutput Project name = IBS11_1103 Study name = IBS 11 The command to be run is: perl /home/caseyr/projects/LIMSScripts/3100DataIO/mk3100plt.pl -n 'IBS 11' -b 1103 -o myoutput -p IBS11_1103 -i S rtnvar = 13 The command looks perfectly legit, and will run at the command line if I cut and paste it. I do not understand the return value of 13. I can get a simple perl script that takes no arguments to run ok; so I think this has something to do with the arguments. I've used escapeshellarg() to no avail. I've always tried the same with system() and the backtick operator --
View Replies !
Passthru Point To Pfsock
i make the commands execute right after the connection is made because the connecting closses if $password isnt sent right away. PHP Code: pfsockopen($ip,$port); passthru ($password); passthru ("/say [SERVER BOT]user has logged into".$site.""); passthru ("/lobby"); if ($command1==""){ Â Â exit; } else { passthru ($command1); if ($command2==""){ Â Â exit; } else {
View Replies !
Passthru + Auto Generated Headers
I'm slightly confused with the passthru() command. The program I call writes html headers itself. However, passthru() makes apache sending some generated headers first. There's no fault with spaches in the code etc, I think. Here's an simplified example: $ cat /www/example.php <? passthru("cat /tmp/output"); ?> $ cat /tmp/output Content-Type: text/html <HTML><HEAD></HEAD>Message</BODY></HTML> $ curl -i "http://localhost/example.php" HTTP/1.1 200 OK Date: Sat, 16 Jul 2005 14:47:29 GMT Server: Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7d DAV/2 PHP/5.1.0b3 X-Powered-By: PHP/5.1.0b3 Content-Length: 66 Content-Type: text/html Content-Type: text/html <HTML><HEAD></HEAD>Message</BODY></HTML>
View Replies !
Exec, Passthru Disabled So How To Call C++ .exe File?
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each time. The transcript so far is reproduced for your amusement below. To summarise: I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in a php script to solve a puzzle and output the solution. It works fine with Apache/php on my own machine, but it seems Streamline.net disable exec, passthru etc. They eventually say, cryptically: ' CGI executables are supported, however this is very different from executing a program from within a PHP script'. So how would I call my Sudoko.exe file? The 'dialog': My last question seems to have been 'fixed' before being answered, so I'll have another go. I'm trying to call an .exe file on the server but get an 'unable to fork' error message. I have Apache/php installed locally and it works fine. Do you have to turn on 'cmd.exe' permissions or something? Try it yourself at: Warning: passthru(): Unable to fork [Sudoku.exe (argument...)] in (.php file...) It's the same with exec() as well. We do not support passthru or exec functions. So how would I call my Sudoku.exe program from a php script? I do not want 'scripting help', I just want to use some of the functions that you offer as a host and which I have paid for. As I have said what I am trying to do works perfectly on my machine, so it must be a question of something you have to enable your end. What do you mean you don't support passthru or exec? They are both standard php commands. . You asked "how would I call my Sudoku.exe program from a php script?" clearly this is asking us how you can use scripting? Certain functions are disabled in PHP for security reasons. Which functions are 'disabled in PHP for security reasons' ? You can find this out with the inbuilt php function phpinfo() Could you tell me where on the page that phpinfo() produces these functions are listed? For example, passthru() does not appear to be on the page. . search for "disable_functions" on that page. disable_functions lists 'no value'. So again, could you tell me where I can find the list of standard php functions which you have disabled? Please can you provide a link to your phpinfo file so we can investigate this further. We had previously checked this on a linux server, which showed the functions that have been disabled. We've passed this on to an engineer to investigate further. For your information the following are disabled: shell_exec,exec,system,passthru,popen Your knowledge base says: Q. Are CGI (Common Gateway Interface) executables supported? A. Yes these are supported on either the Windows and Linux servers But you are telling me that the only php functions which can call my executable are disabled. Will you clarify once and for all if I can call my exe file or not. I AM NOT ASKING FOR SCRIPTING HELP, I have books about that. I just want to know if I can do ON YOUR SERVER what you say I can do, and if not why not.
View Replies !
Convert UNIX Format Into An Hours:Minutes:Seconds Format
I have a a UNIX format number that I want to convert into an Hours:Minutes:Seconds format for a stopwatch/countdown timer script I'm writing. I used date("H:i:s", ($time)), but the problem is, if the period I'm counting is above 24 hours, the Hours reset to 0. So If I was counting down 49 Hours, It's be displayed as 01:00:00 instead of 49:00:00.
View Replies !
Date/time Format To Be A Normal Format
i want my date/time format to be a normal format... ex. 1-11-2006 9:20pm.. it comes out for me like 2006-1-11 21:00:30 code i have is... how could i have it so it displays it normally... <?php echo $filelist_array["date"]; ?>
View Replies !
Format Currency - Dollar Format
I want to take a variable and make sure that I output to the browser in dollar format ie if I set $price=100. I want to make sure that $price appears as 100.00. in turn make sure that when $price=100.97 is outputted as 100.97
View Replies !
System(); Command Not Working On Remote System. Windows.
My server is a windows machine, on the same domain as python(also a windows machine). Apache is running as a service as an administrator. This is a test only environment to whom it may concern(I hate people telling me how insecure my system is) I'm just trying to run: $last_line = exec('dir pythonc$', $retval, $g); print_r($retval); echo '<br>'.$g.'<br>'; echo '$last_line= '.$last_line.'<br>'; Which outputs: Array ( ) 1 $last_line= The command from the command line works fine. And apache can access directories that only administrators can access on the local machine.
View Replies !
|