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
Solved

Execute Telnet Commands

Posted on 2001-07-08
4
701 Views
Last Modified: 2008-03-03
Hi,

In my website I don't have telnet access.

Is there a way to execute telnet commands using php such as creating or transfering databases ?

Regards,,

0
Comment
Question by:Zuhair070699
  • 2
4 Comments
 
LVL 4

Expert Comment

by:ykf2000
ID: 6262463
Hi,


You can execute commands in PHP. Try the exec command like

exec("mylsqldump xxx > backup.txt");
0
 
LVL 1

Accepted Solution

by:
sweatje earned 50 total points
ID: 6262512
If you really wanted to be dangerous (allowing adhoc exec commands on your system is something you should try to keep to a minimum), make a form with a textbox you enter your command in as shell_command and post to this script:

<?php
exec("$shell_command", $output, $error);  
if (!$error){
     while (list(,$line) = each($output)){
       echo $line, "<BR>\n";
     }
}
?>
0
 

Author Comment

by:Zuhair070699
ID: 6264906
Hi,

I tried the following script but I got error number: 127

========================================================

<?

$shell_command= "mysql -uUserName -pPassword DatabaseName < /home/www/backup/backup.sql";

exec("$shell_command", $output, $error);  
if (!$error){
    while (list(,$line) = each($output)){
      echo $line, "<BR>\n";
    }
}

else{ echo "Error no: ";}
?>

========================================================

Any Idea
0
 
LVL 1

Expert Comment

by:sweatje
ID: 6267186
One problem is that all commands executed in this manner will be at the security level of the web server (generally nobody).  I believe nobody will have to be able to have read/execure rights on mysql and read rights on /home/www/backup/backup.sql
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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 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