Jump to content

TeddyKiller

Members
  • Posts

    1,056
  • Joined

  • Last visited

    Never

Everything posted by TeddyKiller

  1. Simple Q. Hard A. I have a code, and a function in class Mailer. if(mail send) { success } else { not success } Like so.. if ($mailer->sendWelcome($fullname, $email, $password, $link)) { $_SESSION['success'] = 'You have successfully registered and an activation email has gone to your account'; header("Location: /tests/index.php"); } else { $_SESSION['success'] = 'Mail failed to send'; } and the function is simialr to as follows function sendWelcome($name, $email, $pass, $link) { if(mail($email, $subject, $mail_body, $header)) { return true; } else { return false; } } The body etc is defined inside the function... Now, it returns the true message. 'You have successfully registered ... ' so it means the message was sent, only... nobody gets it?! Any help?! Thanks!
  2. I have changed to this - http://plugins.jquery.com/project/vTicker It looks nice, however.. how would I change the max to display to - 'to fit' so that all will be shown ... default is 3. It seems to only allow a limit.
  3. Mmm.. I've seen this http://www.dynamicdrive.com/dynamicindex2/mikescroll.htm It looks good, once I change the width and stuff but.. It uses an "add.item" thingy, what I'd like is to.. have divs, inside a wrapper div of the scroller... I just can't find anything.
  4. I have.. lets say 10 comments... I want to auto scroll them. You don't see the scroller, it just does it. What happens is.. it pauses on one comment.. for.. so many seconds, then scrolls to the next.. pauses, then scrolls to the next and so on. The process repeats itself and cannot be stopped. What is it and how can it be done?
  5. No, it had proper values and I editted them. - That was just a typo.
  6. Whats the BOM characters? and how do I check if its being saved as UTF-8. I'm using notepad++. EDIT: Just checked in encoding. It's saving it as UTF-8.
  7. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/l/o/s/lostignorance/html/test/includes/Login2/config.php:1) in /home/content/l/o/s/lostignorance/html/test/includes/Login2/session.php on line 18 This seems simple. only it's not. theres no whitespace, nothing being executed before session_start. All it is, is php. My config is the same as this, and it works fine... yet it doesn't on here. Line 18, is session_start, its a class I use on my site and it works fine. This isn't the problem. I am 100% sure of it. This is my page.. <?php include("includes/Login2/config.php"); echo 'Stuffs'; ?> config.php, is as follows <?php define('DB_SERVER', "server"); define('DB_USER', "user"); define('DB_PASS', "pass"); define('DB_NAME', "name"); define("COOKIE_EXPIRE", 31536000); //1 Year require_once("includes/Login2/db.php"); require_once("includes/Login2/functions.php"); require_once("includes/Login2/user.php"); require_once("includes/Login2/session.php"); $database = DatabaseAdapterFactory::factory('mysql', DB_SERVER, DB_USER, DB_PASS, DB_NAME); $database->connect(); $session = new Session; $secret_key = '103041231'; require_once("includes/Login2/form.php"); $form = new Form(); if(isset($_SESSION['uid']) && isset($_SESSION['hash'])) { $user = $session->checkLogin($secret_key); } require_once("includes/Login2/mailer.php"); $mailer = new Mailer(''site name', 'email'); require_once("includes/Login2/settings.php"); $settings = new Settings(); ?> As you see.. no html executed, no whitespace, nothing. Though it doesn't work.. wtf is going on? Seriously need some help. new Session, is when it initializes Session, so thats when it creates a session start
  8. I have a wall post thing, and.. well you comment on it, but.. when i submit a post, it brings down the 'loading comment' and it disappears - as it should do. But the php script doesn't execute, it doesn't even add it to the database.. I cant think of where the problem is. Ajax/javacript $(function() { //Update Message... $(".post").click(function() { var boxval = $("#message").val(); if(boxval=='') { alert("Please Enter Some Text"); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<span class="loading">Loading Comment...</span>'); $.ajax({ type: "POST", url: "update_wall.php", data: {upd: "2", content: boxval}, cache: false, success: function(html){ $("div#update").prepend(html); $("div#update").slideDown("slow"); document.getElementById('content').value=''; document.getElementById('content').focus(); $("#flash").hide(); } }); } return false; }); }); PHP <?php require_once("include/config.php"); if(!$session->logged_in) : redirect("/index.php"); endif; if($_POST['upd'] == '1') { if(isset($_POST['content'])) { $content = clean($_POST['content'],1,0,0); $time = time(); $query = $db->execute("INSERT INTO horblewall (user_id, comment, posted) VALUES ('$user->id', '$content', '$time')"); $query = $db->execute("SELECT w.*, u.avatar, u.displayname FROM horblewall as w, users as u WHERE u.id = w.user_id ORDER BY w.posted DESC"); $row = $db->fetchassoc($query); echo '<div style="border-bottom:1px solid #e11919;" class="bar'.$row['id'].'"> <div style="text-align:left; min-height:90px;"> <div style="float:right; width:105px;"> Posted on<br />'.date("d.m.y H:i", $row['posted']).' <br /><br /> Msg no. '.$row['id'].' <br />'; if($user->level == '9') { echo '<br /> <span class="delete_button"><a href="#" id="'.$row['id'].'" class="delete_update">Delete</a></span>'; } else if($row['user_id'] == $user->id) { echo '<br /> <span class="delete_button"><a href="#" id="'.$row['id'].'" class="delete_update">Delete</a></span>'; } echo '</div> <div style="float:left; width:80px; text-align:center;"> <img src="resize_image.php?file='.$row['avatar'].'&size=70" /> <br /> <a href="#">'.$row['displayname'].'</a> </div> <div style="margin-right:120px; margin-left:95px;"><p>'.$row['comment'].'</p></div> </div> </div>'; } else { echo 'Message empty'; } } ?> Wheres the problem? I've removed the redirection from the php, and.. well, same thing happens =[
  9. Right, well the menu is on the right side of the bottom floating bar... so I need css to put that div.. on the right side... The bottom bar is 90% in width, with a min-width of 900px. Removing the float, keeps it on the right.. obviously, but removing the the position, doesn't make it show up at all
  10. #users { /* this will ba used as a wrapper for the nav_menu so we can center it (nav_menu). especially for IE */ width:150px; /* the code below will PUT the bar at the bottom */ bottom:31px; position:absolute; z-index: 99; float:right; } thats the style for it, but it seems to just stick left...=[
  11. I have a fixed floating bar at the bottom of the page, and when I click on a tab... I would like it to bring up a div .. so it'd be like a menu, so I can put things in it.. but only not a menu. It contains links instead of other tabs etc inside it sort of thing. how can I do it? - Think about facebooks chat.. click on the users bit.. and it brings up that div
  12. The problem with the code below, is that it doesn't match the bad words. So I removed the if statement, and kept the preg_replace, and.. it erases the text. I'm not sure what I did wrong... $badwords = array(NAUGHTY WORDS HERE); $sensors = array(STARS HERE); if(preg_match($badwords, $message)) { $message = preg_replace($badwords, $sensors, $message); } I have $message = preg_replace($patterns, $replacements, $message); above that.. which what that does, is allows smilies in the text. So $patterns = : ), and replaced it with an image. That works fine.. but the bit for bad words doesn't.. Any ideas? Cheers --------------------------- Edit Str_replace did the trick, but why wouldn't it work with preg?
  13. Sometimes the chatscript lags... it's very fast and efficient, but it uses a text file. Sometimes it lags out for like.. 20 seconds maximum so far, but however.. not very often. Why does this happen, and how can it be prevented? If I hooked the chatscript up to the database so it gets messages that way, would it be any slower? and if so.. how much slower. - Is it also the best method? You can access the txt files outside of the chat, if txt files is the best solution, can this be prevented? Thanks!
  14. That was the whole query. My results come out with the rest in the while. The problem was: (us.user_id = f.friend_id OR us.user_id = '$user->id') - For somereason, it was causing the duplication for $user->id.. and duplicating the status made by that id on that account by the amount of their friends. So.. what I did is this.. $query = $db->execute("SELECT friend_id FROM friends WHERE user_id = '$user->id'"); while($row = $db->fetchassoc($query)) { $friend_ids[] = $row['friend_id']; } $friend_ids[] = $user->id; $friend_ids = implode(', ', $friend_ids); $query = "SELECT u.displayname, u.avatar, us.id, us.user_id, us.status, us.posted FROM users AS u, user_status AS us WHERE u.id = us.user_id AND us.user_id IN ($friend_ids) ORDER BY us.posted DESC";
  15. Bump... I really need this sorting, I can't think why it multiples your own statuses by your own friends..
  16. It's grabbing extra data foreach of my friends. I have 8 friends, it duplicates by 8. Thats where the problem is.. but how do I fix it
  17. I now have this.. $query = "SELECT u.displayname, u.avatar, us.id, us.user_id, us.status, us.posted FROM users AS u, user_status AS us, friends AS f WHERE u.id = us.user_id AND f.user_id = '$user->id' AND (us.user_id = f.friend_id OR us.user_id = '$user->id') ORDER BY us.posted DESC"; On my account, it duplicates my results by 8... (ONLY MINE, NOBODY ELSES) but if I go onto my mates account, his status isn't duplicated.. at all.
  18. $query = "SELECT u.displayname, u.avatar, us.id, us.user_id, us.status, us.posted FROM `users` AS u JOIN `user_status` AS us ON u.id = us.user_id JOIN `friends` AS f ON us.user_id = f.friend_id WHERE f.user_id = '$user->id' ORDER BY us.posted DESC"; What that code does, is grab the statuses by the users friends and get the data of that status poster. This seems to work fine.. although I want to add in so it gets all statuses by friends, or by the user. ($user->id holds the id of the user) All the methods I've tried, seems to duplicate displays. I really need this sorting out =[
  19. well.. from above this line preg_match_all('#alt="([^"]+)"/>([0-9]+)#', $content, $out); You could do a foreach, change the nessecary lines to match below.. $raw = curl_exec($change) or die(curl_error()); curl_close($change); foreach($raw as $raw1) { preg_match_all('#alt="([^"]+)"/>([0-9]+)#', $content, $out); ... } Might work. It seems as if the curl query, is getting hte first result as its not looped out. So this may workl.
  20. I want to place a Javascript Cookies value into a textbox, and I can't find any articles about it. Any help? Thanks
  21. I'm not sure what place this should be in, but it's compltely driving me nuts. I'm having chinese/japanese figures showing up instead of doing anything the code states. Example here This is my code.. <html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <script> function selectMenu(VALUE) { var HTML = ''; HTML += '<table>'; for(var VAL = 1; VAL <= VALUE; VAL++) { HTML += '<tr><td>Choice ' + VAL + '</td><td><input type="text" name="field' + VAL + '" /></td></tr>'; } HTML += '</table>'; document.getElementById('selects').innerHTML = HTML; } function setCookie(VALUE) { var NAME = 'myCookie'; var DATE = new Date(); DATE.setTime(DATE.getTime()+(15*60)); // Minutes * Seconds var EXPIRE = DATE.toGMTString(); document.cookie = NAME + "=" + VALUE+"; expires=" + EXPIRE + " path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } </script> <style> table.td { padding:5px; } </style> </head> <body> <form action="" method="post"> <table> <tr> <td>Poll Name</td> <td><input type="text" name="pollName" onkeyup="setCookie(this.value)" value="readCookie('myCookie')"/></td> </tr> <tr> <td>Number of fields</td> <td> <select name="fields" onchange="selectMenu(this.value)"> <option value="" selected disabled> </option> <?php for($i = 1; $i < 11; $i++) { echo '<option value="' . $i . '" '; if($i == 1) { echo 'disabled'; } echo '>' . $i . '</option>'; } ?> </select> </td> </tr> </table> <div id="selects"></div> <table> <tr> <td><input type="submit" name="submit" value="create" /></td> <td></td> </tr> </table> </form> </body> </html> My host allows php, the rest of my domain uses PHp and it works fine... whats the problem?
  22. I have this javascript function... function setCookie(VALUE) { var NAME = 'myCookie'; var DATE = new Date(); DATE.setTime(DATE.getTime()+(15*60)); // Minutes * Seconds var EXPIRE = DATE.toGMTString(); document.cookie = NAME + "=" + VALUE+"; expires=" + EXPIRE + " path=/"; } then I have this.. <input type="text" name="pollName" onkeyup="setCookie(this.value)" value="<?php echo $_COOKIES['myCookie'] ?>"/> It doesn't echo the cookies value.. whats wrong?
  23. Great thanks! Now.. theres a problem. If you type in some of the textboxes, change the .. drop down value.. it'll reload the inputs. I would like it so if .. someone filled in 5.. and 8 were selected.. then the user switched the drop down to 5.. it'll take off the bottom 3. Equalling 5.. without changing the values inside the 5 boxes filled. .. if you get me. <script> function selectMenu(VALUE) { var HTML = ''; HTML += '<table>'; for(var VAL = 1; VAL <= VALUE; VAL++) { HTML += '<tr><td>Choice ' + VAL + '</td><td><input type="text" name="field' + VAL + '" /></td></tr>'; } HTML += '</table>'; document.getElementById('selects').innerHTML = HTML; } </script> <style> table.td { padding:5px; } </style> <?php echo '<form action="" method="post"> <table> <tr><td>Poll Name</td><td><input type="text" name="pollName" /></td></tr> <tr><td>Number of fields</td><td><select name="fields" onchange="selectMenu(this.value)"> <option value="" selected disabled> </option>'; for($i = 1; $i < 11; $i++) { echo '<option value="' . $i . '" '; if($i == 1) { echo 'disabled'; } echo '>' . $i . '</option>'; } echo '</select></td></tr> </table> <div id="selects"></div> <table><tr><td><input type="submit" name="submit" value="create" /></td><td></td></tr></table> </form>'; ?>
  24. Thanks.. it displays a textbox.. but.. its like this.. NaN *textbox* it doesn't display more than one.. whats the problem?
  25. I have this little script. Though it doesn't do anything.. it doesn't populate the div. Any help? <script> function selectMenu(VALUE) { DIV.document.getElementById('selects'); for(VAL = 0; VAL <= VALUE; VAL++) { HTML = HTML + 'Choice ' + VAL + '<input type="text" name="field"' + VAL + '" /><br />'; } DIV.innerHTML = HTML; } </script> <?php echo '<form action="" method="post"> Poll Name<input type="text" name="pollName" /> <br /> <select name="fields" onchange="selectMenu(this.value)"> <option value=""> </option>'; for($i = 1; $i < 11; $i++) { echo '<option value="' . $i . '">' . $i . '</option>'; } echo '</select> <div id="selects"></div> <input type="submit" name="submit" value="create" />'; ?>
×
×
  • 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.