Iryk Posted December 13, 2006 Share Posted December 13, 2006 [code]<?php $db_username = $_POST['db_username']; $db_password = $_POST['db_password']; $db_host = $_POST['db_host']; if($your_password != "$retype_password") { echo "<center><span style='color: red; font: 8pt verdana'>Your passwords do not match. Please go back and retype the information.</span></center>"; } else {$con = mysql_connect("$db_host","$db_username","$db_password");if (!$con) { echo "<center><span style='color: red; font: 8pt verdana'>Database information is wrong. Please go back and retype the information.</span></center>"; } else { $dat = date("D j M, Y"); $title = $_POST['site_title']; $description = $_POST['site_description']; $copyright = $_POST['site_copyright']; $url = $_POST['site_url']; $banner = $_POST['site_banner']; $username = $_POST['your_username']; $password = md5($_POST['your_password']); $location = $_POST['your_location']; $email = $_POST['your_email']; $avatar = $_POST['your_avatar']; $website = $_POST['your_website']; $signature = $_POST['your_signature']; mysql_query("INSERT INTO user (user, pass, website, email, avatar, location, sig) VALUES ('$username','$password', '$website', '$email', '$avatar','$location','$signature')"); mysql_query("INSERT INTO staff VALUES ('$username','Admin','0')"); mysql_query("INSERT INTO site VALUES ('$title','$description','$dat','Blue','$copyright','$url','$banner')"); $new_content '<? mysql_connect("$db_host","$db_username","$db_password"); ?>'; $file = fopen('db_connect.php'); fwrite('$file','$new_content'); fclose($file);}?>[/code]Here is the error i get:Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 34 Quote Link to comment Share on other sites More sharing options...
trq Posted December 13, 2006 Share Posted December 13, 2006 If you used the proper <?php tags the boards syntax highlighting would have kicked in and you would easily noticed your missing the = in this line...[code=php:0]$new_content = '<? mysql_connect("$db_host","$db_username","$db_password"); ?>';[/code] Quote Link to comment Share on other sites More sharing options...
Iryk Posted December 13, 2006 Author Share Posted December 13, 2006 OMG!! thank you lol... that was easy... Quote Link to comment Share on other sites More sharing options...
Iryk Posted December 13, 2006 Author Share Posted December 13, 2006 Now im getting this error:Parse error: parse error, unexpected $ in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 39 Quote Link to comment Share on other sites More sharing options...
trq Posted December 13, 2006 Share Posted December 13, 2006 It appears your missing a closing }. Its hard to tell though with the way your code is formatted. Quote Link to comment Share on other sites More sharing options...
Iryk Posted December 13, 2006 Author Share Posted December 13, 2006 Do you know how i should format it then? i am trying to rewrite my previous scripts and am having a hard time... Quote Link to comment Share on other sites More sharing options...
trq Posted December 13, 2006 Share Posted December 13, 2006 I usually use 2 spaces for indentation... doesn't really matter as long as your consistant. Also, do you realise that variables do not need to be surrounded by quotes?You had a few variables surrounded by single quotes which just plain won't work.[code=php:0]fwrite('$file','$new_content');[/code]Anyway... here it is formatted for easier reading.[code]<?php $db_username = $_POST['db_username']; $db_password = $_POST['db_password']; $db_host = $_POST['db_host']; if ($your_password != $retype_password) { echo "<center><span style='color: red; font: 8pt verdana'>Your passwords do not match. Please go back and retype the information.</span></center>"; } else { $con = mysql_connect($db_host,$db_username,$db_password); if (!$con) { echo "<center><span style='color: red; font: 8pt verdana'>Database information is wrong. Please go back and retype the information.</span></center>"; } else { $dat = date("D j M, Y"); $title = $_POST['site_title']; $description = $_POST['site_description']; $copyright = $_POST['site_copyright']; $url = $_POST['site_url']; $banner = $_POST['site_banner']; $username = $_POST['your_username']; $password = md5($_POST['your_password']); $location = $_POST['your_location']; $email = $_POST['your_email']; $avatar = $_POST['your_avatar']; $website = $_POST['your_website']; $signature = $_POST['your_signature']; mysql_query("INSERT INTO user (user, pass, website, email, avatar, location, sig) VALUES ('$username','$password', '$website', '$email', '$avatar','$location','$signature')"); mysql_query("INSERT INTO staff VALUES ('$username','Admin','0')"); mysql_query("INSERT INTO site VALUES ('$title','$description','$dat','Blue','$copyright','$url','$banner')"); $new_content = "<?php mysql_connect($db_host,$db_username,$db_password); ?>"; $file = fopen('db_connect.php'); fwrite($file,$new_content); fclose($file); } }?>[/code] Quote Link to comment Share on other sites More sharing options...
Iryk Posted December 13, 2006 Author Share Posted December 13, 2006 OK thank you soo much! but now i get these errors:Warning: fopen() expects at least 2 parameters, 1 given in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 34Warning: fwrite(): supplied argument is not a valid stream resource in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 35Warning: fclose(): supplied argument is not a valid stream resource in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 36 Quote Link to comment Share on other sites More sharing options...
trq Posted December 13, 2006 Share Posted December 13, 2006 Read the manual on [url=http://php.net/fopen]fopen[/url](). Quote Link to comment Share on other sites More sharing options...
Iryk Posted December 13, 2006 Author Share Posted December 13, 2006 OK well i got it now... thanks for the help 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.