FaLgoR
Members-
Content Count
224 -
Joined
-
Last visited
Everything posted by FaLgoR
-
Invision == Best AdministratiosPHPBB == Best design/skinsI prefer PHPBB.
-
No. CMS sistems like php-nuke have much features which I don't need. So, I make my own CMS`s with only the things I need.
-
Very nice tutorial. Good job man!
-
Well, in this tut, I'll show you how to do an simple link counter, with only one count for each IP and the date when the link were clicked. Just remember, this is only one way to do it. First, create an mysql database called 'links', with 2 table: first table will be called 'links', with the columns: id, title, ref and clicks. The other one will be 3 columns and will be called links_info: id, ip and date. Just remember that the columns 'id' of this second table IS NOT auto-increment. Here is the code of the file which will count the clicks, link.php: <?$host = 'localhost';$user = 'root';$pass = '';$db = 'links';mysql_connect($host,$user,$pass) or die (mysql_error()); // try to connect to databasemysql_select_db($db); // try to select the database with the link detailsif(!$id)exit; // if the link was not specified, stop runing$id = stripslashes($id); // for security reasons$linkquery = mysql_query("SELECT * FROM links WHERE id=$id LIMIT 1;"); // look for the specified link$link = mysql_fetch_array($linkquery);if(!$link)die("The specified ID does not exists!");// if the ID exists in the database, start the count process$day = date("d");$month = date("m");$year = date("y");$date = "$day/$month/$year";$ip = $_SERVER["REMOTE_ADDR"];$query = mysql_query("SELECT * FROM links_info WHERE ip='$ip';");$lookvisitorsip = mysql_fetch_array($query);if(!$lookvisitorsip) // if the visitor's ip isn't already in the database add one more clickmysql_query("UPDATE links SET clicks=(clicks+1) WHERE id=$id;"); // add 1 click to the specified id// if you just want to count clicks, without get members info delete this next linemysql_query("INSERT INTO links_info (id,ip,date) VALUES ($id,'$ip','$date');") or die(mysql_error()); // save the area which your visitor went, their IP and the date when they visit itheader("Location: $link[ref]"); // redirect to the page?> Well, the page is done!! Now, you must enter all your links there, with the title, ref (the url to the file) and blah blah blah blah Your links will now be just like this: <a href="links.php?id=1">Link txt</a> Change id=1 for the id of the link inserted into the database. Now, let's make an page which shows the 10 more visited links, top10.php: <?$host = 'localhost';$user = 'root';$pass = '';$db = 'links';mysql_connect($host,$user,$pass) or die (mysql_error()); // try to connect to databasemysql_select_db($db); // try to select the database with the link details?>More visited:<br><?$lquery = mysql_query("SELECT * FROM links LIMIT 10;"); // you can change this LIMIT 10 for any other limit u want$x = 1;while($link = mysql_fetch_array($lquery)){?><?=$x?>°: <a href="link.php?id=<?=$link[id]?>"><?=$link[title]?></a> Cliks: <?=$link[clicks]?><br><?$x++; // increase $x}?> This page is not so beatiful, but you can change the HTML when you want, but don't change php lines, until you know what you are doing. That's all, folks! I've tested this script and I know he is working fine. If, for any reason this script doesn't work in your page, just post here and I'll help you
-
Yeah, I agree with you. I post really big topics, but written by me (tutorials and other things). And when I'm reading the forums, I saw quotes in topics with no replys! People make the first reply of the topic quoting the question! This is ridiculos! I really hate it, and think the admins of the forums must find an solution for this problem. I suggest don't giving chars count for the quotes.
-
Which Game Do You Think Is Better Farcry, Counterstrike ect
FaLgoR replied to konane's topic in Computer Gaming
Why don't you just start an poll with this options? It would be easist, faster an more efficient -
I think its impossible. If it would be possible, nobody would use it. Why encript the code if it can easilly be uncripted? Isn't logical? But, you can compare an text with an encripted code to see if they are the same text: <?$var = md5("aaa");$textsent = md5($_POST["someform"]);if($textsent == $var)print "The sent text and the password are the same!";elseprint "The sented text and the password aren't the same!";?><form action="<? echo "$PHP_SELF"; ?>" method="post"><input type="text" name="someform"></form>Got it? But if you want just to unencript the text, forget it..
-
Don't need to make 2 pages.. you can use only one page called form.php: <?if($send){ // if the send button were clickdif(strlen($_POST['title']) < 1)echo "Sorry, but your subject title is too short. Please go back and try again.";else{ if(strlen($_POST['email']) < 10) echo "Sorry, but this email is too short. Please use a larger email address."; else { if(strlen($_POST['message']) < 1) echo "Sorry, but your message is too short. Please make it larger."; else mail($_POST['email'], $_POST['Title'], $_POST['message']); }}}else{ //else, show the form?><form action="<? echo "$PHP_SELF"; ?>" method='post'>To: <input type='text' name='email' size=20>Subject: <input type='text' name='title' size=20>Message: <textarea cols=50 rows=25 name='message'></textarea><input type='submit' value='Send' name='send'></form><?}?> It more simple. Only one page is needed
-
Just make an new file with *.php extension.
-
Thank you =]I don't know why I'm tryn to get reputation points, but I like to collect them, just for fun =P
-
I am not showing an page tracker, this is just a hit counter! =/
-
Another script, which shows the visitors onlineat the moment in your site. This script was not made by me, I just think it will be very usefull to u. <?$timeout = 15; // change it. It is the timer which will delete the member of online list (in minutes)if (!$datei) $datei = dirname(__FILE__)."/online.txt";$time = @time();$ip = $REMOTE_ADDR;$string = "$ip|$time\n";$a = fopen("online.txt", "a+");fputs($a, $string);fclose($a);$timeout = time()-(60*$timeout);$all = "";$i = 0;$datei = file("online.txt");for ($num = 0; $num < count($datei); $num++) { $pieces = explode("|",$datei[$num]); if ($pieces[1] > $timeout) { $all .= $pieces[0]; $all .= ","; } $i++;}$all = substr($all,0,strlen($all)-1);$arraypieces = explode(",",$all);$useronline = count(array_flip(array_flip($arraypieces)));echo $useronline;$dell = "";for ($numm = 0; $numm < count($datei); $numm++) { $tiles = explode("|",$datei[$numm]); if ($tiles[1] > $timeout) { $dell .= "$tiles[0]|$tiles[1]"; }}if (!$datei) $datei = dirname(__FILE__)."/online.txt";$time = @time();$ip = $REMOTE_ADDR;$string = "$dell";$a = fopen("online.txt", "w+");fputs($a, $string);fclose($a);?> Now, just make an blank file called online.txt. That's all! I hope I've helped you
-
Well, here we will make an hit counterusing php and an *.txt file. This script is so simple, but very usefull. First, le'ts make an file called counter.php, with the following codes inside: <?$file = 'counter.txt'; // this is the file where the number of visitors will be written$fopen = fopen("$file", "r"); // open the text file$count = fread($fopen, 1024); // read the text filefclose($fp); // close the text file$count = $count + 1; // add one more hitecho "$count"; // print the number$fopen = fopen("counter.txt", "w"); // open the file againfwrite($fp, $count); // write the new numberfclose($fp); // close the file?> That's all, it must e working fine (I'm using it :]). To show the number of hits on your site and add the counter, just insert this line where the counter will be: <? include("counter.php"); ?>It will show the visitors AND add the counter. Problems, just post ;D ----------------------------- Edited ------------------------------------- I forgot, youll have to make an blank file called counter.txt. Have fun =P
-
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!
-
yes, youre right. I use PHPEditor to edit my phps, its very good
-
I tried to use it to see the preview of this simple code:<?$var = 'lets try it';echo "$var";?>But the preview were not show o.0
-
well man, I think the globals have to be turned on because the page sent an url: download.php?id=1, so, if the globals are turned off it doesn't work. I'll try to found an solution for your problem, and I'll send u another msg if I find it.
-
Don't need houses, stables work 20% faster, cavalary archers costs -25%,they have paladins, champions and much great units... isn't it overpowered? Only don't need houses is an great advantage (the best, I can say), but they have much more strong units and great advantages.. Surelly it's overpowered.. Huns Down! | | V
-
I really don't know... I tried to learn ASP with eleven years old, but latelly I begin on PHP.. but I didn't know how to test my scripts, but IIS was easist... but when I does it, with 12 years old I liked more than ASP, I've downloaded loads of codes and tutorials (tutorials did never helped me) and requesting for help on mIRC when I got some problem, and now, with 14 years old I've 2 years of experience programing in PHP try to download simple codes to learn with then (but don't just copy, or you'll not learn nothing...)
-
I've installed the attach MOD on my board, but it only works when I use SubSilver theme! I want to use it in other themes, just like BlackandWhite (I use it).Can somebody help me? Thx
-
yes, php is much more simply, but javascript is faster. The javascript code are load in the HTML page, and when it's done, you click on the button 'Calculate' and the result come at the same time. PHP needs to load an other page, an go back to another calc, and load the page again....
-
Well, in this tut, I'll show you how to do an simple link counter, with only one count for each IP and the date when the link were clicked. Just remember, this is only one way to do it. First, create an mysql database called 'links', with 2 table: first table will be called 'links', with the columns: id, title, ref and clicks. The other one will be 3 columns and will be called links_info: id, ip and date. Just remember that the columns 'id' of this second table IS NOT auto-increment. Here is the code of the file which will count the clicks, link.php: <?$host = 'localhost';$user = 'root';$pass = '';$db = 'links';mysql_connect($host,$user,$pass) or die (mysql_error()); // try to connect to databasemysql_select_db($db); // try to select the database with the link detailsif(!$id)exit; // if the link was not specified, stop runing$id = stripslashes($id); // for security reasons$linkquery = mysql_query("SELECT * FROM links WHERE id=$id LIMIT 1;"); // look for the specified link$link = mysql_fetch_array($linkquery);if(!$link)die("The specified ID does not exists!");// if the ID exists in the database, start the count process$day = date("d");$month = date("m");$year = date("y");$date = "$day/$month/$year";$ip = $_SERVER["REMOTE_ADDR"];$query = mysql_query("SELECT * FROM links_info WHERE ip='$ip';");$lookvisitorsip = mysql_fetch_array($query);if(!$lookvisitorsip) // if the visitor's ip isn't already in the database add one more clickmysql_query("UPDATE links SET clicks=(clicks+1) WHERE id=$id;"); // add 1 click to the specified id// if you just want to count clicks, without get members info delete this next linemysql_query("INSERT INTO links_info (id,ip,date) VALUES ($id,'$ip','$date');") or die(mysql_error()); // save the area which your visitor went, their IP and the date when they visit itheader("Location: $link[ref]"); // redirect to the page?> Well, the page is done!! Now, you must enter all your links there, with the title, ref (the url to the file) and blah blah blah blah Your links will now be just like this: <a href="links.php?id=1">Link txt</a> Change id=1 for the id of the link inserted into the database. Now, let's make an page which shows the 10 more visited links, top10.php: <?$host = 'localhost';$user = 'root';$pass = '';$db = 'links';mysql_connect($host,$user,$pass) or die (mysql_error()); // try to connect to databasemysql_select_db($db); // try to select the database with the link details?>More visited:<br><?$lquery = mysql_query("SELECT * FROM links LIMIT 10;"); // you can change this LIMIT 10 for any other limit u want$x = 1;while($link = mysql_fetch_array($lquery)){?><?=$x?>°: <a href="link.php?id=<?=$link[id]?>"><?=$link[title]?></a> Cliks: <?=$link[clicks]?><br><?$x++; // increase $x}?> This page is not so beatiful, but you can change the HTML when you want, but don't change php lines, until you know what you are doing. That's all, folks! I've tested this script and I know he is working fine. If, for any reason this script doesn't work in your page, just post here and I'll help you
-
Why don't some moderator move this topic? o0
-
I don't think so. They don't need houses and have the great units avaiable, just like paladins. I have a friend who plays great with the huns, but if he play withany other civ, teutons for example, he is badest than an rook :~houses are an part of the strategy... and the huns don't need torespeect it. I know, probably "Yes" will win, but I'm entirely against this civilization.