Jump to content

Web page migration script help


hunterzzz

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.