Jump to content

thewooleymammoth

Members
  • Posts

    768
  • Joined

  • Last visited

    Never

Everything posted by thewooleymammoth

  1. holy shit, looks like there is infact alot to work on, thanks for all the input. i will try and fix all that shit. and have you guys test it again. thanks again.
  2. <a href='http://www.getyourlinkon.net' target='_blank'>www.getyourlinkon.net</a> tell me if you find any errors, the first time you go there it takes a minute to load, i have to work with the server people about that... if you know why please tell me. if you have any ideas or if you find errors please tell me, thanks.
  3. ... sure <?php echo "<embed src="yourmusic.wav" width="140" height="40" autostart="false" loop="FALSE"> </embed>"; ?>
  4. ive got a page going that reads a file, if it exists and outputs it in a table, im trying to create a sort by catogory type link. <?php $pagename='Links'; include('tophalf.php'); ?> <?php if(isset($_COOKIE['auth'])) { echo "<table width='100%'> <tr align='center'> <td align='center'> Sort By </td> </tr> <tr align='center'> <td align='center'> <a href='links test.php?type=Comedy'>comedy</a> </td> </tr> <table>"; $lastlink = 50; $type=strip_tags($_GET['type']); while($lastlink != 0){ $filename = "links/".$lastlink.'.txt'; if (is_readable($filename)){ $openfile = fopen($filename, "r") or die('error1');; $content = fread($openfile, filesize($filename)) or die ('error2'); $conexp = explode('|',$content); $date = date('F d Y H:i:s.', filemtime($filename)); $user= $_COOKIE['auth']; $filenamecom="links/".$lastlink."com.txt"; $color1='#4F4F4F'; $color3='999999'; $color2='#E5E5E5'; if ($type == All || $type == $conexp[0]){ echo " <table border='0' width='50%' bgcolor='$color1' cellpadding='5' cellspacing='2' align='center'> <tr> <td>insert advertisement<br></td> </tr> <tr> <td align='left' width='100%'><h1 STYLE='font-family: Arial; font-size : 16pt; font-weight :bold;text-align : left; color :999999 ;margin:0;margin-left:2px;padding:0'>"; if ($conexp[1] == 'safe'){echo "<img src='img/childsafe.gif' width='50' height='50'> ";} else{} echo $conexp[0]."</span></td> </tr> <tr bgcolor=$color3> <td align='right' width='100%'>Added by <a href='member.php?user=".$conexp[2]."'>".$conexp[2]."</a><br>".$conexp[3]."</td> </tr> <tr bgcolor=$color3> <td bgcolor=$color2><a href='".$conexp[4]."' target='_blank'>".$conexp[4]."</a> <br>".$conexp[5]."</td> </tr> <tr align='center'> <td><a href='linkcomments.php?lastlink=".$lastlink."'>View Comments</a></td> </tr> </table> <br><br> "; fclose($filename); $num=4; $num2=$num+1; $lastlink--; }else{} }else{ $lastlink--; } } }else{ echo 'Please Login to view Links'; } ?> <?php include('bottumhalf.php'); ?> the problem is that when get is set to all, it seems to have no problem but when its set to Comedy, it times out everytime, could someone please enlighten me on why its so slow and possibly how to fix it, thanks. an example of the file being displayed is as follows Comedy|safe| thewooleymammoth| Friday 21st of September 2007 11:05:08 AM| http://youtube.com/watch?v=ea7oIraV2Q0| DR TRAN| [attachment deleted by admin]
  5. so there is no way to specify that i only want html tags? wouldnt i have to go through and do that with every possible php and mysql tag?
  6. How would i go about stripping all tags but html tags? like myspace does...?
  7. so this should place a file called 1.txt inside www.mysite.com/files/1.txt ? <?php $result=1; $filename=files/$result.".txt"; $openfile = fopen($filename, "a") or die("could not open file $filename"); fwrite($openfile, 'this is the text'); ?> that doesnt work, it tries to devide files by 1 which is undefined so the file ends in the same directory called 0.txt
  8. How do i write files to a directory? i can only figure out how to make the site open files in the same directory as as the script file, is there osme way to tell it to read or write a directory? say in /files/?
  9. Alright i solved it, the correct syntax was "UPDATE $table SET `updatenumber` = '$newresult' WHERE `$table`.`num` =1;"
  10. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'updatenumber=`2` WHERE num='1'' at line 1 lol nope, thanks for the help btw Im using wamp5 do you think htat could be the problem? perhaps because its not a regularly installed apche php and mysql its not evaluating things correctly?
  11. nope You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''UPDATE' . `userlist` . `filenames` . 'updatenumber=' . `2` . 'WHERE num='1'' at line 1 i hate errors i cant figure out
  12. this returns a syntax error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'updatenumber=2 WHERE num='1'' at line 1 <?php $query=mysql_query("SELECT*FROM $table WHERE num='1'") or die(mysql_error()); $result=mysql_fetch_assoc($query); $newresult=$result['updatenumber']+1; $connectmysql=mysql_connect('localhost',$username,$password) or die(mysql_error()); $selectdb=mysql_select_db($database) or die(mysql_error()); $connectmysql; $selectdb; $filehandle = fopen($filename, "w"); $query; mysql_query("UPDATE $database $table updatenumber=$newresult WHERE num='1';") or die(mysql_error()); ?> in mysql i want it to update a number, there are two columns in the database one is num one is update number... thanks. idk what the syntax error is but i cant figure it out. help appreciated
  13. alright so i tried it like this <?php $lastart=1; while($lastart!=0){ $filename="$lastart".".txt"; $openfile=fopen($filename, "r") or die('error1'); $content=fread($openfile, filesize($filename)) or die ('error2'); echo "$lastart"; if(!fread($openfile, filesize($filename))){ $lastart=0; }else{ echo " <table> <tr> <td>".date(F d Y H:i:s., filemtime($filename)."</td> </tr> <tr> <td>".$content."</td> </tr> <tr> <td>written by eric wooley</td> </tr> </table>"; $lastart=$lastart+1; } } ?> but i got the same result
  14. I wanted to have the site owner (probably me) create a text file named 1.txt or 2.txt or whatever and have the page show the contents of the file in order of smallest to largest (as decided by the name of the txt file) but nothing shows up at all <?php while($lastart!=0){ $lastart=1; $filename="$lastart".".txt"; $openfile=fopen($filename, "r"); $content=fread($openfile, filesize($filename)); fclose($openfile); if(!fread($openfile, 'r')){ $lastart=0; }else{ echo "<table> <tr> <td>"."date(F d Y H:i:s., filemtime($filename)"."</td> </tr> <tr> <td>"."$content"."</td> </tr> <tr> <td> </td> </tr> </table>"; $lastart=$lastart+1; } } ?> nothing shows up which im assuming means the while statement is satisfied? if that is the case i would like to know how i would go about looping it so that when there is no file with the number its looking for it ends the loop. if that is not the case i just dont know what is and help would be appreciated. thanks Eric
  15. OOOH MY GOD IM AN IDIOT thanks it still doesnt work though im still stumped, the way i have the quotes set up it should work right? maybe it has to do with my form in the login page... it looks like it should send the POST through so idk i hate my computer sometimes
  16. I created a login page a while ago, and i decided to turn it into a two page process, however i cant get the login.php page to link back to whatever page linked to it... i hope that makes sence. page user logs in from: (which i would like to be every page on the site) <?php $tp='index.php'; $user2=$_COOKIE['auth']; if(isset($_COOKIE['auth'])) { echo "welcome $user2<br>"; echo "<form method='post' action='login.php'><input type='submit' value='logout' name='logout'>"; } elseif (!isset($_COOKIE['auth'])) { echo "<a>please login:</a><br> <table> <form method='post' action='login.php'> <tr> <td>Username:</td> <td><input type='text' name='username'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'></td> </tr> <tr> <td><input type='hidden' name='pn' value=$tp> <input type='submit' name='loggedin' value='Log In'><br></td> <td><a href='resister.php'>Register here</a></td> </tr> </table>"; } else { echo "error"; } ?> login page: <?php $tp=$_post['pn']; $username="root"; $password=""; $database="userlist"; $table="login"; $connectmysql=mysql_connect('localhost',$username,$password) or die(mysql_error()); $selectdb=mysql_select_db($database) or die(mysql_error()); $user2=$_COOKIE['auth']; if(isset($_POST['logout'])) { setcookie("auth", "$user2", time()-3600); echo "you have logged out<br><a href='$tp'>return to your page</a>"; } elseif(isset($_COOKIE['auth'])) { echo "You have already logged in<br>"; echo "<a href='$tp'>return to your page</a>$tp"; } elseif (isset($_POST['loggedin'])) { $user=$_POST['username']; $userpass=$_POST['password']; $query=mysql_query("SELECT*FROM $table WHERE username='$user'") or die(mysql_error()); $result=mysql_fetch_assoc($query); $connectmysql; $selectdb; if($user == $result['username'] && $userpass == $result['password']) { setcookie ('auth', $user, time()+3600); echo "You have logged in succesfully.<br> <a href='$tp'>return to your page</a>"; } elseif ($userpass != $result['password']) { echo "bad user/password combanation please try again.<br> <a href='$tp'>return to your page</a>"; } elseif ($user !== $result['username']) { echo "bad user/password combanation please try again.<br> <a href='$tp'>return to your page</a>"; } } else { echo "error"; } ?> the login.php page just refers back to itself and no matter how i play with the "" '' it never makes a difference
  17. alright as far as i can tell i got the whole thing working... woot for me im sure its not secure so if you feel like poking some holes in it now its fine with me. thanks again for all the help im off to the registration page! thanks again for the help. here was my final code. <?php $username="root"; $password=""; $database="userlist"; $table="login"; $connectmysql=mysql_connect('localhost',$username,$password) or die(mysql_error()); $selectdb=mysql_select_db($database) or die(mysql_error()); $user2=$_COOKIE['auth']; if($_COOKIE['auth']) { echo "welcome $user2"; } elseif (!isset($_POST['loggedin'])) { echo "<a>please login:</a><br> <form method='post' action='index.php'> Username:<input type='text' name='username'><br> Password:<input type='text' name='password'><br> <input type='submit' name='loggedin' value='Log In'><br> <a href='resister.php'>Register here</a>"; } elseif (isset($_POST['loggedin'])) { $user=$_POST['username']; $userpass=$_POST['password']; $query=mysql_query("SELECT*FROM $table WHERE username='$user'") or die(mysql_error()); $result=mysql_fetch_assoc($query) or die(error1); $connectmysql; $selectdb; if($user == $result['username']) { if($userpass == $result['password']) { setcookie ('auth', $user); echo "You have logged in succesfully"; } elseif ($userpass != $result['password']) { echo "bad user/password combanation please try again.1"; } } elseif ($user !== $result['username']) { echo "bad user/password combanation please try again.2"; } } else { echo "error"; } ?>
  18. ah thanks.. i am getting the error from the line. $result=mysql_fetch_assoc($query) or die('error'); and originally i had something like this elseif (isset($_POST['loggedin'])) { $connectmysql; $selectdb; if($user == $result['username']) { if($userpass == $result['password']) { setcookie ('auth','$user'); echo "You have logged in succesfully"; } elseif ($userpass != $result['password']) { echo "bad user/password combonation please try again.1"; } } elseif ($user !== $result['username']) { echo "bad user/password combonation please try again.2"; } but it said it couldnt modify header or something like that, so i thought if i make it as a variable at the top of the page it might do it right... idk i was just expiramenting and left it. help with that would be apreciated also, but now i need to know why im getting an error from this line $result=mysql_fetch_assoc($query) or die('error'); thanks again
  19. <?php $username="root"; $password=""; $database="userlist"; $table="login"; $user=$_POST['username']; $userpass=$_POST['password']; $connectmysql=mysql_connect('localhost',$username,$password) or die(mysql_error()); $selectdb=mysql_select_db($database) or die(mysql_error()); $query=mysql_query("SELECT*FROM $table WHERE username='$user'"); $result=mysql_fetch_assoc($query) or die('error'); $user2=$_COOKIE['auth']; $makecookie=setcookie ('auth','$user'); if($_COOKIE['auth']) { echo "welcome $user2"; } elseif (!isset($_POST['loggedin'])) { echo "<a>please login:</a><br> <form method='post' action='index.php'> Username:<input type='text' name='username'><br> Password:<input type='text' name='password'><br> <input type='submit' name='loggedin' value='Log In'><br> <a href='resister.php'>Register here</a>"; } elseif (isset($_POST['loggedin'])) { $connectmysql; $selectdb; if($user == $result['username']) { if($userpass == $result['password']) { $makecookie; echo "You have logged in succesfully"; } elseif ($userpass != $result['password']) { echo "bad user/password combonation please try again.1"; } } elseif ($user !== $result['username']) { echo "bad user/password combonation please try again.2"; } } else { echo "error"; } ?> i just get the "error" which means none of the conditions are met... and i dont see how its possible for none of them to be met... thanks
  20. <?php $makecookie=setcookie ('auth',$user); $username="root"; $password=""; $database="userlist"; $table="login"; $user=$_POST['username']; $userpass=$_POST['password']; $connectmysql=mysql_connect('localhost',$username,$password) or die(mysql_error()); $selectdb=mysql_select_db($database) or die(mysql_error()); $query=mysql_query("SELECT*FROM $table WHERE username='$user'"); $result=mysql_fetch_assoc($query) or die('error'); $user2=$_COOKIE['auth']; if($_COOKIE['auth']) { echo "welcome $user2"; } elseif (!isset($_POST['loggedin'])) { echo "<a>please login:</a><br> <form method='post' action='index.php'> Username:<input type='text' name='username'><br> Password:<input type='text' name='password'><br> <input type='submit' name='loggedin' value='Log In'><br> <a href='resister.php'>Register here</a>"; } elseif (isset($_POST['loggedin'])) { $connectmysql; $selectdb; if($user == $result['username']) { if($userpass == $result['password']) { $makecookie echo "You have logged in succesfully"; } elseif ($userpass != $result['password']) { echo "bad user/password combonation please try again.1"; } } elseif ($user !== $result['username']) { echo "bad user/password combonation please try again.2"; } } else { echo "error"; } ?> a freind helped me with those errors. and now i only get "error" but i think i can probably figure out whats going on with that. thanks again for the help
  21. You might need to change that if you are trying to compare passwords. yea i saw that and changed it already thanks though
  22. ... alright... anyways now i get this error Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\served\website temp\index.php on line 6 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\served\website temp\index.php on line 7 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\served\website temp\index.php on line 7 Could not select database idk if you can help with this error or not, it might just be my setup... idk help appreciated
  23. alright cool thanks. i havnt seen em lol. Im basically brand new to programming i just went througha few shitty tutorials and looked up some functions sorry for my lack of competince
×
×
  • Create New...

Important Information

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.