Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Posts posted by DeanWhitehouse

  1. this is my code

    <?php
    if(isset($_POST['upload']))
    {
    $target = "images/";
    $image = basename( $_FILES['uploadedfile']['name']);
    $imagename = $_POST['imagename'];
    $imagecaption = $_POST['imagecaption'];
    $image_thumb = "<img src='$image' width='200px'/>";
    $image_link = '<a href='.$image.' rel="lightbox" title='.$imagecaption.'>'.$imagename.'</a>'; 
    $user_check = mysql_num_rows(mysql_query("SELECT * FROM `hayleyimages` WHERE image_name=1 "));
    $target = $target . basename( $_FILES['uploaded']['name']) ;
    $ok=1;
    
    //This is our size condition
    if ($uploaded_size > 350000)
    {
    echo "Your file is too large.<br>";
    $ok=0;
    }
    
    //This is our limit file type condition
    if ($uploaded_type =="text/php")
    {
    echo "No PHP files<br>";
    $ok=0;
    }
    
    //Here we check that $ok was not set to 0 by an error
    if ($ok==0)
    {
    Echo "Sorry your file was not uploaded";
    }
    
    if($user_check >= 1)
    {
    echo "$imagename already exists, please rename it.";
    }
    
    //If everything is ok we try to upload it
    else
    {
    //if($image && $imagename && $imagecaption)
    //{
    mysql_query("INSERT INTO `hayleyimages` (image_link,  image_name, image_caption, image_id) VALUES 	  ('$image_link','$imagename','$imagecaption', '')")
    or die('Error ' . mysql_error());
    	if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    	{
    	echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
    
    	}
    		else
    		{
    		echo "Sorry, there was a problem uploading your file.";
    		}
    //}
    //else
    //{
    //echo "<br>Please make sure all fields are filled in.";
    //}
    }
    }
    ?>
    <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">Image Name: <input type="text" name="imagename" /><br />Image Caption: <input type="text" name="imagecaption" /></form>
    <form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
    Please choose a file: <input name="uploaded" type="file" /><br />
    <input type="submit" value="Submit" name="upload" />
    </form>
    </body>
    </html>
    

     

    i have already connected to the database, and the file inserts properly , but it doesn't seem to insert the name and caption into the database. Can anybody see why?

  2. This will sound stupid, but how can i make an upload form and script. I looked at a few tutorials (w3 schools, tizag) and i didn't really get them. can anyone explain the code for it, i think with that i can make my own.

  3. just a quick quest, how do i check if an email is sent? this is my email code

    $to      = $user_email;
    $subject = 'Welcome,'$user_name;
    $message = "Hello,$user_name<br> welcome to the Random Game Design Template System<br> Congratulations on succesfully creating your site. This email can be fully customised in the admin centre $homepage.";
    $headers = 'From: RGD TS' . "\r\n" .
           'X-Mailer: PHP/' . phpversion();
    
    mail($to, $subject, $message, $headers);
    

    can i just add

    if(mail()
    {
    //my code
    }
    else
    {
    
    }
    

     

  4. still having a problem with this,

    this is my code

    variables

    $mainpage = "/home.php";
    $sitetitle = "Random Template System";
    $homepage = "http://" . $_SERVER["SERVER_NAME"];
    $titlepage = "http://" . $_SERVER["SERVER_NAME"].$mainpage;
    $customheader = "<a class='title' href='$home_page.$main_page'>$site_title</a>";
    $h_ome = "Home";
    $int_ro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomize the site.";
    $wel_come = wordwrap($intro, 70, "<br />\n", true);
    $di_sc = "This is the site disclaimer. Here is where most sites have copyright information and other things.";
    $sitedisclaimer = wordwrap($disc, 130, "<br />\n", true);
    $st_yle = "style.css";
    

     

    and this is what is wrote

    <?php
    $home_page = "http://deanwhitehouse.awardspace.co.uk";
    $main_page = "/home.php";
    $site_title = "Random Template System";
    $title_page = "http://deanwhitehouse.awardspace.co.uk/home.php";
    $custom_header = "<a class='title' href='.'></a>";
    $home = "Home";
    $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomize the site.";
    $style = "style.css";
    $site_disclaimer = "";
    $disc  = "This is the site disclaimer. Here is where most sites have copyright information and other things.";
    $welcome = "";
    
    ?>

     

    the writing code

    <?php
    
    // Random Game Design: PHP Website Template
    //  Version 1
    //  Copyright Dean Whitehouse, 2008
    require_once 'install.php';
    $config_file = "../includes/main.inc.php";
    
    $fw=fopen($config_file,"w+") 
    or die("Unable to open file!");	// Unable to open file
    
    $config_homepg = "\$home_page = \"".$homepage."\";\n";
    $config_main = "\$main_page = \"".$mainpage."\";\n";
    $config_title = "\$site_title = \"".$sitetitle."\";\n";
    $config_titlepg = "\$title_page = \"".$titlepage."\";\n";
    $config_customhead = "\$custom_header = \"".$customheader."\";\n";
    $config_home2 = "\$home = \"".$h_ome."\";\n";
    $config_intro = "\$intro = \"".$int_ro."\";\n";
    $config_welcome = "\$welcome = \"".$wel_come."\";\n";
    $config_disc = "\$disc  = \"".$di_sc."\";\n";
    $config_sitedisc = "\$site_disclaimer = \"".$sitedisclaimer."\";\n";
    $config_style = "\$style = \"".$st_yle."\";\n";
    
    $config_write = $config_homepg.$config_main.$config_title.$config_titlepg.$config_customhead.$config_home2.$config_intro.$config_style.$config_sitedisc.$config_disc.$config_welcome;
    
    fwrite($fw, "<?php\n".$config_write."\n?>");
    
    fclose($fw);
    
    ?>

  5. i am trying to write this to a file

    this is only an extract of the code

    $mainpage = "/home.php";
    $sitetitle = "Random Template System";
    $homepage = "http://" . $_SERVER["SERVER_NAME"];
    $titlepage = "http://" . $_SERVER["SERVER_NAME"].$mainpage;
    $customheader = '<a class="title" href="$home_page.$main_page">$site_title</a>';
    $h_ome = "Home";
    $int_ro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomize the site.";
    $wel_come = 'wordwrap($intro, 70, "<br />\n", true)';
    $di_sc = "This is the site disclaimer. Here is where most sites have copyright information and other things.";
    $sitedisclaimer = 'wordwrap($disc, 130, "<br />\n", true)';
    $st_yle = "style.css";
    

     

    this is the code i am using to write it

    <?php
    
    // Random Game Design: PHP Website Template
    //  Version 1
    //  Copyright Dean Whitehouse, 2008
    require_once 'install.php';
    $config_file = "../includes/main.inc.php";
    
    $fw=fopen($config_file,"w+") 
    or die("Unable to open file!");	// Unable to open file
    
    $config_homepg = "\$home_page = \"".$homepage."\";\n";
    $config_main = "\$main_page = \"".$mainpage."\";\n";
    $config_title = "\$site_title = \"".$sitetitle."\";\n";
    $config_titlepg = "\$title_page = \"".$titlepage."\";\n";
    $config_customhead = "\$custom_header = \"".$customheader."\";\n";
    $config_home2 = "\$home = \"".$h_ome."\";\n";
    $config_intro = "\$intro = \"".$int_ro."\";\n";
    $config_welcome = "\$welcome = \"".$wel_come."\";\n";
    $config_disc = "\$disc  = \"".$di_sc."\";\n";
    $config_sitedisc = "\$site_disclaimer = \"".$sitedisclaimer."\";\n";
    $config_style = "\$style = \"".$st_yle."\";\n";
    
    $config_write = $config_homepg.$config_main.$config_title.$config_titlepg.$config_customhead.$config_home2.$config_intro.$config_style.$config_sitedisc.$config_disc.$config_welcome;
    
    fwrite($fw, "<?php\n".$config_write."\n?>");
    
    fclose($fw);
    
    ?>

     

    i can't seem to write some of the variables properly

    these are the one's that don't work

     

    $custom_header = "<a class="title" href="$home_page.$main_page">$site_title</a>";

    $site_disclaimer = "wordwrap($disc, 130, "<br />\n", true)";

    $welcome = "wordwrap($intro, 70, "<br />\n", true)";

     

    i get a page error when viewing a page using the custom_header variable.

    can anyone help?

  6. yer, but i have a quick fix solution.

    this is what i am using now

    <?php
    // Random Game Design: PHP Website Template
    //  Version 1
    //  Copyright Dean Whitehouse, 2008
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['table_names']))
    {
    require_once '../includes/db_connect.php';
    $dbhost = $_POST["dbhost"];			
    $user = $_POST["user"];
    $forum_quest = $_POST["forum_question"];
    $forum_answ = $_POST ["forum_answers"];
    if ($user.$forum_quest.$forum_answ)
    {
    require_once "config_writetable.php";
    echo "Table details saved:<br>User details saved: $user<br>Forum Questions saved: $forum_quest<br>Forum Answers saved: $forum_answ";
    ?>
    <p>Table name's saved, press continue to create the table.<form action="<?php $_SERVER['PHP_SELF'] ?>?stage3" method="post">
    <input type='submit' value='Continue' name='table_saved'>
    </form>
    </p>
    <?php
    }
    else
    {
    echo ("Please go back and fill in the required fields");
    }
    mysql_close();
    exit();
    }
    
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['table_saved']))
    {
    require_once '../includes/db_connect.php';
    require_once '../includes/config_table.inc.php';
    mysql_connect($dbhost,$dbuser,$dbpass)
    or die('Could not connect: ' . mysql_error());
    
    // Select database
    mysql_select_db($dbname)
    or die('Could not find the database: ' . mysql_error());
    
    $sql_user = "CREATE TABLE $user(
    user_id int(11) AUTO_INCREMENT NOT NULL PRIMARY KEY,
    user_name varchar(100) NOT NULL,
    user_password varchar(100) NOT NULL,
    user_email varchar(100) NOT NULL,
    user_ip varchar(20) NOT NULL,
    user_ban varchar(3) NOT NULL,
    ban_reason varchar(100) NOT NULL,
    ban_length varchar(25) NOT NULL,
    userlevel tinyint(1) unsigned NOT NULL,
    random_key varchar(32) NOT NULL,
    user_activated varchar(25) NOT NULL,
    show_email int(1) NOT NULL
    )";
    
    
    $sql_forum1 = "CREATE TABLE $forum_quest(
    id int(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    topic varchar(255) NOT NULL default '',
    detail longtext NOT NULL,
    name varchar(65) NOT NULL default '',
    email varchar(65) NOT NULL default '',
    datetime varchar(25) NOT NULL default '',
    view int(4) NOT NULL default '0',
    reply int(4) NOT NULL default '0'
    )";
    
    
    $sql_forum2 = "CREATE TABLE $forum_answ(
    question_id int(4) NOT NULL default '0',
    a_id int(4) NOT NULL default '0',
    a_name varchar(65) NOT NULL default '',
    a_email varchar(65) NOT NULL default '',
    a_answer longtext NOT NULL,
    a_datetime varchar(25) NOT NULL default '',
    KEY a_id (`a_id`)
    )";
    
    $make_user= mysql_query($sql_user);
    $make_forum = mysql_query($sql_forum1);
    $make_forum1 = mysql_query($sql_forum2);
    $checkifexist_user = mysql_query ("SELECT * FROM '$user' LIMIT 0,1");
    $checkifexist_quest = mysql_query ("SELECT * FROM '$forum_quest' LIMIT 0,1");
    $checkifexist_answ = mysql_query ("SELECT * FROM '$forum_answ' LIMIT 0,1");
    
    if (!$make_user)
    {
    echo("'$user' Table already exists.<br>'$user' table could not be created.<br>");
    }
    else
    {
    echo("'$user' Table Created.<br>");
    }
    if (!make_forum)
    {
    echo("'$forum_quest' Table already exists.<br>'$forum_quest' table could not be created.<br>");
    }
    else
    {
    echo("'$forum_quest' Table Created.<br>");
    }
    if (!make_forum1)
    {
    echo("'$forum_quest' Table already exists.<br>'$forum_quest' table could not be created.<br>");
    }
    else
    {
    echo("'$forum_answ' Table Created.<br>");
    }
    ?><form action="<?php $_SERVER['PHP_SELF'] ?>?stage4" method="post">
    <input type="submit" value="Continue" name="continue_saved"/>
    <?
    mysql_close();
    exit();
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['continue_saved']))
    {
    require_once '../includes/db_connect.php';
    ?>
    <html>
    <table bgcolor='#999999' align='center' width="400px">
    <form action="<?php $_SERVER['PHP_SELF']; ?>?stage5" method="POST">
    <tr><td width="10px">Username: </td><td><input type='text' name='user_name' maxlength="20" width="400px"  /><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">E-mail Address:</td> <td><input type='text' name='user_email' /><br /></td></tr>
    <tr><td width="10px">Confirm E-mail Address: </td><td><input type='text' name='user_email2'/><br /></td></tr>
    <tr><td width="10px">Password:</td><td> <input type='password' name='user_password' maxlength="30"/><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">Confirm Password:</td><td> <input type='password' name='user_password2'  maxlength="30" /><br /></td></tr>
    <tr><td><input type='submit' value='Complete Registration' name='admin_signup' /></td><td><input type="reset" value="Reset Fields" name="reset" /></td></tr>
    </form>
    </table>
    </html>
    <?php
    mysql_close();
    exit();
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['admin_signup'])){	
    require_once '../includes/db_connect.php';
    $user_name = mysql_real_escape_string($_POST["user_name"]);		
    $user_password =mysql_real_escape_string($_POST["user_password"]);		
    $user_password2 =mysql_real_escape_string ($_POST["user_password2"]);
    $user_email =mysql_real_escape_string ($_POST["user_email"]);		
    $user_email2 =mysql_real_escape_string ($_POST["user_email2"]);
    $ip = $_SERVER['REMOTE_ADDR'];
    $checkpw = $user_password == $user_password2;
    $checkem = $user_email == $user_email2;
    if ($user_name && $user_password && $user_password2 && $user_email && $user_email2)
    {
    		$user_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE userlevel=1 "));	
    		$length = strlen($user_password);
    		$length1 = strlen($user_name);
    		if ($length >= 6)
    				{
    					if ($length1 >= 4)
    					{
    						if ($user_check >= 1)
    						{
    							echo "Sorry, but the head admin account is already created. Please delete the table in your mysql 		                                database and run the install.php file.";
    						}
    							elseif ($checkpw.$checkem)
    							{
    							$userPswd = md5($user_password);
    							$userpwsd = sha1($userPswd);
    							mysql_query("INSERT INTO `$user` (user_id,  user_name, user_password, user_email, user_ip, userlevel) VALUES ('','$user_name','$userpwsd','$user_email','$ip','1')")
    							or die('Error ' . mysql_error());
    						require_once 'main_write.php';
    						require_once 'redirect_install.php';
    							 }
    					 }
    				} 
    						if($length <= 5)
    						{
    
    							echo "Password Too Short<br>";
    						}
    
    					if($length1 <= 3)
    					{
    
    						echo "Username Too Short.<br>";
    					}
    
    				if(!$checkpw)
    				{
    
    						echo "The passwords you entered do not match. Please check these details and try again.<br>";
    				}
    
    			if(!$checkem)
    			{
    
    				echo "The emails you entered do not match. Please check these details and try again.<br>";
    			}
    	}
    	else 
    		{
    
    			echo "Please fill in all of the required fields.";
    		}
    mysql_close();
    exit();		
    }
    
    ?><!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['check']))
    {
    // Database Connection Information
    $dbhost = $_POST["dbhost"];			// Database Host
    $dbuser = $_POST["dbuser"];		// Database Username
    $dbpass = $_POST["dbpass"];		// Database Password
    $dbname = $_POST["dbname"];			// Database Name
    
    
    // Attempt to connect to the database using the user submitted form.
    $con = mysql_connect($dbhost, $dbuser, $dbpass);
    if ($con)
    {
    require_once 'config_write.php';
    echo "You have successfully connected with these details to '$dbname'. <br>Username - '$dbuser'<br> Password - '$dbpass'<br> Database Host - '$dbhost'<br>Please enter the table names you want, or if you want to use the preset names click continue. NOTE: Each table must be a different name. Please do not leave any blank spaces.
    ";
    ?>
    <table align="center" bgcolor="#333333" width="300px" border="0">
    <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>?stage2">
    <tr><td><font color="#FFFFFF">User Details:</td><td><input type='text' name='user' onClick="this.value=''" value="Users"></td></tr>
    <tr><td><font color="#ffffff">Forum Questions</td>
    <td><input type="text" name='forum_question' onClick="this.value=''" value="questions"></td></tr>
    <tr><td><font color='#ffffff'>Forum Answers</td>
    <td><input type='text' name='forum_answers' onClick="this.value=''" value="answers"><br></td></tr>
    <tr><td></td><td><input type='submit' value='Continue' name='table_names'></td></tr>
    </font>
    </form>
    </table>	
    <?php 
    }					
    else
    {
    	echo 'Error connecting to database:'  . mysql_error() . '\n';		// Database creation failed
    }
    mysql_close();
    exit();
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <table align='center' bgcolor="#999999" width='300px' border='0'><form method='post' action="<?php $_SERVER['PHP_SELF']; ?>?stage1">
    <tr><td>
    Database Host:</td><td>  
    <input type='text' name='dbhost' onClick="this.value=''" value="Database Host"><br></td></tr>
    <tr><td>
    Database Username:</td><td>  
    <input type='text' name='dbuser' onClick="this.value=''" value="Database Username"><br></td></tr>
    <tr><td>
    Database Password:  </td><td>
    <input type='text' name='dbpass' onClick="this.value=''" value="Database Password"><br></td></tr>
    <tr><td>
    Database Name:  </td><td>
    <input type='text' name='dbname' onClick="this.value=''" value="Database Name"><br></td></tr>
    <tr><td></td><td><input type='submit' value='Continue' name='check'>
    </td></tr></form>
    </table>
    <!------------------------------------------------------------------------------------------------------->
    

     

    if anyone wants to point out errors or anything, please do

  7. ok, i have another related problem(related to this script)

    it's hard to explain, but i will try, the first table in the script should only appear once, and then not again (so only if you run the page, and then when you press next(or what ever) you don't see it) but it appears on every part of the installation.

    here is my script

    <?php
    // Random Game Design: PHP Website Template
    //  Version 1
    //  Copyright Dean Whitehouse, 2008
    session_start();
    ?>
    
    <!------------------------------------------------------------------------------------------------------->
    <table align='center' bgcolor="#999999" width='300px' border='0'><form method='post' action="<?php $_SERVER['PHP_SELF']; ?>">
    <tr><td>
    Database Host:</td><td>  
    <input type='text' name='dbhost' onClick="this.value=''" value="Database Host"><br></td></tr>
    <tr><td>
    Database Username:</td><td>  
    <input type='text' name='dbuser' onClick="this.value=''" value="Database Username"><br></td></tr>
    <tr><td>
    Database Password:  </td><td>
    <input type='text' name='dbpass' onClick="this.value=''" value="Database Password"><br></td></tr>
    <tr><td>
    Database Name:  </td><td>
    <input type='text' name='dbname' onClick="this.value=''" value="Database Name"><br></td></tr>
    <tr><td></td><td><input type='submit' value='Continue' name='check'>
    </td></tr></form>
    </table>
    
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['check']))
    {
    // Database Connection Information
    $dbhost = $_POST["dbhost"];			// Database Host
    $dbuser = $_POST["dbuser"];		// Database Username
    $dbpass = $_POST["dbpass"];		// Database Password
    $dbname = $_POST["dbname"];			// Database Name
    
    
    // Attempt to connect to the database using the user submitted form.
    $con = mysql_connect($dbhost, $dbuser, $dbpass);
    if ($con)
    {
    require_once 'config_write.php';
    echo "You have successfully connected with these details to '$dbname'. <br>Username - '$dbuser'<br> Password - '$dbpass'<br> Database Host - '$dbhost'<br>Please enter the table names you want, or if you want to use the preset names click continue. NOTE: Each table must be a different name. Please do not leave any blank spaces.
    ";
    ?>
    <table align="center" bgcolor="#333333" width="300px" border="0">
    <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    <tr><td><font color="#FFFFFF">User Details:</td><td><input type='text' name='user' onClick="this.value=''" value="Users"></td></tr>
    <tr><td><font color="#ffffff">Forum Questions</td>
    <td><input type="text" name='forum_question' onClick="this.value=''" value="questions"></td></tr>
    <tr><td><font color='#ffffff'>Forum Answers</td>
    <td><input type='text' name='forum_answers' onClick="this.value=''" value="answers"><br></td></tr>
    <tr><td></td><td><input type='submit' value='Continue' name='table_names'></td></tr>
    </font>
    </form>
    </table>	
    <?php 
    }					
    else
    {
    	echo 'Error connecting to database:'  . mysql_error() . '\n';		// Database creation failed
    }
    // Close connection to the database
    mysql_close();
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['table_names']))
    {
    require_once '../includes/db_connect.php';
    $dbhost = $_POST["dbhost"];			
    $user = $_POST["user"];
    $forum_quest = $_POST["forum_question"];
    $forum_answ = $_POST ["forum_answers"];
    if ($user.$forum_quest.$forum_answ)
    {
    require_once "config_writetable.php";
    echo "Table details saved:<br>User details saved: $user<br>Forum Questions saved: $forum_quest<br>Forum Answers saved: $forum_answ";
    ?>
    <p>Table name's saved, press continue to create the table.<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
    <input type='submit' value='Continue' name='table_saved'>
    </form>
    </p>
    <?php
    }
    else
    {
    echo ("Please go back and fill in the required fields");
    }
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['table_saved']))
    {
    require_once '../includes/db_connect.php';
    mysql_connect($dbhost,$dbuser,$dbpass)
    or die('Could not connect: ' . mysql_error());
    
    // Select database
    mysql_select_db($dbname)
    or die('Could not find the database: ' . mysql_error());
    
    $sql_user = "CREATE TABLE $user(
    user_id int(11) AUTO_INCREMENT NOT NULL PRIMARY KEY,
    user_name varchar(100) NOT NULL,
    user_password varchar(100) NOT NULL,
    user_email varchar(100) NOT NULL,
    user_ip varchar(20) NOT NULL,
    user_ban varchar(3) NOT NULL,
    ban_reason varchar(100) NOT NULL,
    ban_length varchar(25) NOT NULL,
    userlevel tinyint(1) unsigned NOT NULL,
    random_key varchar(32) NOT NULL,
    user_activated varchar(25) NOT NULL,
    show_email int(1) NOT NULL
    )";
    
    
    $sql_forum1 = "CREATE TABLE $forum_quest(
    id int(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    topic varchar(255) NOT NULL default '',
    detail longtext NOT NULL,
    name varchar(65) NOT NULL default '',
    email varchar(65) NOT NULL default '',
    datetime varchar(25) NOT NULL default '',
    view int(4) NOT NULL default '0',
    reply int(4) NOT NULL default '0'
    )";
    
    
    $sql_forum2 = "CREATE TABLE $forum_answ(
    question_id int(4) NOT NULL default '0' PRIMARY KEY,
    a_id int(4) NOT NULL default '0',
    a_name varchar(65) NOT NULL default '',
    a_email varchar(65) NOT NULL default '',
    a_answer longtext NOT NULL,
    a_datetime varchar(25) NOT NULL default '',
    )";
    
    $make_user= mysql_query($sql_user);
    $make_forum = mysql_query($sql_forum1);
    $make_forum1 = mysql_query($sql_forum2);
    $checkifexist_user = mysql_query ("SELECT * FROM '$user' LIMIT 0,1");
    $checkifexist_quest = mysql_query ("SELECT * FROM '$forum_quest' LIMIT 0,1");
    $checkifexist_answ = mysql_query ("SELECT * FROM '$forum_answ' LIMIT 0,1");
    
    if (!$make_user)
    {
    echo("'$user' Table already exists.<br>'$user' table could not be created.<br>");
    }
    else
    {
    echo("'$user' Table Created.<br>");
    }
    if (!make_forum)
    {
    echo("'$forum_quest' Table already exists.<br>'$forum_quest' table could not be created.<br>");
    }
    else
    {
    echo("'$forum_quest' Table Created.<br>");
    }
    if (!make_forum1)
    {
    echo("'$forum_quest' Table already exists.<br>'$forum_quest' table could not be created.<br>");
    }
    else
    {
    echo("'$forum_answ' Table Created.<br>");
    }
    ?><form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
    <input type="submit" value="Continue" name="continue_saved"/>
    <?
    mysql_close();
    exit();
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php
    if(isset($_POST['continue_saved']))
    {
    require_once '../includes/db_connect.php';
    ?>
    <html>
    <table bgcolor='#999999' align='center' width="400px">
    <form action='<?php $_SERVER['PHP_SELF']; ?>' method='POST'>
    <tr><td width="10px">Username: </td><td><input type='text' name='user_name' maxlength="20" width="400px"  /><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">E-mail Address:</td> <td><input type='text' name='user_email' /><br /></td></tr>
    <tr><td width="10px">Confirm E-mail Address: </td><td><input type='text' name='user_email2'/><br /></td></tr>
    <tr><td width="10px">Password:</td><td> <input type='password' name='user_password' maxlength="30"/><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">Confirm Password:</td><td> <input type='password' name='user_password2'  maxlength="30" /><br /></td></tr>
    <tr><td><input type='submit' value='Complete Registration' name='admin_signup' /></td><td><input type="reset" value="Reset Fields" name="reset" /></td></tr>
    </form>
    </table>
    </html>
    <?php
    }
    ?>
    <!------------------------------------------------------------------------------------------------------->
    <?php //admin form ?>
    <?php
    if(isset($_POST['admin_signup'])){	
    require_once '../includes/db_connect.php';
    $user_name = mysql_real_escape_string($_POST["user_name"]);		
    $user_password =mysql_real_escape_string($_POST["user_password"]);		
    $user_password2 =mysql_real_escape_string ($_POST["user_password2"]);
    $user_email =mysql_real_escape_string ($_POST["user_email"]);		
    $user_email2 =mysql_real_escape_string ($_POST["user_email2"]);
    $ip = $_SERVER['REMOTE_ADDR'];
    $checkpw = $user_password == $user_password2;
    $checkem = $user_email == $user_email2;
    if ($user_name && $user_password && $user_password2 && $user_email && $user_email2)
    {
    		$user_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE userlevel=1 "));	
    		$length = strlen($user_password);
    		$length1 = strlen($user_name);
    		if ($length >= 6)
    				{
    					if ($length1 >= 4)
    					{
    						if ($user_check >= 1)
    						{
    							echo "Sorry, but the head admin account is already created. Please delete the table in your mysql 		                                database and run the install.php file.";
    						}
    							elseif ($checkpw.$checkem)
    							{
    							$userPswd = md5($user_password);
    							$userpwsd = sha1($userPswd);
    							mysql_query("INSERT INTO `$user` (user_id,  user_name, user_password, user_email, user_ip, userlevel) VALUES ('','$user_name','$userpwsd','$user_email','$ip','1')")
    							or die('Error ' . mysql_error());
    						require_once 'main_write.php';
    						require_once 'redirect_install.php';
    							 }
    					 }
    				} 
    						if($length <= 5)
    						{
    
    							echo "Password Too Short<br>";
    						}
    
    					if($length1 <= 3)
    					{
    
    						echo "Username Too Short.<br>";
    					}
    
    				if(!$checkpw)
    				{
    
    						echo "The passwords you entered do not match. Please check these details and try again.<br>";
    				}
    
    			if(!$checkem)
    			{
    
    				echo "The emails you entered do not match. Please check these details and try again.<br>";
    			}
    	}
    	else 
    		{
    
    			echo "Please fill in all of the required fields.";
    		}
    mysql_close();			
    }
    
    ?>
    <!------------------------------------------------------------------------------------------------------->

     

    each part of the installation is seperated by html comment tags

  8. ok, thanks for the reply, i didn't think of trying that.

    Here is an update of my code, does anyone know how to echo the error on next to the form without inlcuding the file?

     

    <?php
    // Random Game Design: PHP Website Template
    //  Version 1
    //  Copyright Dean Whitehouse, 2008
    if(isset($_POST['admin_signup'])){	
    require_once '../includes/db_connect.php';
    $user_name = mysql_real_escape_string($_POST["user_name"]);		
    $user_password =mysql_real_escape_string($_POST["user_password"]);		
    $user_password2 =mysql_real_escape_string ($_POST["user_password2"]);
    $user_email =mysql_real_escape_string ($_POST["user_email"]);		
    $user_email2 =mysql_real_escape_string ($_POST["user_email2"]);
    $ip = $_SERVER['REMOTE_ADDR'];
    $checkpw = $user_password == $user_password2;
    $checkem = $user_email == $user_email2;
    if ($user_name && $user_password && $user_password2 && $user_email && $user_email2)
    	{
    		$user_check = mysql_num_rows(mysql_query("SELECT * FROM $user WHERE user_email='$user_email' 
    																			OR user_name='$user_name'"));
    			$length = strlen($user_password);
    			$length1 = strlen($user_name);
    				if ($length >= 6)
    				{
    					if ($length1 >= 4)
    					{
    						if ($user_check >= 1)
    						{
    							require_once 'register.php';
    							echo "Sorry, but the username or email you
    							 requested is already in use. Please enter a different username.";
    						}
    
    							elseif ($user_password == $user_password2 && $user_email == $user_email2)
    							{
    							$userPswd = md5($user_password);
    							$userpwsd = sha1($userPswd);
    							mysql_query("INSERT INTO `$user` (user_id, 
    							 user_name, user_password, user_email, user_ip, userlevel
    							 ) VALUES 		('','$user_name','$userpwsd','$user_email','$ip','1')")
    							or die('Error ' . mysql_error());
    							echo "Succesfully Registered.";
    							header ("http://".$_SERVER[HTTP_HOST]);
     							}
    					}
    				}
    
    
    
    						if($length <= 5)
    						{
    
    							echo "Password Too Short<br>";
    						}
    
    					if($length1 <= 3)
    					{
    
    						echo "Username Too Short.<br>";
    					}
    
    				if(!$checkpw)
    				{
    
    						echo "The passwords you entered do not match. Please check these details and try again.<br>";
    				}
    
    			if(!$checkem)
    			{
    				echo "The emails you entered do not match. Please check these details and try again.<br>";
    			}
    	}
    	else 
    		{
    
    			echo "Please fill in all of the required fields.";
    		}
    mysql_close();
    }
    exit();
    if(isset($_POST['continue_saved']))
    {
    require_once '../includes/db_connect.php';
    ?>
    <html>
    <table bgcolor='#999999' align='center' width="400px">
    <form action='<?php $_SERVER['PHP_SELF']; ?>' method='POST'>
    <tr><td width="10px">Username: </td><td><input type='text' name='user_name' maxlength="20" width="400px" value="<?php echo $user_name ?>" /><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">E-mail Address:</td> <td><input type='text' name='user_email' value="<?php echo $user_email ?>"/><br /></td></tr>
    <tr><td width="10px">Confirm E-mail Address: </td><td><input type='text' name='user_email2' value="<?php echo $user_email2 ?>"/><br /></td></tr>
    <tr><td width="10px">Password:</td><td> <input type='password' name='user_password' maxlength="30"/><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">Confirm Password:</td><td> <input type='password' name='user_password2'  maxlength="30" /><br /></td></tr>
    <tr><td><input type='submit' value='Complete Registration' name='admin_signup' /></td><td><input type="reset" value="Reset Fields" name="reset" /></td></tr>
    </form>
    </table>
    </html>
    <?php
    exit();
    }

  9. on my registration form, i have a few things that are required , how can i have it so that it shows the error on next to the form and keeps what the user entered in the form(except password). My form is embebed into a page, so i cannont include the page, as it will shows the begging on the page and not the registration form.

    this is my part of code

    if(isset($_POST['admin_signup'])){	
    require_once '../includes/db_connect.php';
    $user_name = mysql_real_escape_string($_POST["user_name"]);		
    $user_password =mysql_real_escape_string($_POST["user_password"]);		
    $user_password2 =mysql_real_escape_string ($_POST["user_password2"]);
    $user_email =mysql_real_escape_string ($_POST["user_email"]);		
    $user_email2 =mysql_real_escape_string ($_POST["user_email2"]);
    $ip = $_SERVER['REMOTE_ADDR'];
    if ($user_name && $user_password && $user_password2 && $user_email && $user_email2)
    {
    	$user_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE userlevel=1 "));	
    $length = strlen($user_password);
    if ($length >= 6)
    {
    if ($user_check >= 1)	
    {
    	echo "Sorry, but the head admin account is already created. Please delete the table in your mysql database and run the install.php file.";
    }
    elseif ($user_password == $user_password2 && $user_email == $user_email2)
    {
    $userPswd = md5($user_password);
    $userpwsd = sha1($userPswd);
    mysql_query("INSERT INTO `$user` (user_id,  user_name, user_password, user_email, user_ip, userlevel) VALUES ('','$user_name','$userpwsd','$user_email','$ip','1')")
    or die('Error ' . mysql_error());
    require_once 'main_write.php';
    require_once 'redirect_install.php';
     }
     }
    else
    {
    echo "Either the passwords or emails you entered do not match. Please check these details and try again";	
    
    }
    } 
    
    else 
    {
    echo "Please fill in all of the required fields.";
    mysql_close();
    }
    }
    exit();
    ?>
    <?php
    if(isset($_POST['continue_saved']))
    {
    require_once '../includes/db_connect.php';
    ?>
    <html>
    <table bgcolor='#999999' align='center' width="400px">
    <form action='<?php $_SERVER['PHP_SELF']; ?>' method='POST'>
    <tr><td width="10px">Username: </td><td><input type='text' name='user_name' maxlength="20" width="400px"  /><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">E-mail Address:</td> <td><input type='text' name='user_email' /><br /></td></tr>
    <tr><td width="10px">Confirm E-mail Address: </td><td><input type='text' name='user_email2'/><br /></td></tr>
    <tr><td width="10px">Password:</td><td> <input type='password' name='user_password' maxlength="30"/><br /></td></tr>
    <tr><td width="10px">Maximum Length<br /> 20 characters.</td></tr>
    <tr><td width="10px">Confirm Password:</td><td> <input type='password' name='user_password2'  maxlength="30" /><br /></td></tr>
    <tr><td><input type='submit' value='Complete Registration' name='admin_signup' /></td><td><input type="reset" value="Reset Fields" name="reset" /></td></tr>
    </form>
    </table>
    </html>
    <?php
    exit();
    }

  10. i am getting these errors when i try and login

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'crazyemochild'@'82.197.131.40' (using password: NO) in /home/www/mysitename.co.uk/nav_bar.php on line 86
    
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/www/mysitename.co.uk/nav_bar.php on line 86
    
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'crazyemochild'@'82.197.131.40' (using password: NO) in /home/www/mysitename.co.uk/nav_bar.php on line 87
    
    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/www/mysitename.co.uk/nav_bar.php on line 87

    but i only get these errors when i try to login on certain pages???

    i can login on the home page, but only that page.

    this is my code

    <div class="login">
    <?php
    $server = str_replace("?logout","",$_SERVER['PHP_SELF']);
    ?>
    <table class="log_in"><form action="<?php echo "$server"; ?>" method="post">
    <th>Welcome</th>
    <tr><td align="center">Username:</td></tr><tr><td align="center"><input type="text" name="user_name"  size="16" value="<?php echo $_COOKIE['uname']; ?>" /><br /></td></tr>
    <tr><td align="center">Password:</td></tr><tr><td align="center"> <input type="password" name="user_password"  size="16" value="<?php echo $_COOKIE['userpw'] ?>" /><br /></td></tr>
    <tr><td align="center"><input type="hidden" name="login" value="true"><input type="submit" value="Submit"></td></tr>
    <tr><td align="centre"><input type="checkbox" name="remember" <?php echo $_COOKIE['check'] ?>> Remember Me </td></tr><tr><td align="center"><a href="register.php">[Register]</a></td></tr><tr><td align="center"><a href="forgot_password.php">[Forgot Password?]</a></td></tr></table>
    </form>
    </div>
    <?php 
    if ($_SESSION['is_valid'] == false) {
        if (isset($_POST['login'])) { 
    
            $user_name = mysql_real_escape_string($_POST["user_name"]);
            $user_password = mysql_real_escape_string($_POST["user_password"]);
            $cookiename = forumcookie;
            $verify_username = strlen($user_name);
            $verify_pass = strlen($user_password);
            if ($verify_pass > 0 && $verify_username > 0) {
                $userPswd = md5($user_password);
                $userpwsd = sha1($userPswd);
                $sql = "SELECT * FROM $user WHERE user_name='$user_name' AND user_password='$userpwsd' LIMIT 1;";
                $result = mysql_query($sql) or die(mysql_error() . " in $sql");
                if (mysql_num_rows($result) == 1) {
                    $row = mysql_fetch_assoc($result);
                    $s_userpass = serialize($userpass);
                    $_SESSION['id_username'] = $row['user_name'];
                    $_SESSION['id_user_password'] = $row['user_password'];
                    $_SESSION['user_level'] = $row['userlevel'];
                    $_SESSION['user_id'] = $row['user_id'];
                    $_SESSION['is_valid'] = true;
                    if (isset($_POST['remember'])) {
                      $checked = "checked='checked'";
    		         setcookie("uname", $_SESSION['id_username'], time() + 86400*100);
                      setcookie("userpw", $user_password, time() + 86400*100);
    			  setcookie("check",$checked, time() + 86400*100);
    			  mysql_close();
                 }
                  header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
                } else {
                    echo "Login failed. Username or Password are not correct.";
                }
            } else {
                ?>
    		<p><font style="font-size:small;">You left required field(s) blank</font></p>
    		<?php
            }
        }
    }
    }
    ?>
    </div>
    </div>

     

    and this is the home page

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <?php
    $filename = "install/instll.php";
    if (file_exists($filename)) {
         ?><p class="exists"><br>Please remove the install.php file<br> and the install folder</p><?php
    } else
    {
    ?><p class="welcome"><?php echo"$welcome"; ?></p>
    <?php
    }
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>
    

     

    and this is the member page(this is where i got the error)

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> 
    <div class="member">
    <?php
    if ($_SESSION['is_valid'] == true){
    
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    require_once 'nav_bar.php';
    
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname";
    $show_email = $row['show_email'];
    if (mysql_num_rows($result) < 1) {
         echo 'This ID does not exist in the database<br>';
     echo "<a href=\"members.php\">Return to Members Page</a>";
     exit();
    }
    if ($show_email == 1)
    { 
    $email = "$profemail";
    $email = explode('@',$email);
    echo '<br>Email:'
    ?>
    <a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>";self.close();'onmouseover='window.status="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>"; return true;' onmouseout='window.status="";return true;'> Email Me</a>
    <?php
    }
    elseif ($show_email == 0)
    {
    echo "<br>Email:   Hidden";
    }
    exit();
    }
    else {
    echo "Unknown User ID! <br />";
    echo "<a href=\"members.php\">Return to Members Page</a>";
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>
    </div>
    <?php
    mysql_close();
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>

     

    the nav_bar is where the login form is

    any other questions , please ask me

  11. i have this pagination code, that is ment to display 1 user per page, but it doesn't work, it shows all the usernames but has page 1-3 but they all show the same data. There is also a number 7 at the top of the area where the pagination is.

    this is my pagination code,

    if (!(isset($pagenum)))
    {
    $pagenum = 1;
    } 
    $data = mysql_query("SELECT * FROM $user") or die(mysql_error());
    $rows = mysql_num_rows($data); 
    $page_rows = 1;
    $last = ceil($rows/$page_rows); 
    if ($pagenum < 1)
    {
    $pagenum = 1;
    }
    elseif ($pagenum > $last)
    {
    $pagenum = $last;
    } 
    $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
    $data_p = mysql_query("SELECT * FROM $user $max") or die(mysql_error());
    while($info = mysql_fetch_array( $data_p ))
    {
    Print $info['user_id'];
    echo "<br>";
    }
    echo "<p>";
    echo " --Page $pagenum of $last-- <p>";
    if ($pagenum == 1)
    {
    }
    else
    {
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
    echo " ";
    $previous = $pagenum-1;
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";
    } 
    echo " ---- ";
    if ($pagenum == $last)
    {
    }
    else {
    $next = $pagenum+1;
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
    echo " ";
    echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";
    }

     

    and this is where i tried implementing it

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> 
    <div class="member">
    <?php
    if ($_SESSION['is_valid'] == true){
    
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    require_once 'nav_bar.php';
    
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname";
    $show_email = $row['show_email'];
    if (mysql_num_rows($result) < 1) {
         echo 'This ID does not exist in the database<br>';
     echo "<a href=\"members.php\">Return to Members Page</a>";
     exit();
    }
    if ($show_email == 1)
    { 
    echo '<br>Email:<a href="mailto:'.$profemail.'">    Email Me</a>';
    }
    elseif ($show_email == 0)
    {
    echo "<br>Email:   Hidden";
    }
    exit();
    }
    else {
    echo "Unknown User ID! <br />";
    echo "<a href=\"members.php\">Return to Members Page</a>";
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>
    </div>
    <?php
    mysql_close();
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>

     

    this is the exact area

    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }

     

    if i'm not explaining properly just say

  12. when i click on a members ID the navigation bar dissapears, the URL goes from members.php to members.php?id=18

    this is my code

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> 
    <div class="member">
    <?php
    if ($_SESSION['is_valid'] == true){
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname<br>";
    $show_email = $row['show_email'];
    if (mysql_num_rows($result) < 1) {
         echo 'This ID does not exist in the database';
     exit();
    }
    if ($show_email == 1)
    { 
    echo 'Email:<a href="mailto:'.$profemail.'">    Email Me</a>';
    }
    elseif ($show_email == 0)
    {
    echo "Email:   Hidden";
    }
    exit();
    }
    else {
    echo "Unknown User ID! <br />";
    echo "<a href=\"members.php\">Return to Members Page</a>";
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>
    </div>
    <?php
    mysql_close();
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>

  13. i tried this way , and it didn't work

    <?php
    $email = "admin@randomgamedesign.uk.tt";
    $email = explode($email, '@');
    ?>
    <span style="float: right; text-align: right;"><a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>";self.close();' ;return true;'>Email </a></span>

     

    so i think i will have to try this way, and have two input boxes one for

    "email" and another for "hotmail.com".

    Unless anyone knows a better way to reduce spam.

×
×
  • Create New...

Important Information

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.