Jump to content

TaylorSandbek

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by TaylorSandbek

  1. Thanks T L G! Very helpful.. well actually you kind of did it for me. I wish I understood more of the code itself so I would actually learn. Im just starting out and anything thats not basic ish is gibberish to me still. obviously the kind of site im working on is not ideal for someone just starting lol
  2. Really? Seems like it wouldnt work that way to me, but thanks
  3. Heres the quick lowdown - making a site where the user will have friends. How to save these friends in a database? surely a table titled friends that stores the friend info will get way to full way too fast, even if I use longtext right? help is appreciated as usual - Taylor (thanks in advance)
  4. Thanks guys for all the help.. I suppose it is just stupid little flaws in my code I was not noticing, thanks for being fresh eys and finding them for me.
  5. I apologize, will make note of that. But could you discern any problems? I cant.. thats the problem. What am I doing wrong here
  6. I have a script which I will post that continually gives me an error sign, even after I fix the things on the lines. Im lost as to what else could be wrong (and yes, I have cleared my cache before retrying it..) Any help and insight is appreciated! The Script - <?php ########## FRIEND CALENDAR HOMEPAGE, LOGIN, SHORT DESCRIPTION ######### /* Shows title and header logo * login.php */ echo <html><title>Friend Calendar</title> "<img src="FriendCalendar.psd"="FClogo">" <body>Welcome. Friend Calendar is a free tool, where you may look at other peoples schedules, post your own, and request events to be planned. </body></html>; // Connects to your Database include("passwords.php"); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: membersHome.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=register.php>Click Here to Register[/url]'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: membersHome.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } echo <html> <body> <a href="register.php">"register"[/url] </body> </html>; ?> Members Homepage - <?php #### Members Area #### <?php echo <html><title>Friend Calendar</title> <a href="membersHome"><img src="friendcalendarlogo.psd"="FClogo">[/url] </html>; // Connects to your Database include(french.php); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); } //otherwise they are shown the members area else { echo = "Welcome to Friend Calendar."; ################## ## Show Nav bar ## ################## echo <html> <a href="MyCalendar.php"="MyCalendar"[/url] <a href="Events.php"="Events"[/url] <a href="Friends.php"="Friends"[/url] <a href="Inbox.php"=Inbox"[/url] ; ################################## ### Search for requested event ### ################################## if { $events = "SELECT events FROM user WHERE username = '$username' AND read==o"; $result = mysql_query($events) or die ("there are no events requested at the moment"); } echo $result; else { echo <html>There are no requested events at this time. To request an event with a friend, go <a href="friends.php"="here"[/url].</html>; } ######################################## #### Show user their personal notes #### ######################################## if { $notes = "SELECT notes FROM user WHERE username='$username'"; $result = mysql_query($notes) or die ("You have created no notes. to create one, just fill in the empty text box below, and click the save button"); } echo $result; else { echo <html>You have no created notes at this time. If you wish to create a note, just start typing in the empty text box below, and click the "save" button</html>; } ###################################### ###### Form for entering notes ####### ###################################### echo <p>Do not include any special characters in your notes, this includes the equal sign, plus sign, exclamation point, etc. The Notes application will not work if there are any special chracters.; echo <html> <body> <form method="post" action="notesINSERT.php"> <input type="text" name="note" size="500"> </body></html>; ########################################################################## ############ Shows Calendar For Person ################################### ########################################################################## include "calendar_class.php"; $file = basename($_SERVER['PHP_SELF']); echo calendar($file); echo "<a href=logout.php>Logout[/url]"; } } } else /*if *the cookie does not exist, *they are taken to the login screen*/ { header("Location: login.php"); } ?> Many more pages of code returned invalid also, but as it seems as though it is probably an issue of me being incorrect with one spot in my coding, I will leave it at these two examples to try and find the problem and see if it pertains to the others pages of code as well. - the n00b
  7. I keep getting "parser error on line ____" and now I have checked all the lines and redone a lot of things and I still get an error on some line everytime I change it
  8. I know this should go in the help section but that is currently down.. I have a script which I will post that continually gives me an error sign, even after I fix the things on the lines. Im lost as to what else could be wrong (and yes, I have cleared my cache before retrying it..) Any help and insight is appreciated! The Script - <?php ########## FRIEND CALENDAR HOMEPAGE, LOGIN, SHORT DESCRIPTION ######### /* Shows title and header logo * login.php */ echo <html><title>Friend Calendar</title> "<img src="FriendCalendar.psd"="FClogo">"<br><br> <body>Welcome. Friend Calendar is a free tool, where you may look at other peoples schedules, post your own, and request events to be planned. </body></html>; // Connects to your Database include("passwords.php"); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: membersHome.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=register.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: membersHome.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } echo <html> <body> <a href="register.php">"register"</a> </body> </html>; ?> Members Homepage - <?php #### Members Area #### <?php echo <html><title>Friend Calendar</title> <a href="membersHome"><img src="friendcalendarlogo.psd"="FClogo"></a> </html>; // Connects to your Database include(french.php); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); } //otherwise they are shown the members area else { echo = "Welcome to Friend Calendar."; ################## ## Show Nav bar ## ################## echo <html> <a href="MyCalendar.php"="MyCalendar"</a> <a href="Events.php"="Events"</a> <a href="Friends.php"="Friends"</a> <a href="Inbox.php"=Inbox"</a><br>; ################################## ### Search for requested event ### ################################## if { $events = "SELECT events FROM user WHERE username = '$username' AND read==o"; $result = mysql_query($events) or die ("there are no events requested at the moment"); } echo $result; else { echo <html>There are no requested events at this time. To request an event with a friend, go <a href="friends.php"=<b>"here"</b></a>.</html>; } ######################################## #### Show user their personal notes #### ######################################## if { $notes = "SELECT notes FROM user WHERE username='$username'"; $result = mysql_query($notes) or die ("You have created no notes. to create one, just fill in the empty text box below, and click the save button"); } echo $result; else { echo <html>You have no created notes at this time. If you wish to create a note, just start typing in the empty text box below, and click the "save" button</html>; } ###################################### ###### Form for entering notes ####### ###################################### echo <p>Do not include any special characters in your notes, this includes the equal sign, plus sign, exclamation point, etc. The Notes application will not work if there are any special chracters.; echo <html> <body> <form method="post" action="notesINSERT.php"> <input type="text" name="note" size="500"> </body></html>; ########################################################################## ############ Shows Calendar For Person ################################### ########################################################################## include "calendar_class.php"; $file = basename($_SERVER['PHP_SELF']); echo calendar($file); echo "<a href=logout.php>Logout</a>"; } } } else /*if *the cookie does not exist, *they are taken to the login screen*/ { header("Location: login.php"); } ?> Many more pages of code returned invalid also, but as it seems as though it is probably an issue of me being incorrect with one spot in my coding, I will leave it at these two examples to try and find the problem and see if it pertains to the others pages of code as well. Again, apologize for not posting this in help, but this is the closest place I could find.. you are sort of testing my code. Anyway, the "test" is greatly appreciated.. - the n00b
  9. This is correct? $events = "SELECT events FROM user WHERE username ='$username' WHERE read==0";
  10. Thanks for the quick reply sharkbait.. very helpful. Implementing this as we speak
  11. Building a site/facebook app that is pretty complex (as they say, my eyes were larger then my stomach, so my imagination is larger then my skills) and well, obviously Ive run into some problems. One of the main features of this is that it notifies you when your friend has requested an event. (wont get into further detail as it is not necessary). But Im lost as to how I would do this. My one solution was store the request for an event in my database, then everytime someone logged on I would check for stored event request. But then How would I determine which requests where replied to/deleted? Would I use some number increment system like when page views != 1 do not show? I think that is the route to take but I am not quite sure how I would write that out. As I said in the beginning, Im a learning coder with very limited knowledge. Im not asking anyone to write this out for me, as that would be counterproductive to actually learning, but rather to explain to me the concept of how I would do this, because I am pretty lost. Thanks in advance for the help - the n00b
  12. Hey, Im Taylor, I just signed up here - looking for a good community to be a part of as I learn/develop my php skills. Nice to meet you all, in advance
×
×
  • 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.