DJ_CARO Posted June 25, 2010 Share Posted June 25, 2010 Hi , I have login, register script and now I am making the User profile script I already got <?php session_start(); require_once 'database.php'; if (isset($_SESSION['user'])){ echo "Welcome ".$_SESSION['user']; ?> <form name="logout" method="post" action="logout.php"> <input type="submit" name="logout" id="logout" value="Logout"> </form> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>This is your profile! </title> <script type="text/javascript" src="http://ajax.googleapis.com/ ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.edit_link').click(function() { $('.text_wrapper').hide(); var data=$('.text_wrapper').html(); $('.edit').show(); $('.editbox').html(data); $('.editbox').focus(); }); $(".editbox").mouseup(function() { return false }); $(".editbox").change(function() { $('.edit').hide(); var boxval = $(".editbox").val(); var dataString = 'data='+ boxval; $.ajax({ type: "POST", url: "update_profile_ajax.php", data: dataString, cache: false, success: function(html) { $('.text_wrapper').html(boxval); $('.text_wrapper').show(); } }); }); $(document).mouseup(function() { $('.edit').hide(); $('.text_wrapper').show(); }); }); </script> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; } .mainbox { width:250px; margin:50px; } .text_wrapper { border:solid 1px #0099CC; padding:5px; width:187px; } .edit_link { float:right } .editbox { overflow: hidden; height: 61px;border:solid 1px #0099CC; width:190px; font-size:12px;font-family:Arial, Helvetica, sans-serif; padding:5px } </style> </head> <body> <div class="mainbox"> <a href="#" class="edit_link" title="Edit">Edit</a> <?php $profile=$row['profile']; $SQL="INSERT INTO profile (profile_box) VALUES ('".$row."')"; ?> <h4>Write what are you thinking now </h4> <div class="text_wrapper" style=""><?php echo $profile; ?></div> <div class="edit" style="display:none"><textarea class="editbox" cols="23" rows="3" name="profile_box"></textarea></div> <br /> <div id="person info"> <center> Your login is: <b><? echo $_SESSION['user']; ?></b> <br /> Your Name is:<b><? $name = $_GET['name'] ; echo "$name"?></b> <br /> Your E-mail is:<b></b> <br /> Your Website is:<b></b> <br /> Your Telephone number:<b></b> <br /> </center> </div> </body> </html> <?php } elseif(isset($_SESSION['admin'])){ echo"Welcome ".$_SESSION['admin']; echo"<br><br>You are logged in as an Admin"; ?> <form name="logout" method="post" action="logout.php"> <input type="submit" name="logout" id="logout" value="Logout"> </form> <?php }else{ ?> <form name="login_form" method="post" action="login2.php"> <label> <input name="user" type="text" id="user">ID<br /> <input name="pass" type="password" id="pass">Password<br /> </label> <input type="submit" name="login" id="login" value="Login"> </label> </p> </form> <form name="Register" method="post" action="reg.php"> <input type="submit" name="register" id="register" value="Register"> </form><br /> <?php } ?> and now how can I display the "name" etc after "Your name:"? I have try "GET""echo" but this did not help also I dont know how to write eg: if user log in and want to see others profiles the user just click on link or picture and this will direct them to the other user profile , and I also want to put in there some users pictures, and display them on their profies and on the start page . Thanks for u help Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/ Share on other sites More sharing options...
DJ_CARO Posted June 25, 2010 Author Share Posted June 25, 2010 or just tell me how to display the Name: Email: Website: telephone: my mysql database row is user and in the database I have all listed like name email website telephone Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/#findComment-1077371 Share on other sites More sharing options...
jd307 Posted June 25, 2010 Share Posted June 25, 2010 So, you have your information within a database and you want to display the users information based on what is stored within $_SESSION['user']? You should really read up on some of the basics of PHP/MySQL as all you want to do is use a SELECT statement to grab the users info and then echo out this info onto the screen. As you have already have a login script, you should already have an example of this method so it shouldn't be too difficult to adapt. Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/#findComment-1077381 Share on other sites More sharing options...
Jax2 Posted June 25, 2010 Share Posted June 25, 2010 as stated above, if you have the information in a database, it's all rather simple... for example: $sql="SELECT * FROM USERS WHERE user_name=$name"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { echo "Name: ".$row['name']."/r/n"; echo "Email: ".$row['email']."/r/n"; } And so on to get their info. One piece of advice ... think ahead on how you plan on doing this. For example, if you use login sessions, make sure that the person logged in, if they're looking at their own user info, be sure to use an if statement and check against the database before you show any private info an such ... otherwise, everything that is shown on the user page will be available to everyone else too... You can also use this for hiding albums, sending mail back and forth and much more. Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/#findComment-1077398 Share on other sites More sharing options...
DJ_CARO Posted June 26, 2010 Author Share Posted June 26, 2010 as stated above, if you have the information in a database, it's all rather simple... for example: $sql="SELECT * FROM USERS WHERE user_name=$name"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { echo "Name: ".$row['name']."/r/n"; echo "Email: ".$row['email']."/r/n"; } And so on to get their info. One piece of advice ... think ahead on how you plan on doing this. For example, if you use login sessions, make sure that the person logged in, if they're looking at their own user info, be sure to use an if statement and check against the database before you show any private info an such ... otherwise, everything that is shown on the user page will be available to everyone else too... You can also use this for hiding albums, sending mail back and forth and much more. Thank you Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/#findComment-1077562 Share on other sites More sharing options...
DJ_CARO Posted June 26, 2010 Author Share Posted June 26, 2010 Yeach I did it like <? $query="select * from user"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "$nt[name]"; } ?> yes and I have other problem when I wrote the code to my script it display Your Name is:Karoladmin there are 2 dierent profiles Karol, and Admin so how can I do this that it display only 1 profile name,number etc ? Thanks for any info Link to comment https://forums.phpfreaks.com/topic/205886-can-you-help-me-which-php-users-system/#findComment-1077567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.