ArcAiN6 Posted September 10, 2006 Share Posted September 10, 2006 I recently started a project with a group, and after lengthy discussion, i've decided that the best way to patch / update thier mysql driven forums.I was planning on using some sort of form to let the administrator select witch patch to apply, but i've run into a snag, whenever i select teh data on the form, and click submit, the screen is then blank.. here is what i have so far in it's entirity. I look forward to your suggestions and ideas :)[DIR]= /home/http/vhosts/xxxxxxxxxx.com/subdomains/cf/htdocsForm.php located in [DIR]/patches/:[code]<?phpecho ("<html>");echo ("<body>");echo ("");echo ("<form action='complete.php' method='post'>");echo ("<select name='Patch'>");echo ("<option value='patch.php'>Mass Inactive Users ban</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("<option value=''>n/a</option>");echo ("</select>");echo ("<input type='submit' name='submit' value='Patch'>");echo ("</form>");echo ("");echo ("</body>");echo ("</html>");?>[/code]Complete.php located in [DIR]/patches/:[code]<?phpinclude = 'includes/config.php';include = 'includes/opendb.php';mysql_select_db($dbname, $dbcnx);include = 'includes/$patch';if ( @mysql_query($sql) ) { echo("<p>Update affected " . mysql_affected_rows() . "rows.</p>");} else { echo("<p>Error performing update: " . mysql_error() ."</p>");}?>[/code]config.php Located in [DIR]/includes/patches/:[code]<?php// This is an example of config.php$dbhost = 'localhost';$dbuser = 'xxxxx';$dbpass = 'xxxxxx';$dbname = 'xxxxxxxxxxx';// DO NOT EDIT BELOW THIS LINE$patch = $_POST["Patch"];$date = date('l dS \of F Y h:I:s A');?>[/code]opendb.php Located in [DIR]/includes/patches/:[code]<?php // Connect to the database server $dbcnx = @mysql_connect("localhost", $dbuser, $dbpass); if (!$dbcnx) { echo( "<p>Unable to connect to the " . "database server at this time.</p>"); exit();}?>[/code]patch.php located in [DIR]/patches/[code]<?php$sql = "UPDATE ibf_members,ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature='Banned on $date by nExfUn script' WHERE ibf_members.id=ibf_member_extra.id AND ibf_members.mgroup=151 AND ibf_members.posts<20 AND ibf_members.joined< UNIX_TIMESTAMP()-2592000;";?>[/code]as you can see, i've attempted to make it so the admin can choose wich patch to apply by using a dropdown menu. But i've also parted everything out so it may be used again in other parts or or other standalone patches at a later date. The reason i'm attempting to do it this iway is to ease the burden on myself and the sql coder so we only need to write out as little as possible. Any help with this would be much appreciated. Sorry for including all of the files, but i thought it would be more clear to everyone that way. Quote Link to comment https://forums.phpfreaks.com/topic/20261-building-a-patch-system/ Share on other sites More sharing options...
corbin Posted September 10, 2006 Share Posted September 10, 2006 Try makingecho ("<option value='patch.php'>Mass Inactive Users ban</option>");echo ("<option value='patch'>Mass Inactive Users ban</option>");and make$patch = $_POST["Patch"];$patch = $_POST["Patch"] . ".php";and see if anything different happens, also on patch.php at the end add mysql_query($sql); Quote Link to comment https://forums.phpfreaks.com/topic/20261-building-a-patch-system/#findComment-89163 Share on other sites More sharing options...
HuggieBear Posted September 10, 2006 Share Posted September 10, 2006 Corbin,[code=php:0]mysql_query($sql);[/code]Is already included after the statement itself, but it's just included in complete.phpRegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20261-building-a-patch-system/#findComment-89275 Share on other sites More sharing options...
redarrow Posted September 10, 2006 Share Posted September 10, 2006 First use the firom in a function and add that function to a page called functions.phpThen include("functions.php");Then call the function example function form(); any were you need it.redesign your form had a hartattack here. Quote Link to comment https://forums.phpfreaks.com/topic/20261-building-a-patch-system/#findComment-89282 Share on other sites More sharing options...
ArcAiN6 Posted September 11, 2006 Author Share Posted September 11, 2006 ok... i rewrote everything.. but now i'm not getting any type of responce.. i.e. it supposed to tell me if everything went OK, or if something went wrong... just getting a blank page... the form is not included as it's very large.. don't wanna over post.. if you guys need to see it let me know.. patch1.php[code]<?php$dbhost = "localhost";$user = "xxxxxx";$pw = "xxxxxxx";$dbname = "xxxxxxxxxx";$join = $_POST["join"]$memb = $_POST["memb"]$count = $_POST["count"]$date = date('l dS \of F Y h:I:s A');$dbcnx = @mysql_connect($dbhost, $user, $pw); if (!$dbcnx) { echo( "<p>Unable to connect to the " . "database server at this time.</p>"); exit();}mysql_select_db($dbname, $dbcnx);$sql = "UPDATE ibf_members,ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature='Banned on $date by nExfUn script' WHERE ibf_members.id=ibf_member_extra.id AND ibf_members.mgroup=$memb AND ibf_members.posts<$count AND ibf_members.joined< UNIX_TIMESTAMP()-$join;";if ( @mysql_query($sql) ) { echo("<p>Update affected " . mysql_affected_rows() . "rows.</p>");} else { echo("<p>Error performing update: " . mysql_error() ."</p>");} ?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20261-building-a-patch-system/#findComment-89622 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.