andrew_biggart
-
Posts
363 -
Joined
-
Last visited
-
Days Won
1
Posts posted by andrew_biggart
-
-
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>"; } ?>
-
ok these are the errors i am getting.
Cannot send session cache limiter - headers already sent
Cannot modify header information - headers already sent by
-
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>"; } ?>
-
I know this is the wrong place for it but I really need help with my assingment which is in tomorrow morning and im stuggling so does anyone know abit about it?
-
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";
}
}
}
-
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"); } } ?>
-
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.
-
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> ";} ?>
-
Ok thankyou very much for your help, i will try and get into the habit of doing this.
The form does show up when count=1 but i want the form always to show up wether count =1 or not!
I only want the echo to show up when ever count =1 to say u have submitted a comment.
-
Yes mikesta707 I do
-
Ok thanks I should of realised that myself!
Now the problem is that the form to enter the comment doesnt show up? Any ideas?
-
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
-
thankyou that has worked!!!
just so i know what does this do?
AND use mysql_real_escape_string();
$name=mysql_real_escape_string ($_GET['username']); $Status=mysql_real_escape_string ($_POST['Status']);
-
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(); ?>
-
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
-
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 !
-
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; }
-
or does anyone know i got site to get cool scripts off, or one similar to this?
-
Does anyone know what this script is called or where i can find it? its the one with all the magazine covers on it! http://www.bigspark.co.uk/index.htm
-
How very helpful thankyou very much I dont suppose you know how to creatte effect on the images, so when you mouse over it reveals another image below saying click hear to enter etc? if not dont worry, thanks for your help!
-
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
-
Does anyone know how i would go about creating this effect? When you scroll over the image it moves down and reveals another image below it.
Like this
http://www.iamdan.net/works.html
and also at the top of the page when u clcik news i drop down box slides out.
Can anyone point me in the right direction to creating these effects please?
-
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; } });
-
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?
Login redirect help please.
in PHP Coding Help
Posted
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.