Jump to content

phpSensei

Members
  • Posts

    2,838
  • Joined

  • Last visited

    Never

Everything posted by phpSensei

  1. <a onclick="replaceText(''), document.getElementById('message'); return false;"><img src="../admin/happy.gif" alt="" width="18" height="24"></a> Am I suposed to change anything else than the ElementbyId('message') or.... Thanks for the support though.. It doesnt work because I have never used javascript so much, just pure php.
  2. <script type="text/javascript"> function smiley(tag) { var emo=document.forms["form"].elements["message"]; emo.value+="" } </script> the code works perfectly, but everytime you put a text into the field, it goes at the end of the string, not where the cursor is. help please.
  3. Why do i keep getting this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\project_upload\register.php on line 192 $to = '$email@hotmail.com'; $subject = "Your Account Information"; $body = "You have sucessfully registered at my localhost host"; if (mail($to, $subject, $body)) { echo("<p>Account information has been sent to your email!</p>"); } else { echo("<p>Message delivery failed...</p>"); } But never works, please help me out.
  4. THANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNKYYYYYYYYYYYYOU SOOOOOOOOOOOOOO MUCCCCCCH K I wont ever attempt to do something like that again in big, but thankyou thankyou...
  5. OOOOOOOOMG!!!!!!!!!! IT is so Simple now... In Simple Steps, all you do is hash the password assigned to the username, then match it with the one in the database. Thankyou both.
  6. I see now... KK, the password is hashed first, then I insert it in my database and this shows up... "512475d105b974761ab5a28ff5a127". The password I wanted was Apples just for example, then it got hashed. When a user logs in, will it require the password as Apples or the Hashed one?
  7. I have created a website, with a forum, file upload, news system, and more options but I wont get into details.. I have one quick little question: "Why is Md5 Hashing so important?" I want a straight answer, and not just for security. I just created a user registration field and the password is hashed with md5.. so what? It is a bunch of numbers, and how is this useful?
  8. Please thorpe your magesty, how do you make it happen with your all mightyness..
  9. I want two things replaced in a message posted by a user dont know how... I use this: $sad="sad"; $img="img"; $smilies = str_replace("", '<img src="files/smilies/happy.gif" width="18" height="24">', $row['message'] || $sad, $img, $row['message']);
  10. Screw what I said, Heres the thing... $happy = str_replace("", '<img src="files/smilies/happy.gif" width="18" height="24">', $row['message']); echo $happy; What if I want to replace more than one thing in the same variable?
  11. <?php $sql="SELECT * FROM frontpage ORDER BY id DESC LIMIT 3"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { $happy = str_replace("", "happy", $row['message']); echo ' <table width="80%" border="0" align="center"> <tr> <td colspan="2"><div align="center" class="style6"> <h3>' . $malestr . '</h3> </div></td> </tr> <tr align="center" valign="top"> <td colspan="2"><div align="center" class="style6"> <div align="center"><span class="style8">' . $row['message'] . ' <br> <br> </span> <hr size="2"> </div> </div></td> </tr> <tr> <td width="100%" height="21"><div align="left"><span class="style5"><img src="files/images/admin_avy.png" width="12" height="12"> user: -- </span> <img src="files/images/comment.png"><span class="style5"> Comments ( 0 ) <img src="files/images/written.png" width="12" height="12"> Date Written:<em>' . $row['date'] .'</em></span></div></td> <td width="0%" class="style5"><div align="left"></div></td> </tr> </table>'; } ?> I did this, but it doesnt work.
  12. Can someone help me with this? I know exactly how to write a preg_replace script, but dont know how to do the following... When a user posts a message, he can add the following stuff: <"b"><"/b"> Sorry, I had to put double quotes because this site reads it as a bold. <center></center> - tongue ;p - Wink :0 - Suprised How would you make it so the script finds a string wrapped by the bold, and center, and to find the smilies, and replace them with something of my own. And please dont give me answers that dont relate to anything.
  13. Before Anything, I think I should Explain how my Forum works. Everytime a user adds a topic, the Id of the Forum which the topic is being added to, is inserted in a table row called id_forum, in the messages table. (Same table for Adding Topics). Once it has the Forum's id, you can display these topics like this <?php //We Get the ID of the Topic passed from the URL// $id=$_GET['id']; //Here We Select Everything from Messages, then INNER JOIN with the Forums table// $sql="SELECT * FROM messages INNER JOIN forums ON id_message=id_forum WHERE id_forum='$id' "; $result=mysql_query($sql); $row=mysql_fetch_array($result); ?> I am trying to Collect a user's ip when he views a thread in my forum. Now to skip some of the code, I will do a IF statement for: <?php //Here we Collect the IP Adress of this user// $ip=$_SERVER['REMOTE_ADDR']; //Here we check if in OUr SELECT STATEMENT, We can Find a unique ip// If( $ip == $row['unique_ip']){ //If The ip already Exists, We do Not ADD 1 to the Unique Views// die(); } //Else If the ip is unique, We add it to our list of Ip's, so Later this ip will not count as unique// elseif ($ip != $row['uniqure_ip']{ $id=$_GET['id_message']; mysql_query ("INSERT INTO message_msg (uip) WHERE id_msg='$id' VALUES ('$ip')") mysql_query("UPDATE messages SET uniqueviews = uniqueviews + 1 WHERE message_id='$id2'"); } ?> The ip doesnt go to the proper message id.
  14. Thankyou so much, My forum is done with everything. This was the only thing left.
  15. Edit: I know what you mean but... I dont know which function will calculate the most current date.
  16. I have a little question... Can I use the SELECT statement, and Display all my data from a certain table depending on the date? If the date is newer then it will show that id, within the table? Any of this possible? I was thinking of this <?php $sql="SELECT * FROM table_1 ORDER BY date ASC"; $result=mysql_query($sql); $row=mysql_fetch_array($result); ?>
  17. Silly me, I took up too much coding, and your's looks much more simple but safer.. I will wait for the rest..
  18. I want to know how unsafe this login validation is... <?php /*We include our database connection file*/ include("connection.php");?> <?php /*We use the POST method to get the username a password from the form*/ $username=$_POST['username']; $password=$_POST['password']; //Once our Connection is good to go, we can use the SELECT query// $sql= "SELECT * FROM members"; //Here we set our query to the Variable RESULT// $result=mysql_query($sql); //Then we pass it on to the ROW variable as an array// $row=mysql_fetch_array($result); if( $username != $row['username'] || $password != $row['password'] ){ die("Error 2: That username/password does not exist in our Database <br> <br> <a href = errorlog.html>View all Error Logs</a>"); } elseif(isset($_POST['username']) || isset($_POST['password'])){ session_start(); $_SESSION['username'] = $_POST['username']; session_register($username); header( 'Location: index.php' ); } else die("Error 1: Could not log in with username and password provided, Please try again later <br> <br> <a href = errorlog.html>View all Error Logs</a>"); ?>
  19. I managed to loggin the user but! What if I wanted to show the users statistics, like number of post and date he joined my site... How would you use the SELECT statement for this?
  20. I want to show the users login information when he is on the index page.
  21. Alright, I finished the script. I have registered a session just when the user logs in. Now once the session is registered, but how do you use this information? like this: $_SESSION['username']; ?
  22. What does the HASH do? How do you insert sessions into a Database?
  23. I still do not understand what hash key is, I know how to use it but whats it good for? md5 right? How do you insert the userID with sessions?
  24. I have a few questions regarding user loggin in. First I am going to skip the part where we see if the post is set, or if the user matches the same one in the database. Lets say everything is okay, and when success the user session is registered. Now here is my question; "WHAT needs to be Registered?". <?php session_register['username']; session_register['password']; ?> Or do I need to register a user id.... Totally confused here, help me out.
  25. I have a forum and its is almost finished... I am currently displaying the Total number of Topics within a Forum, but I dont know how. Each Topic is assigned to a Forum by inserting the Forum's id which is "ID", (located in forums table), and into a field named idforum, which is located in the topic_fr table. Now that idforum has the id of the forum it has been inserted into, I can display these in each forum. I have 2 forums, but I do not know how to display the total number of topics in each forum. I was thinking something like this, but no. $query = mysql_query("SELECT * FROM message_msg INNER JOIN forums ON idtop_msg=id WHERE idtop_msg='$id'"); $number=mysql_num_rows($query); echo $number;
×
×
  • 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.