Asheeown
-
Posts
471 -
Joined
-
Last visited
Posts posted by Asheeown
-
-
Not a one time thing. Migration script for linux servers, this is for the home directories.
-
I am trying to transfer all directories fully intact with all files from one server to another. I have the IP and root password but RSH and RSYNC both don't have password definitions. I am also using ssh2 so I have access to the ssh2_sftp command for both servers.
Is there anyway to do this?
-
Hey Mar, sorry I didn't post back last night but I got it working.
<?php $BashProfileSource = file_get_contents("ssh2.sftp://".$Source['sftp']."".$h[1]."/.bash_profile"); $BashProfileStream = fopen("ssh2.sftp://".$Destination['sftp']."".$h[1]."/.bash_profile", 'w'); if($BashProfileDest = fwrite($BashProfileStream, $BashProfileSource)) echo "<font color=\"green\">User ".$h['0'].": Created bash profile file</font><br>"; fclose($BashProfileStream); ssh2_exec($Destination['Connection'], "chmod +x ".$h[1]."/.bash_profile"); ?>
It's copying the .bash files for a user migration in linux
Thanks for the help the file_get_contents method worked the best.
-
I'm connecting as root for development purposes, so yes. Is there a way I can create the file first? Maybe that will give it the shove it needs
-
Warning: ssh2_scp_send() [function.ssh2-scp-send]: Failure creating remote file in /home/Migrate/htdocs/test.php on line 167
I tried the connection with both server connections.
-
I need to copy a file from one remote server to another remote server with valid ssh2 connections that are already made. Do I have to use fopen to create the file then pull the content inside the file I want to copy and write it into the new one? Or is there an easier way to go about this?
-
Both work like a charm, tyvm.
-
I have an array value that I want to compare to another array value that is similar but they are both strings.
Array value one example: $x[2] = "503";
Array value two example: $y[2] = "500";
Now I want to check if $x[2] is greater than $y[2] and I can't do that when they are strings. The function intval does not work.
-
I installed the SSH2 extension on my server and I'm connecting to two servers. I need to get the contents of a text file on one server and put them in the same text file on the other server. I can do all the parsing of information in between, but what commands should I use to get the results I am looking for?
-
I'm writing a linux shared hosting server migration tool. I want it to look nice and display all results instantaneously. Plus it's part of a new thing I'm doing where my web apps are more like actual applications.
-
This isn't something you can do with php.
Oh really, then try this out
if (ob_get_level() == 0) ob_start(); for($i=0; $i < 10; $i++) { echo $i . ' '; ob_flush(); flush(); sleep(1); } ob_end_flush();
Thanks for not helping btw.
-
That's not true, as I've said I have done this before. As information is released into the buffer it will push it into display.
-
ob_start(); for($i=0; $i < 10; $i++) { echo $i . ' '; ob_flush(); flush(); sleep(1); }
Does not output 0 1 2 3 4 5 6 7 8 9 incrementally it waits till the script is done loading and then displays it. Anyone know if I'm doing something wrong, I have done this before but I can't figure it out.
-
<?php require_once('load_data.php'); if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); $result = mysql_query("SELECT * FROM $table ORDER BY submission_id DESC LIMIT 10")or die(mysql_error()); $Check = ""; while($row = mysql_fetch_array($result)) { if(!in_array($row['col_2'], $Check)) { $Check[] = $row['col_2']; echo '<li><a href="author.php?id='.$row['col_2'].'" class="job_link" title="recent posts by '.$row['col_2'].'">'.$row['col_2'].'</a></li>'; } } ?>
Honestly, I don't even know if this will work, basically the idea is to populate a small array. If the value is already in the array, don't display it, if it isn't display the row and insert the value into the array.
-
On the approve.php or deny.php you'll have a URL variable called "id"
Call it like this:
<?php $Id = $_GET['id']; ?>
Now the variable $Id holds the id for whatever you are doing you can use it in a mysql query to set an approve or deny flag in the database.
-
If you're still looking for an answer, you can use a NOT IN statement in a delete where clause. Like so...
DELETE * FROM Messages WHERE Id NOT IN(SELECT * FROM Messages ORDER BY Id DESC LIMIT 15);
Now, I don't know if yours is DESC or ASC, could never distinguish without actually coding it and trying both.
-
SELECT * FROM Messages ORDER BY Id DESC LIMIT 15
Replace "Messages" with your messages table, add any 'WHERE' statements you may have before the order by command. The key is the LIMIT 15 at the end, tells it to only pull 15 records
-
Where is it pulling the chat from?
-
I think your filter on your search is invalid, at least that's the error I get when I screw up my filter. Change your filter to a variable and do something like this:
$filter="(CN=Ann Frank)";
Lol, just need to replace the last name with something real.
-
I made an LDAP search script this morning in PHP. I also have an almost identical script running asp.net. Thing is that some attributes from the search entries aren't there in PHP when they do show up in ASP.net. Such as the "memberOf" attribute in Active Directory. Can anyone help me out? It obviously can't be permissions because the scripts are working off the same account and same ldap server.
-
It all depends on the ads you have on your website. Low paying, strict one category ads go on normal websites such as this one. Then on general public sites ad agencies can contact and offer a certain amount for a spot if they feel they'll get a lot of hits there. It's all about your community of people and just what they are looking for.
If you have a site for older people (50+) you can put ads for life insurance, etc. and most of those ads will be scams because they realize that it's easier to scam an older person than a younger one.
-
Don't waste your breath, kid. My last project made a grand total of 83 cents off ads from google over it's one year eight month period of being live. That's with 500+ unique users using it. I don't want you to come here and accuse me of wanting to steal someone's golden idea, I'd rather you just keep to yourself. I am not a shallow little shit looking to steal other peoples' ideas. If you don't want to share an idea DON'T, simple solution. Jesus christ what is wrong with asking if anyone has any harmless ideas.
I'm basically not even asking for a website idea, it's an idea for an application. Like monitoring an existing program from the web. My goal isn't to take peoples' ideas that they want to utilize it's to pursue an idea that someone has that they would like to see.
-
I have
var x = Questions[i]; var length = document.form1.q_x.length;
I need x to actually show the variable in the command
If you do
var x = Questions[i]; var length = 'document.form1.q_'+x+'.length';
It just prints the command as plain text.
-
I do some freelancing apart from this so like I said it doesn't need to make money, it would be nice if it did though.
That right there suggests that I don't care about about the running costs. It is my own server, I maintain it and the rack slot/bandwith fee is waved for me. Doesn't mean I can go crazy with bandwidth but it means that the idea doesn't have to make money.
I'm not asking anyone to give up their golden idea but that's what everyone keeps assuming, thanks for flaming, I don't need help from people who act like this.
Transfer linux directories using PHP
in PHP Coding Help
Posted
Because that's what I am doing it in. It's part of a project I am doing for myself, a nice batch of admin tools.
I don't see why it's relevant that you need to know the reason why I am using PHP.
It can be done using SSH key files for password free access but that's just annoying and all I am simply asking is if maybe ssh2_scp_recv or send can be looped from a directory listing to copy everything in structure.