View Full Version : Check this script??? I know its Bad.
jad9321
07-07-2006, 04:49 PM
Hey guys... I just through a script together really quick. can you check it out... Dosent seem to work...
<form method='post' action='install.php?step=1'>
<table>
<tr>
<td>MySQL User:</td>
<td><input type='text' name='muser' size='20'></td>
</tr>
<tr>
<td>MySQL Password:</td>
<td><input type='text' name='mpass' size='20'></td>
</tr>
<tr>
<td>MySQL Database:</td>
<td><input type='text' name='mdata' size='20'></td>
</tr>
<tr>
<td>Make sure all the above info is correct.</td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form>";
}else{
$muser = $_POST['muser']; $mpass = $_POST['mpass'];
$mdata = $_POST['mdata'];
if(empty($muser) || empty($mpass) || empty($mdata) ||{
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
}
// Connect to Check
mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error());
mysql_select_db ("$mdata");
// Create Tables
mysql_query("CREATE TABLE `request` (
`Habbo Name` varchar(20) NOT NULL default '',
`Song Request` varchar(50) NOT NULL default '',
`Shoutout\Joke` varchar(10) NOT NULL default '',
PRIMARY KEY (`Habbo Name`)
) TYPE=MyISAM") or die(mysql_error());
I know its really bad but i need help... :]
Demo at http://smileyoureahabbo.freepgs.com/install.php
if(empty($muser) || empty($mpass) || empty($mdata) ||{Forgot to close the condition.
jad9321
07-07-2006, 04:57 PM
err??? How Do You Do That... lol i'm dumb.
Indubitably.
if(empty($muser) || empty($mpass) || empty($mdata)){
jad9321
07-07-2006, 05:06 PM
Its still not working...
<form method='post' action='install.php?step=1'>
<table>
<tr>
<td>MySQL User:</td>
<td><input type='text' name='muser' size='20'></td>
</tr>
<tr>
<td>MySQL Password:</td>
<td><input type='text' name='mpass' size='20'></td>
</tr>
<tr>
<td>MySQL Database:</td>
<td><input type='text' name='mdata' size='20'></td>
</tr>
<tr>
<td>Make sure all the above info is correct.</td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form>";
}else{
$muser = $_POST['muser']; $mpass = $_POST['mpass'];
$mdata = $_POST['mdata'];
if(empty($muser) || empty($mpass) || empty($mdata)){
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
}
// Connect to Check
mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error());
mysql_select_db ("$mdata");
// Create Tables
mysql_query("CREATE TABLE `request` (
`Habbo Name` varchar(20) NOT NULL default '',
`Song Request` varchar(50) NOT NULL default '',
`Shoutout\Joke` varchar(10) NOT NULL default '',
PRIMARY KEY (`Habbo Name`)
) TYPE=MyISAM") or die(mysql_error());
demo: http://smileyoureahabbo.freepgs.com/install.php
jad9321
07-07-2006, 05:14 PM
hmm....
Can you give us the error(s) you get?
jad9321
07-07-2006, 05:20 PM
It shows the accual text thats in the file on the page:
"; }else{ $muser = $_POST['muser']; $mpass = $_POST['mpass']; $mdata = $_POST['mdata']; if(empty($muser) || empty($mpass) || empty($mdata)){ Echo"Error: You have some boxes with No info in them, You MUST fill in EVERY BOX!"; die(); } // Connect to Check mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error()); mysql_select_db ("$mdata"); // Create Tables mysql_query("CREATE TABLE `request` ( `Habbo Name` varchar(20) NOT NULL default '', `Song Request` varchar(50) NOT NULL default '', `Shoutout\Joke` varchar(10) NOT NULL default '', PRIMARY KEY (`Habbo Name`) ) TYPE=MyISAM") or die(mysql_error());
You can see what I meen at http://smileyoureahabbo.freepgs.com/install.php
jad9321
07-07-2006, 05:28 PM
-sighs-
jad9321
07-07-2006, 05:39 PM
Twey you have any idea?
Oh, I see... it looks as though you've copied and pasted the script from somewhere and missed a big chunk off the top.
jad9321
07-07-2006, 05:46 PM
Not quite,
I wrote it by looking at another script. Some of it was changed, All i want it to do is ask for the db username, Password, And DB and create the tabel.
jad9321
07-07-2006, 05:53 PM
Twey you have any ideaaa on how to fix this???
jr_yeo
07-07-2006, 05:54 PM
where is the if part for the
}else{ $muser = $_POST['muser']; $mpass = $_POST['mpass']; $mdata = $_POST['mdata']
if it exist before the <form></form> script then u should
</form><? } else {
// the rest of the code here
?>
i think.... :p
jad9321
07-07-2006, 05:59 PM
Dont see it...
jr_yeo
07-07-2006, 06:07 PM
what dont u see?
the if part for the else clause or what m referring to? :p
jad9321
07-07-2006, 06:10 PM
I dont see
</form><? } else {
// the rest of the code here
?>
And the if part... Is the if part this?:
if(empty($muser) || empty($mpass) || empty($mdata)){
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
}
jr_yeo
07-07-2006, 06:17 PM
the script should like something like :
<?if (condition) { ?>
<form method='post' action='install.php?step=1'>
<table>
<tr>
<td>MySQL User:</td>
<td><input type='text' name='muser' size='20'></td>
</tr>
<tr>
<td>MySQL Password:</td>
<td><input type='text' name='mpass' size='20'></td>
</tr>
<tr>
<td>MySQL Database:</td>
<td><input type='text' name='mdata' size='20'></td>
</tr>
<tr>
<td>Make sure all the above info is correct.</td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form><?
}else{
$muser = $_POST['muser']; $mpass = $_POST['mpass'];
$mdata = $_POST['mdata'];
}
if(empty($muser) || empty($mpass) || empty($mdata) ||{
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
}
// Connect to Check
mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error());
mysql_select_db ("$mdata");
// Create Tables
mysql_query("CREATE TABLE `request` (
`Habbo Name` varchar(20) NOT NULL default '',
`Song Request` varchar(50) NOT NULL default '',
`Shoutout\Joke` varchar(10) NOT NULL default '',
PRIMARY KEY (`Habbo Name`)
) TYPE=MyISAM") or die(mysql_error()); ?>
dunno how to highlight the correction(s) that i think should be corrected? (redundant huh?) :D
jad9321
07-07-2006, 06:18 PM
And what should the condition be, cause i'm stupid...
jr_yeo
07-07-2006, 06:19 PM
if that is the case, that if part should be before the else part :p
jad9321
07-07-2006, 06:21 PM
whaa?
jr_yeo
07-07-2006, 06:22 PM
And what should the condition be, cause i'm stupid...
cheer up kiddo.... just a newbie thing.... dont look down on urself... :D
jad9321
07-07-2006, 06:23 PM
lol. Ok.
jad9321
07-07-2006, 06:25 PM
if that is the case, that if part should be before the else part
huh??
jr_yeo
07-07-2006, 06:25 PM
ok...ok.... sorry thought u might catch what m trying to say .... give u what i think should be the outlook of the php script....
<? if(empty($muser) || empty($mpass) || empty($mdata) ||{
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
} ?>
<form method='post' action='install.php?step=1'>
<table>
<tr>
<td>MySQL User:</td>
<td><input type='text' name='muser' size='20'></td>
</tr>
<tr>
<td>MySQL Password:</td>
<td><input type='text' name='mpass' size='20'></td>
</tr>
<tr>
<td>MySQL Database:</td>
<td><input type='text' name='mdata' size='20'></td>
</tr>
<tr>
<td>Make sure all the above info is correct.</td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form><?
}else{
$muser = $_POST['muser']; $mpass = $_POST['mpass'];
$mdata = $_POST['mdata'];
}
// Connect to Check
mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error());
mysql_select_db ("$mdata");
// Create Tables
mysql_query("CREATE TABLE `request` (
`Habbo Name` varchar(20) NOT NULL default '',
`Song Request` varchar(50) NOT NULL default '',
`Shoutout\Joke` varchar(10) NOT NULL default '',
PRIMARY KEY (`Habbo Name`)
) TYPE=MyISAM") or die(mysql_error()); ?>
this is a 100% perfect script.... :D
jad9321
07-07-2006, 06:28 PM
Now i'm getting this error:
Parse error: parse error, unexpected '{' in /fpgs/fpgshttpd/smileyoureahabbo/install.php on line 1
jr_yeo
07-07-2006, 06:31 PM
Indubitably.
if(empty($muser) || empty($mpass) || empty($mdata)){
:eek: use the code above on line 1 :o
might help
jr_yeo
07-07-2006, 06:34 PM
if there still exist errors, its now way out of my league :o
sorry :(
jad9321
07-07-2006, 06:35 PM
So it should look like this?
<? if(empty($muser) || empty($mpass) || empty($mdata)){
Echo"<b>Error:</b> You have some boxes with No info in them, You MUST fill in EVERY BOX!";
die();
} ?>
<form method='post' action='install.php?step=1'>
<table>
<tr>
<td>MySQL User:</td>
<td><input type='text' name='muser' size='20'></td>
</tr>
<tr>
<td>MySQL Password:</td>
<td><input type='text' name='mpass' size='20'></td>
</tr>
<tr>
<td>MySQL Database:</td>
<td><input type='text' name='mdata' size='20'></td>
</tr>
<tr>
<td>Make sure all the above info is correct.</td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form><?
}else{
$muser = $_POST['muser']; $mpass = $_POST['mpass'];
$mdata = $_POST['mdata'];
}
// Connect to Check
mysql_connect ("localhost", "$muser", "$mpass") or die(mysql_error());
mysql_select_db ("$mdata");
// Create Tables
mysql_query("CREATE TABLE `request` (
`Habbo Name` varchar(20) NOT NULL default '',
`Song Request` varchar(50) NOT NULL default '',
`Shoutout\Joke` varchar(10) NOT NULL default '',
PRIMARY KEY (`Habbo Name`)
) TYPE=MyISAM") or die(mysql_error()); ?>
jr_yeo
07-07-2006, 06:37 PM
yeah :D more or less something like that :)
jad9321
07-07-2006, 06:39 PM
still not working... It dosent seem to like the }else{ thingy....
jr_yeo
07-07-2006, 06:41 PM
we should probably wait for Twey to be online again.... :o
can't help you beyond what i have said on my earlier posts :cool:
jad9321
07-07-2006, 06:50 PM
Wow... I'm good... lol I was messing around with it and i got it to work!
jr_yeo
07-08-2006, 02:29 AM
thats nice to hear :p dont get cocky though :D
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.