Jump to content

IDOXLR8

Members
  • Posts

    31
  • Joined

  • Last visited

IDOXLR8's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. IDOXLR8

    Downtimes...

    That's really great. I wasn't looking forward to moving again. I have been really satisfied here.. Thanks djbob!
  2. If you have ever needed to copy a bunch of files or folders there is an easy way of doing this with little effort. I wrote this script to manage new account folder creation on our local intranet and it works great. I made a template folder containing all the needed files and folders and used this script when setting up a new user. Enjoy... <?php function recurse_copy($src,$dst) { $dir = opendir($src); @mkdir($dst); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { if ( is_dir($src . '/' . $file) ) { recurse_copy($src . '/' . $file,$dst . '/' . $file); } else { copy($src . '/' . $file,$dst . '/' . $file); } } } closedir($dir); } ?>
  3. Create a new database from information sent from a form. In this example I use an external config file with global information that is needed for proper execution. This can be changed to your settings... The Script (create_db.php): <?php include("../config.php"); $con = mysql_connect($global_dbhost,$global_dblogin, $global_dbpass); if (!$con) { die('Could not connect: ' . mysql_error()); } $dbname = $_POST['databasename']; if (mysql_query("CREATE DATABASE $dbname",$con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } mysql_close($con); ?> The config file: <?php $global_dbType = 'mysql'; $global_dbhost = 'localhost'; $global_dbname = 'your_db_name'; $global_dblogin = 'your_username'; $global_dbpass = 'your_password'; $global_encoding = 'utf-8'; $global_rows_per_page = 20; $global_pager_items = 10; ?> The form Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled 1</title> </head> <body> <form method="post" action="create_db.php"> <input name="databasename" type="text" style="width: 287px"><input name="Submit1" type="submit" value="submit"></form> </body> </html>
  4. Yes it has been slow for me for days now. I finally got it working just minutes ago... phew... This is not much different than calling a function in VB6... That's where I spend most of my time. Thanks for all the help. If anyone needs this code it's free for the taking. Glad I could be of help. Wrote a function to do whats needed... <?php //Include database connection details require_once('../config.php'); // php file example : write string variable to text file function replaceinFile($fFile, $sStr, $sRep) { $fArray = file($fFile); // Put the file into an array $fNew = array(); // Create a new array so we can output the results $fFile = fopen($fFile, "w"); // Open the file // Loop through each array index and output the value foreach ($fArray as $fArrayNum => $fArr) { $fNew[] = str_replace($sStr, $sRep, $fArr); // Replace anything in the array which matches our variables } // Loop through each new array index and output the value foreach ($fNew as $fNewNum => $nArr) { fwrite($fFile, $fNew[$fNewNum]); // Write the new data from the array } fclose($fFile); // Close the file } echo $_POST["new_sitename"]; echo '<br />'; echo $global_sitename; replaceinFile('../config.php',$global_sitename,$_POST["new_sitename"]) //replaceinFile('../config.php',"The James Boys","The James Boys2") ?>
  5. Byron I appreciate all the help... I've googled till I can't google anymore... Ok this is getting closer, I'm working with the first 7 variables, I think an array would be the way to go. If I can get them into an array then I can just use the array to output it to the file. //get the old variables loaded first require_once('../config.php'); $global_sitename = $_POST['new_sitename']; $username = $_POST['new_username']; $password = $_POST['new_password']; $database = $_POST['new_database']; $myserver = $_POST['new_server']; $config_base_url = $_POST['new_base_url']; $config_index_page = $_POST['new_index_page']; ================ I tried this and all it did was output the word array to the screen: $newstuff = array($global_sitename=>$_POST['new_sitename'], $username=>$_POST['new_username'], $password=>$_POST['new_password']); echo $newstuff . "<br />"; I think Im going about it all wrong...you would think that this would be widely used... Joomla uses the same thing with it's framework... I found a file that I think I can use that has everything in it that I need. Take a look at it and see what you think...Thanks
  6. Ok maybe I didn't get it right the first time...lol I know that I will have to change the write attribute "a" This is what I'm after I have a line that reads: $global_sitename="The James Boys"; and I just want to change the red part $global_sitename="The James Boys"; there are dozens of globals that I have placed in this file, now I'm writing the Admin section of the site and need a way to configure all aspects of the site not just the easy part...as in database... silly file stuff I know but I never had the need before now... Thanks Byron
  7. I have a config file that stores some Global constants The file sending the info has a standard form that reads the constants and submits them to the page listed below. The config file: $global_this = "thisconstant" $global_that = "thatconstant" I just need to change the constant part not the whole thing??? Any help...This is what I have and its working... Except it appends the whole string to the end of the file... Thanks Guys <?php $sitename = $_POST['sitename']; echo "<html><head><title>$sitename</title></head><body>"; echo "$sitename will be added to record on "; echo $date; echo "<br><br>"; $outputstring = "\$global_sitename=$sitename\n"; @ $fp = fopen("config.php", "a"); flock($fp, 2); if (!$fp) { echo "<p><strong> Your Addition could not be processed at this time. Please try again in a few minutes.</strong></p></body></html>"; exit; } fwrite($fp, $outputstring); flock($fp, 3); fclose($fp); echo "<center><p><b><a href=\"test.php\">Click Here to continue</a></b></p></center>"; ?>
  8. Welcome To HelioHost SilverKo The server has been pretty busy sine the registrations were reopened. It might take some time. djbob explains in this post: http://www.helionet.org/index/index.php?showtopic=4206 I hope this helps...Good Luck
  9. Did you setup a new database from within cPanel? I'm not sure if accessing remotely is allowed as I've never tried it from here. there are a few things that you could do though. try this: http://www.idoxlr8.com/idoxlr8/server.php get the script http://www.idoxlr8.com/idoxlr8/server.txt
  10. This is epic... Great Job djbob. I hope all these guys get caught... Thanks for keeping this kind of trash away!!
  11. IDOXLR8

    I'm back again

    Glad to see ya back djbob. It's 6am cst here and I noticed things running a bit slow and checked the server load. It's currently at 20.23%. I guess this explains it. Maybe the revenue stream will open up again... btw mornin all
  12. This is one way to limit the download speed of a given zip archive. limit_download_speed.txt
  13. Evidently djbob still cares because we still have our free web space, but it seems he just isn't active in the forum anymore. If he would start posting more this group would be come back alive again and start generating him more money. Cheers, Byron I second that. Although we should consider ourselves lucky that we have such a good host and, all for free. This has allowed me to develop without the overhead of paid hosting.
  14. If you don't push the "power button" you won't hear the "beep"
×
×
  • Create New...