hunterzzz Posted December 3, 2011 Share Posted December 3, 2011 I am in the process of creating a web page form and related scripts that will take a file (or listing of files) posted in a form and enter the data into a database and then use rsync to move from a staging web server to a production web server. With the current form i have written i am able to do a single file and i am able to handle an entire directory (basically because there is only a single row of data extracted from and inserted into the database that rsync then reads and moves. So, my problem is the form page and related insert into the database. I am not sure what i need to do in the form to be able to allow a developer or qa person to drop a listing of files into it, and have that then get extracted and inserted as individual rows into the database. Does anyone have any thoughts on a good way to do this? Basically taking this snippet <form method="post" action="<?php echo $PHP_SELF;?>"> File Name:<input type="text" size="12" maxlength="12" name="name"><br /> File to Sync:<input type="text" size="12" maxlength="255" name="dir_path"><br /> <br /> <input type="submit" value="submit" name="submit"> </form> and re-working it to handle a listing of fully pathed files and then insert that into the db, which is done currently by this snippet $conn=mysql_connect (DB_HOST, DB_USER, DB_PASS) or die(mysql_error($conn)); mysql_select_db(DB_NAME); $sql="INSERT INTO fsfiles (name, dir_path) VALUES ('$_POST[name]','$_POST[dir_path]')"; if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error()); } echo "File: ".$name." added for sync<br />"; mysql_close($conn); Any help would be GREATLY appreciated. Thank you in advance Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 3, 2011 Share Posted December 3, 2011 My advice: don't reinvent the wheel. There are tons of professional solutions already to do exactly what you want to do (deploy a project). Just Google "PHP deployment". Quote Link to comment Share on other sites More sharing options...
hunterzzz Posted December 4, 2011 Author Share Posted December 4, 2011 I did that, and all the wonderful tools out there are really way overkill for what i am trying to do, which is a simple web page promotion script from one environment to another - adding overly complicated layers to the process will only push it to the point of being unusable. I supposed i could lessen the burden by simply creating a shell script that will take a file produced by the developers in their web editing tools like Contribute and pass that along to rsync which will be cron'd to look for this file listing and then push flles when it see it. Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 4, 2011 Share Posted December 4, 2011 Maybe you should look into SVN or Git. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.