[PHP]If choose, insert.

Experienced Elementalist
Joined
Mar 22, 2008
Messages
297
Reaction score
0
I'm working on my online loader creator for retros, and i thought i would add pre-hosted DCRs.
I want ppl to be able to choose from a list (Let's say a name from a list) and if they choose eg. Daniel, an adress will be inserted in some places i want.

I hope you get me, here's the current source.

index.php:
PHP:
<?php include 'header.php'; ?>

<div class="main">

<div class="main_top"><b><font color="#FFFFFF">Start of by entering your information.</font></b></div>

<div class="main_texta"><form action=view.php method=get>
<font class=text>
Hotel name:
<br>
<input type=text name=hotelname size=25>
<p>

Your IP:
<br>
<input type=text name=ip size=25>
<p>

Your port:
<br>
<input type=text name=port size=25>
<p>

Your texts:
<br>
<input type=text name=texts size=25>
<p>

Your variables:
<br>
<input type=text name=vars size=25>
<p>

Your DCR's URL:
<br>
<input type=text name=dcr size=25>
<p>

Your loader URL:
<br>
<input type=text name=loader size=25>
<p>

<input type="checkbox" name="I_Agree_To_T.O.S" CHECKED><i>I agree to Habbmoon's <a href=# onClick=myPopup()>T.O.S</a>!</i>
<p> 
<input type=submit name=submit value="I'm Done!">
</form>


</div>

<div class="main_bottom"></div>

<?php include 'footer.php'; ?>

view.php:
PHP:
<?php include 'header.php'; ?>

<div class="main">

<div class="main_top"><b><font color="#FFFFFF">Your loader is done.</font></b></div>

<div class="main_texta">
<?php


$hname = $_GET['hotelname'];
$ip = $_GET['ip'];
$port = $_GET['port'];
$texts = $_GET['texts'];
$vars = $_GET['vars'];
$dcr = $_GET['dcr'];
$loader = $_GET['loader'];
$back = "index.php";
$valid = false;
// HERE THE HNAME CONTROLS STARTS!

if (
 !$hname || empty($hname)
)
{
   echo "<font class=text>The <font class=error>hotel name</font> is empty!<br>";
 $valid = false;
}

// HERE THE HNAME CONTROLS END

// HERE THE IP CONTROLS STARTS!

if (
 !$ip || empty($ip)
)
{
   echo "<font class=text>The <font class=error>IP</font> is empty!<br>
";
 $valid = false;
}
// HERE THE IP CONTROLS ENDS!
// HERE THE PORT CONTROLS STARTS!

 if (
 !$port || empty( $port )
}
{
   echo "<font class=text>The <font class=error>port</font> is empty!<br>
";
    $valid == false;
}
// HERE THE PORT CONTROLS ENDS!
// HERE THE TEXTS CONTROLS STARTS!

if (
 !$texts || empty($texts)
)
{
   echo "<font class=text>The <font class=error>texts</font> url is empty!<br>";
    $valid = false;
}
// HERE THE TEXTS CONTROLS END
// HERE THE VARS CONTROLS STARTS!

if (
 !$vars || empty($vars)
)
{
   echo "<font class=text>The <font class=error>vars url</font> is empty!<br>
";
    $valid = false;
}
// HERE THE VARS CONTROLS END
// HERE THE DCR CONTROLS STARTS!

if (
 !$dcr || empty($dcr)
)
{
   echo "<font class=text>The <font class=error>DCR url</font> is empty!<br>";
    $valid = false;
}
// HERE THE DCR CONTROLS END

if ($valid == true)
{
print "<a href=$back>Back</a>";
}


else {
    // If none of the above statements is correct.

echo "<font class=text>And your loader is done, all you have to do i copy and paste!<br><br>";
echo "<font class=text2>Code:</font>";

echo "<table class=code width=485 valign=top>
<td class=code td valign=top>
<font class=text2>
<html>
<br><head>
<br><title><font class=info>$hname</font></title>
<br><base target=_blank>
<br></head>
<br><body bgcolor=#000000 topmargin=0 link=#FFFFFF vlink=#FFFFFF alink=#FFFFFF>
<br><div align=center>
<br><param name=src value=>
<br><param name=swRemote value=swSaveEnabled=true swVolume=true swRestart=false swPausePlay=false swFastForward=false swTitle=<font class=info>$hname</font> swContextMenu=true>
<br><param name=swStretchStyle value=none>
<br><param name=swText value=>
<br><param name=bgColor value=#000000>
<br><param name=sw6 value=external.texts.txt=<font class=info>$texts</font>>
<br><param name=sw2 value=connection.info.host=<font class=info>$ip</font>;connection.info.port=<font class=info>$port</font>>
<br><param name=sw4 value=connection.mus.host=;connection.mus.port=30 001>
<br><param name=sw3 value=client.reload.url=<font class=info>$loader</font>>
<br><param name=sw1 value=site.url=<font class=info>$loader</font>;url.prefix=<font class=info>$hname</font>>
<br><param name=sw5 value=external.variables.txt=<font class=info>$vars</font>>
<br><embed src=<font class=info>$dcr</font> bgColor=#000000 width=720 height=540 align=middle swRemote=swSaveEnabled=true swVolume=true swRestart=false swPausePlay=false swFastForward=false swTitle=massivewake swContextMenu=true swStretchStyle=none swText= type=application/x-director pluginspage=http://www.macromedia.com/shockwave/download/
<br>sw6=external.texts.txt=<font class=info>$texts</font>
<br>sw2=connection.info.host=<font class=info>$ip</font>;connection.info.port=<font class=info>$port</font>
<br>sw4=connection.mus.host=;connection.mus.port=30001
<br>sw3=client.reload.url=<font class=info>$dcr</font>
<br>sw1=site.url=<font class=info>$loader</font>;url.prefix=<font class=info>$hname</font>
<br>sw5=external.variables.txt=<font class=info>$vars</font>>
<br></div>
<br></body>
<br></html>

</td>
</table>";
echo "<br><font class=text>(All your info is marked <font class=info>red</font>!)</font>.";
echo "<br><br><a href=index.php><font class=text>Make a new loader (back to index)</a>.";
}

?></div><div class=main_bottom></div>

<?php include 'footer.php'; ?>

And here's the adress: http://habbmoon.selaku.com/
 
Dropdown menu, so if you choose daniel, i wanna make to eg. www.mysite.com/dcr/habbo.dcr into the DCR variable.


And yeah btw, if you choose daniel the vars variable is also changed to something else (and you can't change it by yourself.

Well that's easy.
Code:
<form method="post" action="test.php">
<select name="test">
<optgroup label="test">
<option value="test">test</option>
<option value="test">test</option>
</optgroup>
</select>
<input type="submit" />
</form>

As for inserting into a mysql database
PHP:
mysql_query("INSERT INTO `test` VALUES ($var1, $var2)");
 
No, no, no. I don't use any MySQL for this, if you look at my view.php i do like this;
PHP:
$dcr = $_GET['dcr'];
and then i insert the variable where i need it.

@Mike : I wan't people to be able to choose from more than one.
 
I wan't people to be able to choose from a list of pre-hosted DCRs, so if they choose sPLAZE's, the dcr variable will recieive the adress wwww.blablabla.com.
 
Back