FaLgoR
Members-
Content Count
224 -
Joined
-
Last visited
Everything posted by FaLgoR
-
i have fixed all the problems, I think. I've writed somethings wrong in the code. Yes, just litle HTML mystakes, because the PHP code is working fine (now I've tested it). Try to use this version 1.0 of the code... (LoL) If there are any other problems just post here and i'll fix them (again). Thx
-
Oh heeeeeeeeell.... look at this: Login: <input type="text" name="name"><br> the name is incorret, and it does the field "login" be in blank. Just change it for: Login: <input type="text" name="login"> I've edited my post. Try to register now. I'll try to find the login problems. Sorry for the mistakes =[
-
ok, I'll test it and try to find all the problems... wait some minutes..
-
It's not needed an quote here... =/ tryin to get posts?
-
no, I didn't... haieuaheuahpost all the problems here (detailed) and I'll fix them
-
krap give me the code, or I can't help uhave you changed some line in the code I've posted here?
-
if you want an page where the members can view and edit their account details, just copy profiles.php of the administration page, erase the line including verify.php and put this code in the place where the include was:include("conn.php"); // include page with the database connection$cookie = $HTTP_COOKIE_VARS; // to reduce the var's nameif($cookie[login] && $cookie[pass]){$login = $cookie[login];$pass = $cookie[pass];if(!isset($cookie["login"])) header("Location: denied.htm"); // if the user is not logged in, redirect to an error page}that's all, if you think I've forgot some important thing here, tell me and I'll try to make it! =]\_
-
please, copy line 8 here to.
-
yes, but I can't know what is the problem, because I doesn't receive e-mails with the results... can you fix it? Thx!
-
Now, let's complete our login sistem. First, lets make an page which will verify if the logged member is an admin. Oh yes, and you will have to put one more columns on the member's table, "level", and put "Member" as the default value. verify.php: <? include("conn.php"); // include page with the database connection $cookie = $HTTP_COOKIE_VARS; // to reduce the var's name ) if($cookie[login] && $cookie[pass]){ $login = $cookie[login]; $pass = $cookie[pass]; $usrquery = mysql_query("SELECT * FROM members WHERE nick='$login' AND password='$pass';") or die (mysql_error()); // search for the user $user = mysql_fetch_array($usrquery); if($user[level] != 'Admin') header("Location: notfound.htm"); // if the user is not an admin, redirect to an error page } ?> admin.php: <? include("verify.php"); // it will verify if the user is an admin ?> <!-- Here, the table with all the members --> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <form method="post" action="members.php"> <table width="100%" border="0" cellspacing="3" cellpadding="0"> <tr bgcolor="#333333"> <th width="6%" class="header"><font size="1">Editar</font></th> <th width="1%" class="header"><font size="1">ID</font></th> <th width="24%" class="header"><font size="1">Name</font></th> <th width="13%" class="header"><font size="1">Age</font></th> <th width="40%" class="header"><font size="1">E-Mail</font></th> <th width="11%" class="header"><font size="1">Details...</font></th> </tr> <? $query = mysql_query("SELECT * FROM members ORDER BY id;"); if(!mysql_fetch_array($query)) // If there is no members print "<tr><td align=\"center\" colspan=\"7\"><font color=\"#FFFFFF\" size=\"2\"><b>Sorry, there is no members registered.</b></font></td></tr>\n"; // Show you a message while($profiles = mysql_fetch_array($query)) { ?> <tr bgcolor="#666666"> <td> <div align="center"><input type="checkbox" name="id[]" value="<?=$profiles[id]?>"></div></td> <td> <div align="center"><?=$profiles[id]?></div></td> <td> <div align="center"><?=$profiles[name]?></div></td> <td> <div align="center"><?=$profiles[age]?></div></td> <td> <div align="center"><?=$profiles?></div></td> <td> <div align="center"><a href="profiles.php?op=edit&id=<?=$profiles[id]?>" target="_blank">More info...</a></div></td> </tr> <? } ?> </table> </td> </tr> </table> </form> Done, now, profiles.php (used to see and edit member information): <? include("verify.php"); // always put this page, or everybody would have access to this page function Update (&$member, $table, $data) { global $id; $items = explode(" ",$data); $update = ""; $i = 0; while ($tmp = $items[$i++]) { $data = $member[$tmp]; if (is_numeric($data)) $update .= "$tmp=$data"; else { sqlQuotes($data); $update .= "$tmp='$data'"; } if ($items[$i]) $update .= ","; } mysql_query("UPDATE $table SET $update WHERE id=$member[id];"); } // this function is really nice!! switch($op){ case 'edit': // if you're trying to edit/see info $profile = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE id=$id;")); // save the user informations on an variable ?> <!-- now, lets show an table --> <form action="profiles.php?op=doedit&memberid=<?=$profile[id]?>" method="post"> <table width="100%" border="0" cellspacing="3" cellpadding="0"> <tr> <td width="25%"><font color="#FFFFFF">ID</font></td> <td width="75%"><input name="id" type="text" id="id" value="<?=$profile[id]?>" size="2"></td> </tr> <tr> <td><font color="#FFFFFF">Name</font></td> <td><input name="name" type="text" id="nome" value="<?=$profile[name]?>" maxlength="32"></td> </tr> <tr> <td><font color="#FFFFFF">Age</font></td> <td><input name="age" type="text" value="<?=$profile[age]?>" maxlength="32"></td> </tr> <tr> <td><font color="#FFFFFF">Country</font></td> <td><input name="country" type="text" id="estado" value="<?=$profile[country]?>" size="2" maxlength="2"></td> </tr> <tr> <td><font color="#FFFFFF">City</font></td> <td><input name="city" type="text" id="cidade" value="<?=$profile[city]?>"></td> </tr> <tr> <td><font color="#FFFFFF">ICQ</font></td> <td><input name="icq" type="text" id="icq" value="<?=$profile[icq]?>"></td> </tr> <tr> <td height="22"><font color="#FFFFFF">MSN</font></td> <td><input name="msn" type="text" id="msn" value="<?=$profile[msn]?>"></td> </tr> <tr> <td><font color="#FFFFFF">HP</font></td> <td><input name="hp" type="text" id="hp" value="<?=$profile[hp]?>" size="40"></td> </tr> <tr> <td><font color="#FFFFFF">E-mail</font></td> <td><input name="email" type="text" id="email" value="<?=$profile?>" maxlength="60"></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" value="Save"> <input type="reset" value="Reset"> </div></td> </tr> </table> </form> <? break; case 'doedit': if(!$memberid) return; $profile[name] = $name; $profile[age] = $age; $profile[country] = $country; $profile[city] = $city; $profile[icq] = $icq; $profile[msn] = $msn; $profile[hp] = $hp; $profile = $email; Update($profile,"members","name age country city icq msn hp email"); mysql_query("UPDATE members SET id=$id WHERE id=$memberid;"); // update user's id EndNow("Details saved!<br><br><a href=\"admin.php\">Back</a>"); break; } ?> Done ! I did not tested this script, so, if there is something wrong tell me. But I think it will give you some idea that how to do an administration page! Next post I'll show you how to do an page where the members can change their details (but I think, after saw this post, you will not have problems to do it). I hope I have helped you all! =D
-
mizako conn.php is the file with all the connection setings. Ex.<?$host = 'localhost';$user = 'root';$pass = 'pass';$dbname = 'members';mysql_connect($host,$user,$pass);mysql_select_db($dbname);?>So, when you in include this file on your pages, it will do the connection with the database. If would you have to put this code on all your pages, you would lose loads of time, so using includes() will does your work easilly.
-
I've put the following line: /home/falgor/file.phpIs this right? (the file is in the root directory, not on www)
-
ugh its not possible...nobody know it?
-
hehehe, I start this topic because I saw you were needing it :rolleyes:Latelly I'll try to complete this topic by posting an administration page, where you can see the members, edit, delete and send them e-mails. Oh, yes, and a page where the members can see their profiles and edit it, just wait a bit
-
I use hotmail, and I wanted to change for Gmail, but I used hotmail for a long long time, and now its on every site on the web (LoL). Every signup for a site I've used this e-mail, and now I got some dependance from it. If I change it now, it would to cause much problems.
-
The most important thing on a web hosting is comunication betwen the users and administrators (like michaeleg has said). But just remember, we can never be unhappy with services given by free hostings... I mean, their are FREE, and we can't demand nothing from them... But, happily, we have Xisto, which is free and have very good features =]
-
I have some questions about Crin Jobs (I really need this feature):-My script does not accept external access. What is the referer of the crons?-If I want to put the cron to a file called file.php in www directory, what will be the command line?-I am not receiving e-mails with the results. o.OThank you!
-
I've actived my account fifteen minutes ago (aeiuaheiua) and I have to say: you are a really great webhosting! Congratulation! As I've promissed, I'll click on your advertisements regularly, you can bet on it! :)Awn, sorry if it's the wrong place to post it... I'm really confused \_
-
Hey again cragllo! =] I've read this post and I've recently started an topic with an simple login sistem: http://forums.xisto.com/topic/5796-login-system-lets-do-it/ I hope I've helped you again! I'll start lots of topics with PHP sistems, is what I know better =D
-
First, let's do register.php: <? include("conn.php"); // create a file with all the database connections if($do_register){ // if the submit button were clicked if((!$name) || (!$email) || (!$age) || (!$login) || (!$password) || (!$password2)){ print "You can't let any fields in blank.\n"; // if the user did not put some field exit; } $name = stripslashes($name); $email = stripslashes($email); $age = stripslashes($age); $login = stripslashes($login); $password = stripslashes($password); $password2 = stripslashes($password2); // this is for security reasons if($password != $password2){ // if passwords didn't match print "The password and the confirmation are not the same!\n"; exit; } $password = md5($password); mysql_query("INSERT INTO table (name,email,age,login,password) VALUES ('$name','$email',$age,'$login','$password')") or die (mysql_error()); print "Done!\n"; // if its okay, show this message exit; } // close the first "if" ?> <form action="register.php" method="post"> Name: <input type="text" name="name"><br> Email: <input type="text" name="email"><br> Age: <input type="text" name="age"><br> Login: <input type="text" name="login"><br> Password: <input type="password" name="password"><br> Password Again: <input type="password" name="password2"><br> <input type="submit" name="do_register" value="Sumbit"> </form> And now, login.php: <? include("conn.php"); if($do_login){ $login = stripslashes($login); // VERY IMPORTANT FOR SECURITY OF YOUR DATABASE DON'T ERASE IT $passwd = stripslashes($passwd); // VERY IMPORTANT FOR SECURITY OF YOUR DATABASE DON'T ERASE IT $check = mysql_query("SELECT * FROM table WHERE login='$login' LIMIT 1;"); $user = mysql_fetch_array($check); if($user[password] == md5($passwd)){ // if the writed password and the db password are the same... setcookie("login","$login",time()+360000); setcookie("pass","$passwd",time()+360000); // ...set the cookies... header("Location: userspage.php"); // ...and redirect to restrict page }else{ print "Login or password incorrects!\n"; exit; } } ?> <form action="login.php" method="post"> Login: <input type="text" name="login"><br> Passwd: <input type="password" name="passwd"> <input type="submit" name="do_login" value="Log-in!"> </form> And finally, userspage.php: <? if(isset($HTTP_COOKIE_VARS["login"])){ ?> Page contents here <? }else{ ?> This page is restrict for registered users only! <? } ?> Here we are, its a very simple login sistem and you can put more things if u want. Maybe latelly I make an administration page and put here to. If u found any problems with this code, tell me and I'll fix! \_ -------------------- Edit ------------------------- Field password2 was in type="text". Changed by type="password". Field "login" was name="name". This litle mistake caused very much problems! Sumbit button was wrong. I write type="sumbit". Change by type="submit".
-
not eggdrops, I mean PHP bots
-
?????? I did never put this " on mysql_error() function o.O and its not really needed, its only to show the errors (if there are error). Put this function or not, the script must work, because the really needed code is before "or die". But now are your script working well or there is any other problem? I hope I've helped you
-
Can I run mIRC bots on trap 17?Thank u
-
I have downloaded a perl package. I have Apache web server installed in my computer, but I have no idea how to run perl on it (opensource really sux, I dont know what do I do) if there is some perl programmer reading this post, please help me! Thank you! :rolleyes:by the way, if you know any package with webserver and perl already installed please post here too! Thank you again!
-
I am looking for some good web host with php and mysql weeks ago... and in one of this searchs I have found a top10 site of the best free webhosts. Xisto was in second place (the first place sux! Xisto is much better) and here I am . And I see Xisto has not only a good webhost, but a great forum too