deleted user 111213 Grandmaster Cheater
Reputation: 0
Joined: 09 Nov 2007 Posts: 714
|
Posted: Mon Apr 06, 2009 12:55 pm Post subject: how to make "?l=forum" |
|
|
Code: | <style type="text/css">
body{
background-image: url(./images/bg.png);
color:#FFFF00;
font-family:Arial;
}
</style>
<?php
$con = mysql_connect("localhost", "root", "");
mysql_select_db(forum, $con);
$l = $_GET['l'];
$l_array = array('forum');
if(!$l){
echo "<form action=\"index.php?l=2\" method=\"POST\">\n";
echo "<tr><td>Username: </td><td><input type=\"text\" name=\"username\"></td></tr>\n";
echo "<tr><td><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n";
echo "</form>\n";
}
$username = $_POST['username'];
$errors = array();
if($l == "2"){
$sql = "SELECT * FROM users WHERE username='".$username."'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) > 0){
$errors[] = "The username <b>'".$username."'</b> already exists!\n";
}else{
if(count($errors) > 0){
foreach($errors AS $error){
echo $error . "<br />\n";
}
}else{
$sql2 = "INSERT INTO users (username) VALUES('".$username."')";
$res2 = mysql_query($sql2) or die(mysql_error());
echo "You have sucssesfully registered!\n";
}
}
}
if (!$l || !in_array($l, $l_array)) {
if($l == 'forum'){
include './forum.php';
}
}
?> |
the important lines in this are the
Code: | if (!$l || !in_array($l, $l_array)) {
if($l == 'forum'){
include './forum.php';
}
} | and
Code: | $l = $_GET['l'];
$l_array = array('forum'); |
i get the error...
Quote: | Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\xampp\htdocs\forum\index.php on line 47 |
my forum.php file is just
Code: | <?php echo "HI"; ?> |
i don't know how to make it just
any ideas?
EDIT: nvm, i just made it
Code: | $l_array.=$l;
if($l == 'forum'){
include './forum.php';
} |
|
|