Jump to content

predator

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

About predator

  • Birthday 06/22/1988

Contact Methods

  • AIM
    predator12341
  • MSN
    markdavies12341@hotmail.com
  • Website URL
    http://www.mandppcs.co.uk

Profile Information

  • Gender
    Not Telling
  • Location
    England

predator's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry for not replying until now (been doing uni work). That was the only spelling error i saw. However, there are some grammer and punctuation errors throughout the system so you may want to re-think on how you word some things. Regarsd Mark
  2. well if the session is just checking a value in the div u would do this <div class="<? if($_SESSION['username'] ==1) { echo "class1"; } else { echo "class2"; } ?>">
  3. seen a few spelling errors. Nothing to major but it takes the professional look away from the app. Regards Mark
  4. it would put the same one in because all ur enterin in the database is $transaction you can just make the id field increment automatically when you enter a new row into the database did you no that?
  5. yeah wot adam has put dada will work correctly for you mate
  6. you just need a while check to see if the number generated is a 4 or more bigger than the one generated previously if it is not generate a new number until it is $tot = $newNum - $oldNum; while($tot < 4) { $newNum = rand(1,100); $tot = $newNum - $oldNum; } summin along them lines
  7. where it is echoing does not enter submit check that means it is not seeing the press of the submit button (just check the spelling for the sumbit button name with the name you have there). other than that the code you should have is this for the sessions to work <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { echo "it enters the part to show fields are field in(delete me once debugged as the headers will not work other wise)"; // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); session_register("password"); header("location:user.php"); } } } echo "does not enter the submit check"; ?>
  8. use this code for the no errors not showing then you can see where you are or are not entering the script <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { echo "it enters the part to show fields are field in(delete me once debugged as the headers will not work other wise)"; // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" session_register("email"); session_register("password"); header("location:user.php"); } } } echo "does not enter the submit check"; ?>
  9. right in the login script when u check to see if the users pass and and username match before u redirect them to there CP do $_SESSION['hasLoggedIn'] = 1; then make a new sql statment to do $SQL = SELECT * FROM users where username='username the person used to sign in with' $result = mysql_query($SQL); $row = mysql_fetch_assoc($result); $_SESSION['userID'] = $row['id']; then redirect user then the sessions userID contains there id for the no error showing just put some echos in the different stages to see whether or not it is getting to the areas it needs to get to
  10. ah right thanks hitman learn something new every day hehe
  11. just check it works normally to check if emptys return something with the below code. <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1){ // Register $email, $password and redirect to file "user.php" session_register("email"); session_register("password"); header("location:user.php"); } } } ?>
  12. in the login script once the have been validated you would declare the session there to = 1 but only validate it when there username and password match and are all ok. what is their id used for from the database? as for the error probs i am havin a butchers at that now for ya mate
  13. also forgot to put this you dont need fputcsv a normal fwrite will do the same job for ya Below is something i used in a past project. Hope it helps $_file = '../CSV/Admin_List.csv'; $_fp = @fopen( $_file, 'w' ); $SQL2 = "SELECT * FROM adminUsers"; $query2 = mysql_query($SQL2); while ($res2 = mysql_fetch_assoc($query2)) { $_csv_data= $res2['title'].','.$res2['name'].','.$res2['surname'].','.$res2['email'].','.$res2['postcode'].','.$comments.','.$res2['lastLogin'] .','.$stat. "\n"; @fwrite( $_fp, $_csv_data ); } @fclose( $_fp );
  14. y do u not want to use append?
  15. it is up to you how you want to run at the end of the day but OOP is becoming a bigger thing so it is better programming practise to get into these days
×
×
  • 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.