![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
d22552000
-
Posts
535 -
Joined
-
Last visited
Never
Posts posted by d22552000
-
-
all http logins can be bypassed by doing this to the url:
http://username:password@login.somesite.com/
put a username:password where the sites http login is.
It will auto login using those in the url, and then ask if it doesnt get in.
-
how about I help you?
use ftp_mkdir. search it up on php.net.
-
uh.... befor emkdir it says false
after mkdir it says true...
but there is no folder there.
and If I try to copy files, it
says no folder is there.
-
I am on a windows system. I do not need to CHMOD. Neither do I have CRONTABS.
-
I have eliminated that as a proble,.. but for some reason...
I CANNOT CREATE DIRECTORIES USING PHP SCRIPTS!!!!?
Warning: dir(./e) [function.dir]: failed to open dir: No such file or directory in C:\Inetpub\wwwroot\vbcreate.php on line 26
Warning: dir(./e/forum) [function.dir]: failed to open dir: No such file or directory in C:\Inetpub\wwwroot\vbcreate.php on line 26
Warning: dir(./e/forum/admincp) [function.dir]: failed to open dir: No such file or directory in C:\Inetpub\wwwroot\vbcreate.php on line 26
It can't make folders -,- do I gotta us ftp_mkdir -,-,-,-,- cause that's a pain in the arse.
-
Script works now EXCEPT FOR:
Warning: dir(../d/forum) [function.dir]: failed to open dir: No such file or directory in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 28 Fatal error: Call to a member function read() on a non-object in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 29
just to update, this is the source im using now -,-
<?PHP echo "Please be patient, this is long step..<br /><br />"; $n = $_POST['n']; $p = $_POST['p']; $g_link = mysql_connect( '127.0.0.1', 'root', '') or die('Could not connect to server.' ); mysql_query('CREATE DATABASE ' . $n . ';'); mysql_select_db($n, $g_link) or die('Could not select database.'); $s = "../" . $p . "/forum"; $d = "../../VB3.6.7/forum"; copyr($s,$d); recursive_mkdir('c:/Inetpub/wwwroot/$p'); recursive_mkdir('c:/Inetpub/wwwroot/$p/forum'); function copyr($source, $dest){ if (is_file($source)) { $c = copy($source, $dest); return $c; } if (!is_dir($dest)) { $oldumask = umask(0); umask($oldumask); } // Loop through the folder $dir = dir($source); while (false !== $entry = $dir->read()) { if ($entry == "." || $entry == ".."){ continue; } if ($dest !== "$source/$entry"){ copyr("$source/$entry", "$dest/$entry"); } } // Clean up $dir->close(); return true; } echo "Writing Config..<br /><br />"; $filename='C:/Inetpub/wwwroot/'.$p.'/forum/includes/config.php'; $somecontent = "\$config['Database']['dbname'] = '" . $n . "';\$config['Database']['tableprefix'] = '';"; $somecontent = $somecontent . "\$config['Database']['technicalemail'] = '';\$config['Database']['force_sql_mode'] = true;"; $somecontent = $somecontent . "\$config['MasterServer']['servername'] = 'localhost';\$config['MasterServer']['port'] = 3306;"; $somecontent = $somecontent . "\$config['MasterServer']['username'] = 'root';\$config['MasterServer']['password'] = '';"; $somecontent = $somecontent . "\$config['MasterServer']['usepconnect'] = 0;\$config['Misc']['admincpdir'] = 'admincp';"; $somecontent = $somecontent . "\$config['Misc']['modcpdir'] = 'modcp';\$config['Misc']['cookieprefix'] = 'bb';"; $somecontent = $somecontent . "\$config['Misc']['forumpath'] = '';\$config['SpecialUsers']['canviewadminlog'] = '1,2';"; $somecontent = $somecontent . "\$config['SpecialUsers']['canpruneadminlog'] = '1';\$config['SpecialUsers']['canrunqueries'] = '';"; $somecontent = $somecontent . "\$config['SpecialUsers']['undeletableusers'] = '';\$config['SpecialUsers']['superadministrators'] = '1,2';"; $somecontent = $somecontent . "\$config['Misc']['maxwidth'] = 2592;\$config['Misc']['maxheight'] = 1944;"; // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success"; fclose($handle); require('C:\Inetpub\VB3.6.7\sql.php'); //onesql(); echo "sql1 done <br />"; //twosql(); echo "sql2 done <br />"; //thrsql(); echo "sql3 done <br />"; //fursql(); echo "sql4 done <br />"; echo '<br /><br /><br /><br /><a href="http://24.86.150.207/' . $n . '/forum/admincp/index.php">Login to AdminCP</a>'; ?>
uh....... mkdir doenst seem to work -,-.
IM ON WINDOWS PEOPLE, NOT LINUX. I do not have to do ANY chmodding.
thiis is depresing I might have to do ftp_mkdir -,-.
-
-
Uh... works... Its copying files... but is the script still gonna work? or was that just a test?
TRUE = Fault.Error(this_script.TIMEOUT);
The script reached its 300 seconds execution limit.
hmmmmm its supposed to MAKE a/forum lol.
Warning: dir(../a/forum) [function.dir]: failed to open dir: No such file or directory in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 26 Fatal error: Maximum execution time. Fatal error: Maximum execution time ();
-
no, thats again the site.. I fixed all the openand closed ones.
I checked... trust me -,-.
Ive beenb tryign to get this one script wroking for a few hours now, (check the forum check the post itme of "copy folder").
I dunno about thsi script.. if you have somethign to copy folders....
oh and Orio, I tried that, and no go. same error.
-
Are you sure it isn't the lines below it? Maybe it only looks like this after you posted it here, but I don't think PHP can parse those quotes. If infact they are like that, try to change them:
if ($dest !== &#147;$source/$entry&#148;) { copyr(&#148;$source/$entry&#148;, &#147;$dest/$entry&#148;);
to:
if ($dest !== "source/$entry") { copyr("source/$entry","dest/$entry");
this site butchers my code.
-
I DONT EVEN KNOW WHAT I MEAN IN THIS STATMENT.
I did not make the dir fetch code.
-
<?PHP *SNIPPED OUT* $s = "../" . $p . "/forum"; $d = "../../VB3.6.7/forum"; copyr($s,$d); function copyr($source, $dest){ if (is_file($source)) { $c = copy($source, $dest); return $c; } if (!is_dir($dest)) { $oldumask = umask(0); umask($oldumask); } // Loop through the folder $dir = dir($source); while (false !== $entry = $dir->read()) { [b]if ($entry == "." || $entry == "..") {[/b] continue; } if ($dest !== $source/$entry) { copyr($source/$entry, $dest/$entry); } } // Clean up $dir->close(); return true; } *SNIPPED OUT* ?>
It's the only remaining error. Unexpected variable on the bolded line:
if ($entry == "." || $entry == "..") {
-
I forgot to escape all those dollar signs -,- lOL what a stupid mistake.
it passes that part now but...
Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 67
FIXED
but now I have this:
Parse error: syntax error, unexpected T_ECHO in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 72
I fided that but....
YAY!!!
I fixed the million errors thing... now only 3...
Warning: mkdir() [function.mkdir]: No such file or directory in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 19 Warning: readdir(): supplied argument is not a valid Directory resource in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 20 Warning: closedir(): supplied argument is not a valid Directory resource in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 28 Writing Config.. Warning: fopen(C:/Inetpub/wwwroot/a/forum/includes/config.php) [function.fopen]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\Registration\vbcreate.php on line 51 Cannot open file (C:/Inetpub/wwwroot/a/forum/includes/config.php)
-
the line that you quoted, is now the one that doesnt wokr. maybe this might help... syntax highlighting will find open brackets and quotes...
[code=php:0] <?PHP echo "Please be patient, this is long step..<br /><br />"; $n = $_POST['n']; $p = $_POST['p']; $g_link = mysql_connect( '127.0.0.1', 'root', '') or die('Could not connect to server.' ); mysql_query('CREATE DATABASE ' . $n . ';'); mysql_select_db($n, $g_link) or die('Could not select database.'); $d = "C:/Inetpub/wwroot/" . $p . "/forum"; $s = "C:/Inetpub/VB3.6.7/forum"; COPY_RECURSIVE_DIRS($s,$d); function COPY_RECURSIVE_DIRS($dirsource, $dirdest) { if(is_dir($dirsource))$dir_handle=opendir($dirsource); mkdir($dirdest."/".$dirsource, 0750); while($file=readdir($dir_handle)) { if($file!="." && $file!="..") { if(!is_dir($dirsource."/".$file)) copy ($dirsource."/".$file, $dirdest."/".$dirsource."/".$file); else COPY_RECURSIVE_DIRS($dirsource."/".$file, $dirdest); } } closedir($dir_handle); return true; } echo "Writing Config..<br /><br />"; $filename='C:/Inetpub/wwwroot/'.$p.'/forum/includes/config.php'; $somecontent = "$config['Database']['dbname'] = '" . $n . "';$config['Database']['tableprefix'] = '';"; $somecontent = $somecontent . "$config['Database']['technicalemail'] = '';$config['Database']['force_sql_mode'] = true;"; $somecontent = $somecontent . "$config['MasterServer']['servername'] = 'localhost';$config['MasterServer']['port'] = 3306;"; $somecontent = $somecontent . "$config['MasterServer']['username'] = 'root';$config['MasterServer']['password'] = '';"; $somecontent = $somecontent . "$config['MasterServer']['usepconnect'] = 0;$config['Misc']['admincpdir'] = 'admincp';"; $somecontent = $somecontent . "$config['Misc']['modcpdir'] = 'modcp';$config['Misc']['cookieprefix'] = 'bb';"; $somecontent = $somecontent . "$config['Misc']['forumpath'] = '';$config['SpecialUsers']['canviewadminlog'] = '1,2';"; $somecontent = $somecontent . "$config['SpecialUsers']['canpruneadminlog'] = '1';$config['SpecialUsers']['canrunqueries'] = '';"; $somecontent = $somecontent . "$config['SpecialUsers']['undeletableusers'] = '';$config['SpecialUsers']['superadministrators'] = '1,2';"; $somecontent = $somecontent . "$config['Misc']['maxwidth'] = 2592;$config['Misc']['maxheight'] = 1944;"; if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success"; fclose($handle); require('C:\Inetpub\VB3.6.7\sql.php') onesql();echo "sql1 done <br />"; twosql();echo "sql2 done <br />"; thrsql();echo "sql3 done <br />"; fursql();echo "sql4 done <br />"; echo '<br /><br /><br /><br /><a href="http://24.86.150.207/' . $n . '/forum/admincp/index.php">Login to AdminCP</a>'; ?>
[/code]
-
New porblem..
$somecontent = "$config['Database']['dbname'] = '" . $n . "';$config['Database']['tableprefix'] = '';";
its not url or whitespace escaped either..?
Maybe I hsould explain waht my script does..
It installs vBulletin by copying a folder, insterintg the SQL and pointing the config.php file to the new databse. It has to write the database name into the config fiile, so I chose to output it on the script.
-
th eoriginal.php code above IS the whole ifle.. and im tryign it...
-
I just told you, because this one line of code was bugging so much, im running it in its very own php file for testing purposes...
textfile.php
$p=$_GET['p']; $filename='C:/Inetpub/wwwroot/'.$p.'/forum/includes/config.php';
I DID NOT MAKE THE RECURSIVE FOLDER SCRIPT, but I have had it work before.
ORIGINAL.php
<?PHP echo "Please be patient, this is long step..<br /><br />"; $n = $_POST['n']; $p = $_POST['p']; $g_link = mysql_connect( '127.0.0.1', 'root', '') or die('Could not connect to server.' ); mysql_query('CREATE DATABASE ' . $n . ';'); mysql_select_db($n, $g_link) or die('Could not select database.'); $d = "C:/Inetpub/wwroot/" . $p . "/forum"; $s = "C:/Inetpub/VB3.6.7/forum"; COPY_RECURSIVE_DIRS($s,$d); function COPY_RECURSIVE_DIRS($dirsource, $dirdest) { // recursive function to copy // all subdirectories and contents: if(is_dir($dirsource))$dir_handle=opendir($dirsource); mkdir($dirdest."/".$dirsource, 0750); while($file=readdir($dir_handle)) { if($file!="." && $file!="..") { if(!is_dir($dirsource."/".$file)) copy ($dirsource."/".$file, $dirdest."/".$dirsource."/".$file); else COPY_RECURSIVE_DIRS($dirsource."/".$file, $dirdest); } } closedir($dir_handle); return true; } echo "Writing Config..<br /><br />"; $filename="C:/Inetpub/wwwroot/".$p."/forum/includes/config.php"; $somecontent = "$config['Database']['dbname'] = '" . $n . "';$config['Database']['tableprefix'] = '';"; $somecontent = $somecontent . "$config['Database']['technicalemail'] = '';$config['Database']['force_sql_mode'] = true;"; $somecontent = $somecontent . "$config['MasterServer']['servername'] = 'localhost';$config['MasterServer']['port'] = 3306;"; $somecontent = $somecontent . "$config['MasterServer']['username'] = 'root';$config['MasterServer']['password'] = '';"; $somecontent = $somecontent . "$config['MasterServer']['usepconnect'] = 0;$config['Misc']['admincpdir'] = 'admincp';"; $somecontent = $somecontent . "$config['Misc']['modcpdir'] = 'modcp';$config['Misc']['cookieprefix'] = 'bb';"; $somecontent = $somecontent . "$config['Misc']['forumpath'] = '';$config['SpecialUsers']['canviewadminlog'] = '1,2';"; $somecontent = $somecontent . "$config['SpecialUsers']['canpruneadminlog'] = '1';$config['SpecialUsers']['canrunqueries'] = '';"; $somecontent = $somecontent . "$config['SpecialUsers']['undeletableusers'] = '';$config['SpecialUsers']['superadministrators'] = '1,2';"; $somecontent = $somecontent . "$config['Misc']['maxwidth'] = 2592;$config['Misc']['maxheight'] = 1944;"; // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success"; fclose($handle); require('C:\Inetpub\*EDITED OUT*') onesql();echo "sql1 done <br />"; twosql();echo "sql2 done <br />"; thrsql();echo "sql3 done <br />"; fursql();echo "sql4 done <br />"; echo '<br /><br /><br /><br /><a href="http://24.86.150.207/' . $n . '/forum/admincp/index.php">Login to AdminCP</a>'; ?>
-
reply... use the HTML standard... http://www.chami.com/tips/Internet/050798I.html
-
I am parsing this line ALL BY ITSELF cause it kept giving me shit before.
... no spaces
$filename="C:/Inetpub/wwwroot/".$p."/forum/includes/config.php";
result:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING.
-
the funny part is that $p is just 3 letters... but im trying it...
*EDIT* same error.
-
My Source In Problem...
$filename = "C:/Inetpub/wwwroot/" . $p . "/forum/includes/config.php";
My Outcome:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING.
What the Hell?
-
tried that. the path is full. the path comes up perfect elsewhere... and $p is just a folder claled test.. but I need to keep it a variable casue its dynamic.
$filename = "C:/Inetpub/wwwroot/" . $p . "/forum/includes/config.php";
-
in the funciton, the value is reinterpreted, transfered.
think about it:
$d = 1; function der($e); { } der($d);
it transfers the data, and can easily change. and if you use DATE in that function anywhere to predict it... it will get the date AGAIN at the function start.
the important question is... what do you ahve to choose your last value? ??_??_??_xx
what do you ahve determining that last section after the underscore?
-
do phpinfo('cgi');
that will bring up any side scripts (including the only way to run multiple php
).
oh and so you know, you cannot DIE a header. DIE stops the page from loading, not just sending.
use header(); exit(1); instead.
Unexpected Variable
in PHP Coding Help
Posted
I thoguht about that too, but there is no security tab -,-.