Jump to content
xisto Community
chappill

Could Someone Help Me With This?

Recommended Posts




if($step==0){
echo "This will perform a clean install of wisePoll, it will delete any previous versions you may have on your server.<br><a href=\"install.php?step=1\">Continue -></a>";
}

if($step==1){

if(!isset($action)){
if(mysql_select_db("$db_name")){

?>
linenums:0'><?phprequire("config.php");$link=mysql_connect("$sql_localhost","$sql_user","$sql_pass")or die("Couldn't connect to sql server");if($step==0){echo "This will perform a clean install of wisePoll, it will delete any previous versions you may have on your server.<br><a href=\"install.php?step=1\">Continue -></a>";}if($step==1){if(!isset($action)){if(mysql_select_db("$db_name")){?>
This is the code for part of the installation for a poll thing, when installing i hit continue and the url goes from:
http://www.xxx.xxx/
to:
http://www.xxx.xxx/ but the page stays the same!!! Can anyone help?
Edited by chappill (see edit history)

Share this post


Link to post
Share on other sites

I don't see anything wrong with the code you provide, but there is a bunch of code missing, too... Can you post more code?

Share this post


Link to post
Share on other sites

Don't need a link yet, we need the code first to see what it is supposed to be doing.And what is in the config file? just Db connection info?

Share this post


Link to post
Share on other sites
<?php//CONFIGURE THESE VARIABLES//MYSQL VARIABLES$sql_localhost="localhost";//THIS IS THE LOCALHOST NAME OF THE MYSQL SERVER$sql_user="xxxx";//THIS IS THE USERNAME FOR THE MYSQL SERVER ACCOUNT$sql_pass="xxxx";//THIS IS THE PASSWORD FOR THE MYSQL SERVER ACCOUNT$db_name="xxxx";//THIS IS THE NAME OF THE DATABASE YOU WANT TO USE OR CREATE/////////////COOKIE VARIABLES$cookie_time=xxxx;//THIS IS THE LENGTH OF TIME THAT THE VOTE COOKIES LAST IN SECONDS//////////?>

Yeah thats the config fiel do you want ALL of the code from install.php?

Share this post


Link to post
Share on other sites

This is the reason i didn't really want to... It's 500 lines+ long :lol:

<?phpif(!isset($step)){$step=0;}if($step==1){if(isset($already_voted)){setcookie("already_voted","no",time()-3600)or die("Couldnt clear cookies");}?><html><head><?phpecho "<font face=\"arial,sans-serif\" size=\"2\">Cleared Cookies</font><br>\n";}?><title>wisePoll installation</title><script language="javascript" type="text/javascript"><!--if(window!=top){top.location=window.location;}//--></script><style type="text/css">FORM {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;FONT-SIZE: 10px;}SELECT, INPUT, TEXTAREA {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;COLOR: #51485F;FONT-SIZE: 10px;}#submitrow INPUT {BACKGROUND-COLOR:#d0d0d0;COLOR: #000000;}</style></head><body bgcolor="#e0e0e0" link="blue" vlink="blue" alink="blue"><font face="arial,sans-serif" size="2"><?phprequire("config.php");$link=mysql_connect("$sql_localhost","$sql_user","$sql_pass")or die("Couldn't connect to sql server");if($step==0){echo "This will perform a clean install of wisePoll, it will delete any previous versions you may have on your server.<br><a href=\"install.php?step=1\">Continue -></a>";}if($step==1){if(!isset($action)){if(mysql_select_db("$db_name")){?>The database already exists, do you want to use it, or delete it?<br><a href="install.php?step=1&action=use_old">Use It</a><br><a href="install.php?step=1&action=delete_old">Delete It</a><br><?phpdie();}else{$action="create_new";}}if($action=="delete_old"){mysql_drop_db("$db_name")or die("Couldn't drop database");echo "Drop Database<br>";mysql_create_db("$db_name")or die("Couldn't create database");echo "Created Database<br>";mysql_select_db("$db_name")or die("Couldn't select database");echo "Selected Database<br>";}if($action=="create_new"){mysql_create_db("$db_name")or die("Couldn't create database");echo "Created Database<br>";mysql_select_db("$db_name")or die("Couldn't select database");echo "Selected Database<br>";}if($action=="use_old"){mysql_select_db("$db_name")or die("Couldn't select database");echo "Selected Database<br>";}mysql_query("CREATE TABLE wisePoll_admins(User text, Pass text, Mail text, Priv text, Enabled text)")or die("Couldnt create admins table");echo "Created admins table.<br>\n";mysql_query("CREATE TABLE wisePoll_privs(GroupID INT NOT NULL primary key auto_increment, GroupName text, AddAdmin text, EditAdmin text, DisableAdmin text, DeleteAdmin text, AddGroup text, EditGroup text, DeleteGroup text, AddTemplate text, EditTemplate text, DisableTemplate text, DeleteTemplate text, AddPoll text, EditPoll text, DisablePoll text, DeletePoll text, OtherOps text)")or die("Couldnt create priviledges table");echo "Created priviledges table.<br>\n";mysql_query("INSERT INTO wisePoll_privs VALUES('','orig','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes')")or die("Couldnt create original administrator priviledges");echo "Created original administrator priviledges.<br>\n";mysql_query("INSERT INTO wisePoll_privs VALUES('','full','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes')")or die("Couldnt create full administrator priviledges");echo "Created full administrator priviledges.<br>\n";mysql_query("INSERT INTO wisePoll_privs VALUES('','mod','no','no','no','no','no','no','no','no','no','no','no','yes','yes','yes','yes','no')")or die("Couldnt create moderated administrator priviledges");echo "Created moderated administrator priviledges.<br>\n";mysql_query("CREATE TABLE wisePoll_layout(ID INT NOT NULL primary key auto_increment, Template text, HeadInput text, Header text, Footer text, PageTitle text,SiteURL text, PollURL text, TblBorderSize int, TblBorderCol text, LayoutType text, PageBGCol text, PageTxtCol text, PageTxtFont text, PageTxtSize int,PageLnkCol text, PageLnkBGCol text, PagevLinkCol text, PageaLinkCol text, PageoLinkCol text, PageoLinkBGCol text,PageLnkFont text, PageLnkSize int, PageoLinkFont text, MnTblBGCol text, MnTblTxtCol text,MnTblTxtFont text, MnTblTxtSize int, MnTblLnkCol text, MnTblLnkBGCol text, MnTblvLinkCol text, MnTblaLinkCol text,MnTbloLinkCol text, MnTbloLinkBGCol text, MnTblLnkFont text, MnTblLnkSize int, MnTbloLinkFont text,HrowBGCol text, HrowTxtCol text, HrowTxtFont text, HrowTxtSize int, HrowLnkCol text, HrowLnkBGCol text, HrowvLinkCol text,HrowaLinkCol text, HrowoLinkCol text, HrowoLinkBGCol text, HrowLnkFont text, HrowLnkSize int, HrowoLinkFont text,ErowBGCol text, ErowTxtCol text, ErowTxtFont text, ErowTxtSize int, ErowLnkCol text, ErowLnkBGCol text,ErowvLinkCol text, ErowaLinkCol text, ErowoLinkCol text, ErowoLinkBGCol text, ErowLnkFont text, ErowLnkSize int,ErowoLinkFont text, OrowBGCol text, OrowTxtCol text, OrowTxtFont text, OrowTxtSize int, OrowLnkCol text,OrowLnkBGCol text, OrowvLinkCol text, OrowaLinkCol text, OrowoLinkCol text, OrowoLinkBGCol text, OrowLnkFont text,OrowLnkSize int, OrowoLinkFont text, enabled text)")or die("Couldnt create layout table".mysql_error());echo "Created layout table.<br>\n";mysql_query("CREATE TABLE wisePoll_options(PollActive text, InactiveMessage text, UserTemplates text, Frames text, ContactMail text)")or die("Couldnt create options table");echo "Created options table.<br>\n";mysql_query("CREATE TABLE wisePoll_polls(PollID INT NOT NULL primary key auto_increment,PollTitle text,Question text,Options text,Answers text,Enabled text)")or die("Couldnt create polls table");echo "Created polls table.<br>\n";?>You're All good there spanky spank!!<br><br><br><a href="install.php?step=2">Click here</a> to create a user, you MUST do this to access the admin shell.<br><br><?php}if($step==2){?><form action="install.php" method="post"><input type="hidden" value="3" name="step"><table cellpadding="0" cellspacing="0" border="0" bgcolor="#000000" align="center"><tr><td><table cellpadding="4" cellspacing="1" border="0" width="100%"><tr align="center"><td bgcolor="#000000" align="center" width="100%" colspan="2"><font face="verdana,arial,helvetica" size="1" color="#ffffff"><b>Create An Admin</b></font></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Username:</strong></font><br><font face="verdana,arial,helvetica" size="1">Type your desired login name.</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="text" size="30" name="user"></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Password:</strong></font><br><font face="verdana,arial,helvetica" size="1">Type your desired login password.</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="password" size="30" name="pass"></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Confirm Password:</strong></font><br><font face="verdana,arial,helvetica" size="1">Type your desired login password again.</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="password" size="30" name="pass2"></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Email Address:</strong></font><br><font face="verdana,arial,helvetica" size="1">This is the email address you want associated with your account.</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="text" size="30" name="mail"></td></tr><tr align="center"><td bgcolor="#000000" align="center" width="100%" colspan="2"><font face="verdana,arial,helvetica" size="1" color="#ffffff"><b>Enter Your Site Information</b></font></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Site Title:</strong></font><br><font face="verdana,arial,helvetica" size="1">This is the title or name of your site.</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="text" size="30" name="sitename"></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Site URL:</strong></font><br><font face="verdana,arial,helvetica" size="1">This is the url to your site (e.g. [url="http://www.mysite.com/)"]http://http://www.mysite.com/)[/url].</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="text" size="30" name="siteurl"></td></tr><tr><td bgcolor="#d0d0d0" align="left" nowrap><font face="verdana,arial,helvetica" size="2"><strong>Polls URL:</strong></font><br><font face="verdana,arial,helvetica" size="1">This is the url to your polls (e.g. [url="http://forums.xisto.com/no_longer_exists/)"]http://forums.xisto.com/no_longer_exists/)[/url].</font></td><td bgcolor="#dfdfdf" align="center" valign="top"><input type="text" size="30" name="pollurl"></td></tr><tr id="submitrow"><td bgcolor="#000000" align="center" colspan="2"><input type="submit" value="Finish Installation"></td></tr></table></td></tr></table></form><?php}if($step==3){//CHECK SUBMITTED INFORMATIONif((!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$mail)) || (!isset($pass)) || (!isset($pass2)) || (empty($pass)) || (empty($pass2)) || ($pass!=$pass2) || (!isset($user)) || (empty($user)) || (!isset($sitename)) || (empty($sitename)) || (!eregi("^http://+[_a-z0-9-]*",$siteurl)) || (!eregi("^http://+[_a-z0-9-]*",$pollurl))){?><strong>You must fill out all of the information correctly. The problems were as follows:</strong><ul type="disc"><?phpif((!isset($user)) || (empty($user)) || (!isset($sitename)) || (empty($sitename))){echo "<li><strong>Some of the information wasn't filled out.</strong></li>";}if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$mail)){echo "<li><strong>The email address is not a valid email address.</strong></li>";}if(!isset($pass) || !isset($pass2) || empty($pass) || empty($pass2) || ($pass!=$pass2)){echo "<li><strong>The password, and confirm password fields were not the same.</strong></li>";}if(!eregi("^http://+[_a-z0-9-]*",$siteurl) || !eregi("^http://+[_a-z0-9-]*",$pollurl)){echo "<li><strong>The site URL and/or poll URL were not valid URL's. You must use the full address.</strong></li>";}?></ul><strong>Please fix these, and try again. You will be redirected in 5 seconds.</strong><br>If you do not want to wait, or your browser does not support Javascript, <a href="install.php?step=2">click here</a> to go back now.<script language="javascript" type="text/javascript"><!--function goBack(){location="install.php?step=2";}setTimeout('goBack()',5000);//--></script><?phpdie();}$head_input='FORM {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;FONT-SIZE: 10px;}SELECT, INPUT, TEXTAREA {FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;COLOR: #51485F;FONT-SIZE: 10px;}#submitrow INPUT {BACKGROUND-COLOR:#d0d0d0;COLOR: #000000;}';$header='<center><table border="0" cellpadding="0" cellspacing="0" width="98%" align="center"><tr><td height="100" background="top_line.gif" rowspan="2" cellpadding="0" align="left"><a href="<?php echo $pollurl ?>" onfocus="this.blur()"><img src="wisepoll_logo.gif" alt="wisePoll" vspace="0" hspace="0" border="0" width="250" height="99" onfocus="this.blur()"></a></td><td bgcolor="<?php echo $page_bgcol ?>" height="48" align="right" valign="bottom"><a href="search.php" onfocus="this.blur()"><img src="top_search.gif" border="0" hspace="0" vspace="0" alt="Search"></a><a href="<?php echo $siteurl ?>" onfocus="this.blur()"><img src="top_home.gif" border="0" hspace="0" vspace="0" alt="Home"></a></td></tr><tr><td bgcolor="#ffffff" valign="top" align="right"> </td></tr></table>';$footer='<table border="0" cellpadding="0" cellspacing="0" width="98%"><tr><td bgcolor="<?php echo $page_bgcol ?>" align="center"><br><br><font face="<?php echo $page_linkfont ?>" size="<?php echo $page_linksize ?>" color="<?php echo $page_linkcol ?>"><big><</big><strong><a href="mailto:<?php echo $contact_mail ?>" class="page">Contact Us</a> - <a href="<?php echo $siteurl ?>" class="page"><?php echo $sitename ?></a><big>></big></font></td></tr></table>';mysql_select_db("$db_name")or die("Couldn't select database.".mysql_error());echo "Selected Database<br>";mysql_query("INSERT INTO wisePoll_admins VALUES('$user','$pass','$mail','1','yes')")or die("Couldn't create administrator".mysql_error());echo "Created Administrator<br>";mysql_query("INSERT INTO wisePoll_layout VALUES('','Default','$head_input','$header','$footer','$sitename','$siteurl','$pollurl','1','#000000','rows','#336699','#000000','arial,sans-serif','2','#000000','#336699','#000000','#000000','#ff0000','#336699','arial,sans-serif','2','arial,sans-serif','#ffffff','#000000','arial,sans-serif','2','#000000','#ffffff','#000000','#000000','#ff0000','#ffffff','arial,sans-serif','2','arial,sans-serif','#000000','#ffffff','verdana,arial,helvetica','1','#ffffff','#000000','#ffffff','#ffffff','#ffffff','#000000','verdana,arial,helvetica','1','verdana,arial,helvetica','#dfdfdf','#000000','verdana,arial,helvetica','1','#000000','#dfdfdf','#000000','#000000','#ff0000','#dfdfdf','verdana,arial,helvetica','2','verdana,arial,helvetica','#d0d0d0','#000000','verdana,arial,helvetica','1','#000000','#d0d0d0','#000000','#000000','#ff0000','#d0d0d0','verdana,arial,helvetica','2','verdana,arial,helvetica','yes')")or die("Couldn't create default template.".mysql_error());echo "Created default Layout<br>";$inactive_msg="<strong>The polls are currently undergoing renovations.</strong>";mysql_query("INSERT INTO wisePoll_options VALUES('yes','$inactive_msg','yes','yes','$mail')")or die("Couldnt create default options".mysql_error());echo "Created default options.<br><br>";?>The installer is done, you have successfully installed wisePoll version 2.0.0!!!<br>Make sure that you delete the install script (this file) from your server.You may now login to the administrator control panel by <a href="login.php">clicking here</a><?php}?>

Share this post


Link to post
Share on other sites

You are using $_GET variables with incorrect syntax. $_GET variables are put inside the array $_GET which you access with the following syntax.

<?phpif($_GET['variable_name'] == "value") {  //statement}?>

Also, try using the variable $_GET['step'] as a string instead of a integer. The comparison could be wrong.

EDIT: I just noticed that you have $step as defined with 0. With the url index.php?step=1. You are not changing the value of $step. It is staying as 0 the whole time.
Edited by coolcat50 (see edit history)

Share this post


Link to post
Share on other sites

Yeah basically this was written for servers that automatically forward the get variable to regular php variables. Xisto doesn't do this for security reasons. All you should have to do is write $step=$_GET['step']; at the top of your code and that should fix it.

Share this post


Link to post
Share on other sites

Gahhh got another problem, where it says:

he database already exists, do you want to use it, or delete it?<br><a href="install.php?step=1&action=use_old">Use It</a><br><a href="install.php?step=1&action=delete_old">Delete It</a><br>

I click use old and it doesn't forward the page! It's miffing me off.

Share this post


Link to post
Share on other sites

Well it looks like its more than just the step variable that is being passed through the url, so just so we do not have to keep diong this remove the $step=$_GET['step']; and replace it with the following code:

foreach($_GET as $geta=>$getb) $$geta=$getb;

This should resolve all of the problems because this line of code will forward all of the values in the get array to regular php variables. I DO NOT RECOMMEND DOING THIS NORMALLY. This can be a major security risk to your program if you do not know how to properly parse through your user's input. I am only recommending this in this case because it is the installer only, and the file will not be used after installing.

Share this post


Link to post
Share on other sites

Hmmmm worked the furthest so far but now:

<?php}if($step==3){//CHECK SUBMITTED INFORMATIONif((!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$mail)) || (!isset($pass)) || (!isset($pass2)) || (empty($pass)) || (empty($pass2)) || ($pass!=$pass2) || (!isset($user)) || (empty($user)) || (!isset($sitename)) || (empty($sitename)) || (!eregi("^http://forums.xisto.com/no_longer_exists/)) || (!eregi("^http://forums.xisto.com/no_longer_exists/))){?>

That bit (moving to step 3) doesn't work!!! This is like the script from hell, I'll turn it into a challange 3 hosting credits to the solver of my problem! Lol.

Share this post


Link to post
Share on other sites

So what exactly is it doing when you try to go to step 3? Where exactly did you get this script anyway? Perhaps its time to drop this script and go with one written by somebody more competent.

Share this post


Link to post
Share on other sites

Yeah i got it off a mate who said it worked fine :S I'll drop it now. Thanks for the help though, I'll try work on it myself.And i looked and i found the problem!

<tr id="submitrow"><td bgcolor="#000000" align="center" colspan="2"><input type="submit" value="Finish Installation">

It doesn't tell the page to move on to page 3! I'll try do that because its in html.

Edited by chappill (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.