Jump to content
xisto Community

williamm

Members
  • Content Count

    90
  • Joined

  • Last visited

Posts posted by williamm


  1. Its an complete login sistem made and tested by me and I think itwill be very usefull for people who are tryn to learn PHP.
    First, let's make register.php:

    <?include("conn.php"); // create a file with all the database connectionsif($do_register){ // if the submit button were clickedif((!$name) || (!$email) || (!$age) || (!$login) || (!$password) || (!$password2)){print "You can't let any fields in blank.\n"; // if the user did not put some fieldexit;}$name = stripslashes($name);$email = stripslashes($email);$age = stripslashes($age);$login = stripslashes($login);$password = stripslashes($password);$password2 = stripslashes($password2);// this is for security reasonsif($password != $password2){ // if passwords didn't matchprint "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 messageexit;} // 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 'conn.php', which is 'included' in the above file.

    $host = 'localhost';$user = 'root';$pass = '';$db = 'yourdb';mysql_connect($host,$user,$pass) or die ("Database is unavaiable. Please try again later.");mysql_select_db($db) or die ("Database is unavaiable. Please try again later.");

    Notice from jlhaslip:

    I have cut and pasted the missing 'conn.php' in here to avoid all the confusion about it having been missed in the original version of the tutorial.
    Most of the following posts concern this out-of-place file, so this note might help explain why they are there.


    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!<?}?>

    verify.php:
    <?include("conn.php"); // include page with the database connection$cookie = $HTTP_COOKIE_VARS; // to reduce the var's name :o)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 membersprint "<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 messagewhile($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[email]?></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 pagefunction 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[email]?>" 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] = $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 idEndNow("Details saved!<br><br><a href=\"admin.php\">Back</a>");break;}?>

    Try to don't only copy the code and post into your site. If you do it, you will learn nothing with this tut. I hope it have been usefull for you! :)

    hey FaLgoR can i ask you how good you are with php? I need to put together something for a client and i was wondering if i could ask you for some help, not very good at php yet. thanks if you can't its cool just wondering.

  2. Now that we all know Microsoft is comming out with a new windows soon. It's called Windows 7. Now after reading an article about that comming out, i got a little upset. For one in the last sentece that i read, microsoft says We are trying to create an operating system that can make you stop dreaming about OS (Operating System) X or Linux. Well for all of that don't know what OS X is, it's Macintosh's Operating system. Last time i knew was that MAC has created an operating system that runs off of the same hardware as Microsoft Windows does. The hardware that i'm talking about is ram (Random Access Memory) which increaes how much memory can run a game or program. Processor, which is how fast the computer can clock, and how many programs can be opened. The last thing that counts is the hard drive. Now last time i was on a MAC i know of its Stablity. Now the reason of that is because of an operating system that is the bases of Mac. Which is Unix, I have had 3 computers with Unix installed. I know how stable that Operating System is. On the other hand Microsoft has stability problems. With Windows Vista it freezes up on me when i have just Internet Exporer going, and you cant tell me to get more ram and a better prosessor. For one reason because i already have 3 gb of RAM, AMD Atholon x2. It just shouldn't happen and with a MAC with the same hardware doesn't freeze. I think Microsoft should get their act together and try to work with Mac. It would be good for them since they control all of the Brand name computers.


  3. Microsoft office is undoubtedly the beter of the two;open office has several drawbacks:

    -textured backgrounds look terrible, animated dont work properly.
    -Lots of the animations wont work.
    -It also doesnt have a good clipart.
    -It has a feeble attempt at wordart, but looks nothing like as good
    -the autoshapes arent as good

    they are just end result looks drawbacks.

    but there are many more drawbacks.

    Microsoft office works a lot faster on my PC.

    But considering the price, is it really worth paying so much for something which you can get a nearly as good version of, for free?


    you would want to use Microsoft office because you need it for work, or school. For when you need more out of it. Now you would use Open office, for like your thumb drive or something, something you can use to type up some quick notes, or write something down quickly. I personally dont like open office. It doesn't give you all the properties that you would have if you used Microsoft office. Sure it's expensive, but i think it would be totaly worth it later on if used it as much as i said above.

  4. Oh, Is this the review of the original Fantastic Four movie? I just watched and liked the new sequel. It's better than the first one.
    But I like both films. I like the fact that another Marvel superheroine, besides Storm of the X-Men series, to grace the big screen in the form of the beautiful Jessica Alba. And Michael Chaklis' rendition of The Thing is not half as bad. And I like the chemistry between all of the characters. I'd rather prefer a lighthearted approach to superhero movies after the angst of Spider-Man and the grim violence of the Blade series and The Punisher.

    I think rival DC Comics should dive to their roster of characters live Marvel did rather than to stick to their "safe than sorry" two franchises, Batman and Superman. This way maybe they can compete with Marvel in the big screen in a good way.

    To get back in the subject Fantastic Four and its' sequel is not half as bad as the critics might say. The Rise of the Silver Surfer is a great companion film to this past May's Spider-Man 3. It's also a great antidote to some irritating and annoying fare like Pirates of the Caribbean: At World's End and disappoints like Shrek 3. highly recommend for Marvel, superhero movie, and comic book fans alike.

    NOTE: Look for Stan Lee's cameo in the first half of the movie. (I'm not spoiling which scene he's in so check for yourself.)


    I think they did really good on the acting in that movie. They put it together very nicely. Both films were excelent. I think they were both equal. They were funny, sad, exciting at the same time and thats hard to find a movie like the fantastic four. It would be nice if they mad more to complete the collection.=, but i dont know if they will. If they are someone let me know, i would like to see them.

  5. ive used xp, win2k, 95/98/me, vista,server 2k3, sabyon/backtrack/phlax,kubuntu,ubuntu etc. and I would have to say that i like linux because im a techhead. It runs smooth and the opensource development is incredible. Xp runs almost flawless at this point of its life and is a stable system which supports many games assoc. with windows. I however actually run vista ultimate on my desktop and I can't complain. Never has given me any trouble and the aero and eyecandy is great. Software support is finally catching up as well.

    Yeah i have to agree with you on vista. I like it, when i talk to my friends about operating systems, they are like i hate vista, i wish microsoft never made it. Well as i always say its the person that uses the computer that gets it screwed up most of the time. Now i'm a linux fan so i know where you are comming from when you say it runs smooth and its nice that its open source. That way you can edit what you want and make it custom to your likeings.

  6. I use PC Spyware Doctor and Registry Mechanic both are beautiful programs and i realy dislike Norton as it never caught any virus' for me and was always very slow at scanning.

    I Couldn't totaly agree with you any more. Norton does nothing. For an anti-virus i would go with Avast. If you install a program and it find something it tells you right of the bat. doesnt wait till a scan happens its total protection. Its not like any of the other leading anti-virus programs. and its not slow when it comes to scanning. It is really helpful. Now like you said for registry issues i would use Registry Mechanic. That is a nice program that will find anything wrong in your registry. Very nice to have but a little costly.

  7. I'll would say i had enough of both OS, now i turned to MAC OS X, it is definitely the best OS in the world right now. They are developing their OS with true understand of user's needs (not blaming their users when something went wrong), take iphone for example how their engineer really fill all the gaps of what other mobile phones are lacking and more.

    Yes i agree with you, I've had enough with Microsoft. You have made a good choice going to MAC. They made their own operating system and still use the same kind of ram, processor, and hard drive space than microsoft does with their windows and MAC is way more stable. Very Agreeable lol.

  8. xbox 360 vs ps3 which is better

     

    Xbox 360 Vs Ps3

    I now xbox 360 got more consoles sold but ps3.But ps3 got a ton more games sold they both got the same graphics.But 360 graphics are really bright.While ps3 graphics is not to bright which is good.While ps3 gets cool games that arent on 360.But 360 also gots cool games that arent on ps3.They both are cool consoles I love playing my 360 and ps3,but I don't know whats better

    -reply by dylan


    There have been debates about what is better Playstation 3 or Xbox 360. Peronally i'm a sony person, but i'm not dawging on any platform. I think it should be judged on what you feel like playing i own all 3 systems xbox playstation and nintendo. some days i feel like playing the ps some does its the xbox and when i want to have a party its the nintendo. Its just how you fell most of the time.

  9. me, i would prefer using dream weaver in web design signing cause it is much easier doing your layout and coding in dream weaver. Though I usually use dream weaver just to layout my web design and do the logic and backend part of the design in vim (a linux text editor) cause my web server is linux.

    I'm a web designer with tons of experience. I've used alot of programs to write my code. I prefer Adobe Dreamweaver cs3. why cs3 it has more features to use. Before i started using Dreamweaver i used Adobe Golive. I actually liked Golive it was decent. but then adobe stopped making golive so i had to switch to dreamweaver.

  10. For CPU if your into gaming go with an AMD processor. Its lightning fast for gaming, but Intel is better for design stuff etc. So its basically a tradeoff... whatever your more into.

    I'm a web designer, and i run a AMD Atholon 64x2 with 3 gbs of ram 256 Nvida 6200, which will soon be upgraded dont get enought FPS on games lol, and 300 gig drive. and i run 4 Adobe programs at the same time while runnung World of Warcraft. and i have no downtime on my computer try that out and see if that works for you.

  11. Right now I am running a Atlhlon XP on my PC a 2100+ and a Intel Pentium 4 3000 on my lap top. They both seem to work amzingly well. But when it comes to games.. I would have to say AMD comes out on top.
    AMD seems to be the easier processor to over clock with the lesat amount of chance for damage. I have known Intel's to overheat a great deal.


    Well When i game my choice of processor is the AMD Altholon 64 x2. I love AMD and i've ran with Intel most of my gaming life. Didn't really care for it. so i would go with an AMD, i think you will be much happier

  12. I do have to say, that whatever their next operating system is, it had better be amazing, because apple is gaining some ground and if Microsoft doesn't make a good Operating System soon then they will be heading for a downward spiral to the place that is currently reserved for macs. I honestly don't have too big of a problem with this, because then game makers will start programming for other OSes like Mac and linux and I won't be stranded on windows anymore.

    I dont agree with Windows 7. Bill gates has made a monopoly and windows just plainly sucks. I would laugh if microsoft goes down and Mac came up. Think about it Bill Gates runs all of the Name Brand Computers. EXp. Acer, HP, Compaq, ect. He runs every thing and there are some people like me that cant stand windows for its un stability. I haven't seen Microsoft Windows Stable ever. Now Linux that operation system can handle about anything which is including MAC. Linux is the bases of MAC and what i've read in PCMagazine. Microsoft is trying to get people to stop dreaming about OS X and Linux. Well last time i looked its more stable than windows will ever be. Think about it MAC has to build their own operating system. Has to make special hardware to fit their operating system, managed to keep it stable and run excessivly more programs at the same time with the same amout of ram, hardrive space, and processor as Microsoft and is still a better way more stable OS than Windows. So i think Microsoft is a little behind.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.