Jump to content

andrew_biggart

Members
  • Posts

    363
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by andrew_biggart

  1. I cannot find what is wrong with this at all, ive taken out the config include and added it to the check login script so everything is on one page but im still getting the same error about the headers cant be sent, here is the whole check_login.php if this helps. Thanks btw.

     

    <?php
    session_start();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
    
    <!-- #BeginTemplate "default.dwt" -->
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <!-- #BeginEditable "doctitle" -->
    <title>Home | Sign In | Register | Cont</title>
    <!-- #EndEditable -->
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <link href="../css/layout.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" rel="stylesheet" type="text/css" />
    <link href="../css/content.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery-latest.js"></script> 
    <script type="text/javascript" src="../js/scrolltopcontrol.js"></script>
    <script type="text/javascript" src="../js/dropdown_menu.js"></script>
    <style type="text/css">
    
    .style1 {
    border-width: 0px;
    }
    a {
    color: #584d46;
    }
    </style>
    </head>
    
    <body>
    <div id="wrapper">
    <a name="top_page" id="top_page"></a>
    <div id="masthead">
    <form method="post">
    	<table class="masthead" cellpadding="0" cellspacing="0" style="width: 740px; height: 63px">
    		<tr>
    			<td class="homelink" rowspan="2">
    			<a href="default.php"><img alt="iloveartonline | Homepage" height="63" src="../images/homelink_bg.png" width="450" class="style1" /></a>
    			</td>
    			<td class="subnav">Home | Sign In | Register | Contact Us</td>
    		</tr>
    		<tr>
    			<td class="searchbox">
    				<table>
    					<tr>
    						<td>    <input class="search"name="search" type="text" value="Search our site" /></td>
    						<td><a href="search_site.php">
    						<img alt="" class="style1" height="20" src="../images/searchbutton_bg.png" width="20" /></a></td>
    					</tr>
    				</table>
    			</td>
    		</tr>
    	</table>
    </form>
    </div>
    <div id="top_nav_div">
     <ul class="topnav">  
         <li>  
            <a href="#">Artists</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Search Artists</a></li>
                <li class="top"><a href="#">A - E</a></li>
                <li class="top"><a href="#">F - J</a></li>
                <li class="top"><a href="#">K - O</a></li>
                <li class="top"><a href="#">P - T</a></li> 
                <li class="bottom"><a href="#">U - Y</a></li>  
             </ul>
         </li>
         <li>  
            <a href="#">Galleries</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Search Images</a></li>
                <li class="top"><a href="#">A - E</a></li>
                <li class="top"><a href="#">F - J</a></li>
                <li class="top"><a href="#">K - O</a></li>
                <li class="top"><a href="#">P - T</a></li> 
                <li class="bottom"><a href="#">U - Y</a></li>  
             </ul> 
        </li>
        <li>  
            <a href="#">Art News</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Search News</a></li>
                <li class="top"><a href="#">Latest News</a></li>
                <li class="bottom"><a href="#">Most Popular</a></li> 
             </ul>  
        </li>
        <li>  
            <a href="#">Forum</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Search Forum</a></li>
                <li class="top"><a href="#">View Forum</a></li>
                <li class="top"><a href="#">Add a Topic</a></li>
                <li class="bottom"><a href="#">My Topics</a></li> 
             </ul>  
        </li>
        <li>  
            <a href="#">Shop</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Search Shop</a></li>
                <li class="top"><a href="#">Visit Shop</a></li>
                <li class="top"><a href="#">Sell Art</a></li>
                <li class="bottom"><a href="#">View Art</a></li> 
             </ul>  
        </li>
        <li>  
            <a href="#">Contests</a>  
             <ul class="subnav">  
                <li class="bottom"><a href="#">Coming Soon</a></li>  
             </ul>  
        </li> 
            <li>  
            <a href="my_account.php">Account</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">View Profile</a></li>
                <li class="top"><a href="#">Edit profile</a></li>
                <li class="top"><a href="#">View messages</a></li>
                <li class="top"><a href="#">View Blog</a></li>
                <li class="top"><a href="#">View Pieces</a></li> 
                <li class="bottom"><a href="logout.php">Logout</a></li>
             </ul>  
        </li>
        <li>  
            <a href="#">Upload</a>  
             <ul class="subnav">  
                <li class="top"><a href="#">Upload Art</a></li>
                <li class="top"><a href="#">Upload Article</a></li>
                <li class="bottom"><a href="#">Upload Link</a></li> 
             </ul>  
        </li> 
            <li>  
            <a href="#">Contact</a>   
        </li> 
    </ul>  
    </div>
    <!-- #BeginEditable "body" -->
    <div id="container">
    	<div id="left_col">
    			<table>
    				<tr>
    					<td class="login_status">
    					<?php
    					ini_set("display_errors", "1");
    					error_reporting(E_ALL);
    
    					$host="xxxx"; // Host name
    					$username="xxxx"; // Mysql username
    					$password="xxxx"; // Mysql password
    					$db_name="xxxx"; // Database name
    
    					// Connect to server and select databse.
    					mysql_connect("$host", "$username", "$password")or die("cannot connect");
    					mysql_select_db("$db_name")or die("cannot select DB");
    
    					// username and password sent from form 
    					$myusername=$_POST['myusername']; 
    					$mypassword=$_POST['mypassword']; 
    
    					// To protect MySQL injection (more detail about MySQL injection)
    					$myusername = stripslashes($myusername);
    					$mypassword = stripslashes($mypassword);
    					$myusername = mysql_real_escape_string($myusername);
    					$mypassword = mysql_real_escape_string($mypassword);
    
    					$sql="SELECT * FROM biggartfp9_user_infot WHERE Username='$myusername' and Password='$mypassword'";
    					$result=mysql_query($sql);
    					$row = mysql_fetch_assoc($result);
    					$userav = $row['Profile_picture'];
    
    					// Mysql_num_row is counting table row
    					$count=mysql_num_rows($result);
    					// If result matched $myusername and $mypassword, table row must be 1 row
    
    					if($count==1){
    					// Register $myusername, $mypassword and redirect to file 
    					session_register("myusername");
    					session_register("mypassword"); 
    					$_SESSION['myusername'] = $myusername;
    					$_SESSION['myavatar'] = $userav;
    					header((($myusername == "AdMiN") ? "location:my_account.php" : "location:my_account.php"));
    					exit();
    			      	}
    
    			      	else {
    			      	echo "<h1 class=failed_login>Wrong Username or Password!</h1>";
    			      	}
    			   		?>
    					</td>
    				</tr>
    			</table>
    		<form method="post" action="check_login.php">
    			<table class="login_table">
    				<tr>
    					<td class="login_inputs">
    					<input class="login_input" name="myusername" id="username" type="text" value="Username" /></td>
    				</tr>
    				<tr>
    					<td class="login_inputs">
    					<input class="login_input" name="mypassword" id="password" type="password" value="Password" /></td>
    				</tr>
    				<tr>
    					<td class="login_forgot">
    					<a href="#" class="sub_nav_links">Forgotten your password?</a> 
    					<input type="submit" name="Submit" value="Login" class="login_submit" /></td>
    				</tr>
    			</table>
    		</form>
    
    	</div>
    	<div id="page_content">
    		<table>
    			<tr>
    				<td class="reg_h1">
    				 </td>
    			</tr>
    			<tr>
    				<td>
    			<?php
       			   include("config.php");
    			   
    			   if(isset($_POST['register'])){
    			   $Username = ($_POST['Username']);
    			   $Password = ($_POST['Password']);
    			   $Email = ($_POST['Email']);
    			   $Location = ($_POST['Location']);
    
    			   $Age = ($_POST['Age']);
    			   $Sex = ($_POST['Sex']);
    			   $Occupation = ($_POST['Occupation']);
    			   $Interests = ($_POST['Interests']);
    			   $Artist = ($_POST['Artist']);
    			   $Artwork = ($_POST['Artwork']);
    			   $Website = ($_POST['Website']);
    			   $Aboutme = ($_POST['Aboutme']);
    			   $Aboutart = ($_POST['Aboutart']);
    
    
    			   $sql = "INSERT INTO biggartfp9_user_infot ( Username, Password, Email, Location, Age, Sex, Occupation, Interests, Artist, Artwork, Website, Aboutme, Aboutart) VALUES( '$Username','$Password', '$Email', '$Location', '$Age', '$Sex', '$Occupation', '$Interests' , '$Artist', '$Artwork', '$Website', '$Aboutme', '$Aboutart' )";
    			   $result=mysql_query($sql);
    			    if($result){
    				echo "<h1 class=status_green>Congratulations you are now a registered member of iloveartonline.com. You can now Log In.</h1>";					
    				}
    
    				// if not found
    				else {
    				echo "<h1 class=status_red>We have not found your email in our database</h1>";
    				}
    				// close connection
    				mysql_close();
    				}
    				else{
    				}
    				?>
    				</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext">Please take your time to complete all of the fields 
    				of our registration page as this information you enter will be 
    				used to form your profile page. Don&#39;t worry to much as the 
    				information can still be changed at a later date but to save 
    				yourself time at a later date its easier if you fill it in now. 
    				Once you have submitted the form you will be sent a confirmation 
    				email, click on the link contained in the email which will take 
    				you back to our site and you will be able to login from there.<br />
    				<br />
    				Make sure and familiarize yourself with our 
    				<a href="#" class="sub_nav_links">Terms & Conditions</a> and also	our
    				<a href="#" class="sub_nav_links">Private Policy</a> before registering.
    				</td>
    			</tr>
    			<tr>
    				<td class="reg_h2"></td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    			<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    	<form method="post" action="#">
    		<table>
    			<tr>
    				<td class="reg_subtext2">Username :</td>
    				<td>
    				<input class="reg_inputs" name="Username" id="Username0" maxlength="16" type="text" value="" /></td>
    				<td class="reg_max">Max 16 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Password :</td>
    				<td>
    				<input class="reg_inputs" name="Password" id="Password0" maxlength="12" type="password" value="" /></td>
    				<td class="reg_max">Max 12 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Email address :</td>
    				<td>
    				<input class="reg_inputs" name="Email" id="Email" type="text" value="Must be a valid email address" /></td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Location :</td>
    				<td><input class="reg_inputs" name="Location" id="Location" type="text" value="eg. Manchester, UK" /></td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Age :</td>
    				<td><input class="reg_inputs" name="Age" id="Age" type="text" value="" maxlength="50" /></td>
    				<td class="reg_max">Max 50 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Sex :</td>
    				<td><input class="reg_inputs" name="Sex" id="Sex" type="text" value="" maxlength="50" /></td>
    				<td class="reg_max">Max 50 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Occupation :</td>
    				<td><input class="reg_inputs" name="Occupation" id="Occupation" type="text" value="" maxlength="50" /></td>
    				<td class="reg_max">Max 50 characters</td>
    			</tr>
    
    			<tr>
    				<td></td>
    			</tr>
    		</table>
    
    		<br />
    
    
    		<table>
    			<tr>
    				<td class="reg_subtext2" style="width: 150px" valign="bottom">About Yourself :</td>
    				<td rowspan="3"><textarea class="reg_textareas" name="Aboutme" id="Aboutme" rows="50" cols="1">Write a little about yourself to allow other users to get to know you. This information will appear on your own personal profile.</textarea></td>
    			</tr>
    			<tr>
    				<td class="reg_max" valign="top">Max 500 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_max2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_subtext2" style="width: 150px" valign="bottom">About Your Art :</td>
    				<td rowspan="3"><textarea class="reg_textareas" name="Aboutart" id="Aboutart" rows="50" cols="1">Write a little about your art work, where you get your influences from and your passions.</textarea></td>
    			</tr>
    			<tr>
    				<td class="reg_max" valign="top">Max 500 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_max2"> </td>
    			</tr>
    			</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table class="myprofile_change">
    			<tr>
    				<td class="reg_subtext2">Interests :</td>
    				<td><input class="reg_inputs" name="Interests" id="Interests" type="text" maxlength="50"/></td>
    				<td class="reg_max">Max 50 characters</td>
    			</tr>
    			<tr>
    				<td></td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    			<td class="reg_subtext2">Artist :</td>
    				<td><input class="reg_inputs" name="Artist" id="Artist" type="text" maxlength="60"/></td>
    				<td class="reg_max">Max 60 characters</td>
    			</tr>
    			<tr>
    				<td class="reg_subtext2">Artwork :</td>
    				<td><input class="reg_inputs" name="Artwork" id="Artwork" type="text" maxlength="100"/></td>
    				<td class="reg_max">Max 100 characters</td>
    			</tr>
    			<tr>
    			<td class="reg_subtext2">Website :</td>
    			<td><input class="reg_inputs" name="Website" id="Website" type="text" value="http://www."/></td>
    			<td class="reg_max">No spamming</td>
    			</tr>
    			<tr>
    			<td></td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr><td class="reg_subtext">I hereby solemnly declare that once I have 
    				been given membership to this site I will use it with respect & 
    				as it was intended to be used. I will NOT spam, upload porn or 
    				be a general nuisance. <br />
    				<br />
    				I declare that I will try my best to donate new content to the site and upload as much 
    				cool things as I come across while browsing the web. <br />
    				<br />
    				And most of all I agree to enjoy this site to its full extent, have as 
    				much fun as possible and treat it like my own!</td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_subtext">By Checking the box below and submitting your details means that you agree to our 
    				<a href="terms_conditions.php">Terms & Conditions</a>
    				</td>
    			</tr>
    			<tr>
    				<td class="reg_accept"><input type="checkbox" style="width:16px;" onclick="if(this.checked==1)document.getElementById('register').disabled='';else document.getElementById('register').disabled='disabled';" value="" name="accept" />
    				Accept <a href="terms_conditions.php">Terms and Conditions</a> !
    				</td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td class="reg_h2"> </td>
    			</tr>
    		</table>
    
    		<br />
    
    		<table>
    			<tr>
    				<td>
    				<input class="registration_submit" name="regreset" type="reset" value="Reset" /> <input class="registration_submit" id="register" name="register" type="submit" value="Proceed" disabled="disabled" />
    				</td>
    			</tr>
    		</table>
    	</form>
    	</div>
    </div>
    <!-- #EndEditable -->
    <div id="footer">
    	<div id="footer_nav">
    
    		<table>
    			<tr>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_a">Artists</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Search Artists</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">A - E</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">F - J</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">K - O</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">P - T</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">U - Y</td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_g">Galleries</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Search Images</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">A - E</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">F - J</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">K - O</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">P - T</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">U - Y</td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_an">Art News</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Search News</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Latest News</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Most Popular</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_f">Forum</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Search Forum</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Forum</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Add a Topic</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">My Topics</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_s">Shop</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Search Shop</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Shop</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Art</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Sell Art</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_c">Contests</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Coming Soon</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_ac">Account</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Profile</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Edit Profile</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Messages</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Blog</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">View Pieces</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Logout</td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_u">Upload</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Upload Art</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Upload Article</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Upload Link</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    				<td class="f_nav_e" style="width: 86px; height: 200px" valign="top">
    					<table>
    						<tr>
    							<td class="f_header_co">Contact</td>
    						</tr>
    						<tr>
    							<td class="f_subnav">Contact Us</td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    						<tr>
    							<td class="f_subnav_e"></td>
    						</tr>
    					</table>
    				</td>
    			</tr>
    		</table>
    
    	</div>
    </div>
    </div>
    
    
    </body>
    
    <!-- #EndTemplate -->
    </html>
    

  2. ok sorry.

     

    Error message

     

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\xxxx\xxxxx\xxxxxxxxx\check_login.php:114) in D:\xxxx\xxxxx\xxxxxxxxx\config.php on line 2

     

    Warning: Cannot modify header information - headers already sent by (output started at D:\\xxxx\xxxxx\xxxxxxxxx\check_login.php:114) in D:\\xxxx\xxxxx\xxxxxxxxx\\check_login.php on line 170

     

     

     

    i have this at the top of my config file

    <?php
    session_start();
    ?>
    

     

    and this is my check login script

     

    						<?php
    					ini_set("display_errors", "1");
    					error_reporting(E_ALL);
    					include("config.php");
    
    					// username and password sent from form 
    					$myusername=$_POST['myusername']; 
    					$mypassword=$_POST['mypassword']; 
    
    					// To protect MySQL injection (more detail about MySQL injection)
    					$myusername = stripslashes($myusername);
    					$mypassword = stripslashes($mypassword);
    					$myusername = mysql_real_escape_string($myusername);
    					$mypassword = mysql_real_escape_string($mypassword);
    
    					$sql="SELECT * FROM biggartfp9_user_infot WHERE Username='$myusername' and Password='$mypassword'";
    					$result=mysql_query($sql);
    					$row = mysql_fetch_assoc($result);
    					$userav = $row['Profile_picture'];
    
    					// Mysql_num_row is counting table row
    					$count=mysql_num_rows($result);
    					// If result matched $myusername and $mypassword, table row must be 1 row
    
    					if($count==1){
    					// Register $myusername, $mypassword and redirect to file 
    					session_register("myusername");
    					session_register("mypassword"); 
    					$_SESSION['myusername'] = $myusername;
    					$_SESSION['myavatar'] = $userav;
    					header((($myusername == "AdMiN") ? "location:my_account.php" : "location:my_account.php"));
    					exit();
    			      	}
    
    			      	else {
    			      	echo "<h1 class=failed_login>Wrong Username or Password!</h1>";
    			      	}
    			   		?>
    

  3. Ok so I am having problems with my login script, everything is working apart from after the script has checked the username and password and then finds a match, registers the sessions i want it to redirect to my_account.php but it just stays on the login page. Can anyone point out my problem please.

     

    <?php
    					include("config.php");
    
    					// username and password sent from form 
    					$myusername=$_POST['myusername']; 
    					$mypassword=$_POST['mypassword']; 
    
    					// To protect MySQL injection (more detail about MySQL injection)
    					$myusername = stripslashes($myusername);
    					$mypassword = stripslashes($mypassword);
    					$myusername = mysql_real_escape_string($myusername);
    					$mypassword = mysql_real_escape_string($mypassword);
    
    					$sql="SELECT * FROM biggartfp9_user_infot WHERE Username='$myusername' and Password='$mypassword'";
    					$result=mysql_query($sql);
    					$row = mysql_fetch_assoc($result);
    					$userav = $row['Profile_picture'];
    
    					// Mysql_num_row is counting table row
    					$count=mysql_num_rows($result);
    					// If result matched $myusername and $mypassword, table row must be 1 row
    
    					if($count==1){
    					// Register $myusername, $mypassword and redirect to file 
    					session_register("myusername");
    					session_register("mypassword"); 
    					$_SESSION['myusername'] = $myusername;
    					$_SESSION['myavatar'] = $userav;
    					header( 'Location: my_account.php' );
    			      	}
    
    			      	else {
    			      	echo "<h1 class=failed_login>Wrong Username or Password!</h1>";
    			      	}
    			   		?>
    

  4. Ok what I am trying to do is search a database to check for 6 numbers in any order for a lottery syndicate. so far i have got it working but the numbers have to be in the right order, i would like it to work when the numbers are checked in any order how do i go about do that with a if statement?

     

    so far i have this

     

        protected void Button3_Click(object sender, EventArgs e)

        {

            numbersTableAdapters.BallsTableAdapter num = new

              numbersTableAdapters.BallsTableAdapter();

            numbers.BallsDataTable numtable = num.GetNumbers();

     

            Label7.Text = "";

     

            foreach (DataRow row in numtable.Rows)

                if (Label1.Text == System.Convert.ToString(row["Ball1"]) && Label2.Text == System.Convert.ToString(row["Ball2"]) && Label3.Text == System.Convert.ToString(row["Ball3"]) && Label4.Text == System.Convert.ToString(row["Ball4"]) && Label5.Text == System.Convert.ToString(row["Ball5"]) && Label6.Text == System.Convert.ToString(row["Ball6"]))

                {

                    Label7.Text = "Mr " + System.Convert.ToString(row["LastName"]) + ", you have won";

                }

        }

    }

  5. Thanks alot for your help, I will try and get into th habit of doing it that way.

     

    I ended up getting it working straight after I posted this thread... Always the way lol

     

    Anyway I ended up doing it this way.

     

    							<?php
    						include("config.php");
    						if(isset($_POST['add_suggestion']))
    						{
    							if(isset($_SESSION['myusername'])) 
    							{   
    							$Suggestion_username=$_SESSION['name'];
    							$Suggestion_avatar=$_SESSION['myavatar'];
    							$Suggestion_comment=$_POST['Suggestion_comment'];
    
    						    $sql = "SELECT count(Suggestion_username) as sugcount FROM admin_suggestionst WHERE Suggestion_username='$Suggestion_username' ";
    						    $result = mysql_query($sql);
    
    						    $row = mysql_fetch_assoc($result);
    
    						    if($row['sugcount'] != 0) {
    					   	    echo "<h1 class=status_red>You have already submitted your feedback!</h1>";
    					   	    }
    					   	    
    					   	    else{
    
    							$sql2="INSERT INTO admin_suggestionst (Suggestion_username, Suggestion_comment, Suggestion_date, Suggestion_avatar)VALUES('$Suggestion_username', '$Suggestion_comment', NOW(), '$Suggestion_avatar')";
    							$result2=mysql_query($sql2);
    								if($result2)
    								{
    
    								$Message_user=$_SESSION['name'];
    								$Message_sender='AdMiN';
    								$Message_content='We appreciate you taking the time to send us your feedback, we will try and reply to you as soon as possible.';
    								$Message_subject='Your feeback has been received.';
    								$Profile_picture=$_SESSION['myavatar'];
    
    								$sql3="INSERT INTO user_messagest (Message_user, Message_sender, Message_content, Message_subject, Profile_picture)VALUES('$Message_user', '$Message_sender', '$Message_content', '$Message_subject', '$Profile_picture')";
    								$result3=mysql_query($sql3);
    
    
    								echo "<h1 class=status_green><img alt='' height='16' src='Icons/s_success.png' width='16' />Feedback sent !</h1>";
    								}
    								else 
    								{
    								echo "<h1 class=status_red>Oppps, please try again !</h1>";
    								}
    							}
    							mysql_close();
    							}
    							else
    							{
    							header("location:registration.php");
    						}
    						}
    						?>
    

  6. Ok at the minute I have written some code for my suggestion box so when it is run it will check if the form has been submitted, if it hasnt then it will do nothing if it has it then checks if the user is logged in, if they are not it redirects them to the registration page, if they are it adds the information to the database.

     

    							<?php
    						include("config.php");
    						if(isset($_POST['add_suggestion']))
    						{
    						if(isset($_SESSION['myusername'])) 
    						{   
    						$Suggestion_username=$_SESSION['name'];
    						$Suggestion_avatar=$_SESSION['myavatar'];
    						$Suggestion_comment=$_POST['Suggestion_comment'];
    						$sql="INSERT INTO admin_suggestionst (Suggestion_username, Suggestion_comment, Suggestion_date, Suggestion_avatar)VALUES('$Suggestion_username', '$Suggestion_comment', NOW(), '$Suggestion_avatar')";
    						$result=mysql_query($sql);
    						if($result)
    						{
    						echo "<h1 class=status_green>Thanks for your feedback !</h1>";
    						}
    						else 
    						{
    						echo "<h1 class=status_red>Oppps, please try again !</h1>";
    						}
    						mysql_close();
    						}
    						else
    						{
    						header("location:registration.php");
    						}
    						}
    						?>
    

     

    What I would like to do is after it has checked the the form has been submitted and the user is logged in I would like to add another if statement to count how many suggestions have been submitted by this user, if count = 1 then echo u have already submitted bla bla, if count = 0 then run the add to the databse code.

     

    Everytime I try and adapt this into my orginal code I mess one part or another up. Any help would be appreciated thanks.

  7. Ok problem solved. Thankyou mrMarcus it was your suggestion of adding echos to the else statements that made me realise what the problem was. I will get myself into the habit of doing this from now on.

     

    Thanks everyone that helped.

     

    For anyone that is intrested this is how I got it working

     

    							<?php
    						$username=$_GET['username'];
    						$Count=$_GET['Count'];
    						if($Count==1) {
    						echo"Your comment has been added";
    
    							if(isset($_SESSION['myusername'])) {
    
    							echo "
    							<a name='Profile_comment' id='Profile_comment'></a>
    							<form method='post' action='profile_comment.php?username=$username'>
    							<table class='replies_table' style='width: 340px; border-style: solid' align='center'>
    							<tr><td class='reply'>Add a profile comment</td></tr>
    							<tr><td class='replies' colspan='2'>
    								<textarea class='replycomment'name='profilecomment' style='width: 321px; height: 34px'></textarea>
    							</td></tr>
    							<tr><td style='width: 50%'  class='repliesh'>Max 200 characters</td>
    								<td class='style3'>
    								<input name='Submit1' type='submit' value='Add Comment' />  </td></tr>
    							</table>
    							</form>
    
    							";
    							}
    							else{ echo"User not logged in";}
    						}
    						else{ echo "
    
    							<a name='Profile_comment' id='Profile_comment'></a>
    							<form method='post' action='profile_comment.php?username=$username'>
    							<table class='replies_table' style='width: 340px; border-style: solid' align='center'>
    							<tr><td class='reply'>Add a profile comment</td></tr>
    							<tr><td class='replies' colspan='2'>
    								<textarea class='replycomment'name='profilecomment' style='width: 321px; height: 34px'></textarea>
    							</td></tr>
    							<tr><td style='width: 50%'  class='repliesh'>Max 200 characters</td>
    								<td class='style3'>
    								<input name='Submit1' type='submit' value='Add Comment' />  </td></tr>
    							</table>
    							</form>					
    
    						";}
    						?>
    

  8. Ok what I am trying to do is when ever a user has added a comment i want it to echo "ur comment has been added" but only if count is 1. If i post hasnt been submitted and count =0 then i dont want it to echo anything. Im trying to wrap the if statment around an if statement but cannot seem to get it working.

     

    Can anyone help please?

     

    <?php
    						$username=$_GET['username'];
    						$Count=$_GET['Count'];
    						if($Count=1) {
    						echo"Your comment has been added";
    
    						if(isset($_SESSION['myusername'])) {
    						echo "
    						<a name='Profile_comment' id='Profile_comment'></a>
    						<form method='post' action='profile_comment.php?username=$username'>
    						<table class='replies_table' style='width: 340px; border-style: solid' align='center'>
    						<tr><td class='reply'>Add a profile comment</td></tr>
    						<tr><td class='replies' colspan='2'>
    							<textarea class='replycomment'name='profilecomment' style='width: 321px; height: 34px'></textarea>
    						</td></tr>
    						<tr><td style='width: 50%'  class='repliesh'>Max 200 characters</td>
    							<td class='style3'>
    							<input name='Submit1' type='submit' value='Add Comment' />  </td></tr>
    						</table>
    						</form>
    
    						";
    						}
    						else{
    						}
    						}
    						else{
    						}
    						?>
    

     

     

    After the comment has been submitted the url will look like this.

     

    http://localhost/profile.php?username=AdMiN&Count=1#Profile_comment

  9. Ok so im trying to make a form where the user can update their status and when i do update it it just clears the information already in the table but doesnt replace it with the new information... Can anyone spot why?

     

    form :

     

    <table class="acc_status_bg" cellpadding="0" cellspacing="0" style="width: 506; height: 180">
    		<tr>
    			<td>
    				<?php
    
    				include("config.php");
    				$username=$_GET['username'];
    
    
    				// Retrieve data from database 
    				$sql="SELECT * FROM biggartfp9_user_infot WHERE Username='$username'";
    				$result=mysql_query($sql);
    
    				// Start looping rows in mysql database.
    				while($rows=mysql_fetch_array($result)){
    				?>
    				<form method="post" action="update_status.php?username=<?php echo "$username" ?>">
    					<table>
    						<tr>
    							<td class="acc_status_h">What are you doing right now? 
    							?</td>
    							<td class="acc_status_200">200</td>
    						</tr>
    						<tr>
    							<td colspan="2" class="acc_status_input">
    
    								<textarea class="acc_status_textarea"name="TextArea1" rows="2" style="width: 478px"></textarea></td>
    						</tr>
    						<tr>
    							<td colspan="2" class="acc_status_submit">
    								<input class="acc_status_update"name="Update" type="submit" value="Update"/>
    							</td>
    						</tr>
    						<tr>
    							<td colspan="2" class="acc_status_post"><?php echo $rows['Status']; ?></td>
    						</tr>
    						<tr>
    							<td colspan="2" class="acc_status_posted">Posted on : <?php echo $rows['Status_date']; ?></td>
    						</tr>
    					</table>
    				</form>
    				<?php
    				// close while loop 
    				}
    				// close connection 
    				mysql_close();
    				?>
    			</td>
    		</tr>
    	</table>
    

     

     

    php :

     

    <?php
    include("config.php");
    $name=$_GET['username'];
    $Status=$_POST['Status'];
    
    $sql="UPDATE biggartfp9_user_infot SET Status='$Status' WHERE Username='$name'";
    $result=mysql_query($sql);
    
    // if successfully updated.
    if($result){
    header("location:my_account.php?username=$name");
    }
    
    else {
    echo "ERROR";
    }
    // close connection
    mysql_close();
    ?>
    

  10. Ok so basically I am having a little bit of trouble with my layout template.

     

    I have a container div which contain's a left column div and a page content div.

     

    #container {
    max-width: 952px;
    height:100%;
    background-image:url('images/container-bg.png');
    background-repeat:repeat-x;
    margin-top:30px;
    }
    
    #left_col {
    width:316px;
    height:812px;
    float:left;
    }
    #left_column_top {
    width:316px;
    height:12px;
    background-image:url('images/left-col-top-bg.png');
    position:relative;
    }
    
    #left_column_bottom {
    width:300px;
    min-height:720px;
    height:100%;
    background-color:#bfbfbf;
    
    position:relative;
    padding-left:8px;
    padding-right:8px;
    padding-top:40px;
    padding-bottom:40px;
    
    }
    #page_content {
    width:604px;
    min-height:780px;
    height:100%;
    float:right;
    background-color:white;
    border:1px #606060 solid;
    margin-bottom:9px;
    padding:10px;
    }
    

     

    The problem: I would like to solve is that when ever my page content div expands in height you can notice that the left column doesnt, so i want the left column to appear to be the same height as the page conent.

     

    My solution: I deceided to add a bg image to the container div which was repeated when the page content div expanded but this doesnt seem to work.

     

    Can anyone tell me why? Thanks

  11. http://www.t-mobile.co.uk/

     

    I want to know how to create the roll over effect or what script i would use, i can imagine it will be some type of mootools script but dont really know which one!

     

    I have created it to the stage where i have the four buttons created and the images for the right hand side sorted out but i dont which dirrection to go now. Any advice would be appreciated !

  12. Ok i have started to design a site atm and i have created a tabs based menu! It works exactlly how it should in firefox but when i open it in inter(gay) explorer it moves the tabs up by 10 px please try and help me figure it out!

     

    First of all you can see what i mean at http://server.microlite20.com/andrewbiggart.co.uk/Beluga_v1/default.htm

     

    Ok this is the top nav div where the tabs are.

    <div id="top_nav">
    	<table class="t_topnav">
    		<tr>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<a href="default.htm">
    			<img alt="" src="homepage.png" width="120" height="80" id="img8" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img8',/*url*/'homepage_h.png')" class="style1" /></a></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<img alt="" src="aboutus_h.png" width="120" height="80" /></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<img alt="" src="menus.png" width="120" height="80" id="img3" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img3',/*url*/'menus_h.png')" /></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<a href="offers.htm">
    			<img alt="" src="offers.png" width="120" height="80" id="img4" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img4',/*url*/'offers_h.png')" class="style1" /></a></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<img alt="" src="reviews.png" width="120" height="80" id="img5" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img5',/*url*/'reviews_h.png')" /></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<img alt="" src="functions.png" width="120" height="80" id="img6" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img6',/*url*/'functions_h.png')" /></td>
    			<td class="buttons" style="width: 130px; height: 100px" valign="bottom">
    			<img alt="" src="contactus.png" width="120" height="80" id="img7" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img7',/*url*/'contactus_h.png')" /></td>
    		</tr>
    	</table>
    </div>
    

     

     

    and this is the css for the top nav div.

    #top_nav {
    margin-top:30px;
    width:1000px;
    height:71px;
    background-image:url('TabsBg.jpg');
    background-position:center bottom;
    background-repeat:repeat-x;
    padding-bottom:20px;
    }
    

     

    and this is the css for the buttons td

    td.buttons{
    width:130px;
    height:80px;
    padding-right:10px;
    text-align:right;
    padding-bottom:21px;
    padding-top:5px;
    }
    
    

     

  13. Basically i want to creat something similar to the news tab at the top of this page (http://www.iamdan.net/index.html), but instead i want the tab to say client login, and when the tab is clicked a login in form drops down! does anyone know how i would go about creating this effect? I know how to show and hide a div but just cant get my head around how i would get it to slide down over the top of everything! Thanks

  14. im now using this code and it is working to an extent, but i duont know how i can add exta fields so that th comment appears eblow the name.

     

    
    <?php
    //Set no caching
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    ?> 
    
    var guestbook;
    window.addEvent('domready', function(){
    guestbook = new GuestBook();
    });
    
    var GuestBook = new Class({
    
    initialize: function(){
    	var req = new Request.JSON({
    		url: 'control.php?action=getPage',
    		onSuccess: this.success
    	}).send();
    },
    
    success: function(jArray){
    	jArray.each(function(post){
    		var post = new PostItem(post.id, post.name, post.comment);
    		post.display().inject($('commentList'));
    	}, this);
    }
    
    });
    
    
    var PostItem = new Class({	
    
    initialize: function(id, name, comment){
    	this.id = id;
    	this.name = name;
    	this.comment = comment;
    },
    
    display: function(){
    	var cont = new Element('tr',{
    		'class':'',
    
    	});
    
    	var title = new Element('td',{
    		'class':'written',
    		'text':this.name + ' says...'
    	});
    	var comment = new Element('td',{
    		'class':'writtenby',
    		'text':this.comment
    	});
    
    	title.inject(cont);
    	comment.inject(cont);
    	return cont;
    }
    });
    

  15. Ok so i am trying to design a simple guestbook. I have managed to get the code working finally and i can display the information no problem without styling it. But im now trying to get it diisplayed in a table and this is the where the problem start.

     

    i want to display the information in the following table.

     

    		<table style="width: 100%" cellspacing="0" cellpadding="0" class="cat">
    			<tr>
    				<td colspan="3" class="header"> </td>
    			</tr>
    			<tr>
    				<td rowspan="2" class="logo" style="height: 40px; width: 40px;" valign="top">
    				<img alt="Guestbook entry" src="Guesbook_Logo2.png" width="30" height="30" /></td>
    				<td class="written">Written by : </td>
    				<td class="writtenby">Name echoed here</td>
    			</tr>
    			<tr>
    				<td class="subject" colspan="2">post echoed hear</td>
    			</tr>
    		</table>
    
    

     

    this si my read.js file

     

    <?php

    //Set no caching

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

    header("Cache-Control: no-store, no-cache, must-revalidate");

    header("Cache-Control: post-check=0, pre-check=0", false);

    header("Pragma: no-cache");

    ?>

     

    var guestbook;

    window.addEvent('domready', function(){

    guestbook = new GuestBook();

    });

     

    var GuestBook = new Class({

     

    initialize: function(){

    var req = new Request.JSON({

    url: 'control.php?action=getPage',

    onSuccess: this.success

    }).send();

    },

     

    success: function(jArray){

    jArray.each(function(post){

    var post = new PostItem(post.id, post.name, post.comment);

    post.display().inject($('commentList'));

    }, this);

    }

     

    });

     

     

    var PostItem = new Class({

     

    initialize: function(id, name, comment){

    this.id = id;

    this.name = name;

    this.comment = comment;

    },

     

    display: function(){

    var cont = new Element('td',{

    'class':'',

    'id':'post'+this.id

    });

    var title = new Element('td',{

    'class':'written',

    'text':this.name + ' says...'

    });

    var comment = new Element('td',{

    'class':'writtenby',

    'text':this.comment

    });

     

    title.inject(cont);

    comment.inject(cont);

    return cont;

    }

    });

     

     

    Cant someone please poin me in the right direction please?

     

     

×
×
  • 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.