Jump to content
xisto Community

CrazyPensil

Members
  • Content Count

    43
  • Joined

  • Last visited

Everything posted by CrazyPensil

  1. An update of the view script: <?php $j=0; $dh=opendir("photos"); while($file=readdir($dh)) { if($file!="."&&$file!=".."&&$file!="thumbs.db") { $j++; } } closedir($dh); print "<table style=\"margin-left: 12px\"><tr>"; print "<td style=\"border: none\"><font class=part>Total photos: $j.</font></td>\n"; if(!$pagenum) { $pagenum=1; } print "<td style=\"border:none\" width=35%><center>\x20</center></td>"; printf("<td style=\"border: none\"><font class=part>Pages: %d of %d.</font></td></tr></table>",$pagenum,$j/15); print "<center><table class=news>\n"; print "<tr>\n"; $dh=opendir("photos"); $i=0; while($file=readdir($dh)) { if($file!="."&&$file!=".."&&$file!="thumbs.db") { if($i<5) { print "<td>\n<a href=\"java script:window.open('photos/".$file."'); void 0;\" target=_blank>\n<img border=0 color=#faa664 src=\"photos/$file\" width=100 height=80></a></td>"; $i++; } else { print "</tr><tr><td>\n<a href=\"java script:window.open('photos/".$file."'); void 0;\" target=_blank>\n<img border=0 color=#faa664 src=\"photos/$file\" width=100 height=80></a></td>"; $i=1; } } } closedir($dh); print "</tr>\n"; print "</table></center>";?>
  2. Put authentification page on the first page, checking in beginning of each page, which returns user to index.php, if he didn't pass the check. Third time, I will show all the script. What may I do else, if some people aren't able to look at other topics before creating new?) Registering: <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password&&$email) { if(file_exists("users/$login")) { $mess="Ăèê çà íÿò!"; } else { mkdir("users/$login", 0777); $fp=fopen("users/$login/main.txt", "w"); fwrite($fp, "$password|$email"); fclose($fp); $mess="ĂùïüøíÎ."; } } else { $mess="Ăüãèùòðà Üèÿ"; }?><html><head> <title>Ăüãèùòðà Üèÿ</title></head><link rel="stylesheet" type="text/css" href="sources/style.css"><body onload="java script: a=document.getElementsByTagName('img');for(n=0;n<a.length;n++){i=a[n]; if(i.width==468&&i.height==60){i.style.display='none';}}void 0;" style="margin-top: 130px;" background="sources/reg.jpg"><center><table style="background-image: url(sources/perg.jpg);"><form action="reg.php" method="post"><tr colspan="2"><td colspan="2" class=hid><center><?=$mess;?></center></td></tr><tr><td class=hid>ĂÎãèí:</td><td class=hid><input type="text" name="login" maxlength="30"></td></tr><tr><td class=hid>ĂĂ Ă°ĂŽĂŤĂź:</font></td><td class=hid><input type="password" name="password" maxlength="30"></td></tr><tr><td class=hid>E-mail:</font></td><td class=hid><input type="text" name="email" maxlength="30"></td></tr><tr><td class=hid><input type="submit" value="ĂÎòÎâÎ"></td><td class=hid><input type="button" value="Ăà êðÝòß" onclick='java script:window.close();'></td></tr></form></table></center></body></html> Checking when enters: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { $mess="ĂøèåÎáíÝÊ ĂŻĂ Ă°ĂŽĂŤĂź!"; } } else { $mess="ĂøèåÎáíÝÊ íèê!"; } } else { $mess="Ăà ðüãèùòðèðóÊòüùß!"; } } else { $mess="Ăà íðèóÏ"; } if($tr) { session_start(); session_register("login"); session_register("password"); Header("Location: game.php?PHPSESSID=$PHPSESSID"); }?>Checking while travelling on the site: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); }?> P.S. Don't forget about session_start(); in the beginning
  3. CrazyPensil

    PHP

    Just buy a good book;) For me book is the best source to learn something:)
  4. Session_start(); should be on the top of each section(after Error_reporting():oAs for makin' it with MySql, I'm not god at it, so, unluckily, I cant't help you with this one so fast. In 5 day time I will most probably make the same one(or better) using mySql, of course, if noone else isn't faster than mne
  5. As I have already shown, a full version which doesn't keep the state of user(on/off) in a variable and checks ev'rything each time he loads de page. Registering: <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password&&$email) { if(file_exists("users/$login")) { $mess="Ăèê çà íÿò!"; } else { mkdir("users/$login", 0777); $fp=fopen("users/$login/main.txt", "w"); fwrite($fp, "$password|$email"); fclose($fp); $mess="ĂùïüøíÎ."; } } else { $mess="Ăüãèùòðà Üèÿ"; }?><html><head> <title>Ăüãèùòðà Üèÿ</title></head><link rel="stylesheet" type="text/css" href="sources/style.css"><body onload="java script: a=document.getElementsByTagName('img');for(n=0;n<a.length;n++){i=a[n]; if(i.width==468&&i.height==60){i.style.display='none';}}void 0;" style="margin-top: 130px;" background="sources/reg.jpg"><center><table style="background-image: url(sources/perg.jpg);"><form action="reg.php" method="post"><tr colspan="2"><td colspan="2" class=hid><center><?=$mess;?></center></td></tr><tr><td class=hid>ĂÎãèí:</td><td class=hid><input type="text" name="login" maxlength="30"></td></tr><tr><td class=hid>ĂĂ Ă°ĂŽĂŤĂź:</font></td><td class=hid><input type="password" name="password" maxlength="30"></td></tr><tr><td class=hid>E-mail:</font></td><td class=hid><input type="text" name="email" maxlength="30"></td></tr><tr><td class=hid><input type="submit" value="ĂÎòÎâÎ"></td><td class=hid><input type="button" value="Ăà êðÝòß" onclick='java script:window.close();'></td></tr></form></table></center></body></html> Checking when enters: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { $mess="ĂøèåÎáíÝÊ ĂŻĂ Ă°ĂŽĂŤĂź!"; } } else { $mess="ĂøèåÎáíÝÊ íèê!"; } } else { $mess="Ăà ðüãèùòðèðóÊòüùß!"; } } else { $mess="Ăà íðèóÏ"; } if($tr) { session_start(); session_register("login"); session_register("password"); Header("Location: game.php?PHPSESSID=$PHPSESSID"); }?>Checking while travelling on the site: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); }?> P.S. Don't forget about session_start(); in the beginning
  6. Hm... It's not certain yet.There are some bad rumours( said that there will be only planet battles, but I don't believe them)Actually, In Russia it shold be done in 6 months. And it's not sure if it will be in America oficially. ;(You should pray :oAnd, by the way, try the first one.
  7. Registering: <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password&&$email) { if(file_exists("users/$login")) { $mess="Ăèê çà íÿò!"; } else { mkdir("users/$login", 0777); $fp=fopen("users/$login/main.txt", "w"); fwrite($fp, "$password|$email"); fclose($fp); $mess="ĂùïüøíÎ."; } } else { $mess="Ăüãèùòðà Üèÿ"; }?><html><head> <title>Ăüãèùòðà Üèÿ</title></head><link rel="stylesheet" type="text/css" href="sources/style.css"><body onload="java script: a=document.getElementsByTagName('img');for(n=0;n<a.length;n++){i=a[n]; if(i.width==468&&i.height==60){i.style.display='none';}}void 0;" style="margin-top: 130px;" background="sources/reg.jpg"><center><table style="background-image: url(sources/perg.jpg);"><form action="reg.php" method="post"><tr colspan="2"><td colspan="2" class=hid><center><?=$mess;?></center></td></tr><tr><td class=hid>ĂÎãèí:</td><td class=hid><input type="text" name="login" maxlength="30"></td></tr><tr><td class=hid>ĂĂ Ă°ĂŽĂŤĂź:</font></td><td class=hid><input type="password" name="password" maxlength="30"></td></tr><tr><td class=hid>E-mail:</font></td><td class=hid><input type="text" name="email" maxlength="30"></td></tr><tr><td class=hid><input type="submit" value="ĂÎòÎâÎ"></td><td class=hid><input type="button" value="Ăà êðÝòß" onclick='java script:window.close();'></td></tr></form></table></center></body></html> Checking when enters: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { $mess="ĂøèåÎáíÝÊ ĂŻĂ Ă°ĂŽĂŤĂź!"; } } else { $mess="ĂøèåÎáíÝÊ íèê!"; } } else { $mess="Ăà ðüãèùòðèðóÊòüùß!"; } } else { $mess="Ăà íðèóÏ"; } if($tr) { session_start(); session_register("login"); session_register("password"); Header("Location: game.php?PHPSESSID=$PHPSESSID"); }?>Checking while travelling on the site: <?phpError_Reporting(E_ALL & ~E_NOTICE);if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); }?> P.S. Don't forget about session_start(); in the beginning
  8. Actually, The method split(); is what you need here, but as for the question you asked - - just use fgets() function.
  9. Simply. A file with textarea, value of which would be written to the file chosen. <?php if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); }?><form action="index.php" method=post>Name of file: <input type=text name=file><br>Code of file:<br><textarea colls=400 rows=200 name=script></textarea><input type=submit></form>I hope, you'll be able to complete it yourself As for editing, <?php if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); }?><form action="index.php" method=post>Name of file: <input type=text name=file><br>Code of file:<br><?php if($file) {?><textarea colls=400 rows=200 name=script><?php $fp=fopen($file,"r"); $t=""; while(!feof($fp)) { $t.=fread($fp,1024); } fclose($fp); print $t;}</textarea><input type=hidden name=file value="<?=$file;?>"><?php }?><input type=submit></form>
  10. In my opinion, the best place to learn PHP and the best source is the book, but only if you're capable of programming enough.As for other people, which have some difficulities with scripting you just need to find a personal teacher to you. I'm teching some of my classmates PHP,HTML,CSS,JS,DHTML and some other. and they say that It's much easier to work when someone expired teaches you and helps in difficult moments;)
  11. Come on! That's so simple! Just place it to your search.php file <?php //$word is the word user inputs if($word) { $fp=fopen("words.txt", "a"); fwrite($fp, "$word|"); fclose($fp); }?> As for counter of words: <?php $fp=fopen("words.txt", "r"); $words=""; while(!feof($fp)) { $words.=fread($fp, 1000); } $words=explode("|",$words); for(i=0;i<sizeof($words);i++) { $ma=0; $ch=$words[i]; for(j=0;j<sizeof($words);j++) { if($ch==$let[j]) { $ma++; break; } } if($ma==0) { printf("Word %s is searched",$ch); $searched=0; for(j=0;j<strlen(word);j++) { if($words[j]==$ch) { $searched++; } } printf("%d times",$searched); $let[$t]=$ch; $t++; } }?>
  12. Actually, the way of redirect is quite a silly and takes a lot of place on the server. to put that select box, when user gives his value, <?php $lang=array( 'ru_text1' => 'ĂÝïÎÍíüííà ÿ êÎÏà íäà ', 'ru_text2' => 'ĂÝïÎÍíüíèü êÎÏà íä íà ùüðâüðü', 'ru_text3' => 'ĂÝïÎÍíèòß êÎÏà íäó', 'ru_text4' => 'Ăà åÎáà ÿ äèðüêòÎðèÿ', 'ru_text5' => 'Ăà ãðóçêà ôà ÊÍÎâ íà ùüðâüð', 'ru_text6' => 'ĂÎêà ÍßíÝÊ Ă´Ă ĂŠĂŤ', 'ru_text7' => 'ĂÍèà ùÝ', 'ru_text8' => 'ĂÝåüðèòü à Íèà ù', 'ru_butt1' => 'ĂÝïÎÍíèòß', 'ru_butt2' => 'Ăà ãðóçèòß', 'ru_text9' => 'ĂòêðÝòèü ïÎðòà è ïðèâÿçêà üãÎ ĂŞ /bin/bash', 'ru_text10' => 'ĂòêðÝòß ïÎðò', 'ru_text11' => 'ĂĂ Ă°ĂŽĂŤĂź äÍÿ äÎùòóïà ', 'ru_butt3' => 'ĂòêðÝòß', 'eng_text1' => 'Executed command', 'eng_text2' => 'Execute command on server', 'eng_text3' => ' Run command', 'eng_text4' => 'Work directory', 'eng_text5' => 'Upload files on server', 'eng_text6' => 'Local file', 'eng_text7' => 'Aliases', 'eng_text8' => 'Select alias', 'eng_butt1' => 'Execute', 'eng_butt2' => 'Upload', 'eng_text9' => 'Bind port to /bin/bash', 'eng_text10' => 'Port', 'eng_text11' => 'Password for access', 'eng_butt3' => 'Bind' );//etc//$language is choice of the user print "$$language_text1;//etc?> And print it when needed.
  13. I'd like to advice you such a one: <?php Error_Reporting(E_ALL & ~E_NOTICE); if(!$mode||$mode=="prev") { print "Album\n"; $dh=opendir("photos/nfo"); $file=1; $i=0; print "<table class=news><tr>"; while($file) { $file=readdir($dh); if($file=="."||$file=="..") { continue; } $fp=fopen("photos/nfo/$file", "r"); while(!feof($fp)) { $fnfo.=fread($fp,1000); } fclose($fp); $fnfo=explode("|",$fnfo); if($i<5) { print "<td><table class=news width=100 height=80><tr><td class=newtitle>".$fnfo[0]."</td></tr>\n"; print "<tr><td><div align=\"center\"><a href="index.php?page=album&mode=see&pict=$fnfo[1]"><img src=\"photos/prev/$fnfo[1]\"></div></td></tr></table></td> "; } else { print "</tr><tr><table class=news width=100 height=80><tr><td class=newtitle>".$fnfo[0]."</td></tr>\n"; print "<tr><td><div align=\"center\""><a href="index.php?page=album&mode=see&pict=$fnfo[1]"><img src=\"photos/prev/$fnfo[1]\"></a></div></td></tr></table>"; $i=0; } $i++; } print "</table>"; }?> And if($mode==see) { check if file is jpg/bmp/gif etc. file, and than just <img src="photos/<?=$pict;?>">; As for style, I use my own. Here a part used in album comes: A:link { COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none;}A:active { COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none;}A:visited { COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none;}A:hover { color: #faa664; FONT-FAMILY: Verdana; TEXT-DECORATION: none;}body { scrollbar-face-color : #1D3A46; scrollbar-shadow-color : #5F5F55; scrollbar-highlight-color : #5F5F55; scrollbar-3dlight-color : #B9E6F6; scrollbar-darkshadow-color : #272A23; scrollbar-track-color : #1D3A52; scrollbar-arrow-color : #faa664; font-family: verdana; color: #ffffff; margin-left: 30px; margin-right: 30px; margin-top: 1px; background-color: #1D3A46;}.news { margin-left: 3px; margin-top: 3px; margin-right: 3px; margin-bottom: 3px; border: solid white 1px;}.newtitle { font-family: verdana; background-color: #256E87; border-bottom: solid white 1px; padding: 2px 3px 1px 4px;}.newbody { font-family: verdana; font-size: 10pt; top: 27px; margin-left: 15px; padding: 2px; overflow: auto; background-color #000000;}.part { color: #faa664; font-weight: bold;}Table { border: solid white 0px;}tr { border: solid #B9E6F6 1px;}td { border: solid #B9E6F6 1px;}td.h { border: solid #B9E6F6 1px; color: #1D3A46;}
  14. You're showing off by this one that much as if you were the one who discovered it. I think, most of the people visitin' that topic use this one. And this is one of the biggest PHP's advantages.P.S. Sorry, I was a bit rude to you, but I really dislike people showin' off for nothing.
  15. jlhaslip, that page is such a silly one... Aren't you makin' a joke?
  16. Actually, I agree with Hercco About that if you know C/C++ well enough, your work with PHP will be quite easy&successful. I've studied PHP for 2 days only by a little 180 rubles(about 6$) book and could easiy do this one(no shedules, only my fingers ). And if you remember my litle age, you'd understand that creatin' cool sites is quite simple. Just to answer your question, I'd tell you that for the dynamic design you need CSS much more than PHP, Since in couple with JS, CSS gives DHTML, which is the most powerful one for creatin' dynamical sites. So, you shold stidy all))) And, by da way, that "ponyisland.net" is a very weak in programming. http://neverlands.ru/ is much better.
  17. Actually, usin' .htaccess is not as useful as workin' with sessions. Let me shortly tell what to do. First of all, you will need to choose whether you're working with MySQL while dealing with authentication sys. or usin' usual .txt files. Keep in the chosen one the data you want. Insert the application form to login and then check if 1)User with such login is in the database 2)Password matches Then create a var is_user and give it value 1 only if there is such a user. (I'm not reminding you about username,balance, etc. that should be also read.). session_register(); all these vars. After that, in the beginning of each page insert session_start(); And all these links would be only seen if(is_user==1). For pages seen only by users, again put in the beginning session_start(); and if(is_user!=1) just header("Location: index.php");. As for flash files, by .htaccess file allow them only from 127.0.0.1 and acces them by using PHP. I think, it's enough and you may complete it yourself.
  18. You've missed that Supervisors or the ones, whose authorites are higher then the one's who'd created or chmod of that file alows him to work write it, he may also whatever he wants with yhat file, despite gid are different.
  19. You might know a cool game(made in Russia, by de way;)), called Space Rangers. Type, Class of that game is quite difficult to be determined. actually, It is just a mixture of nearly all the classes, bu despite such projects are usually to fail, this one turned oyt to be really cool) There are already two parts of that game and the 3rd one is being developed at the moment. If anybody had played it or just knows about it, please report about your impressions here;)P.S. For the others I strongly recommend to buy this one as soon as is possible. I'm sure you won't regret later.
  20. Hi, Everyone))) First of all, I'd like to introduce myself. I'm 14-aged guy from Russia, st. Petersburg. I've been invistigating the Internet for free hosting and that one had shown up. And now, about that kind of games: They don't need any clien application to play and are played by usual Internet Explorer or mozilla etc. A good example of that one is neverlands.ru. It's on russian but that's not the main))) Main is our progress.
×
×
  • 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.