Jump to content

nexuzkid

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nexuzkid's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Which is exactly my problem Everytime I do a project like this, I always mess up the strings. My current problem is just selecting the username, so that it doesn't inject "true" into all the users, but only the user that the $str (confirmation code) relates to. Sorry for the messy variables, all of my codings are like this...
  2. if($do_account_check == "true"){ die("Your account has already been activated once before!"); } Here I check if the account is already checked $account_check = mysql_query("SELECT confirmacc FROM users WHERE confirmacc='$confirmacc'"); $do_account_check = mysql_num_rows($account_check); And i get the data (confirmacc) out of the database here.
  3. Hi guys. Recently, I've tried to experiment abit with php, and try to make a confirmation code system on my website. Though there's one problem... Each time I try to select the code, relating to the username, it just injects a "True" into ALL Columns. How can I select the username, which the code ($str) relates to? <?php if($_GET['act'] != "") { $str_temp = $_REQUEST['forgot']; $connect = mysql_connect("HOST", "USERNAME", "PASSWORD"); if(!$connect){ die(mysql_error()); } $select_db = mysql_select_db("youjelly", $connect); if(!$select_db){ die(mysql_error()); } $result = mysql_query("SELECT * FROM users WHERE username='$username' AND str='$str'"); $row = mysql_fetch_array($result); $id = $row['id']; $_SESSION['str'] = $row['str']; $str_1 = $_SESSION['str']; $select_user = mysql_query("SELECT username FROM users WHERE id='$id'"); $row2 = mysql_fetch_array($select_user); $user = $row2['str']; if(empty($str_temp)){ die("Please enter your confirmation code!"); } $account_check = mysql_query("SELECT confirmacc FROM users WHERE confirmacc='$confirmacc'"); $do_account_check = mysql_num_rows($account_check); if($do_account_check == "true") die("Your account has already been activated once before!"); if($str_1 < 0){ die("The confirmation code does not exist!"); } $code_check = mysql_query("SELECT confirmacc FROM users WHERE confirmacc='$confirm1'"); mysql_query("UPDATE users SET confirmacc='true' WHERE confirmacc='$confirmacc'"); echo "Congratulations".$username2.$username1.$username."Your account has been activated succesfully!";{ mail($email, "Congratulations $username!","Congratulations $username ! Your account has now been activated and you're now free to surf on MYWEBSITE, ", "From:" . "MYEMAIL") } }else { echo "<br /><div id='form'><center><form action='?act=confirm' method='post'> Activation code:<br /><input type='text' placeholder='Your confirmation code' name='forgot' size='30' value=''> <br /><br /><center></div><input type='submit'></center> </form>"; } ?>
  4. Hmm... haven't learned any of that yet, but I assumed that I could kind of make my own little version... i guess not. But thanks for the help... i'll put userprofiles on the shelf for now then.
  5. Hello guys. I am currently making a userprofile system, and I cant seem to create a .php file for the users. Well anyway heres my register system: $user_profile = '<?php $browserstring = $_SERVER["HTTP_USER_AGENT"]; $pos = strrpos($browserstring, "MSIE"); if($pos > 0) { header("Location:ie.html"); } ?> <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Frontpage</title> <LINK href="http://mydomain.com/style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <div id="header"> </div> <div id="usercon"> <?php $username = $_SESSION["username"]; $lastname = $_SESSION["lastname"]; $firstname = $_SESSION["firstname"]; //Check do we have username and password if(!$username && !$password){ echo "Welcome Guest! <br> <a href=login.php>Login</a> | <a href=regi.php>Register</a>"; }else{ echo "".$firstname ." ". $lastname." <a href="http://www.mydomain.com/logout.php"> Logout</a> | <a href=option.php>Option</a>"; } ?> </div> <div id="content"> <div id="info"> <div id="profile_content"> <div id="profile_data"> </div> <div id="profile_name"> Name:'.$firstname.' </div> <div id="profile_joindate"> '.$date.' </div> <div id="profile_info"> '.$about.' </div> </div> </div> </div> <div id="bottom"> <br /> <br /> </div> </div> </body> </html> '; $fil = fopen("/users/".$username.".php","w"); $order = ""; fwrite($fil,$order); fclose($fil); echo "Click <a href='/users/$username.php'>here</a> to view your profile!"; } ?> Though i get an error saying: Warning: fopen(/users/nexuzkid.php) [function.fopen]: failed to open stream: No such file or directory in register.php on line 330 Warning: fclose(): supplied argument is not a valid stream resource in register.php on line 333 Regards, nexuzkid
  6. could you do a example? (not quite sure on the mail () function) and also that i want to mail every single user, without coding every single of their emails into the parameter.
  7. Hello phpfreaks.com, ive been wondering all week howto do so. If i make a mysql_query and chooses all emails, i only get my own. But how can i choose all the users registered in the database`? best regards William Pfaffe
  8. Ok, thanks mate for the help. Imma head to bed , been staying up for replies.
  9. Oops sorry fellas, forgot to leave username instead of users it works now. Thanks for the help! I knew i could come here and it would be solved Best regards William Pfafe
  10. just tried that but, password table just keeps resetting into nothing. It just leaves the password empty
  11. Nice spotted, but just tried it and it still resets the password into nothing. Thanks for reminding me of that spelling fail tho
  12. Hello PhP Freaks forum In the past weeks ive been trying to make a website, where you can register. Everything seems to work except my cherished Change password feature. Everytime you try to change the password, it just resets it to nothing. Here is the code below. <?php if(isset($_SESSION['username'])) { $username = $_SESSION['username']; $lastname = $_SESSION['lastname']; $firstname = $_SESSION['firstname']; $email = $_SESSION['email']; echo " <h4>Options for:</h4> $username <br /> <br /> First name: $firstname <br />Last name: $lastname <br /><br /><h3>Want to change your password:</h3><br /> <form action='?do=option' method='post'> Old password <input type='password' placeholder='Has to be between 5-15 digits' name='password' size='30' value='' /><br /> <br /> New Password<input type='password' placeholder='Has to be between 5-15 digits' name='newpass' size='30' value='' /><br /> <br /> Confirm new password <input type='password' placeholder='Has to be between 5-15 digits' name='passconf' size='30' value='' /><br /> <center></div><input type='submit' value='Submit'/></center></form>"; }else{ echo 'Please login to view your options!'; } $password = $_REQUEST['password']; $pass_conf = $_REQUEST['newpass']; $email = $_REQUEST['passconf']; $connect = mysql_connect("Host", "User", "Password"); if(!$connect){ die(mysql_error()); } //Selecting database $select_db = mysql_select_db("My Database", $connect); if(!$select_db){ die(mysql_error()); } //Find if entered data is correct $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $row = mysql_fetch_array($result); $id = $row['id']; mysql_query("UPDATE users SET password='$newpass' WHERE username='$user'") ?> And i do know that i dont have a if(Empty($newpass)){ Die(Please fill out the new password) } Or any security on the others, but the problem just seems that it resets the password into nothing Hope i can get this fixed Best Regards William Pfaffe
×
×
  • 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.