Hide Email

Posted on Tuesday 5th June 2007 at 03:46 PM
MCP
MCP's Avatar
Nah. Nothing.
Posted on Tuesday 5th June 2007 at 07:46 PM
SkillMaster
SkillMaster's Avatar
Are you sure you got all the database rows? eg deviantart or yahoo?
Posted on Tuesday 5th June 2007 at 08:20 PM
MCP
MCP's Avatar
Everything has been entered. The gender one is not a problem. It is hiding email. That's the one not updating. The SQL DB has been updated when I started with the ehidden values.
Posted on Tuesday 5th June 2007 at 08:24 PM
SkillMaster
SkillMaster's Avatar
Okay so whats not wokring now?
Posted on Tuesday 5th June 2007 at 08:25 PM
SkillMaster
SkillMaster's Avatar
PHP Code
  1. <?php
  2. session_start(); //allows session
  3. include "config.php";
  4. if($logged[id])
  5. {
  6. switch($_GET[page])
  7. {
  8. default:
  9. $fetch = mysql_query("SELECT * FROM `members` WHERE `username` = '$logged[username]'");
  10. $user = mysql_fetch_array($fetch);
  11. echo ("<form action='?page=update' method='post'>
  12. <table width='350'>
  13. <tr>
  14. <td width='150'>Email:</td>
  15. <td width='200'><input type='text' name='email' size='30' maxlength='55' value='$user[email]'></td>
  16. </tr>
  17. <tr>
  18. <td>Show Email?</td>
  19. if ($logged[ehidden] == Yes)
  20. {
  21. echo ("<td><select name='ehidden'>
  22. <option selected='selected' value='Yes'>Yes</option>
  23. <option value='No'>No</option>
  24. </select></td> ");
  25. }
  26. else
  27. {echo ("<td><select name='ehidden'>
  28. <option value='Yes'>Yes</option>
  29. <option selected='selected' value='No'>No</option>
  30. </select></td> ");
  31. }
  32. </tr>
  33. <tr>
  34. <td>Location:</td>
  35. <td><input type='text' name='location' size='30' maxlength='40' value='$user[location]'></td>
  36. </tr>
  37. <tr>
  38. <td>Age:</td>
  39. <td><input type='text' name='age' size='3' maxlength='3' value='$user[age]'></td>
  40. </tr>
  41. <tr>
  42. ");
  43. if ($logged[sex] == Male)
  44. {
  45. echo ("<td>Sex:</td>
  46. <td><input type='radio' checked='checked' value='Male' name='sex'> Male<br>
  47. <input type='radio' value='Female' name='sex'> Female</td>");
  48. }
  49. else
  50. {echo ("<td>Sex:</td>
  51. <td><input type='radio' value='Male' name='sex'> Male<br>
  52. <input type='radio' checked='checked' value='Female' name='sex'> Female</td>");
  53. }
  54. echo ("
  55. <tr>
  56. <td>About:</td>
  57. <td><textarea name='about' cols='23.5' rows='7' maxlength='700' >$user[about]</textarea></td>
  58. </tr>
  59. <tr>
  60. <td>Interests:</td>
  61. <td><input type='text' name='interests' size='30' maxlength='40' value='$user[interests]' /></td>
  62. </tr>
  63. <tr>
  64. <td>MSN:</td>
  65. <td><input type='text' name='msn' size='30' maxlength='40' value='$user[msn]' /></td>
  66. </tr>
  67. <tr>
  68. <td>Skype:</td>
  69. <td><input type='text' name='skype' size='30' maxlength='40' value='$user[skype]' /></td>
  70. </tr>
  71. <tr>
  72. <td>AIM:</td>
  73. <td><input type='text' name='aim' size='30' maxlength='40' value='$user[aim]' /></td>
  74. </tr>
  75. <tr>
  76. <td>deviantART:</td>
  77. <td><input type='text' name='deviantart' size='30' maxlength='40' value='$user[deviantart]' /></td>
  78. </tr>
  79. <tr>
  80. <td>Yahoo:</td>
  81. <td><input type='text' name='yahoo' size='30' maxlength='40' value='$user[yahoo]' /></td>
  82. </tr>
  83. <tr>
  84. <td colspan='2'><left>
  85. <input type='submit' value='Update'>
  86. </left></td>
  87. </tr>
  88. </table>
  89. </form>");
  90. break;
  91.  
  92. case 'update':
  93. $email = addslashes(htmlspecialchars($_POST[email]));
  94. $ehidden = htmlspecialchars($_POST[ehidden]);
  95. $location = addslashes(htmlspecialchars($_POST[location]));
  96. $age = addslashes(htmlspecialchars($_POST[age]));
  97. $sex = addslashes(htmlspecialchars($_POST[sex]));
  98. $about = addslashes(htmlspecialchars($_POST[about]));
  99. $interests = addslashes(htmlspecialchars($_POST[interests]));
  100. $msn = addslashes(htmlspecialchars($_POST[msn]));
  101. $skype = addslashes(htmlspecialchars($_POST[skype]));
  102. $aim = addslashes(htmlspecialchars($_POST[aim]));
  103. $deviantart = addslashes(htmlspecialchars($_POST[deviantart]));
  104. $yahoo = addslashes(htmlspecialchars($_POST[yahoo]));
  105.  
  106.  
  107. if($sex == "Male" || $sex == Female)
  108. {
  109. $update = mysql_query("UPDATE `members` SET `email` = '$email', `sex` = '$sex', `age` = '$age', `location` = '$location', `ehidden` = '$ehidden', `about` = '$about', `interests` = '$interests', `msn` = '$msn', `skype` = '$skype', `aim` = '$aim', `yahoo` = '$yahoo', `deviantart` = '$deviantart' WHERE `username` = '$logged[username]'");
  110. echo ("Profile updated!<br><a href='login.php'>Return to Member Area</a> or <a href='editprofile.php'>Continue Editing</a>");
  111. }
  112. else
  113. {
  114. echo ("Please select a gender. <a href='editprofile.php'>Go back</a>");
  115. }
  116. break;
  117. }
  118. }
  119. ?>

Try This one
Posted on Tuesday 5th June 2007 at 08:26 PM
SkillMaster
SkillMaster's Avatar
Sorry this
PHP Code
  1. <?php
  2. session_start(); //allows session
  3. include "config.php";
  4. if($logged[id])
  5. {
  6. switch($_GET[page])
  7. {
  8. default:
  9. $fetch = mysql_query("SELECT * FROM `members` WHERE `username` = '$logged[username]'");
  10. $user = mysql_fetch_array($fetch);
  11. echo ("<form action='?page=update' method='post'>
  12. <table width='350'>
  13. <tr>
  14. <td width='150'>Email:</td>
  15. <td width='200'><input type='text' name='email' size='30' maxlength='55' value='$user[email]'></td>
  16. </tr>
  17. <tr>
  18. <td>Show Email?</td>
  19. ");
  20. if ($logged[ehidden] == Yes)
  21. {
  22. echo ("<td><select name='ehidden'>
  23. <option selected='selected' value='Yes'>Yes</option>
  24. <option value='No'>No</option>
  25. </select></td> ");
  26. }
  27. else
  28. {echo ("<td><select name='ehidden'>
  29. <option value='Yes'>Yes</option>
  30. <option selected='selected' value='No'>No</option>
  31. </select></td> ");
  32. }
  33. echo ("
  34. </tr>
  35. <tr>
  36. <td>Location:</td>
  37. <td><input type='text' name='location' size='30' maxlength='40' value='$user[location]'></td>
  38. </tr>
  39. <tr>
  40. <td>Age:</td>
  41. <td><input type='text' name='age' size='3' maxlength='3' value='$user[age]'></td>
  42. </tr>
  43. <tr>
  44. ");
  45. if ($logged[sex] == Male)
  46. {
  47. echo ("<td>Sex:</td>
  48. <td><input type='radio' checked='checked' value='Male' name='sex'> Male<br>
  49. <input type='radio' value='Female' name='sex'> Female</td>");
  50. }
  51. else
  52. {echo ("<td>Sex:</td>
  53. <td><input type='radio' value='Male' name='sex'> Male<br>
  54. <input type='radio' checked='checked' value='Female' name='sex'> Female</td>");
  55. }
  56. echo ("
  57. <tr>
  58. <td>About:</td>
  59. <td><textarea name='about' cols='23.5' rows='7' maxlength='700' >$user[about]</textarea></td>
  60. </tr>
  61. <tr>
  62. <td>Interests:</td>
  63. <td><input type='text' name='interests' size='30' maxlength='40' value='$user[interests]' /></td>
  64. </tr>
  65. <tr>
  66. <td>MSN:</td>
  67. <td><input type='text' name='msn' size='30' maxlength='40' value='$user[msn]' /></td>
  68. </tr>
  69. <tr>
  70. <td>Skype:</td>
  71. <td><input type='text' name='skype' size='30' maxlength='40' value='$user[skype]' /></td>
  72. </tr>
  73. <tr>
  74. <td>AIM:</td>
  75. <td><input type='text' name='aim' size='30' maxlength='40' value='$user[aim]' /></td>
  76. </tr>
  77. <tr>
  78. <td>deviantART:</td>
  79. <td><input type='text' name='deviantart' size='30' maxlength='40' value='$user[deviantart]' /></td>
  80. </tr>
  81. <tr>
  82. <td>Yahoo:</td>
  83. <td><input type='text' name='yahoo' size='30' maxlength='40' value='$user[yahoo]' /></td>
  84. </tr>
  85. <tr>
  86. <td colspan='2'><left>
  87. <input type='submit' value='Update'>
  88. </left></td>
  89. </tr>
  90. </table>
  91. </form>");
  92. break;
  93.  
  94. case 'update':
  95. $email = addslashes(htmlspecialchars($_POST[email]));
  96. $ehidden = htmlspecialchars($_POST[ehidden]);
  97. $location = addslashes(htmlspecialchars($_POST[location]));
  98. $age = addslashes(htmlspecialchars($_POST[age]));
  99. $sex = addslashes(htmlspecialchars($_POST[sex]));
  100. $about = addslashes(htmlspecialchars($_POST[about]));
  101. $interests = addslashes(htmlspecialchars($_POST[interests]));
  102. $msn = addslashes(htmlspecialchars($_POST[msn]));
  103. $skype = addslashes(htmlspecialchars($_POST[skype]));
  104. $aim = addslashes(htmlspecialchars($_POST[aim]));
  105. $deviantart = addslashes(htmlspecialchars($_POST[deviantart]));
  106. $yahoo = addslashes(htmlspecialchars($_POST[yahoo]));
  107.  
  108.  
  109. if($sex == "Male" || $sex == Female)
  110. {
  111. $update = mysql_query("UPDATE `members` SET `email` = '$email', `sex` = '$sex', `age` = '$age', `location` = '$location', `ehidden` = '$ehidden', `about` = '$about', `interests` = '$interests', `msn` = '$msn', `skype` = '$skype', `aim` = '$aim', `yahoo` = '$yahoo', `deviantart` = '$deviantart' WHERE `username` = '$logged[username]'");
  112. echo ("Profile updated!<br><a href='login.php'>Return to Member Area</a> or <a href='editprofile.php'>Continue Editing</a>");
  113. }
  114. else
  115. {
  116. echo ("Please select a gender. <a href='editprofile.php'>Go back</a>");
  117. }
  118. break;
  119. }
  120. }
  121. ?>
Posted on Tuesday 5th June 2007 at 08:47 PM
MCP
MCP's Avatar
Ok Honestly. If these tutorials are simply copy/paste then why is it we have to practically recode the entire thing to get it working?

No it still does not work.
Posted on Tuesday 5th June 2007 at 08:57 PM
SkillMaster
SkillMaster's Avatar
The second code should works fine for me.
Posted on Tuesday 5th June 2007 at 09:05 PM
MCP
MCP's Avatar
Ok It does work for me also. It just does not appear on members.php

Below is the code for that page.
PHP Code
  1. <?php
  2. include('config.php');
  3.  
  4. // Query database
  5. $count_sql = 'SELECT * FROM members';
  6. $count_result = mysql_query($count_sql);
  7.  
  8. //gets the number
  9. $count = mysql_num_rows($count_result);
  10.  
  11. $new = mysql_fetch_array(mysql_query("SELECT * FROM `members` ORDER BY `id` DESC LIMIT 0, 1")); // Gets the newest member
  12. echo "<strong>Newest member:</strong> <a href='members.php?user=$new[username]'>$new[username]</a>"; // displays the newest member
  13. ?> <br>
  14. <br>
  15. <?php
  16. session_start(); //allows session
  17. include "config.php";
  18. echo "<left>";
  19. if(isset($_GET['user'])){ //if there trying to view a profile
  20. //gets the user name and makes it safe
  21. $username = addslashes($_GET[user]);
  22. //querys the db to find the username
  23. $getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
  24. //checks see if the username exists in the db
  25.  
  26.  
  27. $usernum = mysql_num_rows($getuser);
  28. //if it don't exist
  29. if ($usernum == 0)
  30.  
  31. {
  32. //don't exist
  33.  
  34. echo ("User Not Found");
  35.  
  36. }
  37. //if it does exist then show there profile
  38. else
  39. {
  40. $user = mysql_fetch_array($getuser);
  41. echo "
  42. <b>$user[username]'s Profile</b><br><br>
  43. <b>Email:</b> ";
  44. if($user[ehidden] == "yes"){
  45. echo "<i>Hidden</i>";
  46. }else{
  47. echo "$user[email]";
  48. }
  49. echo "<br>
  50. <b>Location:</b> $user[location]<br>
  51. <b>Sex:</b> $user[sex]<br>
  52. <b>Age:</b> $user[age]<br>
  53. <b>About:</b> $user[about]<br>
  54. <b>Interests:</b> $user[interests]<br>
  55. <b>MSN:</b> $user[msn]<br>
  56. <b>Skype:</b> $user[skype]<br>
  57. <b>AIM:</b> $user[aim]<br>
  58. <b>deviantART:</b> $user[deviantart]<br>
  59. <b>Yahoo:</b> $user[yahoo]<br>
  60. ";
  61. $user_rank = change_levels($user[userlevel]); //change level
  62.  
  63. }
  64. }
  65. else
  66. {
  67. //gets all the members from the database
  68. $getusers = mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());
  69. //loops there name out
  70. while ($user = mysql_fetch_array($getusers))
  71. {
  72. echo "- <a href='members.php?user=$user[username]'>$user[username]</a><br>";
  73. }
  74. }
  75. echo "<left>";
  76. ?>
Posted on Tuesday 5th June 2007 at 09:06 PM
SkillMaster
SkillMaster's Avatar
Code
if($user[ehidden] == "yes"){

to
Code
if($user[ehidden] == "Yes"){
Login or register to respond to this forum topic.